#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 */
float **float_arr_init_2d(int, int);
scalar_t__ malloc(int);
float ***float_arr_init_3d(int size_x, int *size_y, int *size_z) {
  float ***array = (float ***)malloc(sizeof(float **) * size_x);
  int i;
  for (i = 0; i < size_x; i++) {
    array[i] = float_arr_init_2d(size_y[i], size_z[i]);
  }
  return array;
}


x86 assembly (clang, -O0):
<float_arr_init_3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1191 <float_arr_init_3d+0x71>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <float_arr_init_2d@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114d <float_arr_init_3d+0x2d>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_arr_init_3d>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%r12d
lea    0x0(,%r12,8),%edi
call   1040 <malloc@plt>
mov    %rax,%r13
test   %r12d,%r12d
jle    116b <float_arr_init_3d+0x4b>
mov    %r12d,%r12d
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r15,%rbx,4),%edi
mov    (%r14,%rbx,4),%esi
call   1030 <float_arr_init_2d@plt>
mov    %rax,0x0(%r13,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <float_arr_init_3d+0x30>
mov    %r13,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float*** @float_arr_init_3d(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca float***
%8 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = mul i64 8, %10
%12 = trunc i64 %11 to i32
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to float***
store float*** %14, float**** %7
store i32 0, i32* %8
br label %15
15: ; preds = %35, %3
%16 = load i32, i32* %8
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %38
19: ; preds = %15
%20 = load i32*, i32** %5
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = load i32*, i32** %6
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
%30 = call float** @float_arr_init_2d(i32 %24, i32 %29)
%31 = load float***, float**** %7
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds float**, float*** %31, i64 %33
store float** %30, float*** %34
br label %35
35: ; preds = %19
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %15
38: ; preds = %15
%39 = load float***, float**** %7
ret float*** %39
}

LLVM IR (-O2):
define float*** @float_arr_init_3d(i32 %0, i32* nocapture %1, i32* nocapture %2) {
%4 = shl i32 %0, 3
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to float***
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %20
8: ; preds = %3
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %18, %10 ]
%12 = getelementptr inbounds i32, i32* %1, i64 %11
%13 = load i32, i32* %12
%14 = getelementptr inbounds i32, i32* %2, i64 %11
%15 = load i32, i32* %14
%16 = tail call float** @float_arr_init_2d(i32 %13, i32 %15)
%17 = getelementptr inbounds float**, float*** %6, i64 %11
store float** %16, float*** %17
%18 = add nuw nsw i64 %11, 1
%19 = icmp eq i64 %18, %9
br i1 %19, label %20, label %10
20: ; preds = %10, %3
ret float*** %6
}