#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*/ errhandler(int, char *, char *);
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ free(float *);
int /*<<< orphan*/ fwrite(float *, int, int, int /*<<< orphan*/ *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
void write_matrix(const char *szFileName, double **m, int nrl, int nrh, int ncl,
                  int nch, double xlength, double ylength, int fFirst) {
  int i, j;
  FILE *fh = 0;
  int nSize = (nrh - nrl + 1) * (nch - ncl + 1);
  float *tmp = (float *)malloc((size_t)(nSize * sizeof(float)));
  int k = 0;
  if (fFirst) {
    fh = fopen(szFileName, "w");
    if (fh == NULL) {
      char szBuff[80];
      sprintf(szBuff, "Outputfile %s cannot be created", szFileName);
      errhandler(
          251,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/grantathon/computational_fluid_dynamics/"
          "refs/heads/master/03_assignment/helper.c",
          szBuff);
    }
  } else {
    fh = fopen(szFileName, "a");
    if (fh == NULL) {
      char szBuff[80];
      sprintf(szBuff, "Outputfile %s cannot be opened", szFileName);
      errhandler(
          263,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/grantathon/computational_fluid_dynamics/"
          "refs/heads/master/03_assignment/helper.c",
          szBuff);
    }
  }
  for (j = ncl; j <= nch; j++)
    for (i = nrl; i <= nrh; i++)
      tmp[k++] = (float)m[i][j];
  fwrite(tmp, sizeof(float), nSize, fh);
  if (fclose(fh)) {
    char szBuff[80];
    sprintf(szBuff, "Outputfile %s cannot be closed", szFileName);
    errhandler(
        277,
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/grantathon/computational_fluid_dynamics/"
        "refs/heads/master/03_assignment/helper.c",
        szBuff);
  };
  free(tmp);
}


x86 assembly (clang, -O0):
<write_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
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)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
add    $0x1,%eax
mov    -0x20(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x44(%rbp)
movslq -0x44(%rbp),%rdi
shl    $0x2,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x0,0x10(%rbp)
je     1233 <write_matrix+0xc3>
mov    -0x8(%rbp),%rdi
lea    0xe15(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    122e <write_matrix+0xbe>
lea    -0xb0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xdf1(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0xb0(%rbp),%rdx
mov    $0xfb,%edi
lea    0xdf9(%rip),%rsi
call   1040 <errhandler@plt>
jmp    1286 <write_matrix+0x116>
mov    -0x8(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1281 <write_matrix+0x111>
lea    -0x100(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe6b(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x100(%rbp),%rdx
mov    $0x107,%edi
lea    0xda6(%rip),%rsi
call   1040 <errhandler@plt>
jmp    1286 <write_matrix+0x116>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     12fb <write_matrix+0x18b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     12e8 <write_matrix+0x178>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x50(%rbp),%rax
mov    -0x54(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x54(%rbp)
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    129e <write_matrix+0x12e>
jmp    12ed <write_matrix+0x17d>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    128c <write_matrix+0x11c>
mov    -0x50(%rbp),%rdi
mov    -0x44(%rbp),%edx
mov    -0x40(%rbp),%rcx
mov    $0x4,%esi
call   1090 <fwrite@plt>
mov    -0x40(%rbp),%rdi
call   1050 <fclose@plt>
cmp    $0x0,%rax
je     1352 <write_matrix+0x1e2>
lea    -0x150(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xdb9(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x150(%rbp),%rdx
mov    $0x115,%edi
lea    0xcd5(%rip),%rsi
call   1040 <errhandler@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9d,%r12d
mov    %r8d,%r14d
mov    %ecx,%ebx
mov    %edx,%ebp
mov    %rsi,0x10(%rsp)
mov    %rdi,%r15
mov    %ecx,%eax
sub    %edx,%eax
add    $0x1,%eax
mov    %r9d,%ecx
sub    %r8d,%ecx
add    $0x1,%ecx
imul   %eax,%ecx
mov    %ecx,0x8(%rsp)
movslq %ecx,%rdi
shl    $0x2,%rdi
call   1060 <malloc@plt>
mov    %rax,(%rsp)
cmpl   $0x0,0xc0(%rsp)
je     11fd <write_matrix+0x8d>
lea    0xe35(%rip),%rsi
mov    %r15,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
jne    123e <write_matrix+0xce>
lea    0xe23(%rip),%rsi
lea    0x30(%rsp),%r13
mov    %r13,%rdi
mov    %r15,%rdx
call   1080 <sprintf@plt>
lea    0xe2c(%rip),%rsi
mov    $0xfb,%edi
jmp    1234 <write_matrix+0xc4>
lea    0xec9(%rip),%rsi
mov    %r15,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
jne    123e <write_matrix+0xce>
lea    0xeb7(%rip),%rsi
lea    0x30(%rsp),%r13
mov    %r13,%rdi
mov    %r15,%rdx
call   1080 <sprintf@plt>
lea    0xdf3(%rip),%rsi
mov    $0x107,%edi
mov    %r13,%rdx
call   1040 <errhandler@plt>
xor    %eax,%eax
mov    %rax,0x18(%rsp)
cmp    %r12d,%r14d
jle    12b5 <write_matrix+0x145>
mov    (%rsp),%rdi
mov    $0x4,%esi
mov    0x8(%rsp),%edx
mov    0x18(%rsp),%rbx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
test   %rax,%rax
je     129a <write_matrix+0x12a>
lea    0xe78(%rip),%rsi
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rdx
call   1080 <sprintf@plt>
lea    0xd95(%rip),%rsi
mov    $0x115,%edi
mov    %rbx,%rdx
call   1040 <errhandler@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movslq %ebp,%r9
lea    0x1(%rbx),%r10d
movslq %r14d,%rdx
add    $0x1,%r12d
mov    %r10d,0xc(%rsp)
sub    %ebp,%r10d
lea    0x1(%r9),%rax
mov    %rax,0x28(%rsp)
mov    0x10(%rsp),%rax
add    $0x8,%rax
mov    %rax,0x20(%rsp)
mov    (%rsp),%r11
add    $0x4,%r11
xor    %ecx,%ecx
jmp    12fd <write_matrix+0x18d>
xchg   %ax,%ax
add    $0x1,%rdx
cmp    %edx,%r12d
je     1248 <write_matrix+0xd8>
cmp    %ebp,%ebx
jl     12f0 <write_matrix+0x180>
movslq %ecx,%rcx
test   $0x1,%r10b
jne    1320 <write_matrix+0x1b0>
mov    %r9,%rax
cmp    %ebp,%ebx
je     12f0 <write_matrix+0x180>
jmp    1348 <write_matrix+0x1d8>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp),%rax
mov    (%rax,%r9,8),%rax
movsd  (%rax,%rdx,8),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    (%rsp),%rax
movss  %xmm0,(%rax,%rcx,4)
add    $0x1,%rcx
mov    0x28(%rsp),%rax
cmp    %ebp,%ebx
je     12f0 <write_matrix+0x180>
mov    %r15,%r14
mov    0xc(%rsp),%esi
mov    %esi,%edi
sub    %eax,%edi
mov    0x20(%rsp),%rsi
lea    (%rsi,%rax,8),%r13
lea    (%r11,%rcx,4),%r8
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    -0x8(%r13,%r15,8),%rax
movsd  (%rax,%rdx,8),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%r8,%r15,4)
mov    0x0(%r13,%r15,8),%rax
movsd  (%rax,%rdx,8),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r8,%r15,4)
add    $0x2,%r15
cmp    %r15d,%edi
jne    1370 <write_matrix+0x200>
add    %r15,%rcx
mov    %r14,%r15
jmp    12f0 <write_matrix+0x180>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [32 x i8] c"Outputfile %s cannot be created\00"
@.str.2 = [171 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/grantathon/computational_fluid_dynamics/refs/heads/master/03_assignment/helper.c\00"
@.str.3 = [2 x i8] c"a\00"
@.str.4 = [31 x i8] c"Outputfile %s cannot be opened\00"
@.str.5 = [31 x i8] c"Outputfile %s cannot be closed\00"
define void @write_matrix(i8* %0, double** %1, i32 %2, i32 %3, i32 %4, i32 %5, double %6, double %7, i32 %8) {
%10 = alloca i8*
%11 = alloca double**
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32*
%22 = alloca i32
%23 = alloca float*
%24 = alloca i32
%25 = alloca [80 x i8]
%26 = alloca [80 x i8]
%27 = alloca [80 x i8]
store i8* %0, i8** %10
store double** %1, double*** %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store double %6, double* %16
store double %7, double* %17
store i32 %8, i32* %18
store i32* null, i32** %21
%28 = load i32, i32* %13
%29 = load i32, i32* %12
%30 = sub nsw i32 %28, %29
%31 = add nsw i32 %30, 1
%32 = load i32, i32* %15
%33 = load i32, i32* %14
%34 = sub nsw i32 %32, %33
%35 = add nsw i32 %34, 1
%36 = mul nsw i32 %31, %35
store i32 %36, i32* %22
%37 = load i32, i32* %22
%38 = sext i32 %37 to i64
%39 = mul i64 %38, 4
%40 = call i64 @malloc(i64 %39)
%41 = inttoptr i64 %40 to float*
store float* %41, float** %23
store i32 0, i32* %24
%42 = load i32, i32* %18
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %56
44: ; preds = %9
%45 = load i8*, i8** %10
%46 = call i32* @fopen(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %46, i32** %21
%47 = load i32*, i32** %21
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %55
49: ; preds = %44
%50 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%51 = load i8*, i8** %10
%52 = call i32 @sprintf(i8* %50, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %51)
%53 = getelementptr inbounds [80 x i8], [80 x i8]* %25, i64 0, i64 0
%54 = call i32 @errhandler(i32 251, i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.2, i64 0, i64 0), i8* %53)
br label %55
55: ; preds = %49, %44
br label %68
56: ; preds = %9
%57 = load i8*, i8** %10
%58 = call i32* @fopen(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %58, i32** %21
%59 = load i32*, i32** %21
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %67
61: ; preds = %56
%62 = getelementptr inbounds [80 x i8], [80 x i8]* %26, i64 0, i64 0
%63 = load i8*, i8** %10
%64 = call i32 @sprintf(i8* %62, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %63)
%65 = getelementptr inbounds [80 x i8], [80 x i8]* %26, i64 0, i64 0
%66 = call i32 @errhandler(i32 263, i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.2, i64 0, i64 0), i8* %65)
br label %67
67: ; preds = %61, %56
br label %68
68: ; preds = %67, %55
%69 = load i32, i32* %14
store i32 %69, i32* %20
br label %70
70: ; preds = %100, %68
%71 = load i32, i32* %20
%72 = load i32, i32* %15
%73 = icmp sle i32 %71, %72
br i1 %73, label %74, label %103
74: ; preds = %70
%75 = load i32, i32* %12
store i32 %75, i32* %19
br label %76
76: ; preds = %96, %74
%77 = load i32, i32* %19
%78 = load i32, i32* %13
%79 = icmp sle i32 %77, %78
br i1 %79, label %80, label %99
80: ; preds = %76
%81 = load double**, double*** %11
%82 = load i32, i32* %19
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double*, double** %81, i64 %83
%85 = load double*, double** %84
%86 = load i32, i32* %20
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %85, i64 %87
%89 = load double, double* %88
%90 = fptrunc double %89 to float
%91 = load float*, float** %23
%92 = load i32, i32* %24
%93 = add nsw i32 %92, 1
store i32 %93, i32* %24
%94 = sext i32 %92 to i64
%95 = getelementptr inbounds float, float* %91, i64 %94
store float %90, float* %95
br label %96
96: ; preds = %80
%97 = load i32, i32* %19
%98 = add nsw i32 %97, 1
store i32 %98, i32* %19
br label %76
99: ; preds = %76
br label %100
100: ; preds = %99
%101 = load i32, i32* %20
%102 = add nsw i32 %101, 1
store i32 %102, i32* %20
br label %70
103: ; preds = %70
%104 = load float*, float** %23
%105 = load i32, i32* %22
%106 = load i32*, i32** %21
%107 = call i32 @fwrite(float* %104, i32 4, i32 %105, i32* %106)
%108 = load i32*, i32** %21
%109 = call i64 @fclose(i32* %108)
%110 = icmp ne i64 %109, 0
br i1 %110, label %111, label %117
111: ; preds = %103
%112 = getelementptr inbounds [80 x i8], [80 x i8]* %27, i64 0, i64 0
%113 = load i8*, i8** %10
%114 = call i32 @sprintf(i8* %112, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %113)
%115 = getelementptr inbounds [80 x i8], [80 x i8]* %27, i64 0, i64 0
%116 = call i32 @errhandler(i32 277, i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.2, i64 0, i64 0), i8* %115)
br label %117
117: ; preds = %111, %103
%118 = load float*, float** %23
%119 = call i32 @free(float* %118)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [32 x i8] c"Outputfile %s cannot be created\00"
@.str.2 = [171 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/grantathon/computational_fluid_dynamics/refs/heads/master/03_assignment/helper.c\00"
@.str.3 = [2 x i8] c"a\00"
@.str.4 = [31 x i8] c"Outputfile %s cannot be opened\00"
@.str.5 = [31 x i8] c"Outputfile %s cannot be closed\00"
define void @write_matrix(i8* %0, double** nocapture %1, i32 %2, i32 %3, i32 %4, i32 %5, double %6, double %7, i32 %8) {
%10 = alloca [80 x i8]
%11 = alloca [80 x i8]
%12 = alloca [80 x i8]
%13 = sub i32 1, %2
%14 = add i32 %13, %3
%15 = sub i32 1, %4
%16 = add i32 %15, %5
%17 = mul nsw i32 %16, %14
%18 = sext i32 %17 to i64
%19 = shl nsw i64 %18, 2
%20 = tail call i64 @malloc(i64 %19)
%21 = inttoptr i64 %20 to float*
%22 = icmp eq i32 %8, 0
br i1 %22, label %30, label %23
23: ; preds = %9
%24 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %37
26: ; preds = %23
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%28 = call i32 @sprintf(i8* %27, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%29 = call i32 @errhandler(i32 251, i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.2, i64 0, i64 0), i8* %27)
br label %37
30: ; preds = %9
%31 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = getelementptr inbounds [80 x i8], [80 x i8]* %11, i64 0, i64 0
%35 = call i32 @sprintf(i8* %34, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%36 = call i32 @errhandler(i32 263, i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.2, i64 0, i64 0), i8* %34)
br label %37
37: ; preds = %30, %33, %23, %26
%38 = phi i32* [ null, %26 ], [ %24, %23 ], [ null, %33 ], [ %31, %30 ]
%39 = icmp sgt i32 %4, %5
br i1 %39, label %97, label %40
40: ; preds = %37
%41 = icmp slt i32 %3, %2
%42 = sext i32 %2 to i64
%43 = add i32 %3, 1
%44 = sext i32 %4 to i64
%45 = add i32 %5, 1
%46 = sub i32 %43, %2
%47 = and i32 %46, 1
%48 = icmp eq i32 %47, 0
%49 = getelementptr inbounds double*, double** %1, i64 %42
%50 = add nsw i64 %42, 1
%51 = icmp eq i32 %3, %2
br label %52
52: ; preds = %40, %92
%53 = phi i64 [ %44, %40 ], [ %94, %92 ]
%54 = phi i32 [ 0, %40 ], [ %93, %92 ]
br i1 %41, label %92, label %55
55: ; preds = %52
%56 = sext i32 %54 to i64
br i1 %48, label %64, label %57
57: ; preds = %55
%58 = load double*, double** %49
%59 = getelementptr inbounds double, double* %58, i64 %53
%60 = load double, double* %59
%61 = fptrunc double %60 to float
%62 = add nsw i64 %56, 1
%63 = getelementptr inbounds float, float* %21, i64 %56
store float %61, float* %63
br label %64
64: ; preds = %57, %55
%65 = phi i64 [ undef, %55 ], [ %62, %57 ]
%66 = phi i64 [ %42, %55 ], [ %50, %57 ]
%67 = phi i64 [ %56, %55 ], [ %62, %57 ]
br i1 %51, label %89, label %68
68: ; preds = %64, %68
%69 = phi i64 [ %86, %68 ], [ %66, %64 ]
%70 = phi i64 [ %84, %68 ], [ %67, %64 ]
%71 = getelementptr inbounds double*, double** %1, i64 %69
%72 = load double*, double** %71
%73 = getelementptr inbounds double, double* %72, i64 %53
%74 = load double, double* %73
%75 = fptrunc double %74 to float
%76 = add nsw i64 %70, 1
%77 = getelementptr inbounds float, float* %21, i64 %70
store float %75, float* %77
%78 = add nsw i64 %69, 1
%79 = getelementptr inbounds double*, double** %1, i64 %78
%80 = load double*, double** %79
%81 = getelementptr inbounds double, double* %80, i64 %53
%82 = load double, double* %81
%83 = fptrunc double %82 to float
%84 = add nsw i64 %70, 2
%85 = getelementptr inbounds float, float* %21, i64 %76
store float %83, float* %85
%86 = add nsw i64 %69, 2
%87 = trunc i64 %86 to i32
%88 = icmp eq i32 %43, %87
br i1 %88, label %89, label %68
89: ; preds = %68, %64
%90 = phi i64 [ %65, %64 ], [ %84, %68 ]
%91 = trunc i64 %90 to i32
br label %92
92: ; preds = %89, %52
%93 = phi i32 [ %54, %52 ], [ %91, %89 ]
%94 = add nsw i64 %53, 1
%95 = trunc i64 %94 to i32
%96 = icmp eq i32 %45, %95
br i1 %96, label %97, label %52
97: ; preds = %92, %37
%98 = call i32 @fwrite(float* %21, i32 4, i32 %17, i32* %38)
%99 = call i64 @fclose(i32* %38)
%100 = icmp eq i64 %99, 0
br i1 %100, label %105, label %101
101: ; preds = %97
%102 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%103 = call i32 @sprintf(i8* %102, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %0)
%104 = call i32 @errhandler(i32 277, i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.2, i64 0, i64 0), i8* %102)
br label %105
105: ; preds = %101, %97
%106 = call i32 @free(float* %21)
ret void
}