Skip to content

Instantly share code, notes, and snippets.

@ftfish
Created January 15, 2015 00:04
Show Gist options
  • Save ftfish/f8ffdb9106b82ae63925 to your computer and use it in GitHub Desktop.
Save ftfish/f8ffdb9106b82ae63925 to your computer and use it in GitHub Desktop.
assembly
; Listing generated by Microsoft (R) Optimizing Compiler Version 18.00.31101.0
TITLE XXX.cpp
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB OLDNAMES
PUBLIC ??_C@_03PMGGPEJJ@?$CFd?6?$AA@ ; `string'
EXTRN __imp__printf:PROC
EXTRN @__security_check_cookie@4:PROC
; COMDAT ??_C@_03PMGGPEJJ@?$CFd?6?$AA@
CONST SEGMENT
??_C@_03PMGGPEJJ@?$CFd?6?$AA@ DB '%d', 0aH, 00H ; `string'
CONST ENDS
PUBLIC _main
EXTRN __vcomp_for_static_end:PROC
EXTRN __vcomp_for_static_simple_init:PROC
EXTRN __vcomp_fork:PROC
EXTRN __vcomp_reduction_i4:PROC
EXTRN __You_must_link_with_Microsoft_OpenMP_library:DWORD
; Function compile flags: /Ogtp
; File XXX.cpp
; COMDAT _main$omp$1
_TEXT SEGMENT
$T1 = -8 ; size = 4
$T2 = -4 ; size = 4
_tans$ = 8 ; size = 4
_main$omp$1 PROC ; COMDAT
push ebp
mov ebp, esp
sub esp, 8
push esi
; 7 : for (int id = 0; id < 10000; ++id) {
lea eax, DWORD PTR $T1[ebp]
xor esi, esi
push eax
lea eax, DWORD PTR $T2[ebp]
push eax
push 1
push 1
push 9999 ; 0000270fH
push esi
call __vcomp_for_static_simple_init
mov eax, DWORD PTR $T2[ebp]
add esp, 24 ; 00000018H
mov ecx, DWORD PTR $T1[ebp]
cmp eax, ecx
jg SHORT $LN2@main$omp$1
mov esi, ecx
sub esi, eax
inc esi
$LN2@main$omp$1:
call __vcomp_for_static_end
; 8 : tans++;
; 9 : }
push esi
push DWORD PTR _tans$[ebp]
push 4
call __vcomp_reduction_i4
add esp, 12 ; 0000000cH
pop esi
mov esp, ebp
pop ebp
ret 0
_main$omp$1 ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File XXX.cpp
; COMDAT _main
_TEXT SEGMENT
_tans$ = -4 ; size = 4
_main PROC ; COMDAT
; 3 : int main() {
push ebp
mov ebp, esp
push ecx
push esi
; 4 : int tans = 0;
mov DWORD PTR _tans$[ebp], 0
mov esi, 100000 ; 000186a0H
$LL5@main:
; 5 : for (int i = 0; i < 100000; ++i)
; 6 : #pragma omp parallel for reduction(+:tans)
lea eax, DWORD PTR _tans$[ebp]
push eax
push OFFSET _main$omp$1
push 1
push 1
call __vcomp_fork
add esp, 16 ; 00000010H
dec esi
jne SHORT $LL5@main
; 7 : for (int id = 0; id < 10000; ++id) {
; 8 : tans++;
; 9 : }
; 10 : printf("%d\n", tans);
push DWORD PTR _tans$[ebp]
push OFFSET ??_C@_03PMGGPEJJ@?$CFd?6?$AA@
call DWORD PTR __imp__printf
add esp, 8
pop esi
; 11 : }
mov esp, ebp
pop ebp
ret 0
_main ENDP
_TEXT ENDS
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment