C code x86 asm MIPS asm x86 asm -O1 MIPS asm -O1 x86 asm -O4 MIPS asm -O4
int main(int i) {
  if (i) 
    main(i >> 1) + 1;
  else 
    return 0;
}

	.file	"lg.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	$12, %esp
	movl	%ecx, -12(%ebp)
	movl	-12(%ebp), %eax
	cmpl	$0, (%eax)
	je	.L2
	movl	-12(%ebp), %edx
	movl	(%edx), %eax
	sarl	%eax
	movl	%eax, (%esp)
	call	main
	jmp	.L1
.L2:
	movl	$0, %eax
	movl	%eax, -8(%ebp)
.L1:
	movl	-8(%ebp), %eax
	addl	$12, %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 "lg.c"
	.section .mdebug.abi32
	.previous
	.abicalls
	.text
	.align	2
	.globl	main
	.ent	main
	.type	main, @function
main:
	.frame	$fp,40,$31		# vars= 8, regs...
	.mask	0xc0000000,-4
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$25
	.set	reorder
	addiu	$sp,$sp,-40
	sw	$31,36($sp)
	sw	$fp,32($sp)
	move	$fp,$sp
	.cprestore	16
	sw	$4,40($fp)
	lw	$2,40($fp)
	beq	$2,$0,$L2
	lw	$2,40($fp)
	sra	$2,$2,1
	move	$4,$2
	jal	main
	b	$L3
$L2:
	sw	$0,24($fp)
	b	$L1
$L3:
$L1:
	lw	$2,24($fp)
	move	$sp,$fp
	lw	$31,36($sp)
	lw	$fp,32($sp)
	addiu	$sp,$sp,40
	j	$31
	.end	main
	.ident	"GCC: (GNU) 3.4.5"
	.file	"lg.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	$4, %esp
	movl	(%ecx), %eax
	movl	$0, %edx
	testl	%eax, %eax
	je	.L1
	sarl	%eax
	movl	%eax, (%esp)
	call	main
.L1:
	movl	%edx, %eax
	addl	$4, %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 "lg.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
	.set	noreorder
	.set	nomacro
	beq	$4,$0,$L1
	move	$2,$0
	.set	macro
	.set	reorder

	sra	$4,$4,1
	jal	main
$L1:
	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	"lg.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
	movl	(%ecx), %eax
	testl	%eax, %eax
	je	.L3
	.p2align 4,,7
.L6:
	sarl	%eax
	jne	.L6
.L3:
	popl	%ecx
	xorl	%eax, %eax
	popl	%ebp
	leal	-4(%ecx), %esp
	ret
	.size	main, .-main
	.ident	"GCC: (GNU) 4.1.2 20080704 ...
	.section	.note.GNU-stack,"",@progb...
	.file	1 "lg.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	nomacro
	
	addiu	$sp,$sp,-32
	sw	$31,24($sp)
	.cprestore	16
	move	$2,$4
	lw	$25,%call16(main)($28)
	sra	$4,$4,1
	bne	$2,$0,$L7
	move	$3,$0

	lw	$31,24($sp)
	move	$2,$3
	j	$31
	addiu	$sp,$sp,32

$L7:
	jalr	$25
	nop

	lw	$28,16($sp)
	lw	$31,24($sp)
	move	$2,$3
	j	$31
	addiu	$sp,$sp,32

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