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