#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__ safe_malloc(int);
double ****alloc_mat4D_double(double ****mat4D_double, int w, int x, int y,
                              int z) {
  unsigned int h, i, j;
  mat4D_double = (double ****)safe_malloc(w * sizeof(double ***));
  for (h = 0; h < w; ++h) {
    mat4D_double[h] = (double ***)safe_malloc(x * sizeof(double **));
    for (i = 0; i < x; ++i) {
      mat4D_double[h][i] = (double **)safe_malloc(y * sizeof(double *));
      for (j = 0; j < y; ++j)
        mat4D_double[h][i][j] = (double *)safe_malloc(z * sizeof(double));
    }
  }
  return mat4D_double;
}


x86 assembly (clang, -O0):
<alloc_mat4D_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <safe_malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1215 <alloc_mat4D_double+0x105>
movslq -0x10(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <safe_malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1202 <alloc_mat4D_double+0xf2>
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <safe_malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    11ef <alloc_mat4D_double+0xdf>
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <safe_malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x24(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11aa <alloc_mat4D_double+0x9a>
jmp    11f4 <alloc_mat4D_double+0xe4>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1173 <alloc_mat4D_double+0x63>
jmp    1207 <alloc_mat4D_double+0xf7>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1143 <alloc_mat4D_double+0x33>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_mat4D_double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8d,%ebp
mov    %rcx,0x10(%rsp)
mov    %rdx,0x8(%rsp)
mov    %esi,%r14d
lea    0x0(,%r14,8),%edi
call   1030 <safe_malloc@plt>
mov    %rax,%rbx
test   %r14d,%r14d
je     11fe <alloc_mat4D_double+0xee>
mov    0x8(%rsp),%rcx
lea    0x0(,%rcx,8),%eax
mov    %eax,(%rsp)
mov    0x10(%rsp),%rax
lea    0x0(,%rax,8),%edx
mov    %edx,0x4(%rsp)
shl    $0x3,%ebp
mov    %r14d,%edx
mov    %rdx,0x18(%rsp)
mov    %ecx,%ecx
mov    %rcx,0x20(%rsp)
mov    %eax,%r15d
xor    %r14d,%r14d
jmp    118b <alloc_mat4D_double+0x7b>
add    $0x1,%r14
cmp    0x18(%rsp),%r14
je     11fe <alloc_mat4D_double+0xee>
mov    (%rsp),%edi
call   1030 <safe_malloc@plt>
mov    %rax,(%rbx,%r14,8)
cmpl   $0x0,0x8(%rsp)
je     1180 <alloc_mat4D_double+0x70>
xor    %r13d,%r13d
jmp    11bb <alloc_mat4D_double+0xab>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r13
cmp    0x20(%rsp),%r13
je     1180 <alloc_mat4D_double+0x70>
mov    0x4(%rsp),%edi
call   1030 <safe_malloc@plt>
mov    (%rbx,%r14,8),%rcx
mov    %rax,(%rcx,%r13,8)
cmpl   $0x0,0x10(%rsp)
je     11b0 <alloc_mat4D_double+0xa0>
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <safe_malloc@plt>
mov    (%rbx,%r14,8),%rcx
mov    (%rcx,%r13,8),%rcx
mov    %rax,(%rcx,%r12,8)
add    $0x1,%r12
cmp    %r12,%r15
jne    11e0 <alloc_mat4D_double+0xd0>
jmp    11b0 <alloc_mat4D_double+0xa0>
mov    %rbx,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double**** @alloc_mat4D_double(double**** %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca double****
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store double**** %0, double***** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = mul i64 %15, 8
%17 = trunc i64 %16 to i32
%18 = call i64 @safe_malloc(i32 %17)
%19 = inttoptr i64 %18 to double****
store double**** %19, double***** %6
store i32 0, i32* %11
br label %20
20: ; preds = %85, %5
%21 = load i32, i32* %11
%22 = load i32, i32* %7
%23 = icmp ult i32 %21, %22
br i1 %23, label %24, label %88
24: ; preds = %20
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = mul i64 %26, 8
%28 = trunc i64 %27 to i32
%29 = call i64 @safe_malloc(i32 %28)
%30 = inttoptr i64 %29 to double***
%31 = load double****, double***** %6
%32 = load i32, i32* %11
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds double***, double**** %31, i64 %33
store double*** %30, double**** %34
store i32 0, i32* %12
br label %35
35: ; preds = %81, %24
%36 = load i32, i32* %12
%37 = load i32, i32* %8
%38 = icmp ult i32 %36, %37
br i1 %38, label %39, label %84
39: ; preds = %35
%40 = load i32, i32* %9
%41 = sext i32 %40 to i64
%42 = mul i64 %41, 8
%43 = trunc i64 %42 to i32
%44 = call i64 @safe_malloc(i32 %43)
%45 = inttoptr i64 %44 to double**
%46 = load double****, double***** %6
%47 = load i32, i32* %11
%48 = zext i32 %47 to i64
%49 = getelementptr inbounds double***, double**** %46, i64 %48
%50 = load double***, double**** %49
%51 = load i32, i32* %12
%52 = zext i32 %51 to i64
%53 = getelementptr inbounds double**, double*** %50, i64 %52
store double** %45, double*** %53
store i32 0, i32* %13
br label %54
54: ; preds = %77, %39
%55 = load i32, i32* %13
%56 = load i32, i32* %9
%57 = icmp ult i32 %55, %56
br i1 %57, label %58, label %80
58: ; preds = %54
%59 = load i32, i32* %10
%60 = sext i32 %59 to i64
%61 = mul i64 %60, 8
%62 = trunc i64 %61 to i32
%63 = call i64 @safe_malloc(i32 %62)
%64 = inttoptr i64 %63 to double*
%65 = load double****, double***** %6
%66 = load i32, i32* %11
%67 = zext i32 %66 to i64
%68 = getelementptr inbounds double***, double**** %65, i64 %67
%69 = load double***, double**** %68
%70 = load i32, i32* %12
%71 = zext i32 %70 to i64
%72 = getelementptr inbounds double**, double*** %69, i64 %71
%73 = load double**, double*** %72
%74 = load i32, i32* %13
%75 = zext i32 %74 to i64
%76 = getelementptr inbounds double*, double** %73, i64 %75
store double* %64, double** %76
br label %77
77: ; preds = %58
%78 = load i32, i32* %13
%79 = add i32 %78, 1
store i32 %79, i32* %13
br label %54
80: ; preds = %54
br label %81
81: ; preds = %80
%82 = load i32, i32* %12
%83 = add i32 %82, 1
store i32 %83, i32* %12
br label %35
84: ; preds = %35
br label %85
85: ; preds = %84
%86 = load i32, i32* %11
%87 = add i32 %86, 1
store i32 %87, i32* %11
br label %20
88: ; preds = %20
%89 = load double****, double***** %6
ret double**** %89
}

LLVM IR (-O2):
define double**** @alloc_mat4D_double(double**** nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = shl i32 %1, 3
%7 = tail call i64 @safe_malloc(i32 %6)
%8 = inttoptr i64 %7 to double****
%9 = icmp eq i32 %1, 0
br i1 %9, label %46, label %10
10: ; preds = %5
%11 = shl i32 %2, 3
%12 = icmp eq i32 %2, 0
%13 = shl i32 %3, 3
%14 = icmp eq i32 %3, 0
%15 = shl i32 %4, 3
%16 = zext i32 %1 to i64
%17 = zext i32 %2 to i64
%18 = zext i32 %3 to i64
br label %19
19: ; preds = %10, %43
%20 = phi i64 [ 0, %10 ], [ %44, %43 ]
%21 = tail call i64 @safe_malloc(i32 %11)
%22 = inttoptr i64 %21 to double***
%23 = getelementptr inbounds double***, double**** %8, i64 %20
store double*** %22, double**** %23
br i1 %12, label %43, label %24
24: ; preds = %19, %40
%25 = phi i64 [ %41, %40 ], [ 0, %19 ]
%26 = tail call i64 @safe_malloc(i32 %13)
%27 = inttoptr i64 %26 to double**
%28 = load double***, double**** %23
%29 = getelementptr inbounds double**, double*** %28, i64 %25
store double** %27, double*** %29
br i1 %14, label %40, label %30
30: ; preds = %24, %30
%31 = phi i64 [ %38, %30 ], [ 0, %24 ]
%32 = tail call i64 @safe_malloc(i32 %15)
%33 = inttoptr i64 %32 to double*
%34 = load double***, double**** %23
%35 = getelementptr inbounds double**, double*** %34, i64 %25
%36 = load double**, double*** %35
%37 = getelementptr inbounds double*, double** %36, i64 %31
store double* %33, double** %37
%38 = add nuw nsw i64 %31, 1
%39 = icmp eq i64 %38, %18
br i1 %39, label %40, label %30
40: ; preds = %30, %24
%41 = add nuw nsw i64 %25, 1
%42 = icmp eq i64 %41, %17
br i1 %42, label %43, label %24
43: ; preds = %40, %19
%44 = add nuw nsw i64 %20, 1
%45 = icmp eq i64 %44, %16
br i1 %45, label %46, label %19
46: ; preds = %43, %5
ret double**** %8
}