Mercurial > hg > CbC > CbC_examples
changeset 3:18eda8cb71e9
forget a.out
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 22 Oct 2014 02:12:59 +0900 |
parents | 35d6eabeadb0 |
children | 175041088754 |
files | code_segment_pointer_check/a.out conv1/a.out conv1/conv1.s factorial/a.out factorial/factorial.cbc factorial/factorial.s factorial/test.s parallel_check/a.out quicksort/a.out regexp/a.out |
diffstat | 10 files changed, 0 insertions(+), 1199 deletions(-) [+] |
line wrap: on
line diff
--- a/conv1/conv1.s Wed Oct 22 02:06:29 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1021 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .macosx_version_min 10, 9 - .globl _f0 - .align 4, 0x90 -_f0: ## @f0 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp0: - .cfi_def_cfa_offset 16 -Ltmp1: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp2: - .cfi_def_cfa_register %rbp - ## kill: EDI<def> EDI<kill> RDI<def> - leal 21(%rdi,%rdi,2), %eax - popq %rbp - retq - .cfi_endproc - - .globl _g0 - .align 4, 0x90 -_g0: ## @g0 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp3: - .cfi_def_cfa_offset 16 -Ltmp4: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp5: - .cfi_def_cfa_register %rbp - ## kill: EDI<def> EDI<kill> RDI<def> - leal 8(%rdi,%rdi), %eax - popq %rbp - retq - .cfi_endproc - - .globl _h0 - .align 4, 0x90 -_h0: ## @h0 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp6: - .cfi_def_cfa_offset 16 -Ltmp7: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp8: - .cfi_def_cfa_register %rbp - ## kill: EDI<def> EDI<kill> RDI<def> - leal 4(%rdi), %eax - popq %rbp - retq - .cfi_endproc - - .globl _f - .align 4, 0x90 -_f: ## @f - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp9: - .cfi_def_cfa_offset 16 -Ltmp10: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp11: - .cfi_def_cfa_register %rbp - subq $16, %rsp - ## kill: EDI<def> EDI<kill> RDI<def> - leal 3(%rdi), %eax - leaq _f_g1(%rip), %rcx - movq %rcx, -24(%rsi) - movl %eax, -12(%rsi) - movl %edi, -16(%rsi) - leaq _g_h1(%rip), %rcx - movq %rcx, -48(%rsi) - movl %eax, -40(%rsi) - movq (%rsi), %rax - leal 20(%rdi,%rdi,2), %edi - addq $16, %rsp - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _f_g0 - .align 4, 0x90 -_f_g0: ## @f_g0 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp12: - .cfi_def_cfa_offset 16 -Ltmp13: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp14: - .cfi_def_cfa_register %rbp - subq $16, %rsp - ## kill: ESI<def> ESI<kill> RSI<def> - ## kill: EDI<def> EDI<kill> RDI<def> - leaq _f_g1(%rip), %rax - movq %rax, -24(%rdx) - movl %esi, -12(%rdx) - movl %edi, -16(%rdx) - leal 3(%rdi), %eax - leaq _g_h1(%rip), %rcx - movq %rcx, -48(%rdx) - movl %eax, -40(%rdx) - movq (%rdx), %rax - leal 3(%rdi,%rdi), %ecx - leal 14(%rsi,%rcx), %edi - movq %rdx, %rsi - addq $16, %rsp - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _f_g1 - .align 4, 0x90 -_f_g1: ## @f_g1 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp15: - .cfi_def_cfa_offset 16 -Ltmp16: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp17: - .cfi_def_cfa_register %rbp - subq $16, %rsp - ## kill: EDI<def> EDI<kill> RDI<def> - movl 12(%rsi), %eax - movq 24(%rsi), %rcx - addq $24, %rsi - leal 4(%rdi,%rax), %edi - addq $16, %rsp - popq %rbp - jmpq *%rcx # TAILCALL - .cfi_endproc - - .globl _g - .align 4, 0x90 -_g: ## @g - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp18: - .cfi_def_cfa_offset 16 -Ltmp19: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp20: - .cfi_def_cfa_register %rbp - subq $16, %rsp - ## kill: EDI<def> EDI<kill> RDI<def> - leaq _g_h1(%rip), %rax - movq %rax, -24(%rsi) - movl %edi, -16(%rsi) - movq (%rsi), %rax - leal 7(%rdi,%rdi), %edi - addq $16, %rsp - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _g_h1 - .align 4, 0x90 -_g_h1: ## @g_h1 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp21: - .cfi_def_cfa_offset 16 -Ltmp22: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp23: - .cfi_def_cfa_register %rbp - subq $16, %rsp - movq 24(%rsi), %rax - addl 8(%rsi), %edi - leaq 24(%rsi), %rsi - addq $16, %rsp - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _h - .align 4, 0x90 -_h: ## @h - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp24: - .cfi_def_cfa_offset 16 -Ltmp25: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp26: - .cfi_def_cfa_register %rbp - subq $16, %rsp - movq (%rsi), %rax - addl $4, %edi - addq $16, %rsp - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _main_return - .align 4, 0x90 -_main_return: ## @main_return - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp27: - .cfi_def_cfa_offset 16 -Ltmp28: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp29: - .cfi_def_cfa_register %rbp - pushq %rbx - pushq %rax -Ltmp30: - .cfi_offset %rbx, -24 - movq %rsi, %rbx - movl %edi, %ecx - movl _loop(%rip), %eax - leal -1(%rax), %edx - movl %edx, _loop(%rip) - testl %eax, %eax - jle LBB9_3 -## BB#1: ## %if.then - leaq _f_g1(%rip), %rax - movq %rax, -24(%rbx) - movl $236, -12(%rbx) - movl $233, -16(%rbx) - leaq _g_h1(%rip), %rax - movq %rax, -48(%rbx) - movl $236, -40(%rbx) - movq (%rbx), %rax - movl $719, %edi ## imm = 0x2CF - movq %rbx, %rsi - jmp LBB9_2 -LBB9_3: ## %if.end - leaq L_.str(%rip), %rdi - xorl %eax, %eax - movl %ecx, %esi - callq _printf - movq 8(%rbx), %rax - movq 16(%rbx), %rsi - xorl %edi, %edi -LBB9_2: ## %if.then - addq $8, %rsp - popq %rbx - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _f2 - .align 4, 0x90 -_f2: ## @f2 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp31: - .cfi_def_cfa_offset 16 -Ltmp32: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp33: - .cfi_def_cfa_register %rbp - pushq %r14 - pushq %rbx - subq $16, %rsp -Ltmp34: - .cfi_offset %rbx, -32 -Ltmp35: - .cfi_offset %r14, -24 - movq %rsi, %r14 - ## kill: EDI<def> EDI<kill> RDI<def> - movl _loop(%rip), %eax - movl %eax, %ecx - notl %ecx - cmpl $-2, %ecx - movl $-1, %edx - cmovgl %ecx, %edx - leal 2(%rax,%rdx), %ebx - movl %ebx, %ecx - andl $7, %ecx - testl %ebx, %ebx - je LBB10_2 -## BB#1: ## %entry - xorl %esi, %esi - testl %ecx, %ecx - movl %eax, %edx - je LBB10_16 -LBB10_2: ## %unr.cmp42 - cmpl $1, %ecx - jne LBB10_4 -## BB#3: - leal 4(%rdi,%rdi), %esi - movl %eax, %edx - jmp LBB10_15 -LBB10_4: ## %unr.cmp35 - cmpl $2, %ecx - movl %eax, %edx - je LBB10_14 -## BB#5: ## %unr.cmp28 - cmpl $3, %ecx - movl %eax, %edx - je LBB10_13 -## BB#6: ## %unr.cmp21 - cmpl $4, %ecx - movl %eax, %edx - je LBB10_12 -## BB#7: ## %unr.cmp14 - cmpl $5, %ecx - movl %eax, %edx - je LBB10_11 -## BB#8: ## %unr.cmp - cmpl $6, %ecx - movl %eax, %edx - je LBB10_10 -## BB#9: ## %tailrecurse.unr - leal -1(%rax), %edx -LBB10_10: ## %tailrecurse.unr6 - decl %edx -LBB10_11: ## %tailrecurse.unr9 - decl %edx -LBB10_12: ## %tailrecurse.unr16 - decl %edx -LBB10_13: ## %tailrecurse.unr23 - decl %edx -LBB10_14: ## %tailrecurse.unr30 - decl %edx - movl $470, %esi ## imm = 0x1D6 -LBB10_15: ## %tailrecurse.unr37 - decl %edx -LBB10_16: ## %entry.split - cmpl $8, %ebx - jb LBB10_19 -## BB#17: ## %entry.split.split - incl %edx - movl $470, %esi ## imm = 0x1D6 - .align 4, 0x90 -LBB10_18: ## %tailrecurse - ## =>This Inner Loop Header: Depth=1 - addl $-8, %edx - testl %edx, %edx - jg LBB10_18 -LBB10_19: ## %if.end.i.i.i.i - leal -1(%rax), %ecx - testl %eax, %eax - movl $-1, %eax - cmovsl %ecx, %eax - movl %eax, _loop(%rip) - leaq L_.str1(%rip), %rdi - xorl %eax, %eax - callq _printf - movq 8(%r14), %rax - movq 16(%r14), %rsi - xorl %edi, %edi - addq $16, %rsp - popq %rbx - popq %r14 - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _g2 - .align 4, 0x90 -_g2: ## @g2 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp36: - .cfi_def_cfa_offset 16 -Ltmp37: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp38: - .cfi_def_cfa_register %rbp - pushq %rbx - pushq %rax -Ltmp39: - .cfi_offset %rbx, -24 - movq %rcx, %rbx - ## kill: EDI<def> EDI<kill> RDI<def> - movl _loop(%rip), %eax - leal -1(%rax), %ecx - movl %ecx, _loop(%rip) - testl %eax, %eax - jle LBB11_2 -## BB#1: ## %if.then.i.i.i - movl $233, %edi - movq %rbx, %rsi - addq $8, %rsp - popq %rbx - popq %rbp - jmp _f2 ## TAILCALL -LBB11_2: ## %if.end.i.i.i - leal 4(%rdi,%rdi), %esi - leaq L_.str1(%rip), %rdi - xorl %eax, %eax - callq _printf - movq 8(%rbx), %rax - movq 16(%rbx), %rsi - xorl %edi, %edi - addq $8, %rsp - popq %rbx - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _h2 - .align 4, 0x90 -_h2: ## @h2 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp40: - .cfi_def_cfa_offset 16 -Ltmp41: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp42: - .cfi_def_cfa_register %rbp - pushq %rbx - pushq %rax -Ltmp43: - .cfi_offset %rbx, -24 - movq %rdx, %rbx - ## kill: EDI<def> EDI<kill> RDI<def> - movl _loop(%rip), %eax - leal -1(%rax), %ecx - movl %ecx, _loop(%rip) - testl %eax, %eax - jle LBB12_2 -## BB#1: ## %if.then.i.i - movl $233, %edi - movq %rbx, %rsi - addq $8, %rsp - popq %rbx - popq %rbp - jmp _f2 ## TAILCALL -LBB12_2: ## %if.end.i.i - leal 4(%rdi,%rdi), %esi - leaq L_.str1(%rip), %rdi - xorl %eax, %eax - callq _printf - movq 8(%rbx), %rax - movq 16(%rbx), %rsi - xorl %edi, %edi - addq $8, %rsp - popq %rbx - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _h2_1 - .align 4, 0x90 -_h2_1: ## @h2_1 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp44: - .cfi_def_cfa_offset 16 -Ltmp45: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp46: - .cfi_def_cfa_register %rbp - pushq %rbx - pushq %rax -Ltmp47: - .cfi_offset %rbx, -24 - movq %rcx, %rbx - movl _loop(%rip), %eax - leal -1(%rax), %ecx - movl %ecx, _loop(%rip) - testl %eax, %eax - jle LBB13_2 -## BB#1: ## %if.then.i - movl $233, %edi - movq %rbx, %rsi - addq $8, %rsp - popq %rbx - popq %rbp - jmp _f2 ## TAILCALL -LBB13_2: ## %if.end.i - addl %edi, %edx - leaq L_.str1(%rip), %rdi - xorl %eax, %eax - movl %edx, %esi - callq _printf - movq 8(%rbx), %rax - movq 16(%rbx), %rsi - xorl %edi, %edi - addq $8, %rsp - popq %rbx - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _main_return2 - .align 4, 0x90 -_main_return2: ## @main_return2 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp48: - .cfi_def_cfa_offset 16 -Ltmp49: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp50: - .cfi_def_cfa_register %rbp - pushq %rbx - pushq %rax -Ltmp51: - .cfi_offset %rbx, -24 - movq %rsi, %rbx - movl %edi, %ecx - movl _loop(%rip), %eax - leal -1(%rax), %edx - movl %edx, _loop(%rip) - testl %eax, %eax - jle LBB14_2 -## BB#1: ## %if.then - movl $233, %edi - movq %rbx, %rsi - addq $8, %rsp - popq %rbx - popq %rbp - jmp _f2 ## TAILCALL -LBB14_2: ## %if.end - leaq L_.str1(%rip), %rdi - xorl %eax, %eax - movl %ecx, %esi - callq _printf - movq 8(%rbx), %rax - movq 16(%rbx), %rsi - xorl %edi, %edi - addq $8, %rsp - popq %rbx - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _f2_1 - .align 4, 0x90 -_f2_1: ## @f2_1 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp52: - .cfi_def_cfa_offset 16 -Ltmp53: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp54: - .cfi_def_cfa_register %rbp - subq $16, %rsp - ## kill: EDI<def> EDI<kill> RDI<def> - movq (%rsi), %rax - leal 21(%rdi,%rdi,2), %edi - addq $16, %rsp - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _g2_1 - .align 4, 0x90 -_g2_1: ## @g2_1 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp55: - .cfi_def_cfa_offset 16 -Ltmp56: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp57: - .cfi_def_cfa_register %rbp - subq $16, %rsp - ## kill: ESI<def> ESI<kill> RSI<def> - ## kill: EDI<def> EDI<kill> RDI<def> - movq (%rdx), %rax - leal 12(%rsi,%rdi,2), %edi - movq %rdx, %rsi - addq $16, %rsp - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _h2_11 - .align 4, 0x90 -_h2_11: ## @h2_11 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp58: - .cfi_def_cfa_offset 16 -Ltmp59: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp60: - .cfi_def_cfa_register %rbp - subq $16, %rsp - ## kill: ESI<def> ESI<kill> RSI<def> - ## kill: EDI<def> EDI<kill> RDI<def> - movq (%rdx), %rax - leal 8(%rsi,%rdi,2), %edi - movq %rdx, %rsi - addq $16, %rsp - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _h2_1_1 - .align 4, 0x90 -_h2_1_1: ## @h2_1_1 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp61: - .cfi_def_cfa_offset 16 -Ltmp62: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp63: - .cfi_def_cfa_register %rbp - subq $16, %rsp - ## kill: EDX<def> EDX<kill> RDX<def> - ## kill: EDI<def> EDI<kill> RDI<def> - movq (%rcx), %rax - addl %esi, %edi - leal 4(%rdx,%rdi), %edi - movq %rcx, %rsi - addq $16, %rsp - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _f2_0_1 - .align 4, 0x90 -_f2_0_1: ## @f2_0_1 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp64: - .cfi_def_cfa_offset 16 -Ltmp65: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp66: - .cfi_def_cfa_register %rbp - subq $16, %rsp - ## kill: ESI<def> ESI<kill> RSI<def> - ## kill: EDI<def> EDI<kill> RDI<def> - movq (%rdx), %rax - leal 4(%rdi,%rsi), %edi - movq %rdx, %rsi - addq $16, %rsp - popq %rbp - jmpq *%rax # TAILCALL - .cfi_endproc - - .globl _main_return2_1 - .align 4, 0x90 -_main_return2_1: ## @main_return2_1 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp67: - .cfi_def_cfa_offset 16 -Ltmp68: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp69: - .cfi_def_cfa_register %rbp - subq $16, %rsp - movl %edi, %ecx - movl _loop(%rip), %eax - leal -1(%rax), %edx - movl %edx, _loop(%rip) - testl %eax, %eax - jle LBB20_2 -## BB#1: ## %if.then - movq (%rsi), %rax - movl $720, %edi ## imm = 0x2D0 - addq $16, %rsp - popq %rbp - jmpq *%rax # TAILCALL -LBB20_2: ## %if.end - leaq L_.str2(%rip), %rdi - xorl %eax, %eax - movl %ecx, %esi - callq _printf - xorl %edi, %edi - callq _exit - .cfi_endproc - - .globl _main..ret0 - .align 4, 0x90 -_main..ret0: ## @main..ret0 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp70: - .cfi_def_cfa_offset 16 -Ltmp71: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp72: - .cfi_def_cfa_register %rbp - movq (%rsi), %rax - movl %edi, (%rax) - movq 8(%rsi), %rdi - movl $1, %esi - callq _longjmp - .cfi_endproc - - .globl _main..ret1 - .align 4, 0x90 -_main..ret1: ## @main..ret1 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp73: - .cfi_def_cfa_offset 16 -Ltmp74: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp75: - .cfi_def_cfa_register %rbp - movq (%rsi), %rax - movl %edi, (%rax) - movq 8(%rsi), %rdi - movl $1, %esi - callq _longjmp - .cfi_endproc - - .globl _main..ret2 - .align 4, 0x90 -_main..ret2: ## @main..ret2 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp76: - .cfi_def_cfa_offset 16 -Ltmp77: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp78: - .cfi_def_cfa_register %rbp - movq (%rsi), %rax - movl %edi, (%rax) - movq 8(%rsi), %rdi - movl $1, %esi - callq _longjmp - .cfi_endproc - - .globl _main - .align 4, 0x90 -_main: ## @main - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp79: - .cfi_def_cfa_offset 16 -Ltmp80: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp81: - .cfi_def_cfa_register %rbp - pushq %r15 - pushq %r14 - pushq %rbx - subq $248, %rsp -Ltmp82: - .cfi_offset %rbx, -40 -Ltmp83: - .cfi_offset %r14, -32 -Ltmp84: - .cfi_offset %r15, -24 - movq ___stack_chk_guard@GOTPCREL(%rip), %r14 - movq (%r14), %r14 - movq %r14, -32(%rbp) - cmpl $2, %edi - jne LBB24_27 -## BB#1: ## %if.end - movq 8(%rsi), %rdi - callq _atoi - xorl %ebx, %ebx - movl %eax, %ecx - cmpl $3, %eax - ja LBB24_30 -## BB#2: ## %if.end - leaq LJTI24_0(%rip), %rax - movslq (%rax,%rcx,4), %rcx - addq %rax, %rcx - jmpq *%rcx -LBB24_3: ## %for.cond.preheader - movl $500000000, _loop(%rip) ## imm = 0x1DCD6500 - leaq L_.str3(%rip), %rdi - xorl %ebx, %ebx - movl $1500000018, %esi ## imm = 0x59682F12 - xorl %eax, %eax - callq _printf - jmp LBB24_30 -LBB24_27: ## %if.then49 - movl $500000000, _loop(%rip) ## imm = 0x1DCD6500 - leaq _main_return2_1(%rip), %rax - movq _main_stack@GOTPCREL(%rip), %r15 - movq %rax, 2024(%r15) - leaq _main..ret2(%rip), %rax - movq %rax, 2032(%r15) - leaq -260(%rbp), %rax - movq %rax, -256(%rbp) - leaq -192(%rbp), %rdi - movq %rdi, -248(%rbp) - callq _setjmp - movl %eax, %ebx - testl %ebx, %ebx - cmovnel -260(%rbp), %ebx - jne LBB24_30 -## BB#28: ## %cleanup.cont73 - leaq -256(%rbp), %rax - movq %rax, 2040(%r15) - movl _loop(%rip), %eax - leaq 2024(%r15), %rsi - leal 21(%rax,%rax,2), %edi -LBB24_29: ## %return - callq *2024(%r15) - subq $8, %rsp - xorl %ebx, %ebx -LBB24_30: ## %return - cmpq -32(%rbp), %r14 - jne LBB24_32 -## BB#31: ## %return - movl %ebx, %eax - addq $248, %rsp - popq %rbx - popq %r14 - popq %r15 - popq %rbp - retq -LBB24_32: ## %return - callq ___stack_chk_fail -LBB24_4: ## %if.then8 - movl $500000000, _loop(%rip) ## imm = 0x1DCD6500 - leaq _main_return(%rip), %rax - movq _main_stack@GOTPCREL(%rip), %r15 - movq %rax, 2024(%r15) - leaq _main..ret0(%rip), %rax - movq %rax, 2032(%r15) - leaq -212(%rbp), %rax - movq %rax, -208(%rbp) - leaq -192(%rbp), %rdi - movq %rdi, -200(%rbp) - callq _setjmp - movl %eax, %ebx - testl %ebx, %ebx - cmovnel -212(%rbp), %ebx - jne LBB24_30 -## BB#5: ## %cleanup.cont - leaq -208(%rbp), %rax - movq %rax, 2040(%r15) - movl _loop(%rip), %eax - leal 3(%rax), %ecx - leaq _f_g1(%rip), %rdx - movq %rdx, 2000(%r15) - movl %ecx, 2012(%r15) - movl %eax, 2008(%r15) - leaq _g_h1(%rip), %rdx - movq %rdx, 1976(%r15) - movl %ecx, 1984(%r15) - leaq 2024(%r15), %rsi - leal 20(%rax,%rax,2), %edi - jmp LBB24_29 -LBB24_6: ## %if.then21 - movl $500000000, _loop(%rip) ## imm = 0x1DCD6500 - leaq _main_return2(%rip), %rax - movq _main_stack@GOTPCREL(%rip), %r15 - movq %rax, 2024(%r15) - leaq _main..ret1(%rip), %rax - movq %rax, 2032(%r15) - leaq -236(%rbp), %rax - movq %rax, -232(%rbp) - leaq -192(%rbp), %rdi - movq %rdi, -224(%rbp) - callq _setjmp - movl %eax, %ebx - testl %ebx, %ebx - cmovnel -236(%rbp), %ebx - jne LBB24_30 -## BB#7: ## %cleanup.cont45 - leaq -232(%rbp), %rax - movq %rax, 2040(%r15) - movl _loop(%rip), %eax - movl %eax, %ecx - notl %ecx - cmpl $-2, %ecx - movl $-1, %edx - cmovgl %ecx, %edx - leal 2(%rax,%rdx), %ecx - movl %ecx, %edi - andl $7, %edi - testl %ecx, %ecx - je LBB24_9 -## BB#8: ## %cleanup.cont45 - xorl %esi, %esi - testl %edi, %edi - movl %eax, %edx - je LBB24_23 -LBB24_9: ## %unr.cmp139 - cmpl $1, %edi - jne LBB24_11 -## BB#10: - leal 4(%rax,%rax), %esi - movl %eax, %edx - jmp LBB24_22 -LBB24_11: ## %unr.cmp132 - cmpl $2, %edi - movl %eax, %edx - je LBB24_21 -## BB#12: ## %unr.cmp125 - cmpl $3, %edi - movl %eax, %edx - je LBB24_20 -## BB#13: ## %unr.cmp118 - cmpl $4, %edi - movl %eax, %edx - je LBB24_19 -## BB#14: ## %unr.cmp111 - cmpl $5, %edi - movl %eax, %edx - je LBB24_18 -## BB#15: ## %unr.cmp - cmpl $6, %edi - movl %eax, %edx - je LBB24_17 -## BB#16: ## %tailrecurse.i.unr - leal -1(%rax), %edx -LBB24_17: ## %tailrecurse.i.unr103 - decl %edx -LBB24_18: ## %tailrecurse.i.unr106 - decl %edx -LBB24_19: ## %tailrecurse.i.unr113 - decl %edx -LBB24_20: ## %tailrecurse.i.unr120 - decl %edx -LBB24_21: ## %tailrecurse.i.unr127 - decl %edx - movl $470, %esi ## imm = 0x1D6 -LBB24_22: ## %tailrecurse.i.unr134 - decl %edx -LBB24_23: ## %cleanup.cont45.split - cmpl $8, %ecx - jb LBB24_26 -## BB#24: ## %cleanup.cont45.split.split - incl %edx - movl $470, %esi ## imm = 0x1D6 - .align 4, 0x90 -LBB24_25: ## %tailrecurse.i - ## =>This Inner Loop Header: Depth=1 - addl $-8, %edx - testl %edx, %edx - jg LBB24_25 -LBB24_26: ## %f2.exit - leal -1(%rax), %ecx - testl %eax, %eax - movl $-1, %eax - cmovsl %ecx, %eax - movl %eax, _loop(%rip) - leaq L_.str1(%rip), %rdi - xorl %ebx, %ebx - xorl %eax, %eax - callq _printf - movq 2040(%r15), %rsi - xorl %edi, %edi - callq *2032(%r15) - subq $8, %rsp - jmp LBB24_30 - .cfi_endproc - .align 2, 0x90 -L24_0_set_3 = LBB24_3-LJTI24_0 -L24_0_set_4 = LBB24_4-LJTI24_0 -L24_0_set_6 = LBB24_6-LJTI24_0 -L24_0_set_27 = LBB24_27-LJTI24_0 -LJTI24_0: - .long L24_0_set_3 - .long L24_0_set_4 - .long L24_0_set_6 - .long L24_0_set_27 - -.zerofill __DATA,__bss,_loop,4,2 ## @loop - .section __TEXT,__cstring,cstring_literals -L_.str: ## @.str - .asciz "#0103:%d\n" - -L_.str1: ## @.str1 - .asciz "#0132:%d\n" - -L_.str2: ## @.str2 - .asciz "#0165:%d\n" - - .comm _main_stack,2048,4 ## @main_stack -L_.str3: ## @.str3 - .asciz "#0193:%d\n" - - -.subsections_via_symbols
--- a/factorial/factorial.cbc Wed Oct 22 02:06:29 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -__code print_factorial(int prod) -{ - printf("factorial = %d\n",prod); - exit(0); -} - -__code factorial0(int prod, int x) -{ - if ( x >= 1) { - goto factorial0(prod*x, x-1); - }else{ - goto print_factorial(prod); - } -} - -__code factorial(int x) -{ - goto factorial0(1, x); -} - -int -main(int argc, char **argv) -{ - int i; - i = atoi(argv[1]); - - goto factorial(i); -}
--- a/factorial/factorial.s Wed Oct 22 02:06:29 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .globl _print_factorial - .align 4, 0x90 -_print_factorial: ## @print_factorial - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp2: - .cfi_def_cfa_offset 16 -Ltmp3: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp4: - .cfi_def_cfa_register %rbp - subq $16, %rsp - leaq L_.str(%rip), %rax - movl %edi, -4(%rbp) - movl -4(%rbp), %esi - movq %rax, %rdi - movb $0, %al - callq _printf - movl $0, %edi - movl %eax, -8(%rbp) ## 4-byte Spill - callq _exit - .cfi_endproc - - .globl _factorial0 - .align 4, 0x90 -_factorial0: ## @factorial0 - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp7: - .cfi_def_cfa_offset 16 -Ltmp8: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp9: - .cfi_def_cfa_register %rbp - subq $16, %rsp - movl %edi, -4(%rbp) - movl %esi, -8(%rbp) - cmpl $1, -8(%rbp) - jl LBB1_2 -## BB#1: ## %if.then - movl -4(%rbp), %eax - imull -8(%rbp), %eax - movl -8(%rbp), %ecx - subl $1, %ecx - movl %eax, %edi - movl %ecx, %esi - callq _factorial0 - jmp LBB1_3 -LBB1_2: ## %if.else - movl -4(%rbp), %edi - callq _print_factorial -LBB1_3: ## %if.end - addq $16, %rsp - popq %rbp - ret - .cfi_endproc - - .globl _factorial - .align 4, 0x90 -_factorial: ## @factorial - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp12: - .cfi_def_cfa_offset 16 -Ltmp13: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp14: - .cfi_def_cfa_register %rbp - subq $16, %rsp - movl $1, %eax - movl %edi, -4(%rbp) - movl -4(%rbp), %esi - movl %eax, %edi - callq _factorial0 - addq $16, %rsp - popq %rbp - ret - .cfi_endproc - - .globl _main - .align 4, 0x90 -_main: ## @main - .cfi_startproc -## BB#0: ## %entry - pushq %rbp -Ltmp17: - .cfi_def_cfa_offset 16 -Ltmp18: - .cfi_offset %rbp, -16 - movq %rsp, %rbp -Ltmp19: - .cfi_def_cfa_register %rbp - subq $32, %rsp - movl %edi, -4(%rbp) - movq %rsi, -16(%rbp) - movq -16(%rbp), %rsi - movq 8(%rsi), %rdi - callq _atoi - movl %eax, -20(%rbp) - movl -20(%rbp), %edi - callq _factorial - movl $0, %eax - addq $32, %rsp - popq %rbp - ret - .cfi_endproc - - .section __TEXT,__cstring,cstring_literals -L_.str: ## @.str - .asciz "factorial = %d\n" - - -.subsections_via_symbols
--- a/factorial/test.s Wed Oct 22 02:06:29 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -; ModuleID = '../../../test.c' -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.8.0" - -@.str = private unnamed_addr constant [6 x i8] c"hello\00", align 1 - -; Function Attrs: nounwind ssp uwtable -define void @hello() #0 { -entry: - %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0)) - ret void -} - -declare i32 @printf(i8*, ...) #1 - -; Function Attrs: nounwind ssp uwtable -define i32 @main() #0 { -entry: - %retval = alloca i32, align 4 - store i32 0, i32* %retval - call void @hello() - call void @hello() - ret i32 0 -} - -attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }