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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
double chiSquareTest(int, double *, double *, double *, double);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *, double, double);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
double scalingCoefficient(int, double *, double *, double *);
double sqrt(double);
int /*<<< orphan*/ sscanf(char *, char *, double *, double *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
double chi_of_data_files_v2(char *experimentalFile, char *theoreticalFile,
                            int scaleTheoretical) {
  int i = 0;
  char line[255];
  FILE *EXP_FILE = fopen(experimentalFile, "r");
  if (EXP_FILE == NULL) {
    fprintf(stderr, "ERROR: Experimental data file %s not found!\n",
            experimentalFile);
    exit(EXIT_FAILURE);
  }
  memset(line, '\0', 255);
  int n_exp = 0;
  while (1) {
    if (fgets(line, sizeof(line), EXP_FILE) == NULL)
      break;
    else {
      if (line[0] != '#') {
        i++;
      }
    }
  }
  n_exp = i;
  fprintf(stdout, "Number of data points in experimental file is %d.\n", i);
  rewind(EXP_FILE);
  memset(line, '\0', 255);
  i = 0;
  double exp_q[n_exp];
  double exp_I_q[n_exp];
  double sigma[n_exp];
  while (1) {
    if (fgets(line, sizeof(line), EXP_FILE) == NULL)
      break;
    else {
      if (line[0] != '#') {
        sscanf(line, "%lf %lf %lf\n", &exp_q[i], &exp_I_q[i], &sigma[i]);
        i++;
      }
    }
  }
  fclose(EXP_FILE);
  int n_theo = 0;
  FILE *THEO_FILE = fopen(theoreticalFile, "r");
  if (THEO_FILE == NULL) {
    fprintf(stderr, "ERROR: Dear user, I couldn't read %s file!\n",
            theoreticalFile);
    exit(EXIT_FAILURE);
  }
  memset(line, '\0', 255);
  i = 0;
  while (1) {
    if (fgets(line, sizeof(line), THEO_FILE) == NULL)
      break;
    else {
      if (line[0] != '#') {
        i++;
      }
    }
  }
  n_theo = i;
  fprintf(stdout, "Number of data points in theoretical file is %d.\n", i);
  if (n_theo != n_exp) {
    fprintf(stderr, "ERROR: Number of data points in experimental and "
                    "theoretical files is supposed to be same!");
    exit(EXIT_FAILURE);
  }
  double theo_I_q[n_exp];
  double theo_q[n_exp];
  for (i = 0; i < n_theo; i++) {
    theo_q[i] = 0.0;
    theo_I_q[i] = 0.0;
  }
  rewind(THEO_FILE);
  memset(line, '\0', 255);
  i = 0;
  while (1) {
    if (fgets(line, sizeof(line), THEO_FILE) == NULL)
      break;
    else {
      if (line[0] != '#') {
        sscanf(line, "%lf %lf\n", &theo_q[i], &theo_I_q[i]);
        i++;
      }
    }
  }
  fclose(THEO_FILE);
  double chiSqrdTestValue = 0.0;
  double coeff = 0.0;
  coeff = scalingCoefficient(n_exp, exp_I_q, theo_I_q, sigma);
  chiSqrdTestValue = chiSquareTest(n_exp, exp_I_q, theo_I_q, sigma, coeff);
  if (scaleTheoretical) {
    FILE *THEO_FIT_FILE = fopen("I_q_makowski_waxs_fit.dat", "w");
    if (THEO_FIT_FILE == NULL) {
      fprintf(stderr, "I_q_makowski_waxs_fit.dat file can not be produced!\n");
      exit(EXIT_FAILURE);
    }
    for (i = 0; i < n_exp; i++) {
      theo_I_q[i] = coeff * (theo_I_q[i]);
      fprintf(THEO_FIT_FILE, "%lf\t%lf\n", exp_q[i], theo_I_q[i]);
    }
    fclose(THEO_FIT_FILE);
  }
  printf("Chi Value=%lf\tScaling coefficient:%lf\n", sqrt(chiSqrdTestValue),
         coeff);
  return (sqrt(chiSqrdTestValue));
}


x86 assembly (clang, -O0):
<chi_of_data_files_v2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe18(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
jne    122c <chi_of_data_files_v2+0x6c>
mov    0x2dd7(%rip),%rax
movslq (%rax),%rdi
mov    -0x8(%rbp),%rdx
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
movl   $0x0,-0x12c(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x128(%rbp),%rdx
mov    $0xff,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    1270 <chi_of_data_files_v2+0xb0>
jmp    1293 <chi_of_data_files_v2+0xd3>
movsbl -0x120(%rbp),%eax
cmp    $0x23,%eax
je     1289 <chi_of_data_files_v2+0xc9>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    128e <chi_of_data_files_v2+0xce>
jmp    1249 <chi_of_data_files_v2+0x89>
mov    -0x18(%rbp),%eax
mov    %eax,-0x12c(%rbp)
mov    0x2d2d(%rip),%rax
movslq (%rax),%rdi
mov    -0x18(%rbp),%edx
lea    0xd7f(%rip),%rsi
xor    %eax,%eax
mov    %eax,-0x1a4(%rbp)
call   1090 <fprintf@plt>
mov    -0x128(%rbp),%rdi
call   1060 <rewind@plt>
mov    -0x1a4(%rbp),%esi
lea    -0x120(%rbp),%rdi
mov    $0xff,%edx
call   1070 <memset@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x12c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x138(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1a0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x140(%rbp)
mov    -0x12c(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x198(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x148(%rbp)
mov    -0x12c(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x190(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x150(%rbp)
jmp    1371 <chi_of_data_files_v2+0x1b1>
lea    -0x120(%rbp),%rdi
mov    -0x128(%rbp),%rdx
mov    $0xff,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    1398 <chi_of_data_files_v2+0x1d8>
jmp    1406 <chi_of_data_files_v2+0x246>
movsbl -0x120(%rbp),%eax
cmp    $0x23,%eax
je     13fc <chi_of_data_files_v2+0x23c>
mov    -0x190(%rbp),%r8
mov    -0x198(%rbp),%rcx
mov    -0x1a0(%rbp),%rdx
lea    -0x120(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%r8
lea    0xc76(%rip),%rsi
mov    $0x0,%al
call   10a0 <sscanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1401 <chi_of_data_files_v2+0x241>
jmp    136c <chi_of_data_files_v2+0x1ac>
mov    -0x128(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x154(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xbd9(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x160(%rbp)
cmpq   $0x0,-0x160(%rbp)
jne    146b <chi_of_data_files_v2+0x2ab>
mov    0x2b98(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rdx
lea    0xc19(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2b74(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
movl   $0x0,-0x18(%rbp)
jmp    148a <chi_of_data_files_v2+0x2ca>
lea    -0x120(%rbp),%rdi
mov    -0x160(%rbp),%rdx
mov    $0xff,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    14b1 <chi_of_data_files_v2+0x2f1>
jmp    14d4 <chi_of_data_files_v2+0x314>
movsbl -0x120(%rbp),%eax
cmp    $0x23,%eax
je     14ca <chi_of_data_files_v2+0x30a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    14cf <chi_of_data_files_v2+0x30f>
jmp    1485 <chi_of_data_files_v2+0x2c5>
mov    -0x18(%rbp),%eax
mov    %eax,-0x154(%rbp)
mov    0x2aec(%rip),%rax
movslq (%rax),%rdi
mov    -0x18(%rbp),%edx
lea    0xbaa(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x154(%rbp),%eax
cmp    -0x12c(%rbp),%eax
je     1530 <chi_of_data_files_v2+0x370>
mov    0x2acf(%rip),%rax
movslq (%rax),%rdi
lea    0xbb2(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2aaf(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x12c(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1b8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x168(%rbp)
mov    -0x12c(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1b0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x170(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x154(%rbp),%eax
jge    15cc <chi_of_data_files_v2+0x40c>
mov    -0x1b8(%rbp),%rax
mov    -0x1b0(%rbp),%rcx
movslq -0x18(%rbp),%rdx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rcx,%rdx,8)
movslq -0x18(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1589 <chi_of_data_files_v2+0x3c9>
mov    -0x160(%rbp),%rdi
call   1060 <rewind@plt>
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
movl   $0x0,-0x18(%rbp)
jmp    15f7 <chi_of_data_files_v2+0x437>
lea    -0x120(%rbp),%rdi
mov    -0x160(%rbp),%rdx
mov    $0xff,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    161e <chi_of_data_files_v2+0x45e>
jmp    167a <chi_of_data_files_v2+0x4ba>
movsbl -0x120(%rbp),%eax
cmp    $0x23,%eax
je     1670 <chi_of_data_files_v2+0x4b0>
mov    -0x1b8(%rbp),%rcx
mov    -0x1b0(%rbp),%rdx
lea    -0x120(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
lea    0xa06(%rip),%rsi
mov    $0x0,%al
call   10a0 <sscanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1675 <chi_of_data_files_v2+0x4b5>
jmp    15f2 <chi_of_data_files_v2+0x432>
mov    -0x160(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x198(%rbp),%rsi
mov    -0x1b8(%rbp),%rdx
mov    -0x190(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x178(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x180(%rbp)
ff
mov    -0x12c(%rbp),%edi
call   10e0 <scalingCoefficient@plt>
mov    -0x198(%rbp),%rsi
mov    -0x1b8(%rbp),%rdx
mov    -0x190(%rbp),%rcx
movsd  %xmm0,-0x180(%rbp)
ff
mov    -0x12c(%rbp),%edi
movsd  -0x180(%rbp),%xmm0
ff
call   1030 <chiSquareTest@plt>
movsd  %xmm0,-0x178(%rbp)
ff
cmpl   $0x0,-0x14(%rbp)
je     17cb <chi_of_data_files_v2+0x60b>
lea    0xa23(%rip),%rdi
lea    0xa36(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x188(%rbp)
cmpq   $0x0,-0x188(%rbp)
jne    174c <chi_of_data_files_v2+0x58c>
mov    0x28b3(%rip),%rax
movslq (%rax),%rdi
lea    0xa0d(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2893(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x12c(%rbp),%eax
jge    17bf <chi_of_data_files_v2+0x5ff>
mov    -0x1b8(%rbp),%rax
mov    -0x1a0(%rbp),%rcx
movsd  -0x180(%rbp),%xmm0
ff
movslq -0x18(%rbp),%rdx
mulsd  (%rax,%rdx,8),%xmm0
movslq -0x18(%rbp),%rdx
movsd  %xmm0,(%rax,%rdx,8)
mov    -0x188(%rbp),%rdi
movslq -0x18(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0x9cf(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1753 <chi_of_data_files_v2+0x593>
mov    -0x188(%rbp),%rdi
call   1040 <fclose@plt>
movsd  -0x178(%rbp),%xmm0
ff
call   10c0 <sqrt@plt>
movsd  -0x180(%rbp),%xmm1
ff
lea    0x99b(%rip),%rdi
call   1050 <printf@plt>
movsd  -0x178(%rbp),%xmm0
ff
call   10c0 <sqrt@plt>
mov    -0x138(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chi_of_data_files_v2>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %edx,%r12d
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xe14(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     15ed <chi_of_data_files_v2+0x41d>
mov    %rax,%r14
mov    %rbx,-0x38(%rbp)
mov    %r12d,-0x44(%rbp)
lea    -0x160(%rbp),%r15
xor    %ebx,%ebx
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
mov    %r15,%rdi
mov    $0xff,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1273 <chi_of_data_files_v2+0xa3>
xor    %ebx,%ebx
lea    -0x160(%rbp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
cmpb   $0x23,-0x160(%rbp)
setne  %al
add    %eax,%ebx
mov    %r15,%rdi
mov    $0xff,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
jne    1250 <chi_of_data_files_v2+0x80>
mov    0x2d56(%rip),%rax
movslq (%rax),%rdi
lea    0xdb3(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %r14,%rdi
call   1060 <rewind@plt>
lea    -0x160(%rbp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
mov    %rsp,-0x60(%rbp)
mov    %ebx,%eax
mov    %rsp,%rcx
mov    %rax,-0x50(%rbp)
lea    0xf(,%rax,8),%r12
and    $0xfffffffffffffff0,%r12
sub    %r12,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rsp,%rax
sub    %r12,%rax
mov    %rax,-0x30(%rbp)
mov    %rax,%rsp
mov    %rsp,%rax
sub    %r12,%rax
mov    %rax,-0x40(%rbp)
mov    %rax,%rsp
mov    %r15,%rdi
mov    $0xff,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     135c <chi_of_data_files_v2+0x18c>
lea    -0x160(%rbp),%rbx
lea    0xd5f(%rip),%r15
xor    %r13d,%r13d
jmp    1325 <chi_of_data_files_v2+0x155>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     135c <chi_of_data_files_v2+0x18c>
cmpb   $0x23,-0x160(%rbp)
je     1310 <chi_of_data_files_v2+0x140>
movslq %r13d,%r13
mov    -0x58(%rbp),%rax
lea    (%rax,%r13,8),%rdx
mov    -0x30(%rbp),%rax
lea    (%rax,%r13,8),%rcx
mov    -0x40(%rbp),%rax
lea    (%rax,%r13,8),%r8
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <sscanf@plt>
add    $0x1,%r13d
jmp    1310 <chi_of_data_files_v2+0x140>
mov    %r14,%rdi
call   1040 <fclose@plt>
lea    0xc9d(%rip),%rsi
mov    -0x38(%rbp),%rbx
mov    %rbx,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1603 <chi_of_data_files_v2+0x433>
mov    %rax,%r14
lea    -0x160(%rbp),%r15
xor    %ebx,%ebx
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
mov    %r15,%rdi
mov    $0xff,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     13e3 <chi_of_data_files_v2+0x213>
xor    %ebx,%ebx
lea    -0x160(%rbp),%r15
nopl   0x0(%rax)
xor    %eax,%eax
cmpb   $0x23,-0x160(%rbp)
setne  %al
add    %eax,%ebx
mov    %r15,%rdi
mov    $0xff,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
jne    13c0 <chi_of_data_files_v2+0x1f0>
mov    0x2be6(%rip),%rax
movslq (%rax),%rdi
lea    0xcaf(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    -0x50(%rbp),%rax
cmp    %eax,%ebx
jne    1620 <chi_of_data_files_v2+0x450>
mov    %rsp,%r13
sub    %r12,%r13
mov    %r13,%rsp
mov    %rsp,%r15
sub    %r12,%r15
mov    %r15,%rsp
test   %rax,%rax
je     1442 <chi_of_data_files_v2+0x272>
lea    0x0(,%rax,8),%rbx
mov    %r15,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1070 <memset@plt>
mov    %r13,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1070 <memset@plt>
mov    %r14,%rdi
call   1060 <rewind@plt>
lea    -0x160(%rbp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     14c6 <chi_of_data_files_v2+0x2f6>
lea    -0x160(%rbp),%r12
xor    %ebx,%ebx
jmp    1495 <chi_of_data_files_v2+0x2c5>
mov    %r12,%rdi
mov    $0xff,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     14c6 <chi_of_data_files_v2+0x2f6>
cmpb   $0x23,-0x160(%rbp)
je     1480 <chi_of_data_files_v2+0x2b0>
movslq %ebx,%rbx
lea    (%r15,%rbx,8),%rdx
lea    0x0(,%rbx,8),%rcx
add    %r13,%rcx
mov    %r12,%rdi
lea    0xbb4(%rip),%rsi
xor    %eax,%eax
call   10a0 <sscanf@plt>
add    $0x1,%ebx
jmp    1480 <chi_of_data_files_v2+0x2b0>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    -0x50(%rbp),%r12
mov    %r12d,%edi
mov    -0x30(%rbp),%rbx
mov    %rbx,%rsi
mov    %r13,%rdx
mov    -0x40(%rbp),%r14
mov    %r14,%rcx
call   10f0 <scalingCoefficient@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r14,%rcx
movsd  %xmm0,-0x38(%rbp)
call   1030 <chiSquareTest@plt>
cmpl   $0x0,-0x44(%rbp)
movsd  %xmm0,-0x30(%rbp)
je     1584 <chi_of_data_files_v2+0x3b4>
lea    0xc1d(%rip),%rdi
lea    0xc30(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1638 <chi_of_data_files_v2+0x468>
mov    %rax,%r15
test   %r12d,%r12d
mov    -0x58(%rbp),%r14
movsd  -0x38(%rbp),%xmm0
je     1577 <chi_of_data_files_v2+0x3a7>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsd  0x0(%r13,%rbx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x0(%r13,%rbx,8)
movsd  (%r14,%rbx,8),%xmm0
mov    %r15,%rdi
lea    0xc1f(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
movsd  -0x38(%rbp),%xmm0
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1540 <chi_of_data_files_v2+0x370>
mov    %r15,%rdi
call   1040 <fclose@plt>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
movsd  %xmm1,-0x40(%rbp)
movapd %xmm1,%xmm0
jae    15a8 <chi_of_data_files_v2+0x3d8>
movsd  -0x30(%rbp),%xmm0
call   10c0 <sqrt@plt>
lea    0xbdb(%rip),%rdi
movsd  -0x38(%rbp),%xmm1
call   1050 <printf@plt>
movsd  -0x30(%rbp),%xmm0
ucomisd 0xa3a(%rip),%xmm0
movsd  -0x40(%rbp),%xmm1
jae    15d6 <chi_of_data_files_v2+0x406>
call   10c0 <sqrt@plt>
movapd %xmm0,%xmm1
mov    -0x60(%rbp),%rsp
movapd %xmm1,%xmm0
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x29ec(%rip),%rax
movslq (%rax),%rdi
lea    0xa0c(%rip),%rsi
mov    %r15,%rdx
jmp    1617 <chi_of_data_files_v2+0x447>
mov    0x29d6(%rip),%rax
movslq (%rax),%rdi
lea    0xa63(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1658 <chi_of_data_files_v2+0x488>
mov    0x29b9(%rip),%rax
movslq (%rax),%rcx
lea    0xaa4(%rip),%rdi
mov    $0x5a,%esi
jmp    164e <chi_of_data_files_v2+0x47e>
mov    0x29a1(%rip),%rax
movslq (%rax),%rcx
lea    0xb03(%rip),%rdi
mov    $0x34,%esi
mov    $0x1,%edx
call   10e0 <fwrite@plt>
mov    0x2979(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [45 x i8] c"ERROR: Experimental data file %s not found!\0A\00"
@EXIT_FAILURE = global i32 0
@stdout = global i32 0
@.str.2 = [51 x i8] c"Number of data points in experimental file is %d.\0A\00"
@.str.3 = [13 x i8] c"%lf %lf %lf\0A\00"
@.str.4 = [44 x i8] c"ERROR: Dear user, I couldn't read %s file!\0A\00"
@.str.5 = [50 x i8] c"Number of data points in theoretical file is %d.\0A\00"
@.str.6 = [91 x i8] c"ERROR: Number of data points in experimental and theoretical files is supposed to be same!\00"
@.str.7 = [9 x i8] c"%lf %lf\0A\00"
@.str.8 = [26 x i8] c"I_q_makowski_waxs_fit.dat\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [53 x i8] c"I_q_makowski_waxs_fit.dat file can not be produced!\0A\00"
@.str.11 = [9 x i8] c"%lf\09%lf\0A\00"
@.str.12 = [39 x i8] c"Chi Value=%lf\09Scaling coefficient:%lf\0A\00"
define double @chi_of_data_files_v2(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [255 x i8]
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
%16 = alloca i32*
%17 = alloca i64
%18 = alloca i64
%19 = alloca double
%20 = alloca double
%21 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
%22 = load i8*, i8** %4
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %23, i32** %9
%24 = load i32*, i32** %9
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %34
26: ; preds = %3
%27 = load i32, i32* @stderr
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to i32*
%30 = load i8*, i8** %4
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %3
%35 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%36 = call i32 @memset(i8* %35, i8 signext 0, i32 255)
store i32 0, i32* %10
br label %37
37: ; preds = %34, %52
%38 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%39 = load i32*, i32** %9
%40 = call i32* @fgets(i8* %38, i32 255, i32* %39)
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %43
42: ; preds = %37
br label %53
43: ; preds = %37
%44 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp ne i32 %46, 35
br i1 %47, label %48, label %51
48: ; preds = %43
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %51
51: ; preds = %48, %43
br label %52
52: ; preds = %51
br label %37
53: ; preds = %42
%54 = load i32, i32* %7
store i32 %54, i32* %10
%55 = load i32, i32* @stdout
%56 = sext i32 %55 to i64
%57 = inttoptr i64 %56 to i32*
%58 = load i32, i32* %7
%59 = call i32 (i32*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i32 %58)
%60 = load i32*, i32** %9
%61 = call i32 @rewind(i32* %60)
%62 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%63 = call i32 @memset(i8* %62, i8 signext 0, i32 255)
store i32 0, i32* %7
%64 = load i32, i32* %10
%65 = zext i32 %64 to i64
%66 = call i8* @llvm.stacksave()
store i8* %66, i8** %11
%67 = alloca double, i64 %65
store i64 %65, i64* %12
%68 = load i32, i32* %10
%69 = zext i32 %68 to i64
%70 = alloca double, i64 %69
store i64 %69, i64* %13
%71 = load i32, i32* %10
%72 = zext i32 %71 to i64
%73 = alloca double, i64 %72
store i64 %72, i64* %14
br label %74
74: ; preds = %101, %53
br label %75
75: ; preds = %74
%76 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%77 = load i32*, i32** %9
%78 = call i32* @fgets(i8* %76, i32 255, i32* %77)
%79 = icmp eq i32* %78, null
br i1 %79, label %80, label %81
80: ; preds = %75
br label %102
81: ; preds = %75
%82 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp ne i32 %84, 35
br i1 %85, label %86, label %100
86: ; preds = %81
%87 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%88 = load i32, i32* %7
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double, double* %67, i64 %89
%91 = load i32, i32* %7
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %70, i64 %92
%94 = load i32, i32* %7
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %73, i64 %95
%97 = call i32 (i8*, i8*, double*, double*, ...) @sscanf(i8* %87, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double* %90, double* %93, double* %96)
%98 = load i32, i32* %7
%99 = add nsw i32 %98, 1
store i32 %99, i32* %7
br label %100
100: ; preds = %86, %81
br label %101
101: ; preds = %100
br label %74
102: ; preds = %80
%103 = load i32*, i32** %9
%104 = call i32 @fclose(i32* %103)
store i32 0, i32* %15
%105 = load i8*, i8** %5
%106 = call i32* @fopen(i8* %105, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %106, i32** %16
%107 = load i32*, i32** %16
%108 = icmp eq i32* %107, null
br i1 %108, label %109, label %117
109: ; preds = %102
%110 = load i32, i32* @stderr
%111 = sext i32 %110 to i64
%112 = inttoptr i64 %111 to i32*
%113 = load i8*, i8** %5
%114 = call i32 (i32*, i8*, ...) @fprintf(i32* %112, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i8* %113)
%115 = load i32, i32* @EXIT_FAILURE
%116 = call i32 @exit(i32 %115)
unreachable
117: ; preds = %102
%118 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%119 = call i32 @memset(i8* %118, i8 signext 0, i32 255)
store i32 0, i32* %7
br label %120
120: ; preds = %136, %117
br label %121
121: ; preds = %120
%122 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%123 = load i32*, i32** %16
%124 = call i32* @fgets(i8* %122, i32 255, i32* %123)
%125 = icmp eq i32* %124, null
br i1 %125, label %126, label %127
126: ; preds = %121
br label %137
127: ; preds = %121
%128 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = icmp ne i32 %130, 35
br i1 %131, label %132, label %135
132: ; preds = %127
%133 = load i32, i32* %7
%134 = add nsw i32 %133, 1
store i32 %134, i32* %7
br label %135
135: ; preds = %132, %127
br label %136
136: ; preds = %135
br label %120
137: ; preds = %126
%138 = load i32, i32* %7
store i32 %138, i32* %15
%139 = load i32, i32* @stdout
%140 = sext i32 %139 to i64
%141 = inttoptr i64 %140 to i32*
%142 = load i32, i32* %7
%143 = call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i32 %142)
%144 = load i32, i32* %15
%145 = load i32, i32* %10
%146 = icmp ne i32 %144, %145
br i1 %146, label %147, label %154
147: ; preds = %137
%148 = load i32, i32* @stderr
%149 = sext i32 %148 to i64
%150 = inttoptr i64 %149 to i32*
%151 = call i32 (i32*, i8*, ...) @fprintf(i32* %150, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.6, i64 0, i64 0))
%152 = load i32, i32* @EXIT_FAILURE
%153 = call i32 @exit(i32 %152)
unreachable
154: ; preds = %137
%155 = load i32, i32* %10
%156 = zext i32 %155 to i64
%157 = alloca double, i64 %156
store i64 %156, i64* %17
%158 = load i32, i32* %10
%159 = zext i32 %158 to i64
%160 = alloca double, i64 %159
store i64 %159, i64* %18
store i32 0, i32* %7
br label %161
161: ; preds = %172, %154
%162 = load i32, i32* %7
%163 = load i32, i32* %15
%164 = icmp slt i32 %162, %163
br i1 %164, label %165, label %175
165: ; preds = %161
%166 = load i32, i32* %7
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds double, double* %160, i64 %167
store double 0.000000e+00, double* %168
%169 = load i32, i32* %7
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds double, double* %157, i64 %170
store double 0.000000e+00, double* %171
br label %172
172: ; preds = %165
%173 = load i32, i32* %7
%174 = add nsw i32 %173, 1
store i32 %174, i32* %7
br label %161
175: ; preds = %161
%176 = load i32*, i32** %16
%177 = call i32 @rewind(i32* %176)
%178 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%179 = call i32 @memset(i8* %178, i8 signext 0, i32 255)
store i32 0, i32* %7
br label %180
180: ; preds = %204, %175
br label %181
181: ; preds = %180
%182 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%183 = load i32*, i32** %16
%184 = call i32* @fgets(i8* %182, i32 255, i32* %183)
%185 = icmp eq i32* %184, null
br i1 %185, label %186, label %187
186: ; preds = %181
br label %205
187: ; preds = %181
%188 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%189 = load i8, i8* %188
%190 = sext i8 %189 to i32
%191 = icmp ne i32 %190, 35
br i1 %191, label %192, label %203
192: ; preds = %187
%193 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%194 = load i32, i32* %7
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds double, double* %160, i64 %195
%197 = load i32, i32* %7
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds double, double* %157, i64 %198
%200 = call i32 (i8*, i8*, double*, double*, ...) @sscanf(i8* %193, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), double* %196, double* %199)
%201 = load i32, i32* %7
%202 = add nsw i32 %201, 1
store i32 %202, i32* %7
br label %203
203: ; preds = %192, %187
br label %204
204: ; preds = %203
br label %180
205: ; preds = %186
%206 = load i32*, i32** %16
%207 = call i32 @fclose(i32* %206)
store double 0.000000e+00, double* %19
store double 0.000000e+00, double* %20
%208 = load i32, i32* %10
%209 = call double @scalingCoefficient(i32 %208, double* %70, double* %157, double* %73)
store double %209, double* %20
%210 = load i32, i32* %10
%211 = load double, double* %20
%212 = call double @chiSquareTest(i32 %210, double* %70, double* %157, double* %73, double %211)
store double %212, double* %19
%213 = load i32, i32* %6
%214 = icmp ne i32 %213, 0
br i1 %214, label %215, label %257
215: ; preds = %205
%216 = call i32* @fopen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %216, i32** %21
%217 = load i32*, i32** %21
%218 = icmp eq i32* %217, null
br i1 %218, label %219, label %226
219: ; preds = %215
%220 = load i32, i32* @stderr
%221 = sext i32 %220 to i64
%222 = inttoptr i64 %221 to i32*
%223 = call i32 (i32*, i8*, ...) @fprintf(i32* %222, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0))
%224 = load i32, i32* @EXIT_FAILURE
%225 = call i32 @exit(i32 %224)
unreachable
226: ; preds = %215
store i32 0, i32* %7
br label %227
227: ; preds = %251, %226
%228 = load i32, i32* %7
%229 = load i32, i32* %10
%230 = icmp slt i32 %228, %229
br i1 %230, label %231, label %254
231: ; preds = %227
%232 = load double, double* %20
%233 = load i32, i32* %7
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds double, double* %157, i64 %234
%236 = load double, double* %235
%237 = fmul double %232, %236
%238 = load i32, i32* %7
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds double, double* %157, i64 %239
store double %237, double* %240
%241 = load i32*, i32** %21
%242 = load i32, i32* %7
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds double, double* %67, i64 %243
%245 = load double, double* %244
%246 = load i32, i32* %7
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds double, double* %157, i64 %247
%249 = load double, double* %248
%250 = call i32 (i32*, i8*, ...) @fprintf(i32* %241, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), double %245, double %249)
br label %251
251: ; preds = %231
%252 = load i32, i32* %7
%253 = add nsw i32 %252, 1
store i32 %253, i32* %7
br label %227
254: ; preds = %227
%255 = load i32*, i32** %21
%256 = call i32 @fclose(i32* %255)
br label %257
257: ; preds = %254, %205
%258 = load double, double* %19
%259 = call double @sqrt(double %258)
%260 = load double, double* %20
%261 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.12, i64 0, i64 0), double %259, double %260)
%262 = load double, double* %19
%263 = call double @sqrt(double %262)
%264 = load i8*, i8** %11
ret double %263
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [45 x i8] c"ERROR: Experimental data file %s not found!\0A\00"
@EXIT_FAILURE = global i32 0
@stdout = global i32 0
@.str.2 = [51 x i8] c"Number of data points in experimental file is %d.\0A\00"
@.str.3 = [13 x i8] c"%lf %lf %lf\0A\00"
@.str.4 = [44 x i8] c"ERROR: Dear user, I couldn't read %s file!\0A\00"
@.str.5 = [50 x i8] c"Number of data points in theoretical file is %d.\0A\00"
@.str.6 = [91 x i8] c"ERROR: Number of data points in experimental and theoretical files is supposed to be same!\00"
@.str.7 = [9 x i8] c"%lf %lf\0A\00"
@.str.8 = [26 x i8] c"I_q_makowski_waxs_fit.dat\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [53 x i8] c"I_q_makowski_waxs_fit.dat file can not be produced!\0A\00"
@.str.11 = [9 x i8] c"%lf\09%lf\0A\00"
@.str.12 = [39 x i8] c"Chi Value=%lf\09Scaling coefficient:%lf\0A\00"
define double @chi_of_data_files_v2(i8* %0, i8* %1, i32 %2) {
%4 = alloca [255 x i8]
%5 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%6 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %15
8: ; preds = %3
%9 = load i32, i32* @stderr
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @exit(i32 %13)
unreachable
15: ; preds = %3
%16 = call i32 @memset(i8* %5, i8 signext 0, i32 255)
%17 = call i32* @fgets(i8* %5, i32 255, i32* %6)
%18 = icmp eq i32* %17, null
br i1 %18, label %27, label %19
19: ; preds = %15, %19
%20 = phi i32 [ %24, %19 ], [ 0, %15 ]
%21 = load i8, i8* %5
%22 = icmp ne i8 %21, 35
%23 = zext i1 %22 to i32
%24 = add nuw nsw i32 %20, %23
%25 = call i32* @fgets(i8* %5, i32 255, i32* %6)
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %19
27: ; preds = %19, %15
%28 = phi i32 [ 0, %15 ], [ %24, %19 ]
%29 = load i32, i32* @stdout
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to i32*
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%33 = call i32 @rewind(i32* %6)
%34 = call i32 @memset(i8* %5, i8 signext 0, i32 255)
%35 = zext i32 %28 to i64
%36 = call i8* @llvm.stacksave()
%37 = alloca double, i64 %35
%38 = alloca double, i64 %35
%39 = alloca double, i64 %35
%40 = call i32* @fgets(i8* %5, i32 255, i32* %6)
%41 = icmp eq i32* %40, null
br i1 %41, label %57, label %42
42: ; preds = %27, %53
%43 = phi i32 [ %54, %53 ], [ 0, %27 ]
%44 = load i8, i8* %5
%45 = icmp eq i8 %44, 35
br i1 %45, label %53, label %46
46: ; preds = %42
%47 = sext i32 %43 to i64
%48 = getelementptr inbounds double, double* %37, i64 %47
%49 = getelementptr inbounds double, double* %38, i64 %47
%50 = getelementptr inbounds double, double* %39, i64 %47
%51 = call i32 (i8*, i8*, double*, double*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double* %48, double* %49, double* %50)
%52 = add nsw i32 %43, 1
br label %53
53: ; preds = %42, %46
%54 = phi i32 [ %52, %46 ], [ %43, %42 ]
%55 = call i32* @fgets(i8* %5, i32 255, i32* %6)
%56 = icmp eq i32* %55, null
br i1 %56, label %57, label %42
57: ; preds = %53, %27
%58 = call i32 @fclose(i32* %6)
%59 = call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %68
61: ; preds = %57
%62 = load i32, i32* @stderr
%63 = sext i32 %62 to i64
%64 = inttoptr i64 %63 to i32*
%65 = call i32 (i32*, i8*, ...) @fprintf(i32* %64, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%66 = load i32, i32* @EXIT_FAILURE
%67 = call i32 @exit(i32 %66)
unreachable
68: ; preds = %57
%69 = call i32 @memset(i8* %5, i8 signext 0, i32 255)
%70 = call i32* @fgets(i8* %5, i32 255, i32* %59)
%71 = icmp eq i32* %70, null
br i1 %71, label %80, label %72
72: ; preds = %68, %72
%73 = phi i32 [ %77, %72 ], [ 0, %68 ]
%74 = load i8, i8* %5
%75 = icmp ne i8 %74, 35
%76 = zext i1 %75 to i32
%77 = add nuw nsw i32 %73, %76
%78 = call i32* @fgets(i8* %5, i32 255, i32* %59)
%79 = icmp eq i32* %78, null
br i1 %79, label %80, label %72
80: ; preds = %72, %68
%81 = phi i32 [ 0, %68 ], [ %77, %72 ]
%82 = load i32, i32* @stdout
%83 = sext i32 %82 to i64
%84 = inttoptr i64 %83 to i32*
%85 = call i32 (i32*, i8*, ...) @fprintf(i32* %84, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i32 %81)
%86 = icmp eq i32 %81, %28
br i1 %86, label %94, label %87
87: ; preds = %80
%88 = load i32, i32* @stderr
%89 = sext i32 %88 to i64
%90 = inttoptr i64 %89 to i32*
%91 = call i64 @fwrite(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.6, i64 0, i64 0), i64 90, i64 1, i32* %90)
%92 = load i32, i32* @EXIT_FAILURE
%93 = call i32 @exit(i32 %92)
unreachable
94: ; preds = %80
%95 = alloca double, i64 %35
%96 = alloca double, i64 %35
%97 = icmp eq i32 %28, 0
br i1 %97, label %102, label %98
98: ; preds = %94
%99 = bitcast double* %96 to i8*
%100 = bitcast double* %95 to i8*
%101 = shl nuw nsw i64 %35, 3
br label %102
102: ; preds = %98, %94
%103 = call i32 @rewind(i32* %59)
%104 = call i32 @memset(i8* %5, i8 signext 0, i32 255)
%105 = call i32* @fgets(i8* %5, i32 255, i32* %59)
%106 = icmp eq i32* %105, null
br i1 %106, label %121, label %107
107: ; preds = %102, %117
%108 = phi i32 [ %118, %117 ], [ 0, %102 ]
%109 = load i8, i8* %5
%110 = icmp eq i8 %109, 35
br i1 %110, label %117, label %111
111: ; preds = %107
%112 = sext i32 %108 to i64
%113 = getelementptr inbounds double, double* %96, i64 %112
%114 = getelementptr inbounds double, double* %95, i64 %112
%115 = call i32 (i8*, i8*, double*, double*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), double* %113, double* %114)
%116 = add nsw i32 %108, 1
br label %117
117: ; preds = %107, %111
%118 = phi i32 [ %116, %111 ], [ %108, %107 ]
%119 = call i32* @fgets(i8* %5, i32 255, i32* %59)
%120 = icmp eq i32* %119, null
br i1 %120, label %121, label %107
121: ; preds = %117, %102
%122 = call i32 @fclose(i32* %59)
%123 = call double @scalingCoefficient(i32 %28, double* %38, double* %95, double* %39)
%124 = call double @chiSquareTest(i32 %28, double* %38, double* %95, double* %39, double %123)
%125 = icmp eq i32 %2, 0
br i1 %125, label %149, label %126
126: ; preds = %121
%127 = call i32* @fopen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%128 = icmp eq i32* %127, null
br i1 %128, label %130, label %129
129: ; preds = %126
br i1 %97, label %147, label %137
130: ; preds = %126
%131 = load i32, i32* @stderr
%132 = sext i32 %131 to i64
%133 = inttoptr i64 %132 to i32*
%134 = call i64 @fwrite(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0), i64 52, i64 1, i32* %133)
%135 = load i32, i32* @EXIT_FAILURE
%136 = call i32 @exit(i32 %135)
unreachable
137: ; preds = %129, %137
%138 = phi i64 [ %145, %137 ], [ 0, %129 ]
%139 = getelementptr inbounds double, double* %95, i64 %138
%140 = load double, double* %139
%141 = fmul double %123, %140
store double %141, double* %139
%142 = getelementptr inbounds double, double* %37, i64 %138
%143 = load double, double* %142
%144 = call i32 (i32*, i8*, ...) @fprintf(i32* %127, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), double %143, double %141)
%145 = add nuw nsw i64 %138, 1
%146 = icmp eq i64 %145, %35
br i1 %146, label %147, label %137
147: ; preds = %137, %129
%148 = call i32 @fclose(i32* %127)
br label %149
149: ; preds = %147, %121
%150 = call double @sqrt(double %124)
%151 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.12, i64 0, i64 0), double %150, double %123)
%152 = call double @sqrt(double %124)
ret double %152
}