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


x86 assembly (clang, -O0):
<SaveMesh>:
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     11d7 <SaveMesh+0xc7>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xe98(%rip),%rsi
mov    $0x2,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    11b7 <SaveMesh+0xa7>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe63(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1176 <SaveMesh+0x66>
mov    -0x8(%rbp),%rdi
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1137 <SaveMesh+0x27>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SaveMesh>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9d,0xc(%rsp)
mov    %rcx,0x20(%rsp)
mov    %rdx,0x18(%rsp)
mov    %r8,0x10(%rsp)
test   %r8d,%r8d
js     11e3 <SaveMesh+0xc3>
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    0x10(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%r15d
xor    %r12d,%r12d
lea    0xe98(%rip),%r14
jmp    1188 <SaveMesh+0x68>
nop
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
add    $0x1,%r12
cmp    0x10(%rsp),%r12
je     11e3 <SaveMesh+0xc3>
mov    0x18(%rsp),%rax
movsd  (%rax,%r12,8),%xmm0
mov    0x20(%rsp),%rax
movsd  (%rax,%r12,8),%xmm1
mov    %rbx,%rdi
lea    0xe58(%rip),%rsi
mov    $0x2,%al
call   1040 <fprintf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1170 <SaveMesh+0x50>
xor    %r13d,%r13d
nopl   0x0(%rax)
mov    0x0(%rbp,%r13,8),%rax
movsd  (%rax,%r12,8),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
add    $0x1,%r13
cmp    %r13,%r15
jne    11c0 <SaveMesh+0xa0>
jmp    1170 <SaveMesh+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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