C code x86 asm MIPS asm x86 asm -O1 MIPS asm -O1 x86 asm -O4 MIPS asm -O4
#include
#include

int main(int argc, char *argv[]) {
     int r = 0;
     switch (argc) {
     case 164:
	  r = 10;
	  break;
     default:
	  r = 1;
     }


     return r;
}
	.file	"switch3.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	$16, %esp
	movl	$0, -8(%ebp)
	movl	(%ecx), %eax
	cmpl	$164, %eax
	je	.L3
	jmp	.L2
.L3:
	movl	$10, -8(%ebp)
	jmp	.L4
.L2:
	movl	$1, -8(%ebp)
.L4:
	movl	-8(%ebp), %eax
	addl	$16, %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 "switch3.c"
	.section .mdebug.abi32
	.previous
	.abicalls
	.text
	.align	2
	.globl	main
	.ent	main
	.type	main, @function
main:
	.frame	$fp,24,$31		# vars= 8, regs...
	.mask	0x40000000,-8
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$25
	.set	reorder
	addiu	$sp,$sp,-24
	sw	$fp,16($sp)
	move	$fp,$sp
	sw	$4,24($fp)
	sw	$5,28($fp)
	sw	$0,8($fp)
	lw	$3,24($fp)
	li	$2,164			# 0xa4
	beq	$3,$2,$L3
	b	$L4
$L3:
	li	$2,10			# 0xa
	sw	$2,8($fp)
	b	$L2
$L4:
	li	$2,1			# 0x1
	sw	$2,8($fp)
$L2:
	lw	$2,8($fp)
	move	$sp,$fp
	lw	$fp,16($sp)
	addiu	$sp,$sp,24
	j	$31
	.end	main
	.ident	"GCC: (GNU) 3.4.5"
	.file	"switch3.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
	cmpl	$164, (%ecx)
	sete	%al
	movzbl	%al, %eax
	leal	1(%eax,%eax,8), %eax
	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 "switch3.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	reorder
	li	$2,164			# 0xa4
	.set	noreorder
	.set	nomacro
	beq	$4,$2,$L2
	li	$3,10			# 0xa
	.set	macro
	.set	reorder

	li	$3,1			# 0x1
$L2:
	.set	noreorder
	.set	nomacro
	j	$31
	move	$2,$3
	.set	macro
	.set	reorder

	.end	main
	.ident	"GCC: (GNU) 3.4.5"
	.file	"switch3.c"
	.text
	.p2align 4,,15
.globl main
	.type	main, @function
main:
	leal	4(%esp), %ecx
	andl	$-16, %esp
	pushl	-4(%ecx)
	xorl	%eax, %eax
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ecx
	cmpl	$164, (%ecx)
	popl	%ecx
	popl	%ebp
	sete	%al
	leal	1(%eax,%eax,8), %eax
	leal	-4(%ecx), %esp
	ret
	.size	main, .-main
	.ident	"GCC: (GNU) 4.1.2 20080704 ...
	.section	.note.GNU-stack,"",@progb...
	.file	1 "switch3.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
	.set	nomacro
	
	li	$2,164			# 0xa4
	beq	$4,$2,$L2
	li	$3,10			# 0xa

	li	$3,1			# 0x1
$L2:
	j	$31
	move	$2,$3

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