#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 *, ...);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
double sqrt(int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void writeMatrix__f(double *U, double *Sigma, double *V, int nSNP, int K,
                    int nIND, int nF, char *OutputFileName) {
  FILE *resultFile;
  char *fileU = malloc(sizeof(char) * 256);
  char *fileS = malloc(sizeof(char) * 256);
  char *fileV = malloc(sizeof(char) * 256);
  int i, j;
  strcpy(fileU, OutputFileName);
  strcat(fileU, ".loadings");
  printf("Opening file %s...\n", fileU);
  if ((resultFile = fopen(fileU, "w")) == NULL)
    printf("ERROR, unable to open %s\n", fileU);
  for (i = 0; i < nSNP; i++) {
    for (j = 0; j < nF; j++) {
      fprintf(resultFile, "%f ", U[i * nF + j]);
    }
    fprintf(resultFile, "\n");
  }
  fclose(resultFile);
  strcpy(fileS, OutputFileName);
  strcat(fileS, ".sigma");
  printf("Opening file %s...\n", fileS);
  if ((resultFile = fopen(fileS, "w")) == NULL)
    printf("ERROR, unable to open %s\n", fileS);
  for (i = 0; i < nF; i++) {
    fprintf(resultFile, "%f ", Sigma[i] / sqrt(nIND - 1));
  }
  fprintf(resultFile, "\n");
  fclose(resultFile);
  strcpy(fileV, OutputFileName);
  strcat(fileV, ".scores");
  printf("Opening file %s...\n", fileV);
  if ((resultFile = fopen(fileV, "w")) == NULL)
    printf("ERROR, unable to open %s\n", fileV);
  for (i = 0; i < nF; i++) {
    for (j = 0; j < nIND; j++) {
      fprintf(resultFile, "%f ", V[i * nIND + j]);
    }
    fprintf(resultFile, "\n");
  }
  fclose(resultFile);
  free(fileU);
  free(fileS);
  free(fileV);
}


x86 assembly (clang, -O0):
<writeMatrix__f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
mov    0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x38(%rbp),%rdi
lea    0xe08(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x38(%rbp),%rsi
lea    0xe02(%rip),%rdi
call   1060 <printf@plt>
mov    -0x38(%rbp),%rdi
lea    0xe06(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    123b <writeMatrix__f+0xab>
mov    -0x38(%rbp),%rsi
lea    0xdea(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12b7 <writeMatrix__f+0x127>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    1297 <writeMatrix__f+0x107>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
imul   0x10(%rbp),%ecx
add    -0x50(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdb8(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1255 <writeMatrix__f+0xc5>
mov    -0x30(%rbp),%rdi
lea    0xd7a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1242 <writeMatrix__f+0xb2>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x40(%rbp),%rdi
mov    0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x40(%rbp),%rdi
lea    0xd66(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x40(%rbp),%rsi
lea    0xd22(%rip),%rdi
call   1060 <printf@plt>
mov    -0x40(%rbp),%rdi
lea    0xd26(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    131b <writeMatrix__f+0x18b>
mov    -0x40(%rbp),%rsi
lea    0xd0a(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    137f <writeMatrix__f+0x1ef>
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x24(%rbp),%edi
sub    $0x1,%edi
call   10a0 <sqrt@plt>
mov    -0x60(%rbp),%rdi
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
divsd  %xmm1,%xmm0
lea    0xcd0(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1322 <writeMatrix__f+0x192>
mov    -0x30(%rbp),%rdi
lea    0xc92(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x48(%rbp),%rdi
mov    0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x48(%rbp),%rdi
lea    0xc93(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x48(%rbp),%rsi
lea    0xc48(%rip),%rdi
call   1060 <printf@plt>
mov    -0x48(%rbp),%rdi
lea    0xc4c(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    13f5 <writeMatrix__f+0x265>
mov    -0x48(%rbp),%rsi
lea    0xc30(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    1471 <writeMatrix__f+0x2e1>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1451 <writeMatrix__f+0x2c1>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x4c(%rbp),%ecx
imul   -0x24(%rbp),%ecx
add    -0x50(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xbfe(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    140f <writeMatrix__f+0x27f>
mov    -0x30(%rbp),%rdi
lea    0xbc0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    13fc <writeMatrix__f+0x26c>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeMatrix__f>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,0x18(%rsp)
mov    %ecx,%r14d
mov    %rdx,0x48(%rsp)
mov    %rsi,0x38(%rsp)
mov    %rdi,%r15
mov    0x98(%rsp),%rbp
mov    0x90(%rsp),%r13d
mov    $0x100,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    $0x100,%edi
call   1090 <malloc@plt>
mov    %rax,0x10(%rsp)
mov    $0x100,%edi
call   1090 <malloc@plt>
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
mov    %rbp,0x30(%rsp)
mov    %rbp,%rsi
call   1040 <strcpy@plt>
lea    0xdeb(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <strcat@plt>
lea    0xde6(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
lea    0xdeb(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
jne    1252 <writeMatrix__f+0xb2>
lea    0xdd6(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
mov    %rbx,0x40(%rsp)
mov    %r13d,%eax
mov    %rax,0x20(%rsp)
test   %r14d,%r14d
jle    12de <writeMatrix__f+0x13e>
movslq %r13d,%rax
mov    %r14d,%ecx
mov    %rcx,0x50(%rsp)
shl    $0x3,%rax
mov    %rax,(%rsp)
xor    %ebx,%ebx
lea    0xdba(%rip),%rbp
mov    %r13d,0x2c(%rsp)
jmp    12b1 <writeMatrix__f+0x111>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %r12,%rsi
call   1070 <fputc@plt>
add    $0x1,%rbx
add    (%rsp),%r15
cmp    0x50(%rsp),%rbx
mov    0x2c(%rsp),%r13d
je     12de <writeMatrix__f+0x13e>
test   %r13d,%r13d
mov    0x20(%rsp),%r13
jle    1290 <writeMatrix__f+0xf0>
xor    %r14d,%r14d
xchg   %ax,%ax
movsd  (%r15,%r14,8),%xmm0
mov    %r12,%rdi
mov    %rbp,%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
add    $0x1,%r14
cmp    %r14,%r13
jne    12c0 <writeMatrix__f+0x120>
jmp    1290 <writeMatrix__f+0xf0>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    0x30(%rsp),%rsi
call   1040 <strcpy@plt>
lea    0xd3f(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <strcat@plt>
lea    0xcfc(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
lea    0xd01(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
jne    133e <writeMatrix__f+0x19e>
lea    0xcec(%rip),%rdi
mov    0x10(%rsp),%rsi
call   1060 <printf@plt>
test   %r13d,%r13d
mov    0x20(%rsp),%r14
mov    0x38(%rsp),%r15
jle    1399 <writeMatrix__f+0x1f9>
mov    0x18(%rsp),%rax
lea    -0x1(%rax),%ebx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movsd  (%r15,%rbp,8),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   10b0 <sqrt@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
mov    %r12,%rdi
lea    0xcb5(%rip),%rsi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1080 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1360 <writeMatrix__f+0x1c0>
mov    $0xa,%edi
mov    %r12,%rsi
call   1070 <fputc@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    0x30(%rsp),%rsi
call   1040 <strcpy@plt>
lea    0xc7e(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <strcat@plt>
lea    0xc34(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
lea    0xc39(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1406 <writeMatrix__f+0x266>
lea    0xc24(%rip),%rdi
mov    0x8(%rsp),%rsi
call   1060 <printf@plt>
test   %r13d,%r13d
mov    0x48(%rsp),%r13
jle    147f <writeMatrix__f+0x2df>
mov    0x18(%rsp),%rax
movslq %eax,%rcx
mov    %eax,%ebx
shl    $0x3,%rcx
mov    %rcx,(%rsp)
xor    %r15d,%r15d
lea    0xc0e(%rip),%r12
jmp    144c <writeMatrix__f+0x2ac>
xchg   %ax,%ax
mov    $0xa,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
add    $0x1,%r15
add    (%rsp),%r13
cmp    0x20(%rsp),%r15
je     147f <writeMatrix__f+0x2df>
cmpl   $0x0,0x18(%rsp)
jle    1430 <writeMatrix__f+0x290>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x0(%r13,%rbp,8),%xmm0
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1460 <writeMatrix__f+0x2c0>
jmp    1430 <writeMatrix__f+0x290>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [10 x i8] c".loadings\00"
@.str.1 = [20 x i8] c"Opening file %s...\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [26 x i8] c"ERROR, unable to open %s\0A\00"
@.str.4 = [4 x i8] c"%f \00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [7 x i8] c".sigma\00"
@.str.7 = [8 x i8] c".scores\00"
define void @writeMatrix__f(double* %0, double* %1, double* %2, i32 %3, i32 %4, i32 %5, i32 %6, i8* %7) {
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i32*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i32
%22 = alloca i32
store double* %0, double** %9
store double* %1, double** %10
store double* %2, double** %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i8* %7, i8** %16
%23 = call i8* @malloc(i32 256)
store i8* %23, i8** %18
%24 = call i8* @malloc(i32 256)
store i8* %24, i8** %19
%25 = call i8* @malloc(i32 256)
store i8* %25, i8** %20
%26 = load i8*, i8** %18
%27 = load i8*, i8** %16
%28 = call i32 @strcpy(i8* %26, i8* %27)
%29 = load i8*, i8** %18
%30 = call i32 @strcat(i8* %29, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%31 = load i8*, i8** %18
%32 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i8*, i8** %18
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %34, i32** %17
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %39
36: ; preds = %8
%37 = load i8*, i8** %18
%38 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %36, %8
store i32 0, i32* %21
br label %40
40: ; preds = %67, %39
%41 = load i32, i32* %21
%42 = load i32, i32* %12
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %70
44: ; preds = %40
store i32 0, i32* %22
br label %45
45: ; preds = %61, %44
%46 = load i32, i32* %22
%47 = load i32, i32* %15
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %64
49: ; preds = %45
%50 = load i32*, i32** %17
%51 = load double*, double** %9
%52 = load i32, i32* %21
%53 = load i32, i32* %15
%54 = mul nsw i32 %52, %53
%55 = load i32, i32* %22
%56 = add nsw i32 %54, %55
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %51, i64 %57
%59 = load double, double* %58
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %59)
br label %61
61: ; preds = %49
%62 = load i32, i32* %22
%63 = add nsw i32 %62, 1
store i32 %63, i32* %22
br label %45
64: ; preds = %45
%65 = load i32*, i32** %17
%66 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %67
67: ; preds = %64
%68 = load i32, i32* %21
%69 = add nsw i32 %68, 1
store i32 %69, i32* %21
br label %40
70: ; preds = %40
%71 = load i32*, i32** %17
%72 = call i32 @fclose(i32* %71)
%73 = load i8*, i8** %19
%74 = load i8*, i8** %16
%75 = call i32 @strcpy(i8* %73, i8* %74)
%76 = load i8*, i8** %19
%77 = call i32 @strcat(i8* %76, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%78 = load i8*, i8** %19
%79 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %78)
%80 = load i8*, i8** %19
%81 = call i32* @fopen(i8* %80, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %81, i32** %17
%82 = icmp eq i32* %81, null
br i1 %82, label %83, label %86
83: ; preds = %70
%84 = load i8*, i8** %19
%85 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %84)
br label %86
86: ; preds = %83, %70
store i32 0, i32* %21
br label %87
87: ; preds = %103, %86
%88 = load i32, i32* %21
%89 = load i32, i32* %15
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %106
91: ; preds = %87
%92 = load i32*, i32** %17
%93 = load double*, double** %10
%94 = load i32, i32* %21
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %93, i64 %95
%97 = load double, double* %96
%98 = load i32, i32* %14
%99 = sub nsw i32 %98, 1
%100 = call double @sqrt(i32 %99)
%101 = fdiv double %97, %100
%102 = call i32 (i32*, i8*, ...) @fprintf(i32* %92, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %101)
br label %103
103: ; preds = %91
%104 = load i32, i32* %21
%105 = add nsw i32 %104, 1
store i32 %105, i32* %21
br label %87
106: ; preds = %87
%107 = load i32*, i32** %17
%108 = call i32 (i32*, i8*, ...) @fprintf(i32* %107, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%109 = load i32*, i32** %17
%110 = call i32 @fclose(i32* %109)
%111 = load i8*, i8** %20
%112 = load i8*, i8** %16
%113 = call i32 @strcpy(i8* %111, i8* %112)
%114 = load i8*, i8** %20
%115 = call i32 @strcat(i8* %114, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%116 = load i8*, i8** %20
%117 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %116)
%118 = load i8*, i8** %20
%119 = call i32* @fopen(i8* %118, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %119, i32** %17
%120 = icmp eq i32* %119, null
br i1 %120, label %121, label %124
121: ; preds = %106
%122 = load i8*, i8** %20
%123 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %122)
br label %124
124: ; preds = %121, %106
store i32 0, i32* %21
br label %125
125: ; preds = %152, %124
%126 = load i32, i32* %21
%127 = load i32, i32* %15
%128 = icmp slt i32 %126, %127
br i1 %128, label %129, label %155
129: ; preds = %125
store i32 0, i32* %22
br label %130
130: ; preds = %146, %129
%131 = load i32, i32* %22
%132 = load i32, i32* %14
%133 = icmp slt i32 %131, %132
br i1 %133, label %134, label %149
134: ; preds = %130
%135 = load i32*, i32** %17
%136 = load double*, double** %11
%137 = load i32, i32* %21
%138 = load i32, i32* %14
%139 = mul nsw i32 %137, %138
%140 = load i32, i32* %22
%141 = add nsw i32 %139, %140
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds double, double* %136, i64 %142
%144 = load double, double* %143
%145 = call i32 (i32*, i8*, ...) @fprintf(i32* %135, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %144)
br label %146
146: ; preds = %134
%147 = load i32, i32* %22
%148 = add nsw i32 %147, 1
store i32 %148, i32* %22
br label %130
149: ; preds = %130
%150 = load i32*, i32** %17
%151 = call i32 (i32*, i8*, ...) @fprintf(i32* %150, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %152
152: ; preds = %149
%153 = load i32, i32* %21
%154 = add nsw i32 %153, 1
store i32 %154, i32* %21
br label %125
155: ; preds = %125
%156 = load i32*, i32** %17
%157 = call i32 @fclose(i32* %156)
%158 = load i8*, i8** %18
%159 = call i32 @free(i8* %158)
%160 = load i8*, i8** %19
%161 = call i32 @free(i8* %160)
%162 = load i8*, i8** %20
%163 = call i32 @free(i8* %162)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c".loadings\00"
@.str.1 = [20 x i8] c"Opening file %s...\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [26 x i8] c"ERROR, unable to open %s\0A\00"
@.str.4 = [4 x i8] c"%f \00"
@.str.6 = [7 x i8] c".sigma\00"
@.str.7 = [8 x i8] c".scores\00"
define void @writeMatrix__f(double* nocapture %0, double* nocapture %1, double* nocapture %2, i32 %3, i32 %4, i32 %5, i32 %6, i8* %7) {
%9 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%10 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%11 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%12 = tail call i32 @strcpy(i8* %9, i8* %7)
%13 = tail call i32 @strcat(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%15 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %19
17: ; preds = %8
%18 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %9)
br label %19
19: ; preds = %17, %8
%20 = icmp sgt i32 %3, 0
br i1 %20, label %21, label %42
21: ; preds = %19
%22 = icmp sgt i32 %6, 0
%23 = sext i32 %6 to i64
%24 = zext i32 %3 to i64
%25 = zext i32 %6 to i64
br label %26
26: ; preds = %21, %38
%27 = phi i64 [ 0, %21 ], [ %40, %38 ]
br i1 %22, label %28, label %38
28: ; preds = %26
%29 = mul nsw i64 %27, %23
br label %30
30: ; preds = %28, %30
%31 = phi i64 [ 0, %28 ], [ %36, %30 ]
%32 = add nsw i64 %31, %29
%33 = getelementptr inbounds double, double* %0, i64 %32
%34 = load double, double* %33
%35 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %34)
%36 = add nuw nsw i64 %31, 1
%37 = icmp eq i64 %36, %25
br i1 %37, label %38, label %30
38: ; preds = %30, %26
%39 = tail call i32 @fputc(i32 10, i32* %15)
%40 = add nuw nsw i64 %27, 1
%41 = icmp eq i64 %40, %24
br i1 %41, label %42, label %26
42: ; preds = %38, %19
%43 = tail call i32 @fclose(i32* %15)
%44 = tail call i32 @strcpy(i8* %10, i8* %7)
%45 = tail call i32 @strcat(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%46 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%47 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %51
49: ; preds = %42
%50 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %51
51: ; preds = %49, %42
%52 = icmp sgt i32 %6, 0
br i1 %52, label %53, label %65
53: ; preds = %51
%54 = add nsw i32 %5, -1
%55 = zext i32 %6 to i64
br label %56
56: ; preds = %53, %56
%57 = phi i64 [ 0, %53 ], [ %63, %56 ]
%58 = getelementptr inbounds double, double* %1, i64 %57
%59 = load double, double* %58
%60 = tail call double @sqrt(i32 %54)
%61 = fdiv double %59, %60
%62 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %61)
%63 = add nuw nsw i64 %57, 1
%64 = icmp eq i64 %63, %55
br i1 %64, label %65, label %56
65: ; preds = %56, %51
%66 = tail call i32 @fputc(i32 10, i32* %47)
%67 = tail call i32 @fclose(i32* %47)
%68 = tail call i32 @strcpy(i8* %11, i8* %7)
%69 = tail call i32 @strcat(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%70 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%71 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%72 = icmp eq i32* %71, null
br i1 %72, label %73, label %75
73: ; preds = %65
%74 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %11)
br label %75
75: ; preds = %73, %65
br i1 %52, label %76, label %97
76: ; preds = %75
%77 = icmp sgt i32 %5, 0
%78 = sext i32 %5 to i64
%79 = zext i32 %6 to i64
%80 = zext i32 %5 to i64
br label %81
81: ; preds = %76, %93
%82 = phi i64 [ 0, %76 ], [ %95, %93 ]
br i1 %77, label %83, label %93
83: ; preds = %81
%84 = mul nsw i64 %82, %78
br label %85
85: ; preds = %83, %85
%86 = phi i64 [ 0, %83 ], [ %91, %85 ]
%87 = add nsw i64 %86, %84
%88 = getelementptr inbounds double, double* %2, i64 %87
%89 = load double, double* %88
%90 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %71, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %89)
%91 = add nuw nsw i64 %86, 1
%92 = icmp eq i64 %91, %80
br i1 %92, label %93, label %85
93: ; preds = %85, %81
%94 = tail call i32 @fputc(i32 10, i32* %71)
%95 = add nuw nsw i64 %82, 1
%96 = icmp eq i64 %95, %79
br i1 %96, label %97, label %81
97: ; preds = %93, %75
%98 = tail call i32 @fclose(i32* %71)
%99 = tail call i32 @free(i8* %9)
%100 = tail call i32 @free(i8* %10)
%101 = tail call i32 @free(i8* %11)
ret void
}