#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int ***aml_array_int_3d_new(int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int ***aml_array_int_3d_load(FILE *file, int s1, int s2, int s3) {
  int i, j, k;
  int ***arr = aml_array_int_3d_new(s1, s2, s3, 0);
  for (i = 0; i < s1; i++)
    for (j = 0; j < s2; j++)
      for (k = 0; k < s3; k++)
        fscanf(file, "%d", &arr[i][j][k]);
  return arr;
}


x86 assembly (clang, -O0):
<aml_array_int_3d_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1040 <aml_array_int_3d_new@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e5 <aml_array_int_3d_load+0xc5>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d2 <aml_array_int_3d_load+0xb2>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11bf <aml_array_int_3d_load+0x9f>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe54(%rip),%rsi
call   1030 <fscanf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1176 <aml_array_int_3d_load+0x56>
jmp    11c4 <aml_array_int_3d_load+0xa4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1163 <aml_array_int_3d_load+0x43>
jmp    11d7 <aml_array_int_3d_load+0xb7>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1150 <aml_array_int_3d_load+0x30>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aml_array_int_3d_load>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %esi,%r12d
mov    %rdi,0x18(%rsp)
mov    %esi,%edi
mov    %edx,(%rsp)
mov    %edx,%esi
mov    %ecx,0x4(%rsp)
mov    %ecx,%edx
xor    %ecx,%ecx
call   1040 <aml_array_int_3d_new@plt>
mov    %rax,%r13
test   %r12d,%r12d
jle    11f7 <aml_array_int_3d_load+0xd7>
mov    %r12d,%eax
mov    %rax,0x8(%rsp)
mov    (%rsp),%eax
mov    %rax,0x10(%rsp)
mov    0x4(%rsp),%eax
shl    $0x2,%rax
xor    %ebx,%ebx
lea    0xe89(%rip),%rbp
mov    %rax,0x20(%rsp)
mov    0x18(%rsp),%r14
jmp    119b <aml_array_int_3d_load+0x7b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
cmp    0x8(%rsp),%rbx
je     11f7 <aml_array_int_3d_load+0xd7>
cmpl   $0x0,(%rsp)
jle    1190 <aml_array_int_3d_load+0x70>
xor    %r15d,%r15d
jmp    11bb <aml_array_int_3d_load+0x9b>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r15
cmp    0x10(%rsp),%r15
je     1190 <aml_array_int_3d_load+0x70>
cmpl   $0x0,0x4(%rsp)
jle    11b0 <aml_array_int_3d_load+0x90>
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x0(%r13,%rbx,8),%rax
mov    (%rax,%r15,8),%rdx
add    %r12,%rdx
mov    %r14,%rdi
mov    %rbp,%rsi
call   1030 <fscanf@plt>
mov    0x20(%rsp),%rax
add    $0x4,%r12
cmp    %r12,%rax
jne    11d0 <aml_array_int_3d_load+0xb0>
jmp    11b0 <aml_array_int_3d_load+0x90>
mov    %r13,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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