#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();
int foo(double *);
int main(void) {
  double A[111 * 1111];
  int i, res;
  for (i = 0; i < 111 * 1111; i++)
    A[i] = 2;
  res = foo(A);
  if (res != 246642)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0de0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xf0dd4(%rbp)
cmpl   $0x1e1b9,-0xf0dd4(%rbp)
jge    1178 <main+0x58>
movslq -0xf0dd4(%rbp),%rax
movsd  0xea5(%rip),%xmm0
movsd  %xmm0,-0xf0dd0(%rbp,%rax,8)
f0 ff
mov    -0xf0dd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf0dd4(%rbp)
jmp    113c <main+0x1c>
lea    -0xf0dd0(%rbp),%rdi
call   1040 <foo@plt>
mov    %eax,-0xf0dd8(%rbp)
cmpl   $0x3c372,-0xf0dd8(%rbp)
je     11a1 <main+0x81>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0xf0de0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xf0dc8,%rsp
mov    $0x12,%eax
movaps 0xecd(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movaps %xmm0,-0x90(%rsp,%rax,8)
ff
movaps %xmm0,-0x80(%rsp,%rax,8)
movaps %xmm0,-0x70(%rsp,%rax,8)
movaps %xmm0,-0x60(%rsp,%rax,8)
movaps %xmm0,-0x50(%rsp,%rax,8)
movaps %xmm0,-0x40(%rsp,%rax,8)
movaps %xmm0,-0x30(%rsp,%rax,8)
movaps %xmm0,-0x20(%rsp,%rax,8)
movaps %xmm0,-0x10(%rsp,%rax,8)
movaps %xmm0,(%rsp,%rax,8)
add    $0x14,%rax
cmp    $0x1e1ca,%rax
jne    1140 <main+0x20>
movabs $0x4000000000000000,%rax
mov    %rax,0xf0dc0(%rsp)
mov    %rsp,%rdi
call   1040 <foo@plt>
cmp    $0x3c372,%eax
jne    11ab <main+0x8b>
xor    %eax,%eax
add    $0xf0dc8,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [123321 x double]
%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, 123321
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [123321 x double], [123321 x double]* %2, i64 0, i64 %10
store double 2.000000e+00, double* %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 [123321 x double], [123321 x double]* %2, i64 0, i64 0
%17 = call i32 @foo(double* %16)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 246642
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 [123321 x double]
%2 = bitcast [123321 x double]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %29, %3 ]
%5 = getelementptr inbounds [123321 x double], [123321 x double]* %1, i64 0, i64 %4
%6 = bitcast double* %5 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %6
%7 = getelementptr inbounds double, double* %5, i64 2
%8 = bitcast double* %7 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %8
%9 = add nuw nsw i64 %4, 4
%10 = getelementptr inbounds [123321 x double], [123321 x double]* %1, i64 0, i64 %9
%11 = bitcast double* %10 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %11
%12 = getelementptr inbounds double, double* %10, i64 2
%13 = bitcast double* %12 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %13
%14 = add nuw nsw i64 %4, 8
%15 = getelementptr inbounds [123321 x double], [123321 x double]* %1, i64 0, i64 %14
%16 = bitcast double* %15 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %16
%17 = getelementptr inbounds double, double* %15, i64 2
%18 = bitcast double* %17 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %18
%19 = add nuw nsw i64 %4, 12
%20 = getelementptr inbounds [123321 x double], [123321 x double]* %1, i64 0, i64 %19
%21 = bitcast double* %20 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %21
%22 = getelementptr inbounds double, double* %20, i64 2
%23 = bitcast double* %22 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %23
%24 = add nuw nsw i64 %4, 16
%25 = getelementptr inbounds [123321 x double], [123321 x double]* %1, i64 0, i64 %24
%26 = bitcast double* %25 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %26
%27 = getelementptr inbounds double, double* %25, i64 2
%28 = bitcast double* %27 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %28
%29 = add nuw nsw i64 %4, 20
%30 = icmp eq i64 %29, 123320
br i1 %30, label %31, label %3
31: ; preds = %3
%32 = getelementptr inbounds [123321 x double], [123321 x double]* %1, i64 0, i64 123320
store double 2.000000e+00, double* %32
%33 = getelementptr inbounds [123321 x double], [123321 x double]* %1, i64 0, i64 0
%34 = call i32 @foo(double* %33)
%35 = icmp eq i32 %34, 246642
br i1 %35, label %38, label %36
36: ; preds = %31
%37 = call i32 (...) @abort()
unreachable
38: ; preds = %31
ret i32 0
}