#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);
float ***alloc_mat3D_float(float ***mat3D_float, int x, int y, int z) {
  unsigned int i, j;
  mat3D_float = (float ***)safe_malloc(x * sizeof(float **));
  for (i = 0; i < x; ++i) {
    mat3D_float[i] = (float **)safe_malloc(y * sizeof(float *));
    for (j = 0; j < y; ++j)
      mat3D_float[i][j] = (float *)safe_malloc(z * sizeof(float));
  }
  return mat3D_float;
}


x86 assembly (clang, -O0):
<alloc_mat3D_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <safe_malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11c0 <alloc_mat3D_float+0xb0>
movslq -0x10(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <safe_malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    11ad <alloc_mat3D_float+0x9d>
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <safe_malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x1c(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116f <alloc_mat3D_float+0x5f>
jmp    11b2 <alloc_mat3D_float+0xa2>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113f <alloc_mat3D_float+0x2f>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_mat3D_float>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r13d
mov    %rdx,0x10(%rsp)
mov    %esi,%r12d
lea    0x0(,%r12,8),%edi
call   1030 <safe_malloc@plt>
mov    %rax,%rbx
test   %r12d,%r12d
je     119b <alloc_mat3D_float+0x8b>
mov    0x10(%rsp),%rax
lea    0x0(,%rax,8),%ecx
mov    %ecx,0xc(%rsp)
shl    $0x2,%r13d
mov    %r12d,%r12d
mov    %eax,%ebp
xor    %r14d,%r14d
jmp    1169 <alloc_mat3D_float+0x59>
nopl   0x0(%rax)
add    $0x1,%r14
cmp    %r12,%r14
je     119b <alloc_mat3D_float+0x8b>
mov    0xc(%rsp),%edi
call   1030 <safe_malloc@plt>
mov    %rax,(%rbx,%r14,8)
cmpl   $0x0,0x10(%rsp)
je     1160 <alloc_mat3D_float+0x50>
xor    %r15d,%r15d
mov    %r13d,%edi
call   1030 <safe_malloc@plt>
mov    (%rbx,%r14,8),%rcx
mov    %rax,(%rcx,%r15,8)
add    $0x1,%r15
cmp    %r15,%rbp
jne    1180 <alloc_mat3D_float+0x70>
jmp    1160 <alloc_mat3D_float+0x50>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define float*** @alloc_mat3D_float(float*** %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca float***
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store float*** %0, float**** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = mul i64 %12, 8
%14 = trunc i64 %13 to i32
%15 = call i64 @safe_malloc(i32 %14)
%16 = inttoptr i64 %15 to float***
store float*** %16, float**** %5
store i32 0, i32* %9
br label %17
17: ; preds = %55, %4
%18 = load i32, i32* %9
%19 = load i32, i32* %6
%20 = icmp ult i32 %18, %19
br i1 %20, label %21, label %58
21: ; preds = %17
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = mul i64 %23, 8
%25 = trunc i64 %24 to i32
%26 = call i64 @safe_malloc(i32 %25)
%27 = inttoptr i64 %26 to float**
%28 = load float***, float**** %5
%29 = load i32, i32* %9
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds float**, float*** %28, i64 %30
store float** %27, float*** %31
store i32 0, i32* %10
br label %32
32: ; preds = %51, %21
%33 = load i32, i32* %10
%34 = load i32, i32* %7
%35 = icmp ult i32 %33, %34
br i1 %35, label %36, label %54
36: ; preds = %32
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = mul i64 %38, 4
%40 = trunc i64 %39 to i32
%41 = call i64 @safe_malloc(i32 %40)
%42 = inttoptr i64 %41 to float*
%43 = load float***, float**** %5
%44 = load i32, i32* %9
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds float**, float*** %43, i64 %45
%47 = load float**, float*** %46
%48 = load i32, i32* %10
%49 = zext i32 %48 to i64
%50 = getelementptr inbounds float*, float** %47, i64 %49
store float* %42, float** %50
br label %51
51: ; preds = %36
%52 = load i32, i32* %10
%53 = add i32 %52, 1
store i32 %53, i32* %10
br label %32
54: ; preds = %32
br label %55
55: ; preds = %54
%56 = load i32, i32* %9
%57 = add i32 %56, 1
store i32 %57, i32* %9
br label %17
58: ; preds = %17
%59 = load float***, float**** %5
ret float*** %59
}

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