#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 SaveArray(FILE *f, double **Data, double *x, double *y, int Nx, int Ny) {
  int i, j;
  for (i = 0; i <= Nx; i++) {
    for (j = 0; j <= Ny; j++)
      fprintf(f, "%.12e\t%.12e\t%.12e\n", x[i], y[j], Data[i][j]);
    fprintf(f, "\n");
  }
}


x86 assembly (clang, -O0):
<SaveArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     11c5 <SaveArray+0xb5>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x28(%rbp),%eax
jg     11a5 <SaveArray+0x95>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xe70(%rip),%rsi
mov    $0x3,%al
call   1030 <fprintf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    114a <SaveArray+0x3a>
mov    -0x8(%rbp),%rdi
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1137 <SaveArray+0x27>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SaveArray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x8(%rsp)
mov    %rcx,0x28(%rsp)
mov    %rdx,0x20(%rsp)
mov    %rsi,0x10(%rsp)
mov    %r8,(%rsp)
test   %r8d,%r8d
js     11fe <SaveArray+0xde>
mov    %rdi,%rbp
mov    0x8(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x18(%rsp)
mov    (%rsp),%rax
add    $0x1,%eax
mov    %rax,(%rsp)
xor    %ebx,%ebx
mov    %rdi,0x30(%rsp)
mov    0x20(%rsp),%r14
jmp    119a <SaveArray+0x7a>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %rcx,%rbp
mov    %rcx,%rsi
call   1030 <fputc@plt>
add    $0x1,%rbx
cmp    (%rsp),%rbx
je     11fe <SaveArray+0xde>
cmpl   $0x0,0x8(%rsp)
mov    0x28(%rsp),%rdx
mov    %rbp,%rcx
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%rbp
lea    0xe48(%rip),%r13
js     1180 <SaveArray+0x60>
xor    %r12d,%r12d
nopl   (%rax)
movsd  (%r14,%rbx,8),%xmm0
movsd  (%rdx,%r12,8),%xmm1
mov    (%rdi,%rbx,8),%rax
movsd  (%rax,%r12,8),%xmm2
mov    %rcx,%rdi
mov    %r13,%rsi
mov    $0x3,%al
mov    %rdx,%r15
call   1040 <fprintf@plt>
mov    0x10(%rsp),%rdi
mov    %r15,%rdx
mov    0x30(%rsp),%rcx
add    $0x1,%r12
cmp    %r12,%rbp
jne    11c0 <SaveArray+0xa0>
jmp    1180 <SaveArray+0x60>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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