#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ initarr(int ****, int, int, int, int);
void *malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main(void) {
  int ****array;
  int hyp_sz = 4, plane_sz = 4, row_sz = 4, col_sz = 4;
  int h, i, j;
  array = malloc(hyp_sz * sizeof(int ***));
  if (array == NULL) {
    fprintf(stderr, "Out Of Memory");
    exit(EXIT_FAILURE);
  }
  for (h = 0; h < hyp_sz; h++) {
    array[h] = malloc(plane_sz * sizeof(int **));
    if (array[h] == NULL) {
      fprintf(stderr, "Out Of Memory");
      exit(EXIT_FAILURE);
    }
    for (i = 0; i < plane_sz; i++) {
      array[h][i] = malloc(row_sz * sizeof(int *));
      if (array[h][i] == NULL) {
        fprintf(stderr, "Out Of Memory");
        exit(EXIT_FAILURE);
      }
      for (j = 0; j < row_sz; j++) {
        array[h][i][j] = malloc(col_sz * sizeof(int));
        if (array[h][i][j] == NULL) {
          fprintf(stderr, "Out Of Memory");
          exit(EXIT_FAILURE);
        }
      }
    }
  }
  printf("\n\n");
  initarr(array, hyp_sz, plane_sz, row_sz, col_sz);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x14(%rbp)
movl   $0x4,-0x18(%rbp)
movl   $0x4,-0x1c(%rbp)
movl   $0x4,-0x20(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11cc <main+0x6c>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
lea    0xe47(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    136a <main+0x20a>
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1233 <main+0xd3>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
lea    0xde0(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1357 <main+0x1f7>
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    12aa <main+0x14a>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
lea    0xd69(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1344 <main+0x1e4>
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1331 <main+0x1d1>
mov    0x2ccb(%rip),%rax
mov    (%rax),%edi
lea    0xce2(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2cae(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
jmp    1336 <main+0x1d6>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12b1 <main+0x151>
jmp    1349 <main+0x1e9>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    123a <main+0xda>
jmp    135c <main+0x1fc>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11d3 <main+0x73>
lea    0xc9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1070 <initarr@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    $0x20,%edi
call   1060 <malloc@plt>
test   %rax,%rax
je     12a1 <main+0x141>
mov    %rax,%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1060 <malloc@plt>
mov    %rax,(%r14,%r15,8)
test   %rax,%rax
je     12a1 <main+0x141>
mov    %rax,%r12
xor    %r13d,%r13d
nopl   (%rax)
mov    $0x20,%edi
call   1060 <malloc@plt>
mov    %rax,(%r12,%r13,8)
mov    (%r14,%r15,8),%rax
mov    (%rax,%r13,8),%rbx
test   %rbx,%rbx
je     12a1 <main+0x141>
mov    $0x10,%edi
call   1060 <malloc@plt>
mov    %rax,(%rbx)
mov    (%r14,%r15,8),%rax
mov    (%rax,%r13,8),%rbx
cmpq   $0x0,(%rbx)
je     12a1 <main+0x141>
mov    $0x10,%edi
call   1060 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    (%r14,%r15,8),%rax
mov    (%rax,%r13,8),%rbx
cmpq   $0x0,0x8(%rbx)
je     12a1 <main+0x141>
mov    $0x10,%edi
call   1060 <malloc@plt>
mov    %rax,0x10(%rbx)
mov    (%r14,%r15,8),%rax
mov    (%rax,%r13,8),%rbx
cmpq   $0x0,0x10(%rbx)
je     12a1 <main+0x141>
mov    $0x10,%edi
call   1060 <malloc@plt>
mov    %rax,0x18(%rbx)
mov    (%r14,%r15,8),%r12
mov    (%r12,%r13,8),%rax
cmpq   $0x0,0x18(%rax)
je     12a1 <main+0x141>
add    $0x1,%r13
cmp    $0x4,%r13
jne    11b0 <main+0x50>
add    $0x1,%r15
cmp    $0x4,%r15
jne    1190 <main+0x30>
lea    0xda2(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0x4,%ecx
mov    $0x4,%r8d
call   1070 <initarr@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x2d38(%rip),%rax
mov    (%rax),%edi
lea    0xd4f(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"Out Of Memory\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32****
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 4, i32* %3
store i32 4, i32* %4
store i32 4, i32* %5
store i32 4, i32* %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = mul i64 %11, 8
%13 = trunc i64 %12 to i32
%14 = call i8* @malloc(i32 %13)
%15 = bitcast i8* %14 to i32****
store i32**** %15, i32***** %2
%16 = load i32****, i32***** %2
%17 = icmp eq i32**** %16, null
br i1 %17, label %18, label %23
18: ; preds = %0
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %0
store i32 0, i32* %7
br label %24
24: ; preds = %137, %23
%25 = load i32, i32* %7
%26 = load i32, i32* %3
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %140
28: ; preds = %24
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = mul i64 %30, 8
%32 = trunc i64 %31 to i32
%33 = call i8* @malloc(i32 %32)
%34 = bitcast i8* %33 to i32***
%35 = load i32****, i32***** %2
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32***, i32**** %35, i64 %37
store i32*** %34, i32**** %38
%39 = load i32****, i32***** %2
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32***, i32**** %39, i64 %41
%43 = load i32***, i32**** %42
%44 = icmp eq i32*** %43, null
br i1 %44, label %45, label %50
45: ; preds = %28
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%48 = load i32, i32* @EXIT_FAILURE
%49 = call i32 @exit(i32 %48)
unreachable
50: ; preds = %28
store i32 0, i32* %8
br label %51
51: ; preds = %133, %50
%52 = load i32, i32* %8
%53 = load i32, i32* %4
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %136
55: ; preds = %51
%56 = load i32, i32* %5
%57 = sext i32 %56 to i64
%58 = mul i64 %57, 8
%59 = trunc i64 %58 to i32
%60 = call i8* @malloc(i32 %59)
%61 = bitcast i8* %60 to i32**
%62 = load i32****, i32***** %2
%63 = load i32, i32* %7
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i32***, i32**** %62, i64 %64
%66 = load i32***, i32**** %65
%67 = load i32, i32* %8
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i32**, i32*** %66, i64 %68
store i32** %61, i32*** %69
%70 = load i32****, i32***** %2
%71 = load i32, i32* %7
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i32***, i32**** %70, i64 %72
%74 = load i32***, i32**** %73
%75 = load i32, i32* %8
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32**, i32*** %74, i64 %76
%78 = load i32**, i32*** %77
%79 = icmp eq i32** %78, null
br i1 %79, label %80, label %85
80: ; preds = %55
%81 = load i32, i32* @stderr
%82 = call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%83 = load i32, i32* @EXIT_FAILURE
%84 = call i32 @exit(i32 %83)
unreachable
85: ; preds = %55
store i32 0, i32* %9
br label %86
86: ; preds = %129, %85
%87 = load i32, i32* %9
%88 = load i32, i32* %5
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %132
90: ; preds = %86
%91 = load i32, i32* %6
%92 = sext i32 %91 to i64
%93 = mul i64 %92, 4
%94 = trunc i64 %93 to i32
%95 = call i8* @malloc(i32 %94)
%96 = bitcast i8* %95 to i32*
%97 = load i32****, i32***** %2
%98 = load i32, i32* %7
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i32***, i32**** %97, i64 %99
%101 = load i32***, i32**** %100
%102 = load i32, i32* %8
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i32**, i32*** %101, i64 %103
%105 = load i32**, i32*** %104
%106 = load i32, i32* %9
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i32*, i32** %105, i64 %107
store i32* %96, i32** %108
%109 = load i32****, i32***** %2
%110 = load i32, i32* %7
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i32***, i32**** %109, i64 %111
%113 = load i32***, i32**** %112
%114 = load i32, i32* %8
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i32**, i32*** %113, i64 %115
%117 = load i32**, i32*** %116
%118 = load i32, i32* %9
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i32*, i32** %117, i64 %119
%121 = load i32*, i32** %120
%122 = icmp eq i32* %121, null
br i1 %122, label %123, label %128
123: ; preds = %90
%124 = load i32, i32* @stderr
%125 = call i32 @fprintf(i32 %124, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%126 = load i32, i32* @EXIT_FAILURE
%127 = call i32 @exit(i32 %126)
unreachable
128: ; preds = %90
br label %129
129: ; preds = %128
%130 = load i32, i32* %9
%131 = add nsw i32 %130, 1
store i32 %131, i32* %9
br label %86
132: ; preds = %86
br label %133
133: ; preds = %132
%134 = load i32, i32* %8
%135 = add nsw i32 %134, 1
store i32 %135, i32* %8
br label %51
136: ; preds = %51
br label %137
137: ; preds = %136
%138 = load i32, i32* %7
%139 = add nsw i32 %138, 1
store i32 %139, i32* %7
br label %24
140: ; preds = %24
%141 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%142 = load i32****, i32***** %2
%143 = load i32, i32* %3
%144 = load i32, i32* %4
%145 = load i32, i32* %5
%146 = load i32, i32* %6
%147 = call i32 @initarr(i32**** %142, i32 %143, i32 %144, i32 %145, i32 %146)
%148 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"Out Of Memory\00"
@EXIT_FAILURE = global i32 0
@str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(32) i8* @malloc(i32 32)
%2 = bitcast i8* %1 to i32****
%3 = icmp eq i8* %1, null
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %0, %83
%10 = phi i64 [ %84, %83 ], [ 0, %0 ]
%11 = tail call dereferenceable_or_null(32) i8* @malloc(i32 32)
%12 = getelementptr inbounds i32***, i32**** %2, i64 %10
%13 = bitcast i32**** %12 to i8**
store i8* %11, i8** %13
%14 = icmp eq i8* %11, null
br i1 %14, label %17, label %15
15: ; preds = %9
%16 = bitcast i8* %11 to i32***
br label %22
17: ; preds = %9
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %15, %75
%23 = phi i32*** [ %16, %15 ], [ %69, %75 ]
%24 = phi i64 [ 0, %15 ], [ %76, %75 ]
%25 = tail call dereferenceable_or_null(32) i8* @malloc(i32 32)
%26 = getelementptr inbounds i32**, i32*** %23, i64 %24
%27 = bitcast i32*** %26 to i8**
store i8* %25, i8** %27
%28 = load i32***, i32**** %12
%29 = getelementptr inbounds i32**, i32*** %28, i64 %24
%30 = load i32**, i32*** %29
%31 = icmp eq i32** %30, null
br i1 %31, label %40, label %32
32: ; preds = %22
%33 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%34 = bitcast i32** %30 to i8**
store i8* %33, i8** %34
%35 = load i32***, i32**** %12
%36 = getelementptr inbounds i32**, i32*** %35, i64 %24
%37 = load i32**, i32*** %36
%38 = load i32*, i32** %37
%39 = icmp eq i32* %38, null
br i1 %39, label %78, label %45
40: ; preds = %22
%41 = load i32, i32* @stderr
%42 = tail call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%43 = load i32, i32* @EXIT_FAILURE
%44 = tail call i32 @exit(i32 %43)
unreachable
45: ; preds = %32
%46 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%47 = getelementptr inbounds i32*, i32** %37, i64 1
%48 = bitcast i32** %47 to i8**
store i8* %46, i8** %48
%49 = load i32***, i32**** %12
%50 = getelementptr inbounds i32**, i32*** %49, i64 %24
%51 = load i32**, i32*** %50
%52 = getelementptr inbounds i32*, i32** %51, i64 1
%53 = load i32*, i32** %52
%54 = icmp eq i32* %53, null
br i1 %54, label %78, label %55
55: ; preds = %45
%56 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%57 = getelementptr inbounds i32*, i32** %51, i64 2
%58 = bitcast i32** %57 to i8**
store i8* %56, i8** %58
%59 = load i32***, i32**** %12
%60 = getelementptr inbounds i32**, i32*** %59, i64 %24
%61 = load i32**, i32*** %60
%62 = getelementptr inbounds i32*, i32** %61, i64 2
%63 = load i32*, i32** %62
%64 = icmp eq i32* %63, null
br i1 %64, label %78, label %65
65: ; preds = %55
%66 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%67 = getelementptr inbounds i32*, i32** %61, i64 3
%68 = bitcast i32** %67 to i8**
store i8* %66, i8** %68
%69 = load i32***, i32**** %12
%70 = getelementptr inbounds i32**, i32*** %69, i64 %24
%71 = load i32**, i32*** %70
%72 = getelementptr inbounds i32*, i32** %71, i64 3
%73 = load i32*, i32** %72
%74 = icmp eq i32* %73, null
br i1 %74, label %78, label %75
75: ; preds = %65
%76 = add nuw nsw i64 %24, 1
%77 = icmp eq i64 %76, 4
br i1 %77, label %83, label %22
78: ; preds = %65, %55, %45, %32
%79 = load i32, i32* @stderr
%80 = tail call i32 @fprintf(i32 %79, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%81 = load i32, i32* @EXIT_FAILURE
%82 = tail call i32 @exit(i32 %81)
unreachable
83: ; preds = %75
%84 = add nuw nsw i64 %10, 1
%85 = icmp eq i64 %84, 4
br i1 %85, label %86, label %9
86: ; preds = %83
%87 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%88 = tail call i32 @initarr(i32**** %2, i32 4, i32 4, i32 4, i32 4)
%89 = tail call i32 (...) @getchar()
ret i32 0
}