#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  size_t i, j;
  int *mat = (int *)malloc((16 * 1024) * (16 * 1024) * sizeof(int));
  for (i = 0; i < (16 * 1024); ++i)
    for (j = 0; j < (16 * 1024); ++j)
      mat[i * (16 * 1024) + j] = 42;
  puts("TEST DONE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x40000000,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x4000,-0x18(%rbp)
jae    11ae <main+0x8e>
movq   $0x0,-0x20(%rbp)
cmpq   $0x4000,-0x20(%rbp)
jae    1198 <main+0x78>
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    $0xe,%rcx
add    -0x20(%rbp),%rcx
movl   $0x2a,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1162 <main+0x42>
jmp    119d <main+0x7d>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114c <main+0x2c>
lea    0xe4b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x40000000,%edi
call   1040 <malloc@plt>
add    $0x70,%rax
xor    %ecx,%ecx
movaps 0xec8(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movups %xmm0,-0x70(%rax,%rdx,4)
movups %xmm0,-0x60(%rax,%rdx,4)
movups %xmm0,-0x50(%rax,%rdx,4)
movups %xmm0,-0x40(%rax,%rdx,4)
movups %xmm0,-0x30(%rax,%rdx,4)
movups %xmm0,-0x20(%rax,%rdx,4)
movups %xmm0,-0x10(%rax,%rdx,4)
movups %xmm0,(%rax,%rdx,4)
add    $0x20,%rdx
cmp    $0x4000,%rdx
jne    1150 <main+0x30>
add    $0x1,%rcx
add    $0x10000,%rax
cmp    $0x4000,%rcx
jne    1140 <main+0x20>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"TEST DONE\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i64 @malloc(i32 1073741824)
%10 = inttoptr i64 %9 to i32*
store i32* %10, i32** %8
store i64 0, i64* %6
br label %11
11: ; preds = %29, %2
%12 = load i64, i64* %6
%13 = icmp ult i64 %12, 16384
br i1 %13, label %14, label %32
14: ; preds = %11
store i64 0, i64* %7
br label %15
15: ; preds = %25, %14
%16 = load i64, i64* %7
%17 = icmp ult i64 %16, 16384
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = load i32*, i32** %8
%20 = load i64, i64* %6
%21 = mul i64 %20, 16384
%22 = load i64, i64* %7
%23 = add i64 %21, %22
%24 = getelementptr inbounds i32, i32* %19, i64 %23
store i32 42, i32* %24
br label %25
25: ; preds = %18
%26 = load i64, i64* %7
%27 = add i64 %26, 1
store i64 %27, i64* %7
br label %15
28: ; preds = %15
br label %29
29: ; preds = %28
%30 = load i64, i64* %6
%31 = add i64 %30, 1
store i64 %31, i64* %6
br label %11
32: ; preds = %11
%33 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"TEST DONE\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 1073741824)
%4 = inttoptr i64 %3 to i32*
br label %5
5: ; preds = %2, %35
%6 = phi i64 [ 0, %2 ], [ %36, %35 ]
%7 = shl i64 %6, 14
br label %8
8: ; preds = %8, %5
%9 = phi i64 [ 0, %5 ], [ %33, %8 ]
%10 = add nuw nsw i64 %9, %7
%11 = getelementptr inbounds i32, i32* %4, i64 %10
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> <i32 42, i32 42, i32 42, i32 42>, <4 x i32>* %12
%13 = getelementptr inbounds i32, i32* %11, i64 4
%14 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> <i32 42, i32 42, i32 42, i32 42>, <4 x i32>* %14
%15 = or i64 %9, 8
%16 = add nuw nsw i64 %15, %7
%17 = getelementptr inbounds i32, i32* %4, i64 %16
%18 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 42, i32 42, i32 42, i32 42>, <4 x i32>* %18
%19 = getelementptr inbounds i32, i32* %17, i64 4
%20 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> <i32 42, i32 42, i32 42, i32 42>, <4 x i32>* %20
%21 = or i64 %9, 16
%22 = add nuw nsw i64 %21, %7
%23 = getelementptr inbounds i32, i32* %4, i64 %22
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> <i32 42, i32 42, i32 42, i32 42>, <4 x i32>* %24
%25 = getelementptr inbounds i32, i32* %23, i64 4
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> <i32 42, i32 42, i32 42, i32 42>, <4 x i32>* %26
%27 = or i64 %9, 24
%28 = add nuw nsw i64 %27, %7
%29 = getelementptr inbounds i32, i32* %4, i64 %28
%30 = bitcast i32* %29 to <4 x i32>*
store <4 x i32> <i32 42, i32 42, i32 42, i32 42>, <4 x i32>* %30
%31 = getelementptr inbounds i32, i32* %29, i64 4
%32 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> <i32 42, i32 42, i32 42, i32 42>, <4 x i32>* %32
%33 = add nuw nsw i64 %9, 32
%34 = icmp eq i64 %33, 16384
br i1 %34, label %35, label %8
35: ; preds = %8
%36 = add nuw nsw i64 %6, 1
%37 = icmp eq i64 %36, 16384
br i1 %37, label %38, label %5
38: ; preds = %35
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 0
}