#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void save(double X[6][6], unsigned long int x, unsigned long int y,
          char *filename) {
  unsigned long int i, j;
  FILE *file;
  file = fopen(filename, "w");
  for (i = 0; i < x; i++) {
    for (j = 0; j < y; j++) {
      fprintf(file, "%8.3f ", X[i][j]);
    }
    fprintf(file, "\n");
  }
  fclose(file);
}


x86 assembly (clang, -O0):
<save>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11e3 <save+0xb3>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11c0 <save+0x90>
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%rax
imul   $0x30,-0x28(%rbp),%rcx
add    %rcx,%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe5a(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    117a <save+0x4a>
mov    -0x38(%rbp),%rdi
lea    0xe3e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1164 <save+0x34>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%rbx
lea    0xea5(%rip),%rsi
mov    %rcx,%rdi
call   1060 <fopen@plt>
mov    %rax,%r12
mov    %rbp,(%rsp)
test   %rbp,%rbp
je     11ce <save+0x8e>
xor    %ebp,%ebp
lea    0xe8a(%rip),%r13
jmp    119b <save+0x5b>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
add    $0x1,%rbp
add    $0x30,%rbx
cmp    (%rsp),%rbp
je     11ce <save+0x8e>
test   %r15,%r15
je     1180 <save+0x40>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rbx,%r14,8),%xmm0
mov    %r12,%rdi
mov    %r13,%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
add    $0x1,%r14
cmp    %r14,%r15
jne    11b0 <save+0x70>
jmp    1180 <save+0x40>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

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

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