C code x86 asm MIPS asm x86 asm -O1 MIPS asm -O1 x86 asm -O4 MIPS asm -O4
int foo(int a, int b, int c);

int main(int i) {


  int a = 0;
  int b = 1;
  int c = 2;

  return foo(a,b,c);
}

	.file	"caller.c"
	.text
.globl main
	.type	main, @function
main:
	leal	4(%esp), %ecx
	andl	$-16, %esp
	pushl	-4(%ecx)
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ecx
	subl	$36, %esp
	movl	$0, -16(%ebp)
	movl	$1, -12(%ebp)
	movl	$2, -8(%ebp)
	movl	-8(%ebp), %eax
	movl	%eax, 8(%esp)
	movl	-12(%ebp), %eax
	movl	%eax, 4(%esp)
	movl	-16(%ebp), %eax
	movl	%eax, (%esp)
	call	foo
	addl	$36, %esp
	popl	%ecx
	popl	%ebp
	leal	-4(%ecx), %esp
	ret
	.size	main, .-main
	.ident	"GCC: (GNU) 4.1.2 20080704 ...
	.section	.note.GNU-stack,"",@progb...
	.file	1 "caller.c"
	.section .mdebug.abi32
	.previous
	.abicalls
	.text
	.align	2
	.globl	main
	.ent	main
	.type	main, @function
main:
	.frame	$fp,48,$31		# vars= 16, reg...
	.mask	0xc0000000,-4
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$25
	.set	reorder
	addiu	$sp,$sp,-48
	sw	$31,44($sp)
	sw	$fp,40($sp)
	move	$fp,$sp
	.cprestore	16
	sw	$4,48($fp)
	sw	$0,24($fp)
	li	$2,1			# 0x1
	sw	$2,28($fp)
	li	$2,2			# 0x2
	sw	$2,32($fp)
	lw	$4,24($fp)
	lw	$5,28($fp)
	lw	$6,32($fp)
	jal	foo
	move	$sp,$fp
	lw	$31,44($sp)
	lw	$fp,40($sp)
	addiu	$sp,$sp,48
	j	$31
	.end	main
	.ident	"GCC: (GNU) 3.4.5"
	.file	"caller.c"
	.text
.globl main
	.type	main, @function
main:
	leal	4(%esp), %ecx
	andl	$-16, %esp
	pushl	-4(%ecx)
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ecx
	subl	$20, %esp
	movl	$2, 8(%esp)
	movl	$1, 4(%esp)
	movl	$0, (%esp)
	call	foo
	addl	$20, %esp
	popl	%ecx
	popl	%ebp
	leal	-4(%ecx), %esp
	ret
	.size	main, .-main
	.ident	"GCC: (GNU) 4.1.2 20080704 ...
	.section	.note.GNU-stack,"",@progb...
	.file	1 "caller.c"
	.section .mdebug.abi32
	.previous
	.abicalls
	.text
	.align	2
	.globl	main
	.ent	main
	.type	main, @function
main:
	.frame	$sp,32,$31		# vars= 0, regs...
	.mask	0x80000000,-8
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$25
	.set	reorder
	addiu	$sp,$sp,-32
	sw	$31,24($sp)
	.cprestore	16
	move	$4,$0
	li	$5,1			# 0x1
	li	$6,2			# 0x2
	jal	foo
	lw	$31,24($sp)
	.set	noreorder
	.set	nomacro
	j	$31
	addiu	$sp,$sp,32
	.set	macro
	.set	reorder

	.end	main
	.ident	"GCC: (GNU) 3.4.5"
	.file	"caller.c"
	.text
	.p2align 4,,15
.globl main
	.type	main, @function
main:
	leal	4(%esp), %ecx
	andl	$-16, %esp
	pushl	-4(%ecx)
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ecx
	subl	$20, %esp
	movl	$2, 8(%esp)
	movl	$1, 4(%esp)
	movl	$0, (%esp)
	call	foo
	addl	$20, %esp
	popl	%ecx
	popl	%ebp
	leal	-4(%ecx), %esp
	ret
	.size	main, .-main
	.ident	"GCC: (GNU) 4.1.2 20080704 ...
	.section	.note.GNU-stack,"",@progb...
	.file	1 "caller.c"
	.section .mdebug.abi32
	.previous
	.abicalls
	.text
	.align	2
	.globl	main
	.ent	main
	.type	main, @function
main:
	.frame	$sp,0,$31		# vars= 0, regs=...
	.mask	0x00000000,0
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$25
	.set	nomacro
	
	lw	$25,%call16(foo)($28)
	move	$4,$0
	li	$5,1			# 0x1
	jr	$25
	li	$6,2			# 0x2

	.set	macro
	.set	reorder
	.end	main
	.ident	"GCC: (GNU) 3.4.5"