#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_4d_new(int, int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int ****aml_array_int_4d_load(FILE *file, int s1, int s2, int s3, int s4) {
  int ****arr = aml_array_int_4d_new(s1, s2, s3, s4, 0);
  int i, j, k, l;
  for (i = 0; i < s1; i++)
    for (j = 0; j < s2; j++)
      for (k = 0; k < s3; k++)
        for (l = 0; l < s4; l++)
          fscanf(file, "%d ", &arr[i][j][k][l]);
  return arr;
}


x86 assembly (clang, -O0):
<aml_array_int_4d_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    %r8d,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
xor    %r8d,%r8d
call   1040 <aml_array_int_4d_new@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    121b <aml_array_int_4d_load+0xfb>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1208 <aml_array_int_4d_load+0xe8>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f5 <aml_array_int_4d_load+0xd5>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11e2 <aml_array_int_4d_load+0xc2>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe31(%rip),%rsi
call   1030 <fscanf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1191 <aml_array_int_4d_load+0x71>
jmp    11e7 <aml_array_int_4d_load+0xc7>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    117e <aml_array_int_4d_load+0x5e>
jmp    11fa <aml_array_int_4d_load+0xda>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    116b <aml_array_int_4d_load+0x4b>
jmp    120d <aml_array_int_4d_load+0xed>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1158 <aml_array_int_4d_load+0x38>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aml_array_int_4d_load>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %esi,%r13d
mov    %rdi,0x30(%rsp)
mov    %esi,%edi
mov    %edx,0xc(%rsp)
mov    %edx,%esi
mov    %ecx,0x10(%rsp)
mov    %ecx,%edx
mov    %r8d,0x14(%rsp)
mov    %r8d,%ecx
xor    %r8d,%r8d
call   1040 <aml_array_int_4d_new@plt>
mov    %rax,%r14
test   %r13d,%r13d
jle    122f <aml_array_int_4d_load+0x10f>
mov    %r13d,%ecx
mov    %rcx,0x18(%rsp)
mov    0xc(%rsp),%ecx
mov    %rcx,0x20(%rsp)
mov    0x10(%rsp),%ecx
mov    %rcx,0x28(%rsp)
mov    0x14(%rsp),%r12d
shl    $0x2,%r12
xor    %edx,%edx
lea    0xe74(%rip),%rbx
mov    0x30(%rsp),%r13
jmp    11af <aml_array_int_4d_load+0x8f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rdx
cmp    0x18(%rsp),%rdx
je     122f <aml_array_int_4d_load+0x10f>
cmpl   $0x0,0xc(%rsp)
jle    11a0 <aml_array_int_4d_load+0x80>
xor    %esi,%esi
mov    %rdx,0x38(%rsp)
jmp    11cb <aml_array_int_4d_load+0xab>
nop
add    $0x1,%rsi
cmp    0x20(%rsp),%rsi
je     11a0 <aml_array_int_4d_load+0x80>
cmpl   $0x0,0x10(%rsp)
jle    11c0 <aml_array_int_4d_load+0xa0>
xor    %r15d,%r15d
mov    %rsi,0x40(%rsp)
jmp    11eb <aml_array_int_4d_load+0xcb>
nopl   0x0(%rax)
add    $0x1,%r15
cmp    0x28(%rsp),%r15
je     11c0 <aml_array_int_4d_load+0xa0>
cmpl   $0x0,0x14(%rsp)
jle    11e0 <aml_array_int_4d_load+0xc0>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r14,%rdx,8),%rax
mov    (%rax,%rsi,8),%rax
mov    (%rax,%r15,8),%rdx
add    %rbp,%rdx
mov    %r13,%rdi
mov    %rbx,%rsi
call   1030 <fscanf@plt>
mov    0x40(%rsp),%rsi
mov    0x38(%rsp),%rdx
add    $0x4,%rbp
cmp    %rbp,%r12
jne    1200 <aml_array_int_4d_load+0xe0>
jmp    11e0 <aml_array_int_4d_load+0xc0>
mov    %r14,%rax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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