#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 *malloc(int);
int /*<<< orphan*/ print_array(int *, int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv, char *env[]) {
  printf("Arrays in C\n");
  int ia[5][4][100][200];
  int ia2[3];
  ia[0][0][0][0] = 5;
  ia[3][0][0][1] = 17;
  int *da = malloc(10 * sizeof(int));
  for (int i = 0; i < 10; i++) {
    da[i] = i * 2;
  }
  print_array(da, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186a40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
movl   $0x5,-0x186a20(%rbp)
movl   $0x11,-0x9c41c(%rbp)
mov    $0x28,%edi
call   1050 <malloc@plt>
mov    %rax,-0x186a38(%rbp)
movl   $0x0,-0x186a3c(%rbp)
cmpl   $0xa,-0x186a3c(%rbp)
jge    11c3 <main+0x93>
mov    -0x186a3c(%rbp),%edx
shl    $0x1,%edx
mov    -0x186a38(%rbp),%rax
movslq -0x186a3c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x186a3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x186a3c(%rbp)
jmp    1188 <main+0x58>
mov    -0x186a38(%rbp),%rdi
mov    $0xa,%esi
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x186a40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x28,%edi
call   1050 <malloc@plt>
movaps 0xeb2(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xeb8(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x1200000010,%rcx
mov    %rcx,0x20(%rax)
mov    %rax,%rdi
mov    $0xa,%esi
call   1040 <print_array@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Arrays in C\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca [5 x [4 x [100 x [200 x i32]]]]
%9 = alloca [3 x i32]
%10 = alloca i32*
%11 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [5 x [4 x [100 x [200 x i32]]]], [5 x [4 x [100 x [200 x i32]]]]* %8, i64 0, i64 0
%14 = getelementptr inbounds [4 x [100 x [200 x i32]]], [4 x [100 x [200 x i32]]]* %13, i64 0, i64 0
%15 = getelementptr inbounds [100 x [200 x i32]], [100 x [200 x i32]]* %14, i64 0, i64 0
%16 = getelementptr inbounds [200 x i32], [200 x i32]* %15, i64 0, i64 0
store i32 5, i32* %16
%17 = getelementptr inbounds [5 x [4 x [100 x [200 x i32]]]], [5 x [4 x [100 x [200 x i32]]]]* %8, i64 0, i64 3
%18 = getelementptr inbounds [4 x [100 x [200 x i32]]], [4 x [100 x [200 x i32]]]* %17, i64 0, i64 0
%19 = getelementptr inbounds [100 x [200 x i32]], [100 x [200 x i32]]* %18, i64 0, i64 0
%20 = getelementptr inbounds [200 x i32], [200 x i32]* %19, i64 0, i64 1
store i32 17, i32* %20
%21 = call i32* @malloc(i32 40)
store i32* %21, i32** %10
store i32 0, i32* %11
br label %22
22: ; preds = %32, %3
%23 = load i32, i32* %11
%24 = icmp slt i32 %23, 10
br i1 %24, label %25, label %35
25: ; preds = %22
%26 = load i32, i32* %11
%27 = mul nsw i32 %26, 2
%28 = load i32*, i32** %10
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 %27, i32* %31
br label %32
32: ; preds = %25
%33 = load i32, i32* %11
%34 = add nsw i32 %33, 1
store i32 %34, i32* %11
br label %22
35: ; preds = %22
%36 = load i32*, i32** %10
%37 = call i32 @print_array(i32* %36, i32 10)
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"Arrays in C\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%5 = tail call i32* @malloc(i32 40)
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 0, i32 2, i32 4, i32 6>, <4 x i32>* %6
%7 = getelementptr inbounds i32, i32* %5, i64 4
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 8, i32 10, i32 12, i32 14>, <4 x i32>* %8
%9 = getelementptr inbounds i32, i32* %5, i64 8
store i32 16, i32* %9
%10 = getelementptr inbounds i32, i32* %5, i64 9
store i32 18, i32* %10
%11 = tail call i32 @print_array(i32* %5, i32 10)
ret i32 0
}