#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_variable_2nd_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[i] * sizeof(double *));
    for (j = 0; j < s2[i]; 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_variable_2nd_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    121d <aml_array_dbl_3d_variable_2nd_new+0x10d>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movslq (%rax,%rcx,4),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x24(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    120a <aml_array_dbl_3d_variable_2nd_new+0xfa>
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f7 <aml_array_dbl_3d_variable_2nd_new+0xe7>
movsd  -0x20(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11bb <aml_array_dbl_3d_variable_2nd_new+0xab>
jmp    11fc <aml_array_dbl_3d_variable_2nd_new+0xec>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    117a <aml_array_dbl_3d_variable_2nd_new+0x6a>
jmp    120f <aml_array_dbl_3d_variable_2nd_new+0xff>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1141 <aml_array_dbl_3d_variable_2nd_new+0x31>
mov    -0x38(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aml_array_dbl_3d_variable_2nd_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,0x10(%rsp)
mov    %edi,%r12d
lea    0x0(,%r12,8),%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %r12d,%r12d
jle    1323 <aml_array_dbl_3d_variable_2nd_new+0x213>
lea    0x0(,%r15,8),%eax
mov    %eax,0xc(%rsp)
mov    %r12d,%eax
mov    %rax,0x18(%rsp)
mov    %r15d,%ebp
mov    %ebp,%eax
and    $0xfffffffc,%eax
mov    %rax,0x38(%rsp)
add    $0xfffffffffffffffc,%rax
mov    %rax,0x30(%rsp)
shr    $0x2,%rax
add    $0x1,%rax
movaps 0x50(%rsp),%xmm0
movlhps %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
mov    %eax,%r12d
and    $0x7,%r12d
and    $0xfffffffffffffff8,%rax
mov    %rax,0x20(%rsp)
mov    %r12,0x28(%rsp)
shl    $0x5,%r12
xor    %r13d,%r13d
jmp    11bf <aml_array_dbl_3d_variable_2nd_new+0xaf>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r13
cmp    0x18(%rsp),%r13
je     1323 <aml_array_dbl_3d_variable_2nd_new+0x213>
mov    0x10(%rsp),%r14
mov    (%r14,%r13,4),%edi
shl    $0x3,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx,%r13,8)
cmpl   $0x0,(%r14,%r13,4)
jle    11b0 <aml_array_dbl_3d_variable_2nd_new+0xa0>
xor    %r14d,%r14d
jmp    11f2 <aml_array_dbl_3d_variable_2nd_new+0xe2>
add    $0x1,%r14
mov    0x10(%rsp),%rax
movslq (%rax,%r13,4),%rax
cmp    %rax,%r14
jge    11b0 <aml_array_dbl_3d_variable_2nd_new+0xa0>
mov    0xc(%rsp),%edi
call   1030 <malloc@plt>
mov    (%rbx,%r13,8),%rcx
mov    %rax,(%rcx,%r14,8)
test   %r15d,%r15d
movaps 0x50(%rsp),%xmm0
jle    11e0 <aml_array_dbl_3d_variable_2nd_new+0xd0>
mov    (%rbx,%r13,8),%rax
mov    (%rax,%r14,8),%rax
cmp    $0x4,%r15d
jae    1230 <aml_array_dbl_3d_variable_2nd_new+0x120>
xor    %ecx,%ecx
jmp    1310 <aml_array_dbl_3d_variable_2nd_new+0x200>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpq   $0x1c,0x30(%rsp)
jae    1244 <aml_array_dbl_3d_variable_2nd_new+0x134>
xor    %ecx,%ecx
movaps 0x40(%rsp),%xmm1
jmp    12c1 <aml_array_dbl_3d_variable_2nd_new+0x1b1>
mov    0x20(%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_variable_2nd_new+0x140>
cmpq   $0x0,0x28(%rsp)
je     12f2 <aml_array_dbl_3d_variable_2nd_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,%r12
jne    12e0 <aml_array_dbl_3d_variable_2nd_new+0x1d0>
mov    0x38(%rsp),%rdx
mov    %rdx,%rcx
cmp    %rbp,%rdx
je     11e0 <aml_array_dbl_3d_variable_2nd_new+0xd0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm0,(%rax,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rbp
jne    1310 <aml_array_dbl_3d_variable_2nd_new+0x200>
jmp    11e0 <aml_array_dbl_3d_variable_2nd_new+0xd0>
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_variable_2nd_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 = %87, %4
%20 = load i32, i32* %9
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %90
23: ; preds = %19
%24 = load i32*, i32** %6
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = sext i32 %28 to i64
%30 = mul i64 %29, 8
%31 = trunc i64 %30 to i32
%32 = call i64 @malloc(i32 %31)
%33 = inttoptr i64 %32 to double**
%34 = load double***, double**** %12
%35 = load i32, i32* %9
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double**, double*** %34, i64 %36
store double** %33, double*** %37
store i32 0, i32* %10
br label %38
38: ; preds = %83, %23
%39 = load i32, i32* %10
%40 = load i32*, i32** %6
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
%44 = load i32, i32* %43
%45 = icmp slt i32 %39, %44
br i1 %45, label %46, label %86
46: ; preds = %38
%47 = load i32, i32* %7
%48 = sext i32 %47 to i64
%49 = mul i64 %48, 8
%50 = trunc i64 %49 to i32
%51 = call i64 @malloc(i32 %50)
%52 = inttoptr i64 %51 to double*
%53 = load double***, double**** %12
%54 = load i32, i32* %9
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double**, double*** %53, i64 %55
%57 = load double**, double*** %56
%58 = load i32, i32* %10
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double*, double** %57, i64 %59
store double* %52, double** %60
store i32 0, i32* %11
br label %61
61: ; preds = %79, %46
%62 = load i32, i32* %11
%63 = load i32, i32* %7
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %82
65: ; preds = %61
%66 = load double, double* %8
%67 = load double***, double**** %12
%68 = load i32, i32* %9
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double**, double*** %67, i64 %69
%71 = load double**, double*** %70
%72 = load i32, i32* %10
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double*, double** %71, i64 %73
%75 = load double*, double** %74
%76 = load i32, i32* %11
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %75, i64 %77
store double %66, double* %78
br label %79
79: ; preds = %65
%80 = load i32, i32* %11
%81 = add nsw i32 %80, 1
store i32 %81, i32* %11
br label %61
82: ; preds = %61
br label %83
83: ; preds = %82
%84 = load i32, i32* %10
%85 = add nsw i32 %84, 1
store i32 %85, i32* %10
br label %38
86: ; preds = %38
br label %87
87: ; preds = %86
%88 = load i32, i32* %9
%89 = add nsw i32 %88, 1
store i32 %89, i32* %9
br label %19
90: ; preds = %19
%91 = load double***, double**** %12
ret double*** %91
}

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