C code x86 asm MIPS asm x86 asm -O1 MIPS asm -O1 x86 asm -O4 MIPS asm -O4
int array[100000];

int main(int count) 
{
     int s = 0;
     int i;
     for(i = 0; i < count + 100000;...
	  s+= array[i];
     }
     return s;
}
	.file	"arrayLoop.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	%ecx, -24(%ebp)
	movl	$0, -12(%ebp)
	movl	$0, -8(%ebp)
	jmp	.L2
.L3:
	movl	-8(%ebp), %eax
	movl	array(,%eax,4), %eax
	addl	%eax, -12(%ebp)
	addl	$1, -8(%ebp)
.L2:
	movl	-24(%ebp), %edx
	movl	(%edx), %eax
	addl	$100000, %eax
	cmpl	-8(%ebp), %eax
	jg	.L3
	movl	-12(%ebp), %eax
	addl	$20, %esp
	popl	%ecx
	popl	%ebp
	leal	-4(%ecx), %esp
	ret
	.size	main, .-main
	.comm	array,400000,32
	.ident	"GCC: (GNU) 4.1.2 20080704 ...
	.section	.note.GNU-stack,"",@progb...
	.file	1 "arrayLoop.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	$0,8($fp)
	sw	$0,12($fp)
$L2:
	lw	$3,24($fp)
	li	$2,65536			# 0x10000
	ori	$2,$2,0x86a0
	addu	$3,$3,$2
	lw	$2,12($fp)
	slt	$2,$2,$3
	beq	$2,$0,$L3
	la	$3,array
	lw	$2,12($fp)
	sll	$2,$2,2
	addu	$2,$2,$3
	lw	$3,8($fp)
	lw	$2,0($2)
	addu	$2,$3,$2
	sw	$2,8($fp)
	lw	$2,12($fp)
	addiu	$2,$2,1
	sw	$2,12($fp)
	b	$L2
$L3:
	lw	$2,8($fp)
	move	$sp,$fp
	lw	$fp,16($sp)
	addiu	$sp,$sp,24
	j	$31
	.end	main

	.comm	array,400000,4
	.ident	"GCC: (GNU) 3.4.5"
	.file	"arrayLoop.c"
	.text
.globl main
	.type	main, @function
main:
	leal	4(%esp), %ecx
	andl	$-16, %esp
	pushl	-4(%ecx)
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ebx
	pushl	%ecx
	movl	(%ecx), %ebx
	leal	100000(%ebx), %eax
	movl	$0, %ecx
	testl	%eax, %eax
	jle	.L4
	movl	$0, %ecx
	movl	$0, %edx
	leal	100000(%ebx), %eax
.L5:
	addl	array(,%edx,4), %ecx
	addl	$1, %edx
	cmpl	%eax, %edx
	jne	.L5
.L4:
	movl	%ecx, %eax
	popl	%ecx
	popl	%ebx
	popl	%ebp
	leal	-4(%ecx), %esp
	ret
	.size	main, .-main
	.comm	array,400000,32
	.ident	"GCC: (GNU) 4.1.2 20080704 ...
	.section	.note.GNU-stack,"",@progb...
	.file	1 "arrayLoop.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
	move	$3,$0
	li	$2,65536			# 0x10000
	ori	$2,$2,0x86a0
	addu	$2,$4,$2
	.set	noreorder
	.set	nomacro
	blez	$2,$L7
	move	$5,$0
	.set	macro
	.set	reorder

	la	$6,array
	li	$2,65536			# 0x10000
	ori	$2,$2,0x86a0
	addu	$4,$4,$2
$L5:
	sll	$2,$3,2
	addu	$2,$2,$6
	lw	$2,0($2)
	addu	$5,$5,$2
	addiu	$3,$3,1
	slt	$2,$3,$4
	bne	$2,$0,$L5
$L7:
	.set	noreorder
	.set	nomacro
	j	$31
	move	$2,$5
	.set	macro
	.set	reorder

	.end	main

	.comm	array,400000,4
	.ident	"GCC: (GNU) 3.4.5"
	.file	"arrayLoop.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
	movl	(%ecx), %ecx
	addl	$100000, %ecx
	testl	%ecx, %ecx
	jle	.L4
	xorl	%edx, %edx
	.p2align 4,,7
.L5:
	addl	array(,%edx,4), %eax
	addl	$1, %edx
	cmpl	%ecx, %edx
	jne	.L5
.L4:
	popl	%ecx
	popl	%ebp
	leal	-4(%ecx), %esp
	ret
	.size	main, .-main
	.comm	array,400000,32
	.ident	"GCC: (GNU) 4.1.2 20080704 ...
	.section	.note.GNU-stack,"",@progb...
	.file	1 "arrayLoop.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
	
	li	$3,65536			# 0x10000
	ori	$2,$3,0x86a0
	addu	$4,$4,$2
	move	$7,$0
	blez	$4,$L7
	move	$6,$0

	lw	$5,%got(array)($28)
	nop
$L5:
	lw	$9,0($5)
	addiu	$6,$6,1
	slt	$8,$6,$4
	addu	$7,$7,$9
	bne	$8,$0,$L5
	addiu	$5,$5,4

$L7:
	j	$31
	move	$2,$7

	.set	macro
	.set	reorder
	.end	main

	.comm	array,400000,4
	.ident	"GCC: (GNU) 3.4.5"