Command for the test (source code):
./chef.py test backend -bw doc/p_510.c
cat build/cpp-bin/assembly.s
Result:
.file "p_510.c"
.text
.Ltext0:
.globl main
.type main, @function
print_tab:
pushq %rbp
movq %rsp, %rbp
subq $52, %rsp
movq %rdi, -8(%rbp) # copyInstr
movl %esi, -12(%rbp) # copyInstr
jmp .L1_innerbeginof_print_tab
.L1_innerbeginof_print_tab:
movl $0, -20(%rbp)
movl -20(%rbp), %r10d
movl %r10d, -24(%rbp) # copyInstr
jmp .L2_Finit
.L2_Finit:
# empty with returnName=i
movl $0, -32(%rbp)
movl -32(%rbp), %r10d
movl %r10d, -24(%rbp) # copyInstr
jmp .L3_Fcond
.L3_Fcond:
# empty with returnName=i
# empty with returnName=size
movl -12(%rbp), %r10d
cmp %r10d, -24(%rbp)
setl %cl
movzbl %cl, %r10d
movl %r10d, -36(%rbp)
cmpl $0, -36(%rbp)
je .L6_Fend
jmp .L4_Fthen
.L4_Fthen:
# empty with returnName=i
# common begin of arrayAccess of tab
pushq %rdx
movl -24(%rbp), %eax
cltq
# begin of remote arrayAccess of tab
leaq 0(,%rax,4), %rdx
movq -8(%rbp), %rax
addq %rdx, %rax
movl (%rax), %r10d
movl %r10d, -40(%rbp)
popq %rdx
# end of remote arrayAccess of tab
pushq %rdi
movl -40(%rbp), %edi # call Param
call putchar
popq %rdi
jmp .L5_Finc
.L5_Finc:
movl -24(%rbp), %r10d
movl %r10d, -44(%rbp) # copyInstr
# empty with returnName=i
movl $1, -48(%rbp)
movl -24(%rbp), %eax
addl %eax, -48(%rbp)
movl -48(%rbp), %r10d
movl %r10d, -24(%rbp) # copyInstr
# empty with returnName=!tmp5
jmp .L3_Fcond
.L6_Fend:
jmp .L7_funcinnerafter
.L7_funcinnerafter:
jmp .L0_endof_print_tab
.L0_endof_print_tab:
leave
ret
main:
pushq %rbp
movq %rsp, %rbp
subq $108, %rsp
jmp .L9_innerbeginof_main
.L9_innerbeginof_main:
movl $0, -8(%rbp)
movl -8(%rbp), %r10d
movl %r10d, -12(%rbp) # copyInstr
movl $10, -32(%rbp)
movl -32(%rbp), %r10d
movl %r10d, -16(%rbp) # copyInstr
movl $75, -40(%rbp)
movl -40(%rbp), %r10d
movl %r10d, -20(%rbp) # copyInstr
movl $79, -48(%rbp)
movl -48(%rbp), %r10d
movl %r10d, -24(%rbp) # copyInstr
nop
movl $3, -56(%rbp)
pushq %rsi
movl -56(%rbp), %esi # call Param
leaq -24(%rbp), %rax
movq %rax, -60(%rbp)
pushq %rdi
movq -60(%rbp), %rdi # call Param
call print_tab
popq %rdi
popq %rsi
jmp .L10_Finit
.L10_Finit:
# empty with returnName=i
movl $0, -68(%rbp)
movl -68(%rbp), %r10d
movl %r10d, -12(%rbp) # copyInstr
jmp .L11_Fcond
.L11_Fcond:
# empty with returnName=i
movl $3, -76(%rbp)
movl -76(%rbp), %r10d
cmp %r10d, -12(%rbp)
setl %cl
movzbl %cl, %r10d
movl %r10d, -80(%rbp)
cmpl $0, -80(%rbp)
je .L14_Fend
jmp .L12_Fthen
.L12_Fthen:
# empty with returnName=i
# common begin of arrayAccess of tab
pushq %rdx
movl -12(%rbp), %eax
cltq
# begin of local arrayAccess of tab
movl -24(%rbp,%rax,4), %r10d
movl %r10d, -84(%rbp)
# end of local arrayAccess of tab
pushq %rdi
movl -84(%rbp), %edi # call Param
call putchar
popq %rdi
jmp .L13_Finc
.L13_Finc:
movl -12(%rbp), %r10d
movl %r10d, -88(%rbp) # copyInstr
# empty with returnName=i
movl $1, -92(%rbp)
movl -12(%rbp), %eax
addl %eax, -92(%rbp)
movl -92(%rbp), %r10d
movl %r10d, -12(%rbp) # copyInstr
# empty with returnName=!tmp19
jmp .L11_Fcond
.L14_Fend:
jmp .L15_funcinnerafter
.L15_funcinnerafter:
movl $0, -100(%rbp)
movl -100(%rbp), %eax
jmp .L8_endof_main
jmp .L8_endof_main
.L8_endof_main:
leave
ret