#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);
double fabs(double);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void save_dmatrix(const char filename[], double **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(1014);
  }
  (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 (fabs(A[i][j]) > 1.e-99)
          fprintf(fp_m, "%21.12e", 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 (fabs(A[i][j]) > 1.e-99)
          fprintf(fp_m, "%21.12e", A[i][j]);
        else
          fprintf(fp_m, "    0                ");
      }
      fprintf(fp_m, "\n");
    }
  }
  fclose(fp_m);
  return;
}


x86 assembly (clang, -O0):
<save_dmatrix>:
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_dmatrix+0x40>
mov    -0x20(%rbp),%eax
sub    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11bc <save_dmatrix+0x4c>
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,0x10(%rbp)
je     11d7 <save_dmatrix+0x67>
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11e3 <save_dmatrix+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_dmatrix+0xa8>
mov    -0x8(%rbp),%rsi
lea    0xe17(%rip),%rdi
call   1050 <printf@plt>
mov    $0x3f6,%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    0xdf3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xdf6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x34(%rbp),%edx
lea    0xdf3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%edx
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0x0,0x10(%rbp)
je     1365 <save_dmatrix+0x1f5>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1360 <save_dmatrix+0x1f0>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1340 <save_dmatrix+0x1d0>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xd37(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xd1b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    131b <save_dmatrix+0x1ab>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xd74(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
jmp    132d <save_dmatrix+0x1bd>
mov    -0x28(%rbp),%rdi
lea    0xd65(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1332 <save_dmatrix+0x1c2>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12b1 <save_dmatrix+0x141>
mov    -0x28(%rbp),%rdi
lea    0xcf2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    129f <save_dmatrix+0x12f>
jmp    1431 <save_dmatrix+0x2c1>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     142c <save_dmatrix+0x2bc>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     140c <save_dmatrix+0x29c>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xc6b(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xc4f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13e7 <save_dmatrix+0x277>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xca8(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
jmp    13f9 <save_dmatrix+0x289>
mov    -0x28(%rbp),%rdi
lea    0xc99(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    13fe <save_dmatrix+0x28e>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    137d <save_dmatrix+0x20d>
mov    -0x28(%rbp),%rdi
lea    0xc26(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    136b <save_dmatrix+0x1fb>
jmp    1431 <save_dmatrix+0x2c1>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_dmatrix>:
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     1401 <save_dmatrix+0x271>
mov    %rax,%r12
mov    %ebx,%eax
sub    %ebp,%eax
mov    %ebp,0xc(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r14d,%ecx
sub    %r13d,%r14d
cmpl   $0x0,0x60(%rsp)
mov    %r13d,0x10(%rsp)
mov    %r14d,%r13d
cmove  %eax,%r13d
mov    %ecx,0x4(%rsp)
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    0xe1b(%rip),%rsi
mov    %r12,%rdi
mov    0x18(%rsp),%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xe17(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xe18(%rip),%rsi
mov    %r12,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xe12(%rip),%rsi
mov    %r12,%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
cmpl   $0x0,0x60(%rsp)
je     1331 <save_dmatrix+0x1a1>
mov    0xc(%rsp),%eax
cmp    %eax,0x8(%rsp)
mov    0x10(%rsp),%ecx
jl     133b <save_dmatrix+0x1ab>
mov    %eax,%edx
movslq %ecx,%rax
movslq %edx,%rbx
addl   $0x1,0x8(%rsp)
lea    (%r15,%rax,8),%rbp
add    $0x1,%r14d
lea    0xde4(%rip),%r15
jmp    12cb <save_dmatrix+0x13b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
add    $0x1,%rbx
cmp    %ebx,0x8(%rsp)
mov    0x10(%rsp),%ecx
je     133b <save_dmatrix+0x1ab>
cmp    %ecx,0x4(%rsp)
jl     12b0 <save_dmatrix+0x120>
xor    %r13d,%r13d
jmp    12fe <save_dmatrix+0x16e>
cs nopw 0x0(%rax,%rax,1)
mov    $0x15,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %r12,%rcx
call   10b0 <fwrite@plt>
add    $0x1,%r13
cmp    %r13d,%r14d
je     12b0 <save_dmatrix+0x120>
mov    0x0(%rbp,%r13,8),%rax
movsd  (%rax,%rbx,8),%xmm0
movapd %xmm0,%xmm1
andpd  0xcec(%rip),%xmm1
ucomisd 0xcf4(%rip),%xmm1
jbe    12e0 <save_dmatrix+0x150>
mov    %r12,%rdi
lea    0xd53(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
jmp    12f5 <save_dmatrix+0x165>
mov    0x10(%rsp),%eax
cmp    %eax,0x4(%rsp)
jge    1352 <save_dmatrix+0x1c2>
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),%rcx
mov    %rcx,0x18(%rsp)
movslq %eax,%rbx
addl   $0x1,0x4(%rsp)
addl   $0x1,0x14(%rsp)
lea    0xd13(%rip),%r13
jmp    1397 <save_dmatrix+0x207>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
add    $0x1,%rbx
cmp    %ebx,0x4(%rsp)
je     133b <save_dmatrix+0x1ab>
mov    0xc(%rsp),%eax
cmp    %eax,0x8(%rsp)
jl     1380 <save_dmatrix+0x1f0>
mov    0x14(%rsp),%r14d
mov    0x18(%rsp),%rbp
jmp    13cf <save_dmatrix+0x23f>
nopl   (%rax)
mov    $0x15,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %r12,%rcx
call   10b0 <fwrite@plt>
add    $0x1,%rbp
add    $0xffffffff,%r14d
je     1380 <save_dmatrix+0x1f0>
mov    (%r15,%rbx,8),%rax
movsd  (%rax,%rbp,8),%xmm0
movapd %xmm0,%xmm1
andpd  0xc1c(%rip),%xmm1
ucomisd 0xc24(%rip),%xmm1
jbe    13b0 <save_dmatrix+0x220>
mov    %r12,%rdi
lea    0xc83(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
jmp    13c5 <save_dmatrix+0x235>
lea    0xc10(%rip),%rdi
mov    0x18(%rsp),%rsi
call   1050 <printf@plt>
mov    $0x3f6,%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 = [8 x i8] c"%21.12e\00"
@.str.6 = [22 x i8] c" 0 \00"
@.str.7 = [2 x i8] c"\0A\00"
define void @save_dmatrix(i8* %0, double** %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i8* %7) {
%9 = alloca i8*
%10 = alloca double**
%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 double** %1, double*** %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 1014)
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 double**, double*** %10
%87 = load i32, i32* %18
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double*, double** %86, i64 %88
%90 = load double*, double** %89
%91 = load i32, i32* %19
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %90, i64 %92
%94 = load double, double* %93
%95 = call double @llvm.fabs.f64(double %94)
%96 = fcmp ogt double %95, 1.000000e-99
br i1 %96, label %97, label %109
97: ; preds = %85
%98 = load i32*, i32** %17
%99 = load double**, double*** %10
%100 = load i32, i32* %18
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double*, double** %99, i64 %101
%103 = load double*, double** %102
%104 = load i32, i32* %19
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %103, i64 %105
%107 = load double, double* %106
%108 = call i32 (i32*, i8*, ...) @fprintf(i32* %98, i8* getelementptr inbounds ([8 x i8], [8 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 ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
br label %112
112: ; preds = %109, %97
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 double**, double*** %10
%137 = load i32, i32* %18
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double*, double** %136, i64 %138
%140 = load double*, double** %139
%141 = load i32, i32* %19
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds double, double* %140, i64 %142
%144 = load double, double* %143
%145 = call double @llvm.fabs.f64(double %144)
%146 = fcmp ogt double %145, 1.000000e-99
br i1 %146, label %147, label %159
147: ; preds = %135
%148 = load i32*, i32** %17
%149 = load double**, double*** %10
%150 = load i32, i32* %18
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds double*, double** %149, i64 %151
%153 = load double*, double** %152
%154 = load i32, i32* %19
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds double, double* %153, i64 %155
%157 = load double, double* %156
%158 = call i32 (i32*, i8*, ...) @fprintf(i32* %148, i8* getelementptr inbounds ([8 x i8], [8 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 ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
br label %162
162: ; preds = %159, %147
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 = [8 x i8] c"%21.12e\00"
@.str.6 = [22 x i8] c" 0 \00"
define void @save_dmatrix(i8* %0, double** 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 1014)
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 double*, double** %1, i64 %49
%51 = load double*, double** %50
%52 = getelementptr inbounds double, double* %51, i64 %47
%53 = load double, double* %52
%54 = call double @llvm.fabs.f64(double %53)
%55 = fcmp ogt double %54, 1.000000e-99
br i1 %55, label %56, label %58
56: ; preds = %48
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), double %53)
br label %60
58: ; preds = %48
%59 = call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i64 21, i64 1, i32* %14)
br label %60
60: ; preds = %56, %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 double*, double** %1, i64 %70
br label %73
73: ; preds = %71, %84
%74 = phi i64 [ %42, %71 ], [ %85, %84 ]
%75 = load double*, double** %72
%76 = getelementptr inbounds double, double* %75, i64 %74
%77 = load double, double* %76
%78 = call double @llvm.fabs.f64(double %77)
%79 = fcmp ogt double %78, 1.000000e-99
br i1 %79, label %80, label %82
80: ; preds = %73
%81 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), double %77)
br label %84
82: ; preds = %73
%83 = call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i64 21, i64 1, i32* %14)
br label %84
84: ; preds = %80, %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
}