Created
October 24, 2015 16:16
-
-
Save AndrewRademacher/3231926dca92a1157a54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.section __TEXT,__text,regular,pure_instructions | |
.macosx_version_min 10, 10 | |
.globl __Z8sumArrayPii | |
.align 4, 0x90 | |
__Z8sumArrayPii: ## @_Z8sumArrayPii | |
.cfi_startproc | |
## BB#0: | |
push rbp | |
Ltmp0: | |
.cfi_def_cfa_offset 16 | |
Ltmp1: | |
.cfi_offset rbp, -16 | |
mov rbp, rsp | |
Ltmp2: | |
.cfi_def_cfa_register rbp | |
sub rsp, 32 | |
mov qword ptr [rbp - 16], rdi | |
mov dword ptr [rbp - 20], esi | |
cmp dword ptr [rbp - 20], 1 | |
jne LBB0_2 | |
## BB#1: | |
mov rax, qword ptr [rbp - 16] | |
mov ecx, dword ptr [rax] | |
mov dword ptr [rbp - 4], ecx | |
jmp LBB0_3 | |
LBB0_2: | |
mov rax, qword ptr [rbp - 16] | |
mov ecx, dword ptr [rax] | |
mov edx, dword ptr [rbp - 20] | |
sub edx, 1 | |
movsxd rax, edx | |
mov rsi, qword ptr [rbp - 16] | |
add ecx, dword ptr [rsi + 4*rax] | |
mov rax, qword ptr [rbp - 16] | |
mov dword ptr [rax], ecx | |
mov ecx, dword ptr [rbp - 20] | |
sub ecx, 1 | |
mov dword ptr [rbp - 24], ecx | |
mov rdi, qword ptr [rbp - 16] | |
mov esi, dword ptr [rbp - 24] | |
call __Z8sumArrayPii | |
mov dword ptr [rbp - 4], eax | |
LBB0_3: | |
mov eax, dword ptr [rbp - 4] | |
add rsp, 32 | |
pop rbp | |
ret | |
.cfi_endproc | |
.globl _main | |
.align 4, 0x90 | |
_main: ## @main | |
.cfi_startproc | |
## BB#0: | |
push rbp | |
Ltmp3: | |
.cfi_def_cfa_offset 16 | |
Ltmp4: | |
.cfi_offset rbp, -16 | |
mov rbp, rsp | |
Ltmp5: | |
.cfi_def_cfa_register rbp | |
sub rsp, 48 | |
mov eax, 3 | |
lea rcx, [rbp - 20] | |
mov rdx, qword ptr [rip + ___stack_chk_guard@GOTPCREL] | |
mov rdx, qword ptr [rdx] | |
mov qword ptr [rbp - 8], rdx | |
mov dword ptr [rbp - 24], edi | |
mov qword ptr [rbp - 32], rsi | |
mov dword ptr [rbp - 20], 4 | |
mov dword ptr [rbp - 16], 5 | |
mov dword ptr [rbp - 12], 7 | |
mov rdi, rcx | |
mov esi, eax | |
call __Z8sumArrayPii | |
lea rdi, [rip + L_.str] | |
mov dword ptr [rbp - 36], eax | |
mov esi, dword ptr [rbp - 36] | |
mov al, 0 | |
call _printf | |
mov rcx, qword ptr [rip + ___stack_chk_guard@GOTPCREL] | |
mov rcx, qword ptr [rcx] | |
cmp rcx, qword ptr [rbp - 8] | |
mov dword ptr [rbp - 40], eax ## 4-byte Spill | |
jne LBB1_2 | |
## BB#1: ## %SP_return | |
xor eax, eax | |
add rsp, 48 | |
pop rbp | |
ret | |
LBB1_2: ## %CallStackCheckFailBlk | |
call ___stack_chk_fail | |
.cfi_endproc | |
.section __TEXT,__cstring,cstring_literals | |
L_.str: ## @.str | |
.asciz "%i\n" | |
.subsections_via_symbols |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment