#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__ calloc(int, int);
int /*<<< orphan*/ get_mem4Dint(int *****, int, int, int, int);
int /*<<< orphan*/ no_mem_exit(char *);
int get_mem5Dint(int ******array5D, int refs, int blocktype, int rows,
                 int columns, int component) {
  int j;
  if (((*array5D) = (int *****)calloc(refs, sizeof(int ****))) == NULL)
    no_mem_exit("get_mem5Dint: array5D");
  ;
  for (j = 0; j < refs; j++)
    get_mem4Dint((*array5D) + j, blocktype, rows, columns, component);
  return refs * blocktype * rows * columns * component * sizeof(int);
}


x86 assembly (clang, -O0):
<get_mem5Dint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    -0x8(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1177 <get_mem5Dint+0x47>
lea    0xe8e(%rip),%rdi
call   1040 <no_mem_exit@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bc <get_mem5Dint+0x8c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
call   1050 <get_mem4Dint@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117e <get_mem5Dint+0x4e>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
shl    $0x2,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mem5Dint>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r12d
mov    %r8d,%r13d
mov    %ecx,%r15d
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %esi,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rbp,%rcx
mov    %rax,0x0(%rbp)
test   %rax,%rax
jne    1179 <get_mem5Dint+0x49>
mov    %rcx,%rbp
lea    0xe8f(%rip),%rdi
call   1040 <no_mem_exit@plt>
mov    %rbp,%rcx
mov    %r14d,0xc(%rsp)
test   %r14d,%r14d
mov    %r12d,%r8d
mov    %r15d,%r14d
mov    %ebx,%ebp
jle    11d0 <get_mem5Dint+0xa0>
mov    0xc(%rsp),%eax
shl    $0x3,%rax
mov    %rax,0x10(%rsp)
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
mov    %rcx,%r12
mov    (%rcx),%rdi
add    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %r13d,%ecx
mov    %r13d,%ebx
mov    %r8d,%r13d
call   1050 <get_mem4Dint@plt>
mov    %r13d,%r8d
mov    %ebx,%r13d
mov    %r12,%rcx
add    $0x8,%r15
cmp    %r15,0x10(%rsp)
jne    11a0 <get_mem5Dint+0x70>
mov    0xc(%rsp),%eax
imul   %ebp,%eax
imul   %r14d,%eax
imul   %r13d,%eax
imul   %r8d,%eax
shl    $0x2,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"get_mem5Dint: array5D\00"
define i32 @get_mem5Dint(i32****** %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32******
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32****** %0, i32******* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i32, i32* %8
%15 = call i64 @calloc(i32 %14, i32 8)
%16 = inttoptr i64 %15 to i32*****
%17 = load i32******, i32******* %7
store i32***** %16, i32****** %17
%18 = icmp eq i32***** %16, null
br i1 %18, label %19, label %21
19: ; preds = %6
%20 = call i32 @no_mem_exit(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %6
store i32 0, i32* %13
br label %22
22: ; preds = %37, %21
%23 = load i32, i32* %13
%24 = load i32, i32* %8
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %40
26: ; preds = %22
%27 = load i32******, i32******* %7
%28 = load i32*****, i32****** %27
%29 = load i32, i32* %13
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32****, i32***** %28, i64 %30
%32 = load i32, i32* %9
%33 = load i32, i32* %10
%34 = load i32, i32* %11
%35 = load i32, i32* %12
%36 = call i32 @get_mem4Dint(i32***** %31, i32 %32, i32 %33, i32 %34, i32 %35)
br label %37
37: ; preds = %26
%38 = load i32, i32* %13
%39 = add nsw i32 %38, 1
store i32 %39, i32* %13
br label %22
40: ; preds = %22
%41 = load i32, i32* %8
%42 = load i32, i32* %9
%43 = mul nsw i32 %41, %42
%44 = load i32, i32* %10
%45 = mul nsw i32 %43, %44
%46 = load i32, i32* %11
%47 = mul nsw i32 %45, %46
%48 = load i32, i32* %12
%49 = mul nsw i32 %47, %48
%50 = sext i32 %49 to i64
%51 = mul i64 %50, 4
%52 = trunc i64 %51 to i32
ret i32 %52
}

LLVM IR (-O2):
@.str = [22 x i8] c"get_mem5Dint: array5D\00"
define i32 @get_mem5Dint(i32****** nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i64 @calloc(i32 %1, i32 8)
%8 = inttoptr i64 %7 to i32*****
store i32***** %8, i32****** %0
%9 = icmp eq i64 %7, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @no_mem_exit(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
%13 = icmp sgt i32 %1, 0
br i1 %13, label %14, label %23
14: ; preds = %12
%15 = zext i32 %1 to i64
br label %16
16: ; preds = %14, %16
%17 = phi i64 [ 0, %14 ], [ %21, %16 ]
%18 = load i32*****, i32****** %0
%19 = getelementptr inbounds i32****, i32***** %18, i64 %17
%20 = tail call i32 @get_mem4Dint(i32***** %19, i32 %2, i32 %3, i32 %4, i32 %5)
%21 = add nuw nsw i64 %17, 1
%22 = icmp eq i64 %21, %15
br i1 %22, label %23, label %16
23: ; preds = %16, %12
%24 = shl i32 %1, 2
%25 = mul i32 %24, %2
%26 = mul i32 %25, %3
%27 = mul i32 %26, %4
%28 = mul i32 %27, %5
ret i32 %28
}