#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*/ time_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void save_matrix(char filename[], float **A, int ml, int mh, int nl, int nh,
                 int transpose, const char *mode) {
  FILE *fp_m;
  int i, j, rows, cols;
  time_t now;
  if (transpose)
    rows = nh - nl + 1;
  else
    rows = mh - ml + 1;
  if (transpose)
    cols = mh - ml + 1;
  else
    cols = nh - nl + 1;
  if ((fp_m = fopen(filename, mode)) == NULL) {
    printf(" error: cannot open file: %s \n", filename);
    exit(1013);
  }
  (void)time(&now);
  fprintf(fp_m, "%% filename: %s - %s", filename, ctime(&now));
  fprintf(fp_m, "%% type: matrix \n");
  fprintf(fp_m, "%% rows: %d\n", rows);
  fprintf(fp_m, "%% columns: %d\n", cols);
  if (transpose) {
    for (j = nl; j <= nh; j++) {
      for (i = ml; i <= mh; i++) {
        if (A[i][j] != 0)
          fprintf(fp_m, "%15.6e", A[i][j]);
        else
          fprintf(fp_m, "    0          ");
      }
      fprintf(fp_m, "\n");
    }
  } else {
    for (i = ml; i <= mh; i++) {
      for (j = nl; j <= nh; j++) {
        if (A[i][j] != 0)
          fprintf(fp_m, "%15.6e", A[i][j]);
        else
          fprintf(fp_m, "    0          ");
      }
      fprintf(fp_m, "\n");
    }
  }
  fclose(fp_m);
  return;
}


x86 assembly (clang, -O0):
<save_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
cmpl   $0x0,0x10(%rbp)
je     11b0 <save_matrix+0x40>
mov    -0x20(%rbp),%eax
sub    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11bc <save_matrix+0x4c>
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,0x10(%rbp)
je     11d7 <save_matrix+0x67>
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11e3 <save_matrix+0x73>
mov    -0x20(%rbp),%eax
sub    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x18(%rbp),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1218 <save_matrix+0xa8>
mov    -0x8(%rbp),%rsi
lea    0xdf7(%rip),%rdi
call   1050 <printf@plt>
mov    $0x3f5,%edi
call   1090 <exit@plt>
lea    -0x3c(%rbp),%rdi
call   1070 <time@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x3c(%rbp),%rdi
call   1040 <ctime@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rdx
mov    %rax,%rcx
lea    0xdd3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xdd6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x34(%rbp),%edx
lea    0xdd3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%edx
lea    0xdcb(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0x0,0x10(%rbp)
je     1363 <save_matrix+0x1f3>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     135e <save_matrix+0x1ee>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     133e <save_matrix+0x1ce>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12e9 <save_matrix+0x179>
jp     12e9 <save_matrix+0x179>
jmp    1319 <save_matrix+0x1a9>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd56(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
jmp    132b <save_matrix+0x1bb>
mov    -0x28(%rbp),%rdi
lea    0xd46(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1330 <save_matrix+0x1c0>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12b1 <save_matrix+0x141>
mov    -0x28(%rbp),%rdi
lea    0xcd4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    129f <save_matrix+0x12f>
jmp    142d <save_matrix+0x2bd>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1428 <save_matrix+0x2b8>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1408 <save_matrix+0x298>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    13b3 <save_matrix+0x243>
jp     13b3 <save_matrix+0x243>
jmp    13e3 <save_matrix+0x273>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc8c(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
jmp    13f5 <save_matrix+0x285>
mov    -0x28(%rbp),%rdi
lea    0xc7c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    13fa <save_matrix+0x28a>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    137b <save_matrix+0x20b>
mov    -0x28(%rbp),%rdi
lea    0xc0a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1369 <save_matrix+0x1f9>
jmp    142d <save_matrix+0x2bd>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9d,%ebx
mov    %r8d,%ebp
mov    %ecx,%r14d
mov    %edx,%r13d
mov    %rsi,%r15
mov    0x68(%rsp),%rsi
mov    %rdi,0x18(%rsp)
call   1090 <fopen@plt>
test   %rax,%rax
je     13fb <save_matrix+0x26b>
mov    %rax,%r12
mov    %ebx,%eax
sub    %ebp,%eax
mov    %ebp,0xc(%rsp)
mov    %r14d,%ecx
sub    %r13d,%r14d
cmpl   $0x0,0x60(%rsp)
mov    %ebx,0x8(%rsp)
mov    %ecx,0x4(%rsp)
mov    %r13d,0x10(%rsp)
mov    %r14d,%r13d
cmove  %eax,%r13d
mov    %eax,0x14(%rsp)
mov    %eax,%ebx
cmove  %r14d,%ebx
add    $0x1,%ebx
add    $0x1,%r13d
lea    0x24(%rsp),%rbp
mov    %rbp,%rdi
call   1080 <time@plt>
mov    %rbp,%rdi
call   1040 <ctime@plt>
lea    0xe07(%rip),%rsi
mov    %r12,%rdi
mov    0x18(%rsp),%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xe03(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xe04(%rip),%rsi
mov    %r12,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xdfe(%rip),%rsi
mov    %r12,%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
cmpl   $0x0,0x60(%rsp)
je     132a <save_matrix+0x19a>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ecx
cmp    %eax,%ecx
mov    0x4(%rsp),%edx
mov    0x10(%rsp),%esi
jl     133a <save_matrix+0x1aa>
mov    %eax,%edi
movslq %esi,%rax
movslq %edi,%rbx
add    $0x1,%ecx
lea    (%r15,%rax,8),%rbp
add    $0x1,%r14d
lea    0xdc4(%rip),%r15
mov    %ecx,0x8(%rsp)
jmp    12d1 <save_matrix+0x141>
nopl   0x0(%rax)
mov    $0xa,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
add    $0x1,%rbx
mov    0x8(%rsp),%ecx
cmp    %ebx,%ecx
mov    0x4(%rsp),%edx
mov    0x10(%rsp),%esi
je     133a <save_matrix+0x1aa>
cmp    %esi,%edx
jl     12b0 <save_matrix+0x120>
xor    %r13d,%r13d
jmp    1302 <save_matrix+0x172>
nopw   0x0(%rax,%rax,1)
mov    $0xf,%esi
mov    $0x1,%edx
lea    0xd7d(%rip),%rdi
mov    %r12,%rcx
call   10b0 <fwrite@plt>
add    $0x1,%r13
cmp    %r13d,%r14d
je     12b0 <save_matrix+0x120>
mov    0x0(%rbp,%r13,8),%rax
movss  (%rax,%rbx,4),%xmm0
ucomiss 0xced(%rip),%xmm0
jne    1317 <save_matrix+0x187>
jnp    12e0 <save_matrix+0x150>
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
jmp    12f9 <save_matrix+0x169>
mov    0x10(%rsp),%edx
mov    0x4(%rsp),%ecx
cmp    %edx,%ecx
mov    0x8(%rsp),%eax
jge    1351 <save_matrix+0x1c1>
mov    %r12,%rdi
call   1030 <fclose@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movslq 0xc(%rsp),%rsi
mov    %rsi,0x18(%rsp)
movslq %edx,%rbx
add    $0x1,%ecx
addl   $0x1,0x14(%rsp)
lea    0xcfa(%rip),%rbp
mov    %ecx,0x4(%rsp)
jmp    139d <save_matrix+0x20d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
add    $0x1,%rbx
mov    0x4(%rsp),%ecx
cmp    %ebx,%ecx
mov    0x8(%rsp),%eax
je     133a <save_matrix+0x1aa>
cmp    0xc(%rsp),%eax
jl     1380 <save_matrix+0x1f0>
mov    0x14(%rsp),%r14d
mov    0x18(%rsp),%r13
jmp    13d3 <save_matrix+0x243>
nop
mov    $0xf,%esi
mov    $0x1,%edx
lea    0xcad(%rip),%rdi
mov    %r12,%rcx
call   10b0 <fwrite@plt>
add    $0x1,%r13
add    $0xffffffff,%r14d
je     1380 <save_matrix+0x1f0>
mov    (%r15,%rbx,8),%rax
movss  (%rax,%r13,4),%xmm0
ucomiss 0xc1c(%rip),%xmm0
jne    13e8 <save_matrix+0x258>
jnp    13b0 <save_matrix+0x220>
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    %rbp,%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
jmp    13c9 <save_matrix+0x239>
lea    0xc02(%rip),%rdi
mov    0x18(%rsp),%rsi
call   1050 <printf@plt>
mov    $0x3f5,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c" error: cannot open file: %s \0A\00"
@.str.1 = [21 x i8] c"%% filename: %s - %s\00"
@.str.2 = [18 x i8] c"%% type: matrix \0A\00"
@.str.3 = [13 x i8] c"%% rows: %d\0A\00"
@.str.4 = [16 x i8] c"%% columns: %d\0A\00"
@.str.5 = [7 x i8] c"%15.6e\00"
@.str.6 = [16 x i8] c" 0 \00"
@.str.7 = [2 x i8] c"\0A\00"
define void @save_matrix(i8* %0, float** %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i8* %7) {
%9 = alloca i8*
%10 = alloca float**
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i32*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
store i8* %0, i8** %9
store float** %1, float*** %10
store i32 %2, i32* %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 = load i32, i32* %15
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %8
%26 = load i32, i32* %14
%27 = load i32, i32* %13
%28 = sub nsw i32 %26, %27
%29 = add nsw i32 %28, 1
store i32 %29, i32* %20
br label %35
30: ; preds = %8
%31 = load i32, i32* %12
%32 = load i32, i32* %11
%33 = sub nsw i32 %31, %32
%34 = add nsw i32 %33, 1
store i32 %34, i32* %20
br label %35
35: ; preds = %30, %25
%36 = load i32, i32* %15
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %43
38: ; preds = %35
%39 = load i32, i32* %12
%40 = load i32, i32* %11
%41 = sub nsw i32 %39, %40
%42 = add nsw i32 %41, 1
store i32 %42, i32* %21
br label %48
43: ; preds = %35
%44 = load i32, i32* %14
%45 = load i32, i32* %13
%46 = sub nsw i32 %44, %45
%47 = add nsw i32 %46, 1
store i32 %47, i32* %21
br label %48
48: ; preds = %43, %38
%49 = load i8*, i8** %9
%50 = load i8*, i8** %16
%51 = call i32* @fopen(i8* %49, i8* %50)
store i32* %51, i32** %17
%52 = icmp eq i32* %51, null
br i1 %52, label %53, label %57
53: ; preds = %48
%54 = load i8*, i8** %9
%55 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %54)
%56 = call i32 @exit(i32 1013)
unreachable
57: ; preds = %48
%58 = call i32 @time(i32* %22)
%59 = load i32*, i32** %17
%60 = load i8*, i8** %9
%61 = call i8* @ctime(i32* %22)
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %59, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %60, i8* %61)
%63 = load i32*, i32** %17
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%65 = load i32*, i32** %17
%66 = load i32, i32* %20
%67 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %66)
%68 = load i32*, i32** %17
%69 = load i32, i32* %21
%70 = call i32 (i32*, i8*, ...) @fprintf(i32* %68, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %15
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %123
73: ; preds = %57
%74 = load i32, i32* %13
store i32 %74, i32* %19
br label %75
75: ; preds = %119, %73
%76 = load i32, i32* %19
%77 = load i32, i32* %14
%78 = icmp sle i32 %76, %77
br i1 %78, label %79, label %122
79: ; preds = %75
%80 = load i32, i32* %11
store i32 %80, i32* %18
br label %81
81: ; preds = %113, %79
%82 = load i32, i32* %18
%83 = load i32, i32* %12
%84 = icmp sle i32 %82, %83
br i1 %84, label %85, label %116
85: ; preds = %81
%86 = load float**, float*** %10
%87 = load i32, i32* %18
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds float*, float** %86, i64 %88
%90 = load float*, float** %89
%91 = load i32, i32* %19
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds float, float* %90, i64 %92
%94 = load float, float* %93
%95 = fcmp une float %94, 0.000000e+00
br i1 %95, label %96, label %109
96: ; preds = %85
%97 = load i32*, i32** %17
%98 = load float**, float*** %10
%99 = load i32, i32* %18
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds float*, float** %98, i64 %100
%102 = load float*, float** %101
%103 = load i32, i32* %19
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds float, float* %102, i64 %104
%106 = load float, float* %105
%107 = fpext float %106 to double
%108 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %107)
br label %112
109: ; preds = %85
%110 = load i32*, i32** %17
%111 = call i32 (i32*, i8*, ...) @fprintf(i32* %110, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %112
112: ; preds = %109, %96
br label %113
113: ; preds = %112
%114 = load i32, i32* %18
%115 = add nsw i32 %114, 1
store i32 %115, i32* %18
br label %81
116: ; preds = %81
%117 = load i32*, i32** %17
%118 = call i32 (i32*, i8*, ...) @fprintf(i32* %117, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %119
119: ; preds = %116
%120 = load i32, i32* %19
%121 = add nsw i32 %120, 1
store i32 %121, i32* %19
br label %75
122: ; preds = %75
br label %173
123: ; preds = %57
%124 = load i32, i32* %11
store i32 %124, i32* %18
br label %125
125: ; preds = %169, %123
%126 = load i32, i32* %18
%127 = load i32, i32* %12
%128 = icmp sle i32 %126, %127
br i1 %128, label %129, label %172
129: ; preds = %125
%130 = load i32, i32* %13
store i32 %130, i32* %19
br label %131
131: ; preds = %163, %129
%132 = load i32, i32* %19
%133 = load i32, i32* %14
%134 = icmp sle i32 %132, %133
br i1 %134, label %135, label %166
135: ; preds = %131
%136 = load float**, float*** %10
%137 = load i32, i32* %18
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds float*, float** %136, i64 %138
%140 = load float*, float** %139
%141 = load i32, i32* %19
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds float, float* %140, i64 %142
%144 = load float, float* %143
%145 = fcmp une float %144, 0.000000e+00
br i1 %145, label %146, label %159
146: ; preds = %135
%147 = load i32*, i32** %17
%148 = load float**, float*** %10
%149 = load i32, i32* %18
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds float*, float** %148, i64 %150
%152 = load float*, float** %151
%153 = load i32, i32* %19
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds float, float* %152, i64 %154
%156 = load float, float* %155
%157 = fpext float %156 to double
%158 = call i32 (i32*, i8*, ...) @fprintf(i32* %147, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %157)
br label %162
159: ; preds = %135
%160 = load i32*, i32** %17
%161 = call i32 (i32*, i8*, ...) @fprintf(i32* %160, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %162
162: ; preds = %159, %146
br label %163
163: ; preds = %162
%164 = load i32, i32* %19
%165 = add nsw i32 %164, 1
store i32 %165, i32* %19
br label %131
166: ; preds = %131
%167 = load i32*, i32** %17
%168 = call i32 (i32*, i8*, ...) @fprintf(i32* %167, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %169
169: ; preds = %166
%170 = load i32, i32* %18
%171 = add nsw i32 %170, 1
store i32 %171, i32* %18
br label %125
172: ; preds = %125
br label %173
173: ; preds = %172, %122
%174 = load i32*, i32** %17
%175 = call i32 @fclose(i32* %174)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c" error: cannot open file: %s \0A\00"
@.str.1 = [21 x i8] c"%% filename: %s - %s\00"
@.str.2 = [18 x i8] c"%% type: matrix \0A\00"
@.str.3 = [13 x i8] c"%% rows: %d\0A\00"
@.str.4 = [16 x i8] c"%% columns: %d\0A\00"
@.str.5 = [7 x i8] c"%15.6e\00"
@.str.6 = [16 x i8] c" 0 \00"
define void @save_matrix(i8* %0, float** nocapture %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i8* nocapture %7) {
%9 = alloca i32
%10 = bitcast i32* %9 to i8*
%11 = icmp eq i32 %6, 0
%12 = sub nsw i32 %5, %4
%13 = sub nsw i32 %3, %2
%14 = tail call i32* @fopen(i8* %0, i8* %7)
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %8
%17 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0)
%18 = tail call i32 @exit(i32 1013)
unreachable
19: ; preds = %8
%20 = select i1 %11, i32 %12, i32 %13
%21 = select i1 %11, i32 %13, i32 %12
%22 = add nsw i32 %21, 1
%23 = add nsw i32 %20, 1
%24 = call i32 @time(i32* %9)
%25 = call i8* @ctime(i32* %9)
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %25)
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %23)
br i1 %11, label %38, label %30
30: ; preds = %19
%31 = icmp slt i32 %5, %4
br i1 %31, label %93, label %32
32: ; preds = %30
%33 = icmp slt i32 %3, %2
%34 = sext i32 %2 to i64
%35 = add i32 %3, 1
%36 = sext i32 %4 to i64
%37 = add i32 %5, 1
br label %46
38: ; preds = %19
%39 = icmp slt i32 %3, %2
br i1 %39, label %93, label %40
40: ; preds = %38
%41 = icmp slt i32 %5, %4
%42 = sext i32 %4 to i64
%43 = add i32 %5, 1
%44 = sext i32 %2 to i64
%45 = add i32 %3, 1
br label %69
46: ; preds = %32, %64
%47 = phi i64 [ %36, %32 ], [ %66, %64 ]
br i1 %33, label %64, label %48
48: ; preds = %46, %60
%49 = phi i64 [ %61, %60 ], [ %34, %46 ]
%50 = getelementptr inbounds float*, float** %1, i64 %49
%51 = load float*, float** %50
%52 = getelementptr inbounds float, float* %51, i64 %47
%53 = load float, float* %52
%54 = fcmp une float %53, 0.000000e+00
br i1 %54, label %55, label %58
55: ; preds = %48
%56 = fpext float %53 to double
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %56)
br label %60
58: ; preds = %48
%59 = call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i64 15, i64 1, i32* %14)
br label %60
60: ; preds = %55, %58
%61 = add nsw i64 %49, 1
%62 = trunc i64 %61 to i32
%63 = icmp eq i32 %35, %62
br i1 %63, label %64, label %48
64: ; preds = %60, %46
%65 = call i32 @fputc(i32 10, i32* %14)
%66 = add nsw i64 %47, 1
%67 = trunc i64 %66 to i32
%68 = icmp eq i32 %37, %67
br i1 %68, label %93, label %46
69: ; preds = %40, %88
%70 = phi i64 [ %44, %40 ], [ %90, %88 ]
br i1 %41, label %88, label %71
71: ; preds = %69
%72 = getelementptr inbounds float*, float** %1, i64 %70
br label %73
73: ; preds = %71, %84
%74 = phi i64 [ %42, %71 ], [ %85, %84 ]
%75 = load float*, float** %72
%76 = getelementptr inbounds float, float* %75, i64 %74
%77 = load float, float* %76
%78 = fcmp une float %77, 0.000000e+00
br i1 %78, label %79, label %82
79: ; preds = %73
%80 = fpext float %77 to double
%81 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %80)
br label %84
82: ; preds = %73
%83 = call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i64 15, i64 1, i32* %14)
br label %84
84: ; preds = %79, %82
%85 = add nsw i64 %74, 1
%86 = trunc i64 %85 to i32
%87 = icmp eq i32 %43, %86
br i1 %87, label %88, label %73
88: ; preds = %84, %69
%89 = call i32 @fputc(i32 10, i32* %14)
%90 = add nsw i64 %70, 1
%91 = trunc i64 %90 to i32
%92 = icmp eq i32 %45, %91
br i1 %92, label %93, label %69
93: ; preds = %64, %88, %30, %38
%94 = call i32 @fclose(i32* %14)
ret void
}