#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 */
double **aml_array_dbl_2d_variable_2nd_new(int, int *, int /*<<< orphan*/);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, double *);
double **aml_array_dbl_2d_variable_2nd_load(FILE *file, int s1, int *s2) {
  int i, j;
  double **arr = aml_array_dbl_2d_variable_2nd_new(s1, s2, 0);
  for (i = 0; i < s1; i++)
    for (j = 0; j < s2[i]; j++)
      fscanf(file, "%lf", &arr[i][j]);
  return arr;
}


x86 assembly (clang, -O0):
<aml_array_dbl_2d_variable_2nd_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1030 <aml_array_dbl_2d_variable_2nd_new@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bb <aml_array_dbl_2d_variable_2nd_load+0x9b>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    11a8 <aml_array_dbl_2d_variable_2nd_load+0x88>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xe6b(%rip),%rsi
call   1040 <fscanf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    115f <aml_array_dbl_2d_variable_2nd_load+0x3f>
jmp    11ad <aml_array_dbl_2d_variable_2nd_load+0x8d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114c <aml_array_dbl_2d_variable_2nd_load+0x2c>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aml_array_dbl_2d_variable_2nd_load>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,0x8(%rsp)
mov    %esi,%edi
mov    %rdx,%rsi
xor    %edx,%edx
call   1030 <aml_array_dbl_2d_variable_2nd_new@plt>
mov    %rax,%r15
test   %ebp,%ebp
jle    11c0 <aml_array_dbl_2d_variable_2nd_load+0xa0>
mov    %ebp,%eax
mov    %rax,(%rsp)
xor    %esi,%esi
lea    0xea6(%rip),%r14
mov    %rbx,0x10(%rsp)
mov    0x8(%rsp),%rbp
jmp    117a <aml_array_dbl_2d_variable_2nd_load+0x5a>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rsi
cmp    (%rsp),%rsi
je     11c0 <aml_array_dbl_2d_variable_2nd_load+0xa0>
cmpl   $0x0,(%rbx,%rsi,4)
jle    1170 <aml_array_dbl_2d_variable_2nd_load+0x50>
xor    %r13d,%r13d
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%rsi,8),%rdx
add    %r13,%rdx
mov    %rbp,%rdi
mov    %rsi,%rbx
mov    %r14,%rsi
call   1040 <fscanf@plt>
mov    %rbx,%rsi
mov    0x10(%rsp),%rbx
add    $0x1,%r12
movslq (%rbx,%rsi,4),%rax
add    $0x8,%r13
cmp    %rax,%r12
jl     1190 <aml_array_dbl_2d_variable_2nd_load+0x70>
jmp    1170 <aml_array_dbl_2d_variable_2nd_load+0x50>
mov    %r15,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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