#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ abort();
unsigned int foo(unsigned int *);
int main(void) {
  unsigned int A[111 * 111];
  int i;
  unsigned int res;
  for (i = 0; i < 111 * 111; i++)
    A[i] = 2;
  res = foo(A);
  if (res != 24642)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0a0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc094(%rbp)
cmpl   $0x3021,-0xc094(%rbp)
jge    1172 <main+0x52>
movslq -0xc094(%rbp),%rax
movl   $0x2,-0xc090(%rbp,%rax,4)
mov    -0xc094(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc094(%rbp)
jmp    113c <main+0x1c>
lea    -0xc090(%rbp),%rdi
call   1040 <foo@plt>
mov    %eax,-0xc098(%rbp)
cmpl   $0x6042,-0xc098(%rbp)
je     119b <main+0x7b>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0xc0a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xc088,%rsp
mov    $0x34,%eax
movaps 0xecd(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movaps %xmm0,-0xd0(%rsp,%rax,4)
ff
movaps %xmm0,-0xc0(%rsp,%rax,4)
ff
movaps %xmm0,-0xb0(%rsp,%rax,4)
ff
movaps %xmm0,-0xa0(%rsp,%rax,4)
ff
movaps %xmm0,-0x90(%rsp,%rax,4)
ff
movaps %xmm0,-0x80(%rsp,%rax,4)
movaps %xmm0,-0x70(%rsp,%rax,4)
movaps %xmm0,-0x60(%rsp,%rax,4)
movaps %xmm0,-0x50(%rsp,%rax,4)
movaps %xmm0,-0x40(%rsp,%rax,4)
movaps %xmm0,-0x30(%rsp,%rax,4)
movaps %xmm0,-0x20(%rsp,%rax,4)
movaps %xmm0,-0x10(%rsp,%rax,4)
movaps %xmm0,(%rsp,%rax,4)
add    $0x38,%rax
cmp    $0x3054,%rax
jne    1140 <main+0x20>
movl   $0x2,0xc080(%rsp)
mov    %rsp,%rdi
call   1040 <foo@plt>
cmp    $0x6042,%eax
jne    11c4 <main+0xa4>
xor    %eax,%eax
add    $0xc088,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [12321 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 12321
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [12321 x i32], [12321 x i32]* %2, i64 0, i64 %10
store i32 2, i32* %11
br label %12
12: ; preds = %8
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %5
15: ; preds = %5
%16 = getelementptr inbounds [12321 x i32], [12321 x i32]* %2, i64 0, i64 0
%17 = call i32 @foo(i32* %16)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 24642
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 (...) @abort()
unreachable
22: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [12321 x i32]
%2 = bitcast [12321 x i32]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %39, %3 ]
%5 = getelementptr inbounds [12321 x i32], [12321 x i32]* %1, i64 0, i64 %4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %6
%7 = getelementptr inbounds i32, i32* %5, i64 4
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %8
%9 = add nuw nsw i64 %4, 8
%10 = getelementptr inbounds [12321 x i32], [12321 x i32]* %1, i64 0, i64 %9
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %11
%12 = getelementptr inbounds i32, i32* %10, i64 4
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %13
%14 = add nuw nsw i64 %4, 16
%15 = getelementptr inbounds [12321 x i32], [12321 x i32]* %1, i64 0, i64 %14
%16 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %16
%17 = getelementptr inbounds i32, i32* %15, i64 4
%18 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %18
%19 = add nuw nsw i64 %4, 24
%20 = getelementptr inbounds [12321 x i32], [12321 x i32]* %1, i64 0, i64 %19
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %21
%22 = getelementptr inbounds i32, i32* %20, i64 4
%23 = bitcast i32* %22 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %23
%24 = add nuw nsw i64 %4, 32
%25 = getelementptr inbounds [12321 x i32], [12321 x i32]* %1, i64 0, i64 %24
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %26
%27 = getelementptr inbounds i32, i32* %25, i64 4
%28 = bitcast i32* %27 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %28
%29 = add nuw nsw i64 %4, 40
%30 = getelementptr inbounds [12321 x i32], [12321 x i32]* %1, i64 0, i64 %29
%31 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %31
%32 = getelementptr inbounds i32, i32* %30, i64 4
%33 = bitcast i32* %32 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %33
%34 = add nuw nsw i64 %4, 48
%35 = getelementptr inbounds [12321 x i32], [12321 x i32]* %1, i64 0, i64 %34
%36 = bitcast i32* %35 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %36
%37 = getelementptr inbounds i32, i32* %35, i64 4
%38 = bitcast i32* %37 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %38
%39 = add nuw nsw i64 %4, 56
%40 = icmp eq i64 %39, 12320
br i1 %40, label %41, label %3
41: ; preds = %3
%42 = getelementptr inbounds [12321 x i32], [12321 x i32]* %1, i64 0, i64 12320
store i32 2, i32* %42
%43 = getelementptr inbounds [12321 x i32], [12321 x i32]* %1, i64 0, i64 0
%44 = call i32 @foo(i32* %43)
%45 = icmp eq i32 %44, 24642
br i1 %45, label %48, label %46
46: ; preds = %41
%47 = call i32 (...) @abort()
unreachable
48: ; preds = %41
ret i32 0
}