#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fitfun(double *, int *, double *, int *, double *, int *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  int nx = 1;
  double x[1];
  int no = 2;
  double obj[2];
  int ncon = 1;
  double constr[1 + 1];
  for (int i = 0; i < argc; i++) {
    printf("simcode: arg %d argv %s\n", i, argv[i]);
    fflush(0);
  }
  FILE *fp = fopen("params.txt", "r");
  if (fp == NULL) {
    printf("Missing %s file. Exiting...\n", "params.txt");
    exit(1);
  }
  for (int i = 0; i < nx; i++)
    fscanf(fp, "%lf", &x[i]);
  fclose(fp);
  for (int i = 0; i < nx; i++) {
    printf("input parameter %d = %f\n", i, x[i]);
  }
  fitfun(x, &nx, obj, &no, constr, &ncon);
  char foname[256];
  FILE *fo;
  strcpy(foname, "fitness.txt");
  fo = fopen(foname, "w");
  if (fo == NULL) {
    printf("Could not create  %s file. Exiting...\n", "fitness.txt");
    exit(1);
  }
  for (int i = 0; i < no; i++)
    fprintf(fo, "%.16lf\n", obj[i]);
  fclose(fo);
  char fcname[256];
  FILE *fc;
  strcpy(fcname, "constr_viol.txt");
  fc = fopen(fcname, "w");
  if (fc == NULL) {
    printf("Could not create  %s file. Exiting...\n", "constr_viol.txt");
    exit(1);
  }
  for (int i = 0; i < ncon; i++)
    fprintf(fc, "%.16lf\n", constr[i]);
  fclose(fc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x24(%rbp)
movl   $0x1,-0x44(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1203 <main+0x73>
mov    -0x64(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    11c5 <main+0x35>
lea    0xe0f(%rip),%rdi
lea    0xe13(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    1244 <main+0xb4>
lea    0xdfa(%rip),%rdi
lea    0xde6(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1284 <main+0xf4>
mov    -0x70(%rbp),%rdi
movslq -0x74(%rbp),%rax
lea    -0x20(%rbp),%rdx
shl    $0x3,%rax
add    %rax,%rdx
lea    0xdd2(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    124b <main+0xbb>
mov    -0x70(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12c9 <main+0x139>
mov    -0x78(%rbp),%esi
movslq -0x78(%rbp),%rax
movsd  -0x20(%rbp,%rax,8),%xmm0
lea    0xd93(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1294 <main+0x104>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    -0x60(%rbp),%r8
lea    -0x14(%rbp),%rsi
lea    -0x24(%rbp),%rcx
lea    -0x44(%rbp),%r9
call   1070 <fitfun@plt>
lea    -0x180(%rbp),%rdi
lea    0xd6c(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x180(%rbp),%rdi
lea    0xd65(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x188(%rbp)
cmpq   $0x0,-0x188(%rbp)
jne    1340 <main+0x1b0>
lea    0xd46(%rip),%rdi
lea    0xd31(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x18c(%rbp)
mov    -0x18c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    138d <main+0x1fd>
mov    -0x188(%rbp),%rdi
movslq -0x18c(%rbp),%rax
movsd  -0x40(%rbp,%rax,8),%xmm0
lea    0xd21(%rip),%rsi
call   1080 <fprintf@plt>
mov    -0x18c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18c(%rbp)
jmp    134a <main+0x1ba>
mov    -0x188(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x290(%rbp),%rdi
lea    0xcf6(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x290(%rbp),%rdi
lea    0xcb2(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x298(%rbp)
cmpq   $0x0,-0x298(%rbp)
jne    13f3 <main+0x263>
lea    0xc93(%rip),%rdi
lea    0xcbb(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x29c(%rbp)
mov    -0x29c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1440 <main+0x2b0>
mov    -0x298(%rbp),%rdi
movslq -0x29c(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
lea    0xc6e(%rip),%rsi
call   1080 <fprintf@plt>
mov    -0x29c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x29c(%rbp)
jmp    13fd <main+0x26d>
mov    -0x298(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x2a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x248,%rsp
movl   $0x1,0x14(%rsp)
movl   $0x2,0x10(%rsp)
movl   $0x1,0xc(%rsp)
test   %edi,%edi
jle    11f0 <main+0x60>
mov    %rsi,%r15
mov    %edi,%r12d
lea    0xe39(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r15,%rbx,8),%rdx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    11d0 <main+0x40>
lea    0xe22(%rip),%rdi
lea    0xe26(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1358 <main+0x1c8>
mov    %rax,%rbx
lea    0xe2d(%rip),%rsi
lea    0x18(%rsp),%r14
mov    %rax,%rdi
mov    %r14,%rdx
call   1060 <fscanf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
movsd  0x18(%rsp),%xmm0
lea    0xe0c(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0x14(%rsp),%rsi
lea    0x30(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x20(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %r14,%rdi
call   1070 <fitfun@plt>
lea    0xdf4(%rip),%rsi
lea    0x140(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xde9(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1368 <main+0x1d8>
mov    %rax,%r15
cmpl   $0x0,0x10(%rsp)
jle    12cf <main+0x13f>
xor    %ebx,%ebx
lea    0xdee(%rip),%r14
nopw   0x0(%rax,%rax,1)
movsd  0x30(%rsp,%rbx,8),%xmm0
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <fprintf@plt>
add    $0x1,%rbx
movslq 0x10(%rsp),%rax
cmp    %rax,%rbx
jl     12b0 <main+0x120>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xdbf(%rip),%rsi
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xd7a(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1378 <main+0x1e8>
mov    %rax,%r15
cmpl   $0x0,0xc(%rsp)
jle    133f <main+0x1af>
xor    %ebx,%ebx
lea    0xd83(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x20(%rsp,%rbx,8),%xmm0
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <fprintf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1320 <main+0x190>
mov    %r15,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x248,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xcc7(%rip),%rdi
lea    0xcb3(%rip),%rsi
jmp    1386 <main+0x1f6>
lea    0xcff(%rip),%rdi
lea    0xcea(%rip),%rsi
jmp    1386 <main+0x1f6>
lea    0xcef(%rip),%rdi
lea    0xd17(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"simcode: arg %d argv %s\0A\00"
@.str.1 = [11 x i8] c"params.txt\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [29 x i8] c"Missing %s file. Exiting...\0A\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [25 x i8] c"input parameter %d = %f\0A\00"
@.str.6 = [12 x i8] c"fitness.txt\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [39 x i8] c"Could not create %s file. Exiting...\0A\00"
@.str.9 = [8 x i8] c"%.16lf\0A\00"
@.str.10 = [16 x i8] c"constr_viol.txt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [1 x double]
%8 = alloca i32
%9 = alloca [2 x double]
%10 = alloca i32
%11 = alloca [2 x double]
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
%16 = alloca [256 x i8]
%17 = alloca i32*
%18 = alloca i32
%19 = alloca [256 x i8]
%20 = alloca i32*
%21 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 2, i32* %8
store i32 1, i32* %10
store i32 0, i32* %12
br label %22
22: ; preds = %35, %2
%23 = load i32, i32* %12
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %38
26: ; preds = %22
%27 = load i32, i32* %12
%28 = load i8**, i8*** %5
%29 = load i32, i32* %12
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %27, i8* %32)
%34 = call i32 @fflush(i32 0)
br label %35
35: ; preds = %26
%36 = load i32, i32* %12
%37 = add nsw i32 %36, 1
store i32 %37, i32* %12
br label %22
38: ; preds = %22
%39 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %39, i32** %13
%40 = load i32*, i32** %13
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %38
store i32 0, i32* %14
br label %46
46: ; preds = %56, %45
%47 = load i32, i32* %14
%48 = load i32, i32* %6
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %59
50: ; preds = %46
%51 = load i32*, i32** %13
%52 = load i32, i32* %14
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [1 x double], [1 x double]* %7, i64 0, i64 %53
%55 = call i32 @fscanf(i32* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %54)
br label %56
56: ; preds = %50
%57 = load i32, i32* %14
%58 = add nsw i32 %57, 1
store i32 %58, i32* %14
br label %46
59: ; preds = %46
%60 = load i32*, i32** %13
%61 = call i32 @fclose(i32* %60)
store i32 0, i32* %15
br label %62
62: ; preds = %73, %59
%63 = load i32, i32* %15
%64 = load i32, i32* %6
%65 = icmp slt i32 %63, %64
br i1 %65, label %66, label %76
66: ; preds = %62
%67 = load i32, i32* %15
%68 = load i32, i32* %15
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [1 x double], [1 x double]* %7, i64 0, i64 %69
%71 = load double, double* %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %67, double %71)
br label %73
73: ; preds = %66
%74 = load i32, i32* %15
%75 = add nsw i32 %74, 1
store i32 %75, i32* %15
br label %62
76: ; preds = %62
%77 = getelementptr inbounds [1 x double], [1 x double]* %7, i64 0, i64 0
%78 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 0
%79 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
%80 = call i32 @fitfun(double* %77, i32* %6, double* %78, i32* %8, double* %79, i32* %10)
%81 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%82 = call i32 @strcpy(i8* %81, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%83 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%84 = call i32* @fopen(i8* %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %84, i32** %17
%85 = load i32*, i32** %17
%86 = icmp eq i32* %85, null
br i1 %86, label %87, label %90
87: ; preds = %76
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%89 = call i32 @exit(i32 1)
unreachable
90: ; preds = %76
store i32 0, i32* %18
br label %91
91: ; preds = %102, %90
%92 = load i32, i32* %18
%93 = load i32, i32* %8
%94 = icmp slt i32 %92, %93
br i1 %94, label %95, label %105
95: ; preds = %91
%96 = load i32*, i32** %17
%97 = load i32, i32* %18
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 %98
%100 = load double, double* %99
%101 = call i32 @fprintf(i32* %96, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), double %100)
br label %102
102: ; preds = %95
%103 = load i32, i32* %18
%104 = add nsw i32 %103, 1
store i32 %104, i32* %18
br label %91
105: ; preds = %91
%106 = load i32*, i32** %17
%107 = call i32 @fclose(i32* %106)
%108 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%109 = call i32 @strcpy(i8* %108, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
%110 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%111 = call i32* @fopen(i8* %110, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %111, i32** %20
%112 = load i32*, i32** %20
%113 = icmp eq i32* %112, null
br i1 %113, label %114, label %117
114: ; preds = %105
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
%116 = call i32 @exit(i32 1)
unreachable
117: ; preds = %105
store i32 0, i32* %21
br label %118
118: ; preds = %129, %117
%119 = load i32, i32* %21
%120 = load i32, i32* %10
%121 = icmp slt i32 %119, %120
br i1 %121, label %122, label %132
122: ; preds = %118
%123 = load i32*, i32** %20
%124 = load i32, i32* %21
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 %125
%127 = load double, double* %126
%128 = call i32 @fprintf(i32* %123, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), double %127)
br label %129
129: ; preds = %122
%130 = load i32, i32* %21
%131 = add nsw i32 %130, 1
store i32 %131, i32* %21
br label %118
132: ; preds = %118
%133 = load i32*, i32** %20
%134 = call i32 @fclose(i32* %133)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"simcode: arg %d argv %s\0A\00"
@.str.1 = [11 x i8] c"params.txt\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [29 x i8] c"Missing %s file. Exiting...\0A\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [25 x i8] c"input parameter %d = %f\0A\00"
@.str.6 = [12 x i8] c"fitness.txt\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [39 x i8] c"Could not create %s file. Exiting...\0A\00"
@.str.9 = [8 x i8] c"%.16lf\0A\00"
@.str.10 = [16 x i8] c"constr_viol.txt\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [1 x double]
%5 = alloca i32
%6 = alloca [2 x double]
%7 = alloca i32
%8 = alloca [2 x double]
%9 = alloca [256 x i8]
%10 = alloca [256 x i8]
%11 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%12 = bitcast [1 x double]* %4 to i8*
%13 = bitcast i32* %5 to i8*
store i32 2, i32* %5
%14 = bitcast [2 x double]* %6 to i8*
%15 = bitcast i32* %7 to i8*
store i32 1, i32* %7
%16 = bitcast [2 x double]* %8 to i8*
%17 = icmp sgt i32 %0, 0
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = zext i32 %0 to i64
br label %23
20: ; preds = %23, %2
%21 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %32, label %35
23: ; preds = %18, %23
%24 = phi i64 [ 0, %18 ], [ %30, %23 ]
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
%26 = load i8*, i8** %25
%27 = trunc i64 %24 to i32
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %27, i8* %26)
%29 = tail call i32 @fflush(i32 0)
%30 = add nuw nsw i64 %24, 1
%31 = icmp eq i64 %30, %19
br i1 %31, label %20, label %23
32: ; preds = %20
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%34 = tail call i32 @exit(i32 1)
unreachable
35: ; preds = %20
%36 = getelementptr inbounds [1 x double], [1 x double]* %4, i64 0, i64 0
%37 = call i32 @fscanf(i32* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %36)
%38 = call i32 @fclose(i32* %21)
%39 = getelementptr inbounds [1 x double], [1 x double]* %4, i64 0, i64 0
%40 = load double, double* %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 0, double %40)
%42 = getelementptr inbounds [1 x double], [1 x double]* %4, i64 0, i64 0
%43 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
%44 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 0
%45 = call i32 @fitfun(double* %42, i32* %3, double* %43, i32* %5, double* %44, i32* %7)
%46 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%47 = call i32 @strcpy(i8* %46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%48 = call i32* @fopen(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%49 = icmp eq i32* %48, null
br i1 %49, label %53, label %50
50: ; preds = %35
%51 = load i32, i32* %5
%52 = icmp sgt i32 %51, 0
br i1 %52, label %65, label %56
53: ; preds = %35
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %65, %50
%57 = call i32 @fclose(i32* %48)
%58 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%59 = call i32 @strcpy(i8* %58, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
%60 = call i32* @fopen(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%61 = icmp eq i32* %60, null
br i1 %61, label %74, label %62
62: ; preds = %56
%63 = load i32, i32* %7
%64 = icmp sgt i32 %63, 0
br i1 %64, label %79, label %77
65: ; preds = %50, %65
%66 = phi i64 [ %70, %65 ], [ 0, %50 ]
%67 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 %66
%68 = load double, double* %67
%69 = call i32 @fprintf(i32* %48, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), double %68)
%70 = add nuw nsw i64 %66, 1
%71 = load i32, i32* %5
%72 = sext i32 %71 to i64
%73 = icmp slt i64 %70, %72
br i1 %73, label %65, label %56
74: ; preds = %56
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %79, %62
%78 = call i32 @fclose(i32* %60)
ret i32 0
79: ; preds = %62, %79
%80 = phi i64 [ %84, %79 ], [ 0, %62 ]
%81 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 %80
%82 = load double, double* %81
%83 = call i32 @fprintf(i32* %60, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), double %82)
%84 = add nuw nsw i64 %80, 1
%85 = load i32, i32* %7
%86 = sext i32 %85 to i64
%87 = icmp slt i64 %84, %86
br i1 %87, label %79, label %77
}