#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void aml_array_dbl_2d_save(FILE *file, double **arr, int s1, int s2) {
  int i, j;
  for (i = 0; i < s1; i++) {
    for (j = 0; j < s2; j++)
      fprintf(file, "%.20lf ", arr[i][j]);
    fprintf(file, "\n");
  }
}


x86 assembly (clang, -O0):
<aml_array_dbl_2d_save>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a1 <aml_array_dbl_2d_save+0x91>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1181 <aml_array_dbl_2d_save+0x71>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe94(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1140 <aml_array_dbl_2d_save+0x30>
mov    -0x8(%rbp),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <aml_array_dbl_2d_save+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aml_array_dbl_2d_save>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0xc(%rsp)
test   %edx,%edx
jle    11b3 <aml_array_dbl_2d_save+0x93>
mov    %rsi,%r13
mov    %rdi,%rbp
mov    %edx,%eax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%ebx
xor    %r14d,%r14d
lea    0xeaf(%rip),%r15
jmp    1178 <aml_array_dbl_2d_save+0x58>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
mov    %rbp,%rsi
call   1030 <fputc@plt>
add    $0x1,%r14
cmp    0x10(%rsp),%r14
je     11b3 <aml_array_dbl_2d_save+0x93>
cmpl   $0x0,0xc(%rsp)
jle    1160 <aml_array_dbl_2d_save+0x40>
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%r14,8),%rax
movsd  (%rax,%r12,8),%xmm0
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
add    $0x1,%r12
cmp    %r12,%rbx
jne    1190 <aml_array_dbl_2d_save+0x70>
jmp    1160 <aml_array_dbl_2d_save+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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