Skip to content

Instantly share code, notes, and snippets.

@PatrickAupperle
Created July 26, 2015 02:19
Show Gist options
  • Save PatrickAupperle/2b56e16e9e5a6a9b251e to your computer and use it in GitHub Desktop.
Save PatrickAupperle/2b56e16e9e5a6a9b251e to your computer and use it in GitHub Desktop.
salt-water-taffy$ cat p5.s
.file "p5.cpp"
.text
.p2align 4,,15
.globl _Z11isDivisableii
.type _Z11isDivisableii, @function
_Z11isDivisableii:
.LFB998:
.cfi_startproc
jmp .L9
.p2align 4,,10
.p2align 3
.L4:
movl %edi, %eax
cltd
idivl %esi
testl %edx, %edx
jne .L7
subl $1, %esi
.L9:
cmpl $1, %esi
jne .L4
movl $1, %eax
ret
.p2align 4,,10
.p2align 3
.L7:
xorl %eax, %eax
ret
.cfi_endproc
.LFE998:
.size _Z11isDivisableii, .-_Z11isDivisableii
.p2align 4,,15
.globl _Z14isDivisableRecii
.type _Z14isDivisableRecii, @function
_Z14isDivisableRecii:
.LFB999:
.cfi_startproc
.L13:
cmpl $1, %esi
je .L16
movl %edi, %eax
cltd
idivl %esi
testl %edx, %edx
je .L18
.L17:
xorl %eax, %eax
ret
.p2align 4,,10
.p2align 3
.L18:
leal -1(%rsi), %ecx
cmpl $1, %ecx
jne .L19
.p2align 4,,10
.p2align 3
.L16:
movl $1, %eax
ret
.p2align 4,,10
.p2align 3
.L19:
movl %edi, %eax
cltd
idivl %ecx
testl %edx, %edx
jne .L17
subl $2, %esi
jmp .L13
.cfi_endproc
.LFE999:
.size _Z14isDivisableRecii, .-_Z14isDivisableRecii
.p2align 4,,15
.globl _Z12findSmallestv
.type _Z12findSmallestv, @function
_Z12findSmallestv:
.LFB1000:
.cfi_startproc
movl $20, %esi
.p2align 4,,10
.p2align 3
.L24:
movl $20, %ecx
.p2align 4,,10
.p2align 3
.L23:
movl %esi, %eax
cltd
idivl %ecx
testl %edx, %edx
jne .L21
subl $1, %ecx
cmpl $1, %ecx
jne .L23
movl %esi, %eax
ret
.p2align 4,,10
.p2align 3
.L21:
addl $1, %esi
jmp .L24
.cfi_endproc
.LFE1000:
.size _Z12findSmallestv, .-_Z12findSmallestv
.section .text.startup,"ax",@progbits
.p2align 4,,15
.globl main
.type main, @function
main:
.LFB1001:
.cfi_startproc
movl $20, %esi
.p2align 4,,10
.p2align 3
.L30:
movl $20, %ecx
.p2align 4,,10
.p2align 3
.L29:
movl %esi, %eax
cltd
idivl %ecx
testl %edx, %edx
jne .L27
subl $1, %ecx
cmpl $1, %ecx
jne .L29
subq $8, %rsp
.cfi_def_cfa_offset 16
movl $_ZSt4cout, %edi
call _ZNSolsEi
movq %rax, %rdi
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
xorl %eax, %eax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.p2align 4,,10
.p2align 3
.L27:
addl $1, %esi
jmp .L30
.cfi_endproc
.LFE1001:
.size main, .-main
.p2align 4,,15
.type _GLOBAL__sub_I__Z11isDivisableii, @function
_GLOBAL__sub_I__Z11isDivisableii:
.LFB1008:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16
movl $_ZStL8__ioinit, %edi
call _ZNSt8ios_base4InitC1Ev
movl $__dso_handle, %edx
movl $_ZStL8__ioinit, %esi
movl $_ZNSt8ios_base4InitD1Ev, %edi
addq $8, %rsp
.cfi_def_cfa_offset 8
jmp __cxa_atexit
.cfi_endproc
.LFE1008:
.size _GLOBAL__sub_I__Z11isDivisableii, .-_GLOBAL__sub_I__Z11isDivisableii
.section .init_array,"aw"
.align 8
.quad _GLOBAL__sub_I__Z11isDivisableii
.local _ZStL8__ioinit
.comm _ZStL8__ioinit,1,1
.hidden __dso_handle
.ident "GCC: (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4"
.section .note.GNU-stack,"",@progbits
salt-water-taffy$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment