#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 main(int argc, char *argv[], char *envp[]) {
  char *a = (char *)malloc(1000000000);
  int i;
  for (i = 0; i < 1000000000; i += 0x1000) {
    a[i] = 'a';
  }
  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    %rdx,-0x18(%rbp)
mov    $0x3b9aca00,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3b9aca00,-0x24(%rbp)
jge    1168 <main+0x58>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x61,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1000,%eax
mov    %eax,-0x24(%rbp)
jmp    113f <main+0x2f>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3b9aca00,%edi
call   1030 <malloc@plt>
xor    %ecx,%ecx
nopl   (%rax)
movb   $0x61,(%rax,%rcx,1)
movb   $0x61,0x1000(%rax,%rcx,1)
61
movb   $0x61,0x2000(%rax,%rcx,1)
61
movb   $0x61,0x3000(%rax,%rcx,1)
61
movb   $0x61,0x4000(%rax,%rcx,1)
61
cmp    $0x3b9a79ff,%rcx
ja     116e <main+0x5e>
movb   $0x61,0x5000(%rax,%rcx,1)
61
movb   $0x61,0x6000(%rax,%rcx,1)
61
movb   $0x61,0x7000(%rax,%rcx,1)
61
add    $0x8000,%rcx
jmp    1120 <main+0x10>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%10 = call i64 @malloc(i32 1000000000)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %8
store i32 0, i32* %9
br label %12
12: ; preds = %20, %3
%13 = load i32, i32* %9
%14 = icmp slt i32 %13, 1000000000
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i8*, i8** %8
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 97, i8* %19
br label %20
20: ; preds = %15
%21 = load i32, i32* %9
%22 = add nsw i32 %21, 4096
store i32 %22, i32* %9
br label %12
23: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i64 @malloc(i32 1000000000)
%5 = inttoptr i64 %4 to i8*
br label %6
6: ; preds = %18, %3
%7 = phi i64 [ 0, %3 ], [ %25, %18 ]
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 97, i8* %8
%9 = or i64 %7, 4096
%10 = getelementptr inbounds i8, i8* %5, i64 %9
store i8 97, i8* %10
%11 = or i64 %7, 8192
%12 = getelementptr inbounds i8, i8* %5, i64 %11
store i8 97, i8* %12
%13 = or i64 %7, 12288
%14 = getelementptr inbounds i8, i8* %5, i64 %13
store i8 97, i8* %14
%15 = or i64 %7, 16384
%16 = getelementptr inbounds i8, i8* %5, i64 %15
store i8 97, i8* %16
%17 = icmp ult i64 %7, 999979520
br i1 %17, label %18, label %26
18: ; preds = %6
%19 = or i64 %7, 20480
%20 = getelementptr inbounds i8, i8* %5, i64 %19
store i8 97, i8* %20
%21 = or i64 %7, 24576
%22 = getelementptr inbounds i8, i8* %5, i64 %21
store i8 97, i8* %22
%23 = or i64 %7, 28672
%24 = getelementptr inbounds i8, i8* %5, i64 %23
store i8 97, i8* %24
%25 = add nuw nsw i64 %7, 32768
br label %6
26: ; preds = %6
ret i32 0
}