#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_3rd_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[j] * sizeof(double));
      for (k = 0; k < s3[j]; k++)
        arr[i][j][k] = val;
    }
  }
  return arr;
}


x86 assembly (clang, -O0):
<aml_array_dbl_3d_variable_3rd_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%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    121d <aml_array_dbl_3d_variable_3rd_new+0x10d>
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    120a <aml_array_dbl_3d_variable_3rd_new+0xfa>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movslq (%rax,%rcx,4),%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
mov    -0x10(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    11f7 <aml_array_dbl_3d_variable_3rd_new+0xe7>
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    11b3 <aml_array_dbl_3d_variable_3rd_new+0xa3>
jmp    11fc <aml_array_dbl_3d_variable_3rd_new+0xec>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1172 <aml_array_dbl_3d_variable_3rd_new+0x62>
jmp    120f <aml_array_dbl_3d_variable_3rd_new+0xff>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <aml_array_dbl_3d_variable_3rd_new+0x31>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aml_array_dbl_3d_variable_3rd_new>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movaps %xmm0,0x30(%rsp)
mov    %rdx,%rbx
mov    %rsi,0x10(%rsp)
mov    %edi,%r12d
lea    0x0(,%r12,8),%edi
call   1030 <malloc@plt>
mov    %rax,%r15
test   %r12d,%r12d
jle    12f3 <aml_array_dbl_3d_variable_3rd_new+0x1e3>
mov    0x10(%rsp),%rax
lea    0x0(,%rax,8),%ecx
mov    %ecx,0xc(%rsp)
mov    %r12d,%ecx
mov    %rcx,0x18(%rsp)
mov    %eax,%r13d
movaps 0x30(%rsp),%xmm0
movlhps %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
xor    %r14d,%r14d
jmp    118f <aml_array_dbl_3d_variable_3rd_new+0x7f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r14
cmp    0x18(%rsp),%r14
je     12f3 <aml_array_dbl_3d_variable_3rd_new+0x1e3>
mov    0xc(%rsp),%edi
call   1030 <malloc@plt>
mov    %rax,(%r15,%r14,8)
cmpl   $0x0,0x10(%rsp)
jle    1180 <aml_array_dbl_3d_variable_3rd_new+0x70>
xor    %r12d,%r12d
jmp    11b9 <aml_array_dbl_3d_variable_3rd_new+0xa9>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12
cmp    %r13,%r12
je     1180 <aml_array_dbl_3d_variable_3rd_new+0x70>
mov    (%rbx,%r12,4),%edi
shl    $0x3,%edi
call   1030 <malloc@plt>
mov    (%r15,%r14,8),%rcx
mov    %rax,(%rcx,%r12,8)
mov    (%rbx,%r12,4),%eax
test   %eax,%eax
movaps 0x30(%rsp),%xmm0
jle    11b0 <aml_array_dbl_3d_variable_3rd_new+0xa0>
mov    (%r15,%r14,8),%rcx
mov    (%rcx,%r12,8),%rcx
cmp    $0x4,%eax
jae    11f0 <aml_array_dbl_3d_variable_3rd_new+0xe0>
xor    %edx,%edx
jmp    12e0 <aml_array_dbl_3d_variable_3rd_new+0x1d0>
xchg   %ax,%ax
mov    %eax,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rbp
mov    %rbp,%rdi
shr    $0x2,%rdi
add    $0x1,%rdi
mov    %edi,%esi
and    $0x7,%esi
cmp    $0x1c,%rbp
jae    121b <aml_array_dbl_3d_variable_3rd_new+0x10b>
xor    %ebp,%ebp
movaps 0x20(%rsp),%xmm1
jmp    12a1 <aml_array_dbl_3d_variable_3rd_new+0x191>
and    $0xfffffffffffffff8,%rdi
xor    %ebp,%ebp
movaps 0x20(%rsp),%xmm1
cs nopw 0x0(%rax,%rax,1)
movups %xmm1,(%rcx,%rbp,8)
movups %xmm1,0x10(%rcx,%rbp,8)
movups %xmm1,0x20(%rcx,%rbp,8)
movups %xmm1,0x30(%rcx,%rbp,8)
movups %xmm1,0x40(%rcx,%rbp,8)
movups %xmm1,0x50(%rcx,%rbp,8)
movups %xmm1,0x60(%rcx,%rbp,8)
movups %xmm1,0x70(%rcx,%rbp,8)
movups %xmm1,0x80(%rcx,%rbp,8)
movups %xmm1,0x90(%rcx,%rbp,8)
movups %xmm1,0xa0(%rcx,%rbp,8)
movups %xmm1,0xb0(%rcx,%rbp,8)
movups %xmm1,0xc0(%rcx,%rbp,8)
movups %xmm1,0xd0(%rcx,%rbp,8)
movups %xmm1,0xe0(%rcx,%rbp,8)
movups %xmm1,0xf0(%rcx,%rbp,8)
add    $0x20,%rbp
add    $0xfffffffffffffff8,%rdi
jne    1230 <aml_array_dbl_3d_variable_3rd_new+0x120>
test   %rsi,%rsi
je     12d2 <aml_array_dbl_3d_variable_3rd_new+0x1c2>
lea    (%rcx,%rbp,8),%rdi
add    $0x10,%rdi
shl    $0x5,%rsi
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movups %xmm1,-0x10(%rdi,%rbp,1)
movups %xmm1,(%rdi,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%rsi
jne    12c0 <aml_array_dbl_3d_variable_3rd_new+0x1b0>
cmp    %rax,%rdx
je     11b0 <aml_array_dbl_3d_variable_3rd_new+0xa0>
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rcx,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rax
jne    12e0 <aml_array_dbl_3d_variable_3rd_new+0x1d0>
jmp    11b0 <aml_array_dbl_3d_variable_3rd_new+0xa0>
mov    %r15,%rax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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