#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*/ memset(char *, char, int);
int main() {
  int i = 0;
  char *buf[10];
  while (i < 10) {
    buf[i] = (char *)malloc(1024 * 1024 * 256);
    memset(buf[i], '\0', 1024 * 1024 * 256);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1179 <main+0x59>
mov    $0x10000000,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
mov    %rcx,-0x60(%rbp,%rax,8)
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdi
xor    %esi,%esi
mov    $0x10000000,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x10000000,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x10000000,%edx
call   1030 <memset@plt>
mov    $0x10000000,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x10000000,%edx
call   1030 <memset@plt>
mov    $0x10000000,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x10000000,%edx
call   1030 <memset@plt>
mov    $0x10000000,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x10000000,%edx
call   1030 <memset@plt>
mov    $0x10000000,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x10000000,%edx
call   1030 <memset@plt>
mov    $0x10000000,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x10000000,%edx
call   1030 <memset@plt>
mov    $0x10000000,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x10000000,%edx
call   1030 <memset@plt>
mov    $0x10000000,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x10000000,%edx
call   1030 <memset@plt>
mov    $0x10000000,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x10000000,%edx
call   1030 <memset@plt>
mov    $0x10000000,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x10000000,%edx
call   1030 <memset@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 268435456)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @memset(i8* %2, i8 signext 0, i32 268435456)
%4 = tail call i64 @malloc(i32 268435456)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @memset(i8* %5, i8 signext 0, i32 268435456)
%7 = tail call i64 @malloc(i32 268435456)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @memset(i8* %8, i8 signext 0, i32 268435456)
%10 = tail call i64 @malloc(i32 268435456)
%11 = inttoptr i64 %10 to i8*
%12 = tail call i32 @memset(i8* %11, i8 signext 0, i32 268435456)
%13 = tail call i64 @malloc(i32 268435456)
%14 = inttoptr i64 %13 to i8*
%15 = tail call i32 @memset(i8* %14, i8 signext 0, i32 268435456)
%16 = tail call i64 @malloc(i32 268435456)
%17 = inttoptr i64 %16 to i8*
%18 = tail call i32 @memset(i8* %17, i8 signext 0, i32 268435456)
%19 = tail call i64 @malloc(i32 268435456)
%20 = inttoptr i64 %19 to i8*
%21 = tail call i32 @memset(i8* %20, i8 signext 0, i32 268435456)
%22 = tail call i64 @malloc(i32 268435456)
%23 = inttoptr i64 %22 to i8*
%24 = tail call i32 @memset(i8* %23, i8 signext 0, i32 268435456)
%25 = tail call i64 @malloc(i32 268435456)
%26 = inttoptr i64 %25 to i8*
%27 = tail call i32 @memset(i8* %26, i8 signext 0, i32 268435456)
%28 = tail call i64 @malloc(i32 268435456)
%29 = inttoptr i64 %28 to i8*
%30 = tail call i32 @memset(i8* %29, i8 signext 0, i32 268435456)
ret i32 0
}