#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*/ printf(char *, ...);
int main(void) {
  int i, sum;
  int arr[((64 * 1048576) / sizeof(int))];
  printf("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];
  printf("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)
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x1000000,%rax
jae    1163 <main+0x53>
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    1137 <main+0x27>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x1000000,%rax
jae    11a0 <main+0x90>
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    1171 <main+0x61>
mov    -0xc(%rbp),%esi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4000010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x4000008,%rsp
lea    0xf80(%rip),%rdi
call   1030 <puts@plt>
movdqa 0xec5(%rip),%xmm0
xor    %eax,%eax
movdqa 0xeca(%rip),%xmm8
movdqa 0xed1(%rip),%xmm9
movdqa 0xed8(%rip),%xmm10
movdqa 0xee0(%rip),%xmm4
movdqa 0xee8(%rip),%xmm5
movdqa 0xef0(%rip),%xmm6
movdqa 0xef8(%rip),%xmm7
movdqa 0xf00(%rip),%xmm1
movdqa %xmm0,%xmm2
paddd  %xmm8,%xmm2
movdqa %xmm0,(%rsp,%rax,4)
movdqa %xmm2,0x10(%rsp,%rax,4)
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm10,%xmm3
movdqa %xmm2,0x20(%rsp,%rax,4)
movdqa %xmm3,0x30(%rsp,%rax,4)
movdqa %xmm0,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm5,%xmm3
movdqa %xmm2,0x40(%rsp,%rax,4)
movdqa %xmm3,0x50(%rsp,%rax,4)
movdqa %xmm0,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm7,%xmm3
movdqa %xmm2,0x60(%rsp,%rax,4)
movdqa %xmm3,0x70(%rsp,%rax,4)
add    $0x20,%rax
paddd  %xmm1,%xmm0
cmp    $0x1000000,%rax
jne    1180 <main+0x60>
pxor   %xmm0,%xmm0
xor    %eax,%eax
pxor   %xmm1,%xmm1
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
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+0xf0>
paddd  %xmm0,%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
lea    0xe24(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x4000008,%rsp
ret

LLVM IR (-O0):
@.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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %6
6: ; preds = %15, %0
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = icmp ult i64 %8, 16777216
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i32, i32* %2
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %4, i64 0, i64 %13
store i32 %11, i32* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %6
18: ; preds = %6
store i32 0, i32* %3
store i32 0, i32* %2
br label %19
19: ; preds = %30, %18
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = icmp ult i64 %21, 16777216
br i1 %22, label %23, label %33
23: ; preds = %19
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [16777216 x i32], [16777216 x i32]* %4, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, %27
store i32 %29, i32* %3
br label %30
30: ; preds = %23
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %19
33: ; preds = %19
%34 = load i32, i32* %3
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %34)
ret i32 0
}

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