#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*/ assert(int);
int *malloc(int);
int main() {
  int *x[10];
  int i = 0;
  while (i < 10)
    x[i++] = malloc(sizeof(int));
  *x[3] = 50;
  *x[7] = 100;
  assert(*x[8] == 100);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0xa,-0x64(%rbp)
jge    1164 <main+0x44>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x64(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x64(%rbp)
cltq
mov    %rcx,-0x60(%rbp,%rax,8)
jmp    1136 <main+0x16>
mov    -0x48(%rbp),%rax
movl   $0x32,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x64,(%rax)
mov    -0x20(%rbp),%rax
cmpl   $0x64,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1040 <malloc@plt>
xor    %edi,%edi
cmpl   $0x64,(%rbx)
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 4)
%2 = tail call i32* @malloc(i32 4)
%3 = tail call i32* @malloc(i32 4)
%4 = tail call i32* @malloc(i32 4)
%5 = tail call i32* @malloc(i32 4)
%6 = tail call i32* @malloc(i32 4)
%7 = tail call i32* @malloc(i32 4)
%8 = tail call i32* @malloc(i32 4)
%9 = tail call i32* @malloc(i32 4)
%10 = tail call i32* @malloc(i32 4)
%11 = load i32, i32* %9
%12 = icmp eq i32 %11, 100
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
ret i32 0
}