#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 */
void ***array_3_pointer_alloc(void *, long, long, long, char, short);
void *vector_alloc(long, char);
void ***array_3_all_alloc(long zn, long sn, long hn, char type,
                          short indexing) {
  void *a;
  long ges_laenge;
  ges_laenge = zn * sn * hn;
  a = vector_alloc(ges_laenge, type);
  if (a == NULL)
    return NULL;
  return array_3_pointer_alloc(a, zn, sn, hn, type, indexing);
}


x86 assembly (clang, -O0):
<array_3_all_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %r8w,%ax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %cl,-0x21(%rbp)
mov    %ax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
imul   -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
movsbl -0x21(%rbp),%esi
call   1030 <vector_alloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    117a <array_3_all_alloc+0x5a>
movq   $0x0,-0x8(%rbp)
jmp    119f <array_3_all_alloc+0x7f>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x21(%rbp),%al
movsbl %al,%r8d
movswl -0x24(%rbp),%r9d
call   1040 <array_3_pointer_alloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_3_all_alloc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r15d
mov    %ecx,%ebx
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbp
mov    %rsi,%rdi
imul   %rbp,%rdi
imul   %rdx,%rdi
mov    %ecx,%esi
call   1030 <vector_alloc@plt>
test   %rax,%rax
je     116e <array_3_all_alloc+0x4e>
movsbl %bl,%r8d
movswl %r15w,%r9d
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <array_3_pointer_alloc@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8*** @array_3_all_alloc(i64 %0, i64 %1, i64 %2, i8 signext %3, i16 signext %4) {
%6 = alloca i8***
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8
%11 = alloca i16
%12 = alloca i8*
%13 = alloca i64
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i8 %3, i8* %10
store i16 %4, i16* %11
%14 = load i64, i64* %7
%15 = load i64, i64* %8
%16 = mul nsw i64 %14, %15
%17 = load i64, i64* %9
%18 = mul nsw i64 %16, %17
store i64 %18, i64* %13
%19 = load i64, i64* %13
%20 = load i8, i8* %10
%21 = call i8* @vector_alloc(i64 %19, i8 signext %20)
store i8* %21, i8** %12
%22 = load i8*, i8** %12
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %25
24: ; preds = %5
store i8*** null, i8**** %6
br label %33
25: ; preds = %5
%26 = load i8*, i8** %12
%27 = load i64, i64* %7
%28 = load i64, i64* %8
%29 = load i64, i64* %9
%30 = load i8, i8* %10
%31 = load i16, i16* %11
%32 = call i8*** @array_3_pointer_alloc(i8* %26, i64 %27, i64 %28, i64 %29, i8 signext %30, i16 signext %31)
store i8*** %32, i8**** %6
br label %33
33: ; preds = %25, %24
%34 = load i8***, i8**** %6
ret i8*** %34
}

LLVM IR (-O2):
define i8*** @array_3_all_alloc(i64 %0, i64 %1, i64 %2, i8 signext %3, i16 signext %4) {
%6 = mul nsw i64 %1, %0
%7 = mul nsw i64 %6, %2
%8 = tail call i8* @vector_alloc(i64 %7, i8 signext %3)
%9 = icmp eq i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = tail call i8*** @array_3_pointer_alloc(i8* %8, i64 %0, i64 %1, i64 %2, i8 signext %3, i16 signext %4)
br label %12
12: ; preds = %5, %10
%13 = phi i8*** [ %11, %10 ], [ null, %5 ]
ret i8*** %13
}