#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);
double ***aml_array_dbl_3d_new(int s1, int s2, int s3, double val) {
  int i, j, k;
  double ***arr = (double ***)malloc(s1 * sizeof(double **));
  for (i = 0; i < s1; i++) {
    arr[i] = (double **)malloc(s2 * sizeof(double *));
    for (j = 0; j < s2; j++) {
      arr[i][j] = (double *)malloc(s3 * sizeof(double));
      for (k = 0; k < s3; k++)
        arr[i][j][k] = val;
    }
  }
  return arr;
}


x86 assembly (clang, -O0):
<aml_array_dbl_3d_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    120c <aml_array_dbl_3d_new+0xfc>
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f9 <aml_array_dbl_3d_new+0xe9>
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e6 <aml_array_dbl_3d_new+0xd6>
movsd  -0x18(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11aa <aml_array_dbl_3d_new+0x9a>
jmp    11eb <aml_array_dbl_3d_new+0xdb>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1171 <aml_array_dbl_3d_new+0x61>
jmp    11fe <aml_array_dbl_3d_new+0xee>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1140 <aml_array_dbl_3d_new+0x30>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aml_array_dbl_3d_new>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
movaps %xmm0,0x50(%rsp)
mov    %edx,%r15d
mov    %rsi,0x8(%rsp)
mov    %edi,%r13d
lea    0x0(,%r13,8),%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %r13d,%r13d
jle    1323 <aml_array_dbl_3d_new+0x213>
mov    0x8(%rsp),%rax
lea    0x0(,%rax,8),%ecx
mov    %ecx,(%rsp)
lea    0x0(,%r15,8),%ecx
mov    %ecx,0x4(%rsp)
mov    %r13d,%ecx
mov    %rcx,0x10(%rsp)
mov    %eax,%eax
mov    %rax,0x38(%rsp)
mov    %r15d,%r12d
mov    %r12d,%eax
and    $0xfffffffc,%eax
mov    %rax,0x30(%rsp)
add    $0xfffffffffffffffc,%rax
mov    %rax,0x28(%rsp)
shr    $0x2,%rax
add    $0x1,%rax
movaps 0x50(%rsp),%xmm0
movlhps %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
mov    %eax,%r13d
and    $0x7,%r13d
and    $0xfffffffffffffff8,%rax
mov    %rax,0x18(%rsp)
mov    %r13,0x20(%rsp)
shl    $0x5,%r13
xor    %ebp,%ebp
jmp    11cf <aml_array_dbl_3d_new+0xbf>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    0x10(%rsp),%rbp
je     1323 <aml_array_dbl_3d_new+0x213>
mov    (%rsp),%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx,%rbp,8)
cmpl   $0x0,0x8(%rsp)
jle    11c0 <aml_array_dbl_3d_new+0xb0>
xor    %r14d,%r14d
jmp    11fb <aml_array_dbl_3d_new+0xeb>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
cmp    0x38(%rsp),%r14
je     11c0 <aml_array_dbl_3d_new+0xb0>
mov    0x4(%rsp),%edi
call   1030 <malloc@plt>
mov    (%rbx,%rbp,8),%rcx
mov    %rax,(%rcx,%r14,8)
test   %r15d,%r15d
movaps 0x50(%rsp),%xmm0
jle    11f0 <aml_array_dbl_3d_new+0xe0>
mov    (%rbx,%rbp,8),%rax
mov    (%rax,%r14,8),%rax
cmp    $0x4,%r15d
jae    1230 <aml_array_dbl_3d_new+0x120>
xor    %ecx,%ecx
jmp    1310 <aml_array_dbl_3d_new+0x200>
nopl   0x0(%rax,%rax,1)
cmpq   $0x1c,0x28(%rsp)
jae    1244 <aml_array_dbl_3d_new+0x134>
xor    %ecx,%ecx
movaps 0x40(%rsp),%xmm1
jmp    12c1 <aml_array_dbl_3d_new+0x1b1>
mov    0x18(%rsp),%rdx
xor    %ecx,%ecx
movaps 0x40(%rsp),%xmm1
movups %xmm1,(%rax,%rcx,8)
movups %xmm1,0x10(%rax,%rcx,8)
movups %xmm1,0x20(%rax,%rcx,8)
movups %xmm1,0x30(%rax,%rcx,8)
movups %xmm1,0x40(%rax,%rcx,8)
movups %xmm1,0x50(%rax,%rcx,8)
movups %xmm1,0x60(%rax,%rcx,8)
movups %xmm1,0x70(%rax,%rcx,8)
movups %xmm1,0x80(%rax,%rcx,8)
movups %xmm1,0x90(%rax,%rcx,8)
movups %xmm1,0xa0(%rax,%rcx,8)
movups %xmm1,0xb0(%rax,%rcx,8)
movups %xmm1,0xc0(%rax,%rcx,8)
movups %xmm1,0xd0(%rax,%rcx,8)
movups %xmm1,0xe0(%rax,%rcx,8)
movups %xmm1,0xf0(%rax,%rcx,8)
add    $0x20,%rcx
add    $0xfffffffffffffff8,%rdx
jne    1250 <aml_array_dbl_3d_new+0x140>
cmpq   $0x0,0x20(%rsp)
je     12f2 <aml_array_dbl_3d_new+0x1e2>
lea    (%rax,%rcx,8),%rcx
add    $0x10,%rcx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups %xmm1,-0x10(%rcx,%rdx,1)
movups %xmm1,(%rcx,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%r13
jne    12e0 <aml_array_dbl_3d_new+0x1d0>
mov    0x30(%rsp),%rdx
mov    %rdx,%rcx
cmp    %r12,%rdx
je     11f0 <aml_array_dbl_3d_new+0xe0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm0,(%rax,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%r12
jne    1310 <aml_array_dbl_3d_new+0x200>
jmp    11f0 <aml_array_dbl_3d_new+0xe0>
mov    %rbx,%rax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define double*** @aml_array_dbl_3d_new(i32 %0, i32 %1, i32 %2, double %3) {
%5 = shl i32 %0, 3
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to double***
%8 = icmp sgt i32 %0, 0
br i1 %8, label %9, label %119
9: ; preds = %4
%10 = shl i32 %1, 3
%11 = icmp sgt i32 %1, 0
%12 = shl i32 %2, 3
%13 = icmp sgt i32 %2, 0
%14 = zext i32 %0 to i64
%15 = zext i32 %1 to i64
%16 = zext i32 %2 to i64
%17 = and i64 %16, 4294967292
%18 = add nsw i64 %17, -4
%19 = lshr exact i64 %18, 2
%20 = add nuw nsw i64 %19, 1
%21 = icmp ult i32 %2, 4
%22 = and i64 %16, 4294967292
%23 = insertelement <2 x double> poison, double %3, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = insertelement <2 x double> poison, double %3, i64 0
%26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> zeroinitializer
%27 = and i64 %20, 7
%28 = icmp ult i64 %18, 28
%29 = and i64 %20, 9223372036854775800
%30 = icmp eq i64 %27, 0
%31 = icmp eq i64 %22, %16
br label %32
32: ; preds = %9, %116
%33 = phi i64 [ 0, %9 ], [ %117, %116 ]
%34 = tail call i64 @malloc(i32 %10)
%35 = inttoptr i64 %34 to double**
%36 = getelementptr inbounds double**, double*** %7, i64 %33
store double** %35, double*** %36
br i1 %11, label %37, label %116
37: ; preds = %32, %113
%38 = phi i64 [ %114, %113 ], [ 0, %32 ]
%39 = tail call i64 @malloc(i32 %12)
%40 = inttoptr i64 %39 to double*
%41 = load double**, double*** %36
%42 = getelementptr inbounds double*, double** %41, i64 %38
store double* %40, double** %42
br i1 %13, label %43, label %113
43: ; preds = %37
%44 = load double**, double*** %36
%45 = getelementptr inbounds double*, double** %44, i64 %38
%46 = load double*, double** %45
br i1 %21, label %106, label %47
47: ; preds = %43
br i1 %28, label %93, label %48
48: ; preds = %47, %48
%49 = phi i64 [ %90, %48 ], [ 0, %47 ]
%50 = phi i64 [ %91, %48 ], [ 0, %47 ]
%51 = getelementptr inbounds double, double* %46, i64 %49
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> %24, <2 x double>* %52
%53 = getelementptr inbounds double, double* %51, i64 2
%54 = bitcast double* %53 to <2 x double>*
store <2 x double> %26, <2 x double>* %54
%55 = or i64 %49, 4
%56 = getelementptr inbounds double, double* %46, i64 %55
%57 = bitcast double* %56 to <2 x double>*
store <2 x double> %24, <2 x double>* %57
%58 = getelementptr inbounds double, double* %56, i64 2
%59 = bitcast double* %58 to <2 x double>*
store <2 x double> %26, <2 x double>* %59
%60 = or i64 %49, 8
%61 = getelementptr inbounds double, double* %46, i64 %60
%62 = bitcast double* %61 to <2 x double>*
store <2 x double> %24, <2 x double>* %62
%63 = getelementptr inbounds double, double* %61, i64 2
%64 = bitcast double* %63 to <2 x double>*
store <2 x double> %26, <2 x double>* %64
%65 = or i64 %49, 12
%66 = getelementptr inbounds double, double* %46, i64 %65
%67 = bitcast double* %66 to <2 x double>*
store <2 x double> %24, <2 x double>* %67
%68 = getelementptr inbounds double, double* %66, i64 2
%69 = bitcast double* %68 to <2 x double>*
store <2 x double> %26, <2 x double>* %69
%70 = or i64 %49, 16
%71 = getelementptr inbounds double, double* %46, i64 %70
%72 = bitcast double* %71 to <2 x double>*
store <2 x double> %24, <2 x double>* %72
%73 = getelementptr inbounds double, double* %71, i64 2
%74 = bitcast double* %73 to <2 x double>*
store <2 x double> %26, <2 x double>* %74
%75 = or i64 %49, 20
%76 = getelementptr inbounds double, double* %46, i64 %75
%77 = bitcast double* %76 to <2 x double>*
store <2 x double> %24, <2 x double>* %77
%78 = getelementptr inbounds double, double* %76, i64 2
%79 = bitcast double* %78 to <2 x double>*
store <2 x double> %26, <2 x double>* %79
%80 = or i64 %49, 24
%81 = getelementptr inbounds double, double* %46, i64 %80
%82 = bitcast double* %81 to <2 x double>*
store <2 x double> %24, <2 x double>* %82
%83 = getelementptr inbounds double, double* %81, i64 2
%84 = bitcast double* %83 to <2 x double>*
store <2 x double> %26, <2 x double>* %84
%85 = or i64 %49, 28
%86 = getelementptr inbounds double, double* %46, i64 %85
%87 = bitcast double* %86 to <2 x double>*
store <2 x double> %24, <2 x double>* %87
%88 = getelementptr inbounds double, double* %86, i64 2
%89 = bitcast double* %88 to <2 x double>*
store <2 x double> %26, <2 x double>* %89
%90 = add nuw i64 %49, 32
%91 = add i64 %50, 8
%92 = icmp eq i64 %91, %29
br i1 %92, label %93, label %48
93: ; preds = %48, %47
%94 = phi i64 [ 0, %47 ], [ %90, %48 ]
br i1 %30, label %105, label %95
95: ; preds = %93, %95
%96 = phi i64 [ %102, %95 ], [ %94, %93 ]
%97 = phi i64 [ %103, %95 ], [ 0, %93 ]
%98 = getelementptr inbounds double, double* %46, i64 %96
%99 = bitcast double* %98 to <2 x double>*
store <2 x double> %24, <2 x double>* %99
%100 = getelementptr inbounds double, double* %98, i64 2
%101 = bitcast double* %100 to <2 x double>*
store <2 x double> %26, <2 x double>* %101
%102 = add nuw i64 %96, 4
%103 = add i64 %97, 1
%104 = icmp eq i64 %103, %27
br i1 %104, label %105, label %95
105: ; preds = %95, %93
br i1 %31, label %113, label %106
106: ; preds = %43, %105
%107 = phi i64 [ 0, %43 ], [ %22, %105 ]
br label %108
108: ; preds = %106, %108
%109 = phi i64 [ %111, %108 ], [ %107, %106 ]
%110 = getelementptr inbounds double, double* %46, i64 %109
store double %3, double* %110
%111 = add nuw nsw i64 %109, 1
%112 = icmp eq i64 %111, %16
br i1 %112, label %113, label %108
113: ; preds = %108, %105, %37
%114 = add nuw nsw i64 %38, 1
%115 = icmp eq i64 %114, %15
br i1 %115, label %116, label %37
116: ; preds = %113, %32
%117 = add nuw nsw i64 %33, 1
%118 = icmp eq i64 %117, %14
br i1 %118, label %119, label %32
119: ; preds = %116, %4
ret double*** %7
}