#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int main(void) {
  int i, sum;
  int arr[((64 * 1048576) / sizeof(int))];
  fprintf(stderr, "lsframe1: start\n");
  for (i = 0; i < ((64 * 1048576) / sizeof(int)); i++)
    arr[i] = i;
  sum = 0;
  for (i = 0; i < ((64 * 1048576) / sizeof(int)); i++)
    sum += arr[i];
  fprintf(stderr, "lsframe1: done, result is %d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4000010,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%edi
lea    0xece(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x1000000,%rax
jae    116c <main+0x5c>
mov    -0x8(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x4000010(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1140 <main+0x30>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x1000000,%rax
jae    11a9 <main+0x99>
movslq -0x8(%rbp),%rax
mov    -0x4000010(%rbp,%rax,4),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117a <main+0x6a>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x4000010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x4000008,%rsp
mov    0x2ebf(%rip),%r14
mov    (%r14),%edi
lea    0xf65(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <fprintf@plt>
movdqa 0xec4(%rip),%xmm0
movdqa 0xecb(%rip),%xmm8
movdqa 0xed2(%rip),%xmm9
movdqa 0xed9(%rip),%xmm10
movdqa 0xee1(%rip),%xmm4
movdqa 0xee9(%rip),%xmm5
movdqa 0xef1(%rip),%xmm6
movdqa 0xef9(%rip),%xmm7
movdqa 0xf01(%rip),%xmm1
nop
movdqa %xmm0,%xmm2
paddd  %xmm8,%xmm2
movdqa %xmm0,(%rsp,%rbx,4)
movdqa %xmm2,0x10(%rsp,%rbx,4)
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm10,%xmm3
movdqa %xmm2,0x20(%rsp,%rbx,4)
movdqa %xmm3,0x30(%rsp,%rbx,4)
movdqa %xmm0,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm5,%xmm3
movdqa %xmm2,0x40(%rsp,%rbx,4)
movdqa %xmm3,0x50(%rsp,%rbx,4)
movdqa %xmm0,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm7,%xmm3
movdqa %xmm2,0x60(%rsp,%rbx,4)
movdqa %xmm3,0x70(%rsp,%rbx,4)
add    $0x20,%rbx
paddd  %xmm1,%xmm0
cmp    $0x1000000,%rbx
jne    1180 <main+0x70>
pxor   %xmm0,%xmm0
xor    %eax,%eax
pxor   %xmm1,%xmm1
cs nopw 0x0(%rax,%rax,1)
nop
paddd  (%rsp,%rax,4),%xmm0
paddd  0x10(%rsp,%rax,4),%xmm1
paddd  0x20(%rsp,%rax,4),%xmm0
paddd  0x30(%rsp,%rax,4),%xmm1
paddd  0x40(%rsp,%rax,4),%xmm0
paddd  0x50(%rsp,%rax,4),%xmm1
paddd  0x60(%rsp,%rax,4),%xmm0
paddd  0x70(%rsp,%rax,4),%xmm1
add    $0x20,%rax
cmp    $0x1000000,%rax
jne    1210 <main+0x100>
paddd  %xmm0,%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%edx
mov    (%r14),%edi
lea    0xe32(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x4000008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"lsframe1: start\0A\00"
@.str.1 = [30 x i8] c"lsframe1: done, result is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [16777216 x i32]
store i32 0, i32* %1
%5 = load i32, i32* @stderr
%6 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %7
7: ; preds = %16, %0
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = icmp ult i64 %9, 16777216
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load i32, i32* %2
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %4, i64 0, i64 %14
store i32 %12, i32* %15
br label %16
16: ; preds = %11
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %7
19: ; preds = %7
store i32 0, i32* %3
store i32 0, i32* %2
br label %20
20: ; preds = %31, %19
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = icmp ult i64 %22, 16777216
br i1 %23, label %24, label %34
24: ; preds = %20
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %4, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = load i32, i32* %3
%30 = add nsw i32 %29, %28
store i32 %30, i32* %3
br label %31
31: ; preds = %24
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %20
34: ; preds = %20
%35 = load i32, i32* @stderr
%36 = load i32, i32* %3
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %36)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"lsframe1: start\0A\00"
@.str.1 = [30 x i8] c"lsframe1: done, result is %d\0A\00"
define i32 @main() {
%1 = alloca [16777216 x i32]
%2 = bitcast [16777216 x i32]* %1 to i8*
%3 = load i32, i32* @stderr
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %5, %0
%6 = phi i64 [ 0, %0 ], [ %34, %5 ]
%7 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %0 ], [ %35, %5 ]
%8 = add <4 x i32> %7, <i32 4, i32 4, i32 4, i32 4>
%9 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %1, i64 0, i64 %6
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> %7, <4 x i32>* %10
%11 = getelementptr inbounds i32, i32* %9, i64 4
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> %8, <4 x i32>* %12
%13 = or i64 %6, 8
%14 = add <4 x i32> %7, <i32 8, i32 8, i32 8, i32 8>
%15 = add <4 x i32> %7, <i32 12, i32 12, i32 12, i32 12>
%16 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %1, i64 0, i64 %13
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> %14, <4 x i32>* %17
%18 = getelementptr inbounds i32, i32* %16, i64 4
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> %15, <4 x i32>* %19
%20 = or i64 %6, 16
%21 = add <4 x i32> %7, <i32 16, i32 16, i32 16, i32 16>
%22 = add <4 x i32> %7, <i32 20, i32 20, i32 20, i32 20>
%23 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %1, i64 0, i64 %20
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> %21, <4 x i32>* %24
%25 = getelementptr inbounds i32, i32* %23, i64 4
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> %22, <4 x i32>* %26
%27 = or i64 %6, 24
%28 = add <4 x i32> %7, <i32 24, i32 24, i32 24, i32 24>
%29 = add <4 x i32> %7, <i32 28, i32 28, i32 28, i32 28>
%30 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %1, i64 0, i64 %27
%31 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> %28, <4 x i32>* %31
%32 = getelementptr inbounds i32, i32* %30, i64 4
%33 = bitcast i32* %32 to <4 x i32>*
store <4 x i32> %29, <4 x i32>* %33
%34 = add nuw nsw i64 %6, 32
%35 = add <4 x i32> %7, <i32 32, i32 32, i32 32, i32 32>
%36 = icmp eq i64 %34, 16777216
br i1 %36, label %37, label %5
37: ; preds = %5, %37
%38 = phi i64 [ %76, %37 ], [ 0, %5 ]
%39 = phi <4 x i32> [ %74, %37 ], [ zeroinitializer, %5 ]
%40 = phi <4 x i32> [ %75, %37 ], [ zeroinitializer, %5 ]
%41 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %1, i64 0, i64 %38
%42 = bitcast i32* %41 to <4 x i32>*
%43 = load <4 x i32>, <4 x i32>* %42
%44 = getelementptr inbounds i32, i32* %41, i64 4
%45 = bitcast i32* %44 to <4 x i32>*
%46 = load <4 x i32>, <4 x i32>* %45
%47 = add <4 x i32> %43, %39
%48 = add <4 x i32> %46, %40
%49 = or i64 %38, 8
%50 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %1, i64 0, i64 %49
%51 = bitcast i32* %50 to <4 x i32>*
%52 = load <4 x i32>, <4 x i32>* %51
%53 = getelementptr inbounds i32, i32* %50, i64 4
%54 = bitcast i32* %53 to <4 x i32>*
%55 = load <4 x i32>, <4 x i32>* %54
%56 = add <4 x i32> %52, %47
%57 = add <4 x i32> %55, %48
%58 = or i64 %38, 16
%59 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %1, i64 0, i64 %58
%60 = bitcast i32* %59 to <4 x i32>*
%61 = load <4 x i32>, <4 x i32>* %60
%62 = getelementptr inbounds i32, i32* %59, i64 4
%63 = bitcast i32* %62 to <4 x i32>*
%64 = load <4 x i32>, <4 x i32>* %63
%65 = add <4 x i32> %61, %56
%66 = add <4 x i32> %64, %57
%67 = or i64 %38, 24
%68 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %1, i64 0, i64 %67
%69 = bitcast i32* %68 to <4 x i32>*
%70 = load <4 x i32>, <4 x i32>* %69
%71 = getelementptr inbounds i32, i32* %68, i64 4
%72 = bitcast i32* %71 to <4 x i32>*
%73 = load <4 x i32>, <4 x i32>* %72
%74 = add <4 x i32> %70, %65
%75 = add <4 x i32> %73, %66
%76 = add nuw nsw i64 %38, 32
%77 = icmp eq i64 %76, 16777216
br i1 %77, label %78, label %37
78: ; preds = %37
%79 = add <4 x i32> %75, %74
%80 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %79)
%81 = load i32, i32* @stderr
%82 = tail call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %80)
ret i32 0
}