#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 *, ...);
double linterpolate(double, double, double, double, double);
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(char *experimentalFile, char *theoreticalFile,
                         int scaleTheoretical) {
  int i = 0, j = 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);
  double expArray[n_exp][3];
  rewind(EXP_FILE);
  memset(line, '\0', 255);
  i = 0;
  while (1) {
    if (fgets(line, sizeof(line), EXP_FILE) == NULL)
      break;
    else {
      if (line[0] != '#') {
        sscanf(line, "%lf %lf %lf\n", &expArray[i][0], &expArray[i][1],
               &expArray[i][2]);
        printf("%lf\t%lf\t%lf\n", expArray[i][0], expArray[i][1],
               expArray[i][2]);
        i++;
      }
    }
  }
  fclose(EXP_FILE);
  double exp_q[n_exp];
  double exp_I_q[n_exp];
  double sigma[n_exp];
  for (i = 0; i < n_exp; i++) {
    exp_q[i] = expArray[i][0];
    exp_I_q[i] = expArray[i][1];
    sigma[i] = expArray[i][2];
  }
  int n_theo = 0;
  FILE *THEO_FILE = fopen(theoreticalFile, "r");
  if (THEO_FILE == NULL) {
    fprintf(stderr, "ERROR: My dear, 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);
  double theoArray[n_theo][2];
  double theo_I_q[n_exp];
  for (i = 0; i < n_theo; i++) {
    theoArray[i][0] = 0.0;
    theoArray[i][1] = 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", &theoArray[i][0], &theoArray[i][1]);
        i++;
      }
    }
  }
  fclose(THEO_FILE);
  for (i = 0; i < n_exp; i++) {
    double x = exp_q[i];
    for (j = 0; j < n_theo; j++)
      if ((x >= theoArray[j][0]) && (x <= theoArray[j + 1][0])) {
        break;
      }
    theo_I_q[i] = linterpolate(theoArray[j][1], theoArray[j + 1][1],
                               theoArray[j][0], x, theoArray[j + 1][0]);
  }
  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)
    for (i = 0; i < n_exp; i++) {
      theo_I_q[i] = coeff * (theo_I_q[i]);
      printf("%lf\t%lf\n", exp_q[i], theo_I_q[i]);
    }
  printf("Chi Value=%lf\tScaling coefficient:%lf\n", sqrt(chiSqrdTestValue),
         coeff);
  return (sqrt(chiSqrdTestValue));
}


x86 assembly (clang, -O0):
<chi_of_data_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe01(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
jne    1242 <chi_of_data_files+0x72>
mov    0x2dc0(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xdd5(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
call   10e0 <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    1286 <chi_of_data_files+0xb6>
jmp    12a9 <chi_of_data_files+0xd9>
movsbl -0x120(%rbp),%eax
cmp    $0x23,%eax
je     129f <chi_of_data_files+0xcf>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12a4 <chi_of_data_files+0xd4>
jmp    125f <chi_of_data_files+0x8f>
mov    -0x18(%rbp),%eax
mov    %eax,-0x12c(%rbp)
mov    0x2d17(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
lea    0xd6a(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    -0x12c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x138(%rbp)
lea    (%rax,%rax,2),%rcx
lea    0xf(,%rcx,8),%rdx
movabs $0x3ffffffff0,%rcx
and    %rcx,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x198(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x140(%rbp)
mov    -0x128(%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    1337 <chi_of_data_files+0x167>
lea    -0x120(%rbp),%rdi
mov    -0x128(%rbp),%rdx
mov    $0xff,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    135e <chi_of_data_files+0x18e>
jmp    1416 <chi_of_data_files+0x246>
movsbl -0x120(%rbp),%eax
cmp    $0x23,%eax
je     140c <chi_of_data_files+0x23c>
mov    -0x198(%rbp),%r8
lea    -0x120(%rbp),%rdi
movslq -0x18(%rbp),%rax
imul   $0x18,%rax,%rax
mov    %r8,%rdx
add    %rax,%rdx
movslq -0x18(%rbp),%rax
imul   $0x18,%rax,%rax
mov    %r8,%rcx
add    %rax,%rcx
add    $0x8,%rcx
movslq -0x18(%rbp),%rax
imul   $0x18,%rax,%rax
add    %rax,%r8
add    $0x10,%r8
lea    0xcb0(%rip),%rsi
mov    $0x0,%al
call   10b0 <sscanf@plt>
mov    -0x198(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x18,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsd  (%rcx),%xmm0
movslq -0x18(%rbp),%rcx
imul   $0x18,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsd  0x8(%rcx),%xmm1
movslq -0x18(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
lea    0xc73(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1411 <chi_of_data_files+0x241>
jmp    1332 <chi_of_data_files+0x162>
mov    -0x128(%rbp),%rdi
call   1040 <fclose@plt>
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,-0x148(%rbp)
mov    -0x12c(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1a8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x150(%rbp)
mov    -0x12c(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1a0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x158(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x12c(%rbp),%eax
jge    152d <chi_of_data_files+0x35d>
mov    -0x1a0(%rbp),%rax
mov    -0x198(%rbp),%rcx
mov    -0x1a8(%rbp),%rdx
mov    -0x1b0(%rbp),%rsi
movslq -0x18(%rbp),%rdi
imul   $0x18,%rdi,%r8
mov    %rcx,%rdi
add    %r8,%rdi
movsd  (%rdi),%xmm0
movslq -0x18(%rbp),%rdi
movsd  %xmm0,(%rsi,%rdi,8)
movslq -0x18(%rbp),%rsi
imul   $0x18,%rsi,%rdi
mov    %rcx,%rsi
add    %rdi,%rsi
movsd  0x8(%rsi),%xmm0
movslq -0x18(%rbp),%rsi
movsd  %xmm0,(%rdx,%rsi,8)
movslq -0x18(%rbp),%rdx
imul   $0x18,%rdx,%rdx
add    %rdx,%rcx
movsd  0x10(%rcx),%xmm0
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    14a4 <chi_of_data_files+0x2d4>
movl   $0x0,-0x15c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xabe(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x168(%rbp)
cmpq   $0x0,-0x168(%rbp)
jne    1585 <chi_of_data_files+0x3b5>
mov    0x2a7d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xb0c(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2a5a(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
movl   $0x0,-0x18(%rbp)
jmp    15a4 <chi_of_data_files+0x3d4>
lea    -0x120(%rbp),%rdi
mov    -0x168(%rbp),%rdx
mov    $0xff,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    15cb <chi_of_data_files+0x3fb>
jmp    15ee <chi_of_data_files+0x41e>
movsbl -0x120(%rbp),%eax
cmp    $0x23,%eax
je     15e4 <chi_of_data_files+0x414>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    15e9 <chi_of_data_files+0x419>
jmp    159f <chi_of_data_files+0x3cf>
mov    -0x18(%rbp),%eax
mov    %eax,-0x15c(%rbp)
mov    0x29d2(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
lea    0xa9c(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    -0x15c(%rbp),%eax
mov    %rax,%rdx
shl    $0x4,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1c0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x170(%rbp)
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,-0x178(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x15c(%rbp),%eax
jge    16b1 <chi_of_data_files+0x4e1>
mov    -0x1c0(%rbp),%rax
movslq -0x18(%rbp),%rdx
shl    $0x4,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rcx)
movslq -0x18(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1665 <chi_of_data_files+0x495>
mov    -0x168(%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    16dc <chi_of_data_files+0x50c>
lea    -0x120(%rbp),%rdi
mov    -0x168(%rbp),%rdx
mov    $0xff,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    1703 <chi_of_data_files+0x533>
jmp    175f <chi_of_data_files+0x58f>
movsbl -0x120(%rbp),%eax
cmp    $0x23,%eax
je     1755 <chi_of_data_files+0x585>
mov    -0x1c0(%rbp),%rcx
lea    -0x120(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x4,%rax
mov    %rcx,%rdx
add    %rax,%rdx
movslq -0x18(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rcx
add    $0x8,%rcx
lea    0x921(%rip),%rsi
mov    $0x0,%al
call   10b0 <sscanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    175a <chi_of_data_files+0x58a>
jmp    16d7 <chi_of_data_files+0x507>
mov    -0x168(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x12c(%rbp),%eax
jge    189b <chi_of_data_files+0x6cb>
mov    -0x1b0(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x180(%rbp)
ff
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x15c(%rbp),%eax
jge    1818 <chi_of_data_files+0x648>
mov    -0x1c0(%rbp),%rax
movsd  -0x180(%rbp),%xmm0
ff
movslq -0x1c(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
ucomisd (%rax),%xmm0
jb     1805 <chi_of_data_files+0x635>
mov    -0x1c0(%rbp),%rax
movsd  -0x180(%rbp),%xmm1
ff
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1805 <chi_of_data_files+0x635>
jmp    1818 <chi_of_data_files+0x648>
jmp    180a <chi_of_data_files+0x63a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    17a0 <chi_of_data_files+0x5d0>
mov    -0x1c0(%rbp),%rax
movslq -0x1c(%rbp),%rdx
shl    $0x4,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsd  0x8(%rcx),%xmm0
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rdx
shl    $0x4,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsd  0x8(%rcx),%xmm1
movslq -0x1c(%rbp),%rdx
shl    $0x4,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsd  (%rcx),%xmm2
movsd  -0x180(%rbp),%xmm3
ff
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm4
call   10a0 <linterpolate@plt>
mov    -0x1b8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1772 <chi_of_data_files+0x5a2>
mov    -0x1a0(%rbp),%rcx
mov    -0x1b8(%rbp),%rdx
mov    -0x1a8(%rbp),%rsi
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x188(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x190(%rbp)
ff
mov    -0x12c(%rbp),%edi
call   10f0 <scalingCoefficient@plt>
mov    -0x1a8(%rbp),%rsi
mov    -0x1b8(%rbp),%rdx
mov    -0x1a0(%rbp),%rcx
movsd  %xmm0,-0x190(%rbp)
ff
mov    -0x12c(%rbp),%edi
movsd  -0x190(%rbp),%xmm0
ff
call   1030 <chiSquareTest@plt>
movsd  %xmm0,-0x188(%rbp)
ff
cmpl   $0x0,-0x14(%rbp)
je     1984 <chi_of_data_files+0x7b4>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x12c(%rbp),%eax
jge    197f <chi_of_data_files+0x7af>
mov    -0x1b8(%rbp),%rax
mov    -0x1b0(%rbp),%rcx
movsd  -0x190(%rbp),%xmm0
ff
movslq -0x18(%rbp),%rdx
mulsd  (%rax,%rdx,8),%xmm0
movslq -0x18(%rbp),%rdx
movsd  %xmm0,(%rax,%rdx,8)
movslq -0x18(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0x709(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    191a <chi_of_data_files+0x74a>
jmp    1984 <chi_of_data_files+0x7b4>
movsd  -0x188(%rbp),%xmm0
ff
call   10d0 <sqrt@plt>
movsd  -0x190(%rbp),%xmm1
ff
lea    0x738(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movsd  -0x188(%rbp),%xmm0
ff
call   10d0 <sqrt@plt>
mov    -0x138(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chi_of_data_files>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %edx,%ebx
mov    %rsi,-0x50(%rbp)
mov    %rdi,%r14
lea    0xe14(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1748 <chi_of_data_files+0x578>
mov    %rax,%r15
mov    %ebx,-0x54(%rbp)
lea    -0x160(%rbp),%r14
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
mov    %r14,%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1263 <chi_of_data_files+0x93>
xor    %ebx,%ebx
lea    -0x160(%rbp),%r14
xchg   %ax,%ax
xor    %eax,%eax
cmpb   $0x23,-0x160(%rbp)
setne  %al
add    %eax,%ebx
mov    %r14,%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
jne    1240 <chi_of_data_files+0x70>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
lea    0xdc4(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rsp,-0x60(%rbp)
mov    %ebx,%eax
mov    %rax,-0x30(%rbp)
lea    (%rax,%rax,2),%rax
lea    0xf(,%rax,8),%rax
movabs $0x3ffffffff0,%rcx
and    %rax,%rcx
mov    %rsp,%rbx
sub    %rcx,%rbx
mov    %rbx,%rsp
mov    %r15,%rdi
call   1060 <rewind@plt>
lea    -0x160(%rbp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
mov    %r14,%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1362 <chi_of_data_files+0x192>
lea    -0x160(%rbp),%r14
xor    %r12d,%r12d
jmp    1305 <chi_of_data_files+0x135>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1362 <chi_of_data_files+0x192>
cmpb   $0x23,-0x160(%rbp)
je     12f0 <chi_of_data_files+0x120>
movslq %r12d,%r12
lea    (%r12,%r12,2),%r13
lea    (%rbx,%r13,8),%rdx
lea    (%rbx,%r13,8),%rcx
add    $0x8,%rcx
lea    (%rbx,%r13,8),%r8
add    $0x10,%r8
mov    %r14,%rdi
lea    0xd37(%rip),%rsi
xor    %eax,%eax
call   10b0 <sscanf@plt>
movsd  (%rbx,%r13,8),%xmm0
movsd  0x8(%rbx,%r13,8),%xmm1
movsd  0x10(%rbx,%r13,8),%xmm2
lea    0xd22(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
add    $0x1,%r12d
jmp    12f0 <chi_of_data_files+0x120>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %rsp,%r14
mov    -0x30(%rbp),%rsi
lea    0xf(,%rsi,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
mov    %rsp,%r13
mov    %rax,-0x48(%rbp)
sub    %rax,%r13
mov    %r13,%rsp
test   %rsi,%rsi
je     143e <chi_of_data_files+0x26e>
cmp    $0x1,%esi
jne    13ab <chi_of_data_files+0x1db>
xor    %eax,%eax
jmp    13fe <chi_of_data_files+0x22e>
mov    %esi,%eax
and    $0xfffffffe,%eax
lea    0x28(%rbx),%rcx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
movsd  -0x28(%rcx),%xmm0
movhps -0x10(%rcx),%xmm0
movaps %xmm0,(%r14,%rdx,8)
movsd  -0x20(%rcx),%xmm0
movhps -0x8(%rcx),%xmm0
movaps %xmm0,(%r12,%rdx,8)
movsd  -0x18(%rcx),%xmm0
movhpd (%rcx),%xmm0
movapd %xmm0,0x0(%r13,%rdx,8)
add    $0x2,%rdx
add    $0x30,%rcx
cmp    %rdx,%rax
jne    13c0 <chi_of_data_files+0x1f0>
cmp    %rsi,%rax
je     143e <chi_of_data_files+0x26e>
lea    (%rax,%rax,2),%rcx
lea    (%rbx,%rcx,8),%rcx
add    $0x10,%rcx
nopw   0x0(%rax,%rax,1)
movsd  -0x10(%rcx),%xmm0
movsd  %xmm0,(%r14,%rax,8)
movsd  -0x8(%rcx),%xmm0
movsd  %xmm0,(%r12,%rax,8)
movsd  (%rcx),%xmm0
movsd  %xmm0,0x0(%r13,%rax,8)
add    $0x1,%rax
add    $0x18,%rcx
cmp    %rax,%rsi
jne    1410 <chi_of_data_files+0x240>
lea    0xbc3(%rip),%rsi
mov    -0x50(%rbp),%rbx
mov    %rbx,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     175d <chi_of_data_files+0x58d>
mov    %rax,%r15
mov    %r13,-0x38(%rbp)
mov    %r12,-0x40(%rbp)
mov    %r14,-0x50(%rbp)
lea    -0x160(%rbp),%rbx
xor    %r12d,%r12d
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     14d4 <chi_of_data_files+0x304>
xor    %r12d,%r12d
lea    -0x160(%rbp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
cmpb   $0x23,-0x160(%rbp)
setne  %al
add    %eax,%r12d
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
jne    14b0 <chi_of_data_files+0x2e0>
mov    %r12d,%r14d
mov    0x2af2(%rip),%rax
mov    (%rax),%edi
lea    0xbc7(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rsp,%r13
mov    %r14,%rdx
shl    $0x4,%rdx
sub    %rdx,%r13
mov    %r13,%rsp
mov    %rsp,%rax
sub    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    %rax,%rsp
test   %r12d,%r12d
je     151e <chi_of_data_files+0x34e>
mov    %r13,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
mov    %r15,%rdi
call   1060 <rewind@plt>
lea    -0x160(%rbp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
mov    %r12,%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     15aa <chi_of_data_files+0x3da>
lea    -0x160(%rbp),%r12
xor    %ebx,%ebx
jmp    1575 <chi_of_data_files+0x3a5>
nopl   0x0(%rax)
mov    %r12,%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     15aa <chi_of_data_files+0x3da>
cmpb   $0x23,-0x160(%rbp)
je     1560 <chi_of_data_files+0x390>
movslq %ebx,%rbx
mov    %rbx,%rax
shl    $0x4,%rax
lea    (%rax,%r13,1),%rdx
lea    (%rax,%r13,1),%rcx
add    $0x8,%rcx
mov    %r12,%rdi
lea    0xad0(%rip),%rsi
xor    %eax,%eax
call   10b0 <sscanf@plt>
add    $0x1,%ebx
jmp    1560 <chi_of_data_files+0x390>
mov    %r15,%rdi
call   1040 <fclose@plt>
cmpq   $0x0,-0x30(%rbp)
mov    -0x54(%rbp),%r12d
je     1650 <chi_of_data_files+0x480>
lea    0x10(%r13),%r15
xor    %ebx,%ebx
jmp    160d <chi_of_data_files+0x43d>
nopl   0x0(%rax)
mov    %r14d,%eax
mov    %eax,%eax
shl    $0x4,%rax
movsd  0x0(%r13,%rax,1),%xmm2
movsd  0x8(%r13,%rax,1),%xmm0
movsd  0x18(%r13,%rax,1),%xmm1
movsd  0x10(%r13,%rax,1),%xmm4
call   10a0 <linterpolate@plt>
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax,%rbx,8)
add    $0x1,%rbx
cmp    -0x30(%rbp),%rbx
je     1650 <chi_of_data_files+0x480>
mov    -0x50(%rbp),%rax
movsd  (%rax,%rbx,8),%xmm3
mov    $0x0,%eax
test   %r14,%r14
je     15d3 <chi_of_data_files+0x403>
mov    %r15,%rcx
xor    %eax,%eax
jmp    163d <chi_of_data_files+0x46d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
add    $0x10,%rcx
cmp    %rax,%r14
je     15d0 <chi_of_data_files+0x400>
ucomisd -0x10(%rcx),%xmm3
jb     1630 <chi_of_data_files+0x460>
movsd  (%rcx),%xmm0
ucomisd %xmm3,%xmm0
jb     1630 <chi_of_data_files+0x460>
jmp    15d3 <chi_of_data_files+0x403>
mov    -0x30(%rbp),%r15
mov    %r15d,%edi
mov    -0x40(%rbp),%rbx
mov    %rbx,%rsi
mov    -0x48(%rbp),%r13
mov    %r13,%rdx
mov    -0x38(%rbp),%r14
mov    %r14,%rcx
call   10f0 <scalingCoefficient@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r14,%rcx
movsd  %xmm0,-0x40(%rbp)
call   1030 <chiSquareTest@plt>
movsd  %xmm0,-0x38(%rbp)
test   %r12d,%r12d
mov    -0x50(%rbp),%r12
je     16dc <chi_of_data_files+0x50c>
test   %r15d,%r15d
je     16dc <chi_of_data_files+0x50c>
xor    %ebx,%ebx
lea    0x9d8(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x0(%r13,%rbx,8),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  %xmm1,0x0(%r13,%rbx,8)
movsd  (%r12,%rbx,8),%xmm0
mov    %r14,%rdi
mov    $0x2,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    16b0 <chi_of_data_files+0x4e0>
movsd  -0x38(%rbp),%xmm1
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
movsd  %xmm0,-0x30(%rbp)
jae    1701 <chi_of_data_files+0x531>
movsd  -0x38(%rbp),%xmm0
call   10d0 <sqrt@plt>
lea    0x9d8(%rip),%rdi
movsd  -0x40(%rbp),%xmm1
mov    $0x2,%al
call   1050 <printf@plt>
movsd  -0x38(%rbp),%xmm0
ucomisd 0x8df(%rip),%xmm0
movsd  -0x30(%rbp),%xmm1
jae    1731 <chi_of_data_files+0x561>
call   10d0 <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    0x2891(%rip),%rax
mov    (%rax),%edi
lea    0x8b2(%rip),%rsi
mov    %r14,%rdx
jmp    1770 <chi_of_data_files+0x5a0>
mov    0x287c(%rip),%rax
mov    (%rax),%edi
lea    0x917(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x285a(%rip),%rax
mov    (%rax),%edi
call   10e0 <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 = [13 x i8] c"%lf\09%lf\09%lf\0A\00"
@.str.5 = [42 x i8] c"ERROR: My dear, I couldn't read %s file!\0A\00"
@.str.6 = [50 x i8] c"Number of data points in theoretical file is %d.\0A\00"
@.str.7 = [9 x i8] c"%lf %lf\0A\00"
@.str.8 = [9 x i8] c"%lf\09%lf\0A\00"
@.str.9 = [39 x i8] c"Chi Value=%lf\09Scaling coefficient:%lf\0A\00"
define double @chi_of_data_files(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [255 x i8]
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i32
%18 = alloca i32*
%19 = alloca i64
%20 = alloca i64
%21 = alloca double
%22 = alloca double
%23 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%24 = load i8*, i8** %4
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %25, i32** %10
%26 = load i32*, i32** %10
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %34
28: ; preds = %3
%29 = load i32, i32* @stderr
%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]* %9, i64 0, i64 0
%36 = call i32 @memset(i8* %35, i8 signext 0, i32 255)
store i32 0, i32* %11
br label %37
37: ; preds = %34, %52
%38 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%39 = load i32*, i32** %10
%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]* %9, 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* %11
%55 = load i32, i32* @stdout
%56 = load i32, i32* %7
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %11
%59 = zext i32 %58 to i64
%60 = call i8* @llvm.stacksave()
store i8* %60, i8** %12
%61 = alloca [3 x double], i64 %59
store i64 %59, i64* %13
%62 = load i32*, i32** %10
%63 = call i32 @rewind(i32* %62)
%64 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%65 = call i32 @memset(i8* %64, i8 signext 0, i32 255)
store i32 0, i32* %7
br label %66
66: ; preds = %112, %53
br label %67
67: ; preds = %66
%68 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%69 = load i32*, i32** %10
%70 = call i32* @fgets(i8* %68, i32 255, i32* %69)
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %73
72: ; preds = %67
br label %113
73: ; preds = %67
%74 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp ne i32 %76, 35
br i1 %77, label %78, label %111
78: ; preds = %73
%79 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%80 = load i32, i32* %7
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 %81
%83 = getelementptr inbounds [3 x double], [3 x double]* %82, i64 0, i64 0
%84 = load i32, i32* %7
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 %85
%87 = getelementptr inbounds [3 x double], [3 x double]* %86, i64 0, i64 1
%88 = load i32, i32* %7
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 %89
%91 = getelementptr inbounds [3 x double], [3 x double]* %90, i64 0, i64 2
%92 = call i32 (i8*, i8*, double*, double*, ...) @sscanf(i8* %79, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double* %83, double* %87, double* %91)
%93 = load i32, i32* %7
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 %94
%96 = getelementptr inbounds [3 x double], [3 x double]* %95, i64 0, i64 0
%97 = load double, double* %96
%98 = load i32, i32* %7
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 %99
%101 = getelementptr inbounds [3 x double], [3 x double]* %100, i64 0, i64 1
%102 = load double, double* %101
%103 = load i32, i32* %7
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 %104
%106 = getelementptr inbounds [3 x double], [3 x double]* %105, i64 0, i64 2
%107 = load double, double* %106
%108 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double %97, double %102, double %107)
%109 = load i32, i32* %7
%110 = add nsw i32 %109, 1
store i32 %110, i32* %7
br label %111
111: ; preds = %78, %73
br label %112
112: ; preds = %111
br label %66
113: ; preds = %72
%114 = load i32*, i32** %10
%115 = call i32 @fclose(i32* %114)
%116 = load i32, i32* %11
%117 = zext i32 %116 to i64
%118 = alloca double, i64 %117
store i64 %117, i64* %14
%119 = load i32, i32* %11
%120 = zext i32 %119 to i64
%121 = alloca double, i64 %120
store i64 %120, i64* %15
%122 = load i32, i32* %11
%123 = zext i32 %122 to i64
%124 = alloca double, i64 %123
store i64 %123, i64* %16
store i32 0, i32* %7
br label %125
125: ; preds = %154, %113
%126 = load i32, i32* %7
%127 = load i32, i32* %11
%128 = icmp slt i32 %126, %127
br i1 %128, label %129, label %157
129: ; preds = %125
%130 = load i32, i32* %7
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 %131
%133 = getelementptr inbounds [3 x double], [3 x double]* %132, i64 0, i64 0
%134 = load double, double* %133
%135 = load i32, i32* %7
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds double, double* %118, i64 %136
store double %134, double* %137
%138 = load i32, i32* %7
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 %139
%141 = getelementptr inbounds [3 x double], [3 x double]* %140, i64 0, i64 1
%142 = load double, double* %141
%143 = load i32, i32* %7
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds double, double* %121, i64 %144
store double %142, double* %145
%146 = load i32, i32* %7
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 %147
%149 = getelementptr inbounds [3 x double], [3 x double]* %148, i64 0, i64 2
%150 = load double, double* %149
%151 = load i32, i32* %7
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds double, double* %124, i64 %152
store double %150, double* %153
br label %154
154: ; preds = %129
%155 = load i32, i32* %7
%156 = add nsw i32 %155, 1
store i32 %156, i32* %7
br label %125
157: ; preds = %125
store i32 0, i32* %17
%158 = load i8*, i8** %5
%159 = call i32* @fopen(i8* %158, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %159, i32** %18
%160 = load i32*, i32** %18
%161 = icmp eq i32* %160, null
br i1 %161, label %162, label %168
162: ; preds = %157
%163 = load i32, i32* @stderr
%164 = load i8*, i8** %5
%165 = call i32 (i32, i8*, ...) @fprintf(i32 %163, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8* %164)
%166 = load i32, i32* @EXIT_FAILURE
%167 = call i32 @exit(i32 %166)
unreachable
168: ; preds = %157
%169 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%170 = call i32 @memset(i8* %169, i8 signext 0, i32 255)
store i32 0, i32* %7
br label %171
171: ; preds = %187, %168
br label %172
172: ; preds = %171
%173 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%174 = load i32*, i32** %18
%175 = call i32* @fgets(i8* %173, i32 255, i32* %174)
%176 = icmp eq i32* %175, null
br i1 %176, label %177, label %178
177: ; preds = %172
br label %188
178: ; preds = %172
%179 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%180 = load i8, i8* %179
%181 = sext i8 %180 to i32
%182 = icmp ne i32 %181, 35
br i1 %182, label %183, label %186
183: ; preds = %178
%184 = load i32, i32* %7
%185 = add nsw i32 %184, 1
store i32 %185, i32* %7
br label %186
186: ; preds = %183, %178
br label %187
187: ; preds = %186
br label %171
188: ; preds = %177
%189 = load i32, i32* %7
store i32 %189, i32* %17
%190 = load i32, i32* @stdout
%191 = load i32, i32* %7
%192 = call i32 (i32, i8*, ...) @fprintf(i32 %190, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i32 %191)
%193 = load i32, i32* %17
%194 = zext i32 %193 to i64
%195 = alloca [2 x double], i64 %194
store i64 %194, i64* %19
%196 = load i32, i32* %11
%197 = zext i32 %196 to i64
%198 = alloca double, i64 %197
store i64 %197, i64* %20
store i32 0, i32* %7
br label %199
199: ; preds = %212, %188
%200 = load i32, i32* %7
%201 = load i32, i32* %17
%202 = icmp slt i32 %200, %201
br i1 %202, label %203, label %215
203: ; preds = %199
%204 = load i32, i32* %7
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds [2 x double], [2 x double]* %195, i64 %205
%207 = getelementptr inbounds [2 x double], [2 x double]* %206, i64 0, i64 0
store double 0.000000e+00, double* %207
%208 = load i32, i32* %7
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds [2 x double], [2 x double]* %195, i64 %209
%211 = getelementptr inbounds [2 x double], [2 x double]* %210, i64 0, i64 1
store double 0.000000e+00, double* %211
br label %212
212: ; preds = %203
%213 = load i32, i32* %7
%214 = add nsw i32 %213, 1
store i32 %214, i32* %7
br label %199
215: ; preds = %199
%216 = load i32*, i32** %18
%217 = call i32 @rewind(i32* %216)
%218 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%219 = call i32 @memset(i8* %218, i8 signext 0, i32 255)
store i32 0, i32* %7
br label %220
220: ; preds = %246, %215
br label %221
221: ; preds = %220
%222 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%223 = load i32*, i32** %18
%224 = call i32* @fgets(i8* %222, i32 255, i32* %223)
%225 = icmp eq i32* %224, null
br i1 %225, label %226, label %227
226: ; preds = %221
br label %247
227: ; preds = %221
%228 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%229 = load i8, i8* %228
%230 = sext i8 %229 to i32
%231 = icmp ne i32 %230, 35
br i1 %231, label %232, label %245
232: ; preds = %227
%233 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%234 = load i32, i32* %7
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds [2 x double], [2 x double]* %195, i64 %235
%237 = getelementptr inbounds [2 x double], [2 x double]* %236, i64 0, i64 0
%238 = load i32, i32* %7
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds [2 x double], [2 x double]* %195, i64 %239
%241 = getelementptr inbounds [2 x double], [2 x double]* %240, i64 0, i64 1
%242 = call i32 (i8*, i8*, double*, double*, ...) @sscanf(i8* %233, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), double* %237, double* %241)
%243 = load i32, i32* %7
%244 = add nsw i32 %243, 1
store i32 %244, i32* %7
br label %245
245: ; preds = %232, %227
br label %246
246: ; preds = %245
br label %220
247: ; preds = %226
%248 = load i32*, i32** %18
%249 = call i32 @fclose(i32* %248)
store i32 0, i32* %7
br label %250
250: ; preds = %313, %247
%251 = load i32, i32* %7
%252 = load i32, i32* %11
%253 = icmp slt i32 %251, %252
br i1 %253, label %254, label %316
254: ; preds = %250
%255 = load i32, i32* %7
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds double, double* %118, i64 %256
%258 = load double, double* %257
store double %258, double* %21
store i32 0, i32* %8
br label %259
259: ; preds = %282, %254
%260 = load i32, i32* %8
%261 = load i32, i32* %17
%262 = icmp slt i32 %260, %261
br i1 %262, label %263, label %285
263: ; preds = %259
%264 = load double, double* %21
%265 = load i32, i32* %8
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds [2 x double], [2 x double]* %195, i64 %266
%268 = getelementptr inbounds [2 x double], [2 x double]* %267, i64 0, i64 0
%269 = load double, double* %268
%270 = fcmp oge double %264, %269
br i1 %270, label %271, label %281
271: ; preds = %263
%272 = load double, double* %21
%273 = load i32, i32* %8
%274 = add nsw i32 %273, 1
%275 = sext i32 %274 to i64
%276 = getelementptr inbounds [2 x double], [2 x double]* %195, i64 %275
%277 = getelementptr inbounds [2 x double], [2 x double]* %276, i64 0, i64 0
%278 = load double, double* %277
%279 = fcmp ole double %272, %278
br i1 %279, label %280, label %281
280: ; preds = %271
br label %285
281: ; preds = %271, %263
br label %282
282: ; preds = %281
%283 = load i32, i32* %8
%284 = add nsw i32 %283, 1
store i32 %284, i32* %8
br label %259
285: ; preds = %280, %259
%286 = load i32, i32* %8
%287 = sext i32 %286 to i64
%288 = getelementptr inbounds [2 x double], [2 x double]* %195, i64 %287
%289 = getelementptr inbounds [2 x double], [2 x double]* %288, i64 0, i64 1
%290 = load double, double* %289
%291 = load i32, i32* %8
%292 = add nsw i32 %291, 1
%293 = sext i32 %292 to i64
%294 = getelementptr inbounds [2 x double], [2 x double]* %195, i64 %293
%295 = getelementptr inbounds [2 x double], [2 x double]* %294, i64 0, i64 1
%296 = load double, double* %295
%297 = load i32, i32* %8
%298 = sext i32 %297 to i64
%299 = getelementptr inbounds [2 x double], [2 x double]* %195, i64 %298
%300 = getelementptr inbounds [2 x double], [2 x double]* %299, i64 0, i64 0
%301 = load double, double* %300
%302 = load double, double* %21
%303 = load i32, i32* %8
%304 = add nsw i32 %303, 1
%305 = sext i32 %304 to i64
%306 = getelementptr inbounds [2 x double], [2 x double]* %195, i64 %305
%307 = getelementptr inbounds [2 x double], [2 x double]* %306, i64 0, i64 0
%308 = load double, double* %307
%309 = call double @linterpolate(double %290, double %296, double %301, double %302, double %308)
%310 = load i32, i32* %7
%311 = sext i32 %310 to i64
%312 = getelementptr inbounds double, double* %198, i64 %311
store double %309, double* %312
br label %313
313: ; preds = %285
%314 = load i32, i32* %7
%315 = add nsw i32 %314, 1
store i32 %315, i32* %7
br label %250
316: ; preds = %250
store double 0.000000e+00, double* %22
store double 0.000000e+00, double* %23
%317 = load i32, i32* %11
%318 = call double @scalingCoefficient(i32 %317, double* %121, double* %198, double* %124)
store double %318, double* %23
%319 = load i32, i32* %11
%320 = load double, double* %23
%321 = call double @chiSquareTest(i32 %319, double* %121, double* %198, double* %124, double %320)
store double %321, double* %22
%322 = load i32, i32* %6
%323 = icmp ne i32 %322, 0
br i1 %323, label %324, label %352
324: ; preds = %316
store i32 0, i32* %7
br label %325
325: ; preds = %348, %324
%326 = load i32, i32* %7
%327 = load i32, i32* %11
%328 = icmp slt i32 %326, %327
br i1 %328, label %329, label %351
329: ; preds = %325
%330 = load double, double* %23
%331 = load i32, i32* %7
%332 = sext i32 %331 to i64
%333 = getelementptr inbounds double, double* %198, i64 %332
%334 = load double, double* %333
%335 = fmul double %330, %334
%336 = load i32, i32* %7
%337 = sext i32 %336 to i64
%338 = getelementptr inbounds double, double* %198, i64 %337
store double %335, double* %338
%339 = load i32, i32* %7
%340 = sext i32 %339 to i64
%341 = getelementptr inbounds double, double* %118, i64 %340
%342 = load double, double* %341
%343 = load i32, i32* %7
%344 = sext i32 %343 to i64
%345 = getelementptr inbounds double, double* %198, i64 %344
%346 = load double, double* %345
%347 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), double %342, double %346)
br label %348
348: ; preds = %329
%349 = load i32, i32* %7
%350 = add nsw i32 %349, 1
store i32 %350, i32* %7
br label %325
351: ; preds = %325
br label %352
352: ; preds = %351, %316
%353 = load double, double* %22
%354 = call double @sqrt(double %353)
%355 = load double, double* %23
%356 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0), double %354, double %355)
%357 = load double, double* %22
%358 = call double @sqrt(double %357)
%359 = load i8*, i8** %12
ret double %358
}

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 = [13 x i8] c"%lf\09%lf\09%lf\0A\00"
@.str.5 = [42 x i8] c"ERROR: My dear, I couldn't read %s file!\0A\00"
@.str.6 = [50 x i8] c"Number of data points in theoretical file is %d.\0A\00"
@.str.7 = [9 x i8] c"%lf %lf\0A\00"
@.str.8 = [9 x i8] c"%lf\09%lf\0A\00"
@.str.9 = [39 x i8] c"Chi Value=%lf\09Scaling coefficient:%lf\0A\00"
define double @chi_of_data_files(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 %13
8: ; preds = %3
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %3
%14 = call i32 @memset(i8* %5, i8 signext 0, i32 255)
%15 = call i32* @fgets(i8* %5, i32 255, i32* %6)
%16 = icmp eq i32* %15, null
br i1 %16, label %25, label %17
17: ; preds = %13, %17
%18 = phi i32 [ %22, %17 ], [ 0, %13 ]
%19 = load i8, i8* %5
%20 = icmp ne i8 %19, 35
%21 = zext i1 %20 to i32
%22 = add nuw nsw i32 %18, %21
%23 = call i32* @fgets(i8* %5, i32 255, i32* %6)
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %17
25: ; preds = %17, %13
%26 = phi i32 [ 0, %13 ], [ %22, %17 ]
%27 = load i32, i32* @stdout
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%29 = zext i32 %26 to i64
%30 = call i8* @llvm.stacksave()
%31 = alloca [3 x double], i64 %29
%32 = call i32 @rewind(i32* %6)
%33 = call i32 @memset(i8* %5, i8 signext 0, i32 255)
%34 = call i32* @fgets(i8* %5, i32 255, i32* %6)
%35 = icmp eq i32* %34, null
br i1 %35, label %55, label %36
36: ; preds = %25, %51
%37 = phi i32 [ %52, %51 ], [ 0, %25 ]
%38 = load i8, i8* %5
%39 = icmp eq i8 %38, 35
br i1 %39, label %51, label %40
40: ; preds = %36
%41 = sext i32 %37 to i64
%42 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %41, i64 0
%43 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %41, i64 1
%44 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %41, i64 2
%45 = 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* %42, double* %43, double* %44)
%46 = load double, double* %42
%47 = load double, double* %43
%48 = load double, double* %44
%49 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double %46, double %47, double %48)
%50 = add nsw i32 %37, 1
br label %51
51: ; preds = %36, %40
%52 = phi i32 [ %50, %40 ], [ %37, %36 ]
%53 = call i32* @fgets(i8* %5, i32 255, i32* %6)
%54 = icmp eq i32* %53, null
br i1 %54, label %55, label %36
55: ; preds = %51, %25
%56 = call i32 @fclose(i32* %6)
%57 = alloca double, i64 %29
%58 = alloca double, i64 %29
%59 = alloca double, i64 %29
%60 = icmp eq i32 %26, 0
br i1 %60, label %111, label %61
61: ; preds = %55
%62 = icmp eq i32 %26, 1
br i1 %62, label %96, label %63
63: ; preds = %61
%64 = and i64 %29, 4294967294
br label %65
65: ; preds = %65, %63
%66 = phi i64 [ 0, %63 ], [ %92, %65 ]
%67 = or i64 %66, 1
%68 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %66, i64 0
%69 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %67, i64 0
%70 = load double, double* %68
%71 = load double, double* %69
%72 = insertelement <2 x double> poison, double %70, i64 0
%73 = insertelement <2 x double> %72, double %71, i64 1
%74 = getelementptr inbounds double, double* %57, i64 %66
%75 = bitcast double* %74 to <2 x double>*
store <2 x double> %73, <2 x double>* %75
%76 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %66, i64 1
%77 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %67, i64 1
%78 = load double, double* %76
%79 = load double, double* %77
%80 = insertelement <2 x double> poison, double %78, i64 0
%81 = insertelement <2 x double> %80, double %79, i64 1
%82 = getelementptr inbounds double, double* %58, i64 %66
%83 = bitcast double* %82 to <2 x double>*
store <2 x double> %81, <2 x double>* %83
%84 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %66, i64 2
%85 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %67, i64 2
%86 = load double, double* %84
%87 = load double, double* %85
%88 = insertelement <2 x double> poison, double %86, i64 0
%89 = insertelement <2 x double> %88, double %87, i64 1
%90 = getelementptr inbounds double, double* %59, i64 %66
%91 = bitcast double* %90 to <2 x double>*
store <2 x double> %89, <2 x double>* %91
%92 = add nuw i64 %66, 2
%93 = icmp eq i64 %92, %64
br i1 %93, label %94, label %65
94: ; preds = %65
%95 = icmp eq i64 %64, %29
br i1 %95, label %111, label %96
96: ; preds = %61, %94
%97 = phi i64 [ 0, %61 ], [ %64, %94 ]
br label %98
98: ; preds = %96, %98
%99 = phi i64 [ %109, %98 ], [ %97, %96 ]
%100 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %99, i64 0
%101 = load double, double* %100
%102 = getelementptr inbounds double, double* %57, i64 %99
store double %101, double* %102
%103 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %99, i64 1
%104 = load double, double* %103
%105 = getelementptr inbounds double, double* %58, i64 %99
store double %104, double* %105
%106 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %99, i64 2
%107 = load double, double* %106
%108 = getelementptr inbounds double, double* %59, i64 %99
store double %107, double* %108
%109 = add nuw nsw i64 %99, 1
%110 = icmp eq i64 %109, %29
br i1 %110, label %111, label %98
111: ; preds = %98, %94, %55
%112 = call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%113 = icmp eq i32* %112, null
br i1 %113, label %114, label %119
114: ; preds = %111
%115 = load i32, i32* @stderr
%116 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%117 = load i32, i32* @EXIT_FAILURE
%118 = call i32 @exit(i32 %117)
unreachable
119: ; preds = %111
%120 = call i32 @memset(i8* %5, i8 signext 0, i32 255)
%121 = call i32* @fgets(i8* %5, i32 255, i32* %112)
%122 = icmp eq i32* %121, null
br i1 %122, label %131, label %123
123: ; preds = %119, %123
%124 = phi i32 [ %128, %123 ], [ 0, %119 ]
%125 = load i8, i8* %5
%126 = icmp ne i8 %125, 35
%127 = zext i1 %126 to i32
%128 = add nuw nsw i32 %124, %127
%129 = call i32* @fgets(i8* %5, i32 255, i32* %112)
%130 = icmp eq i32* %129, null
br i1 %130, label %131, label %123
131: ; preds = %123, %119
%132 = phi i32 [ 0, %119 ], [ %128, %123 ]
%133 = load i32, i32* @stdout
%134 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i32 %132)
%135 = zext i32 %132 to i64
%136 = alloca [2 x double], i64 %135
%137 = alloca double, i64 %29
%138 = icmp eq i32 %132, 0
br i1 %138, label %142, label %139
139: ; preds = %131
%140 = bitcast [2 x double]* %136 to i8*
%141 = shl nuw nsw i64 %135, 4
br label %142
142: ; preds = %139, %131
%143 = call i32 @rewind(i32* %112)
%144 = call i32 @memset(i8* %5, i8 signext 0, i32 255)
%145 = call i32* @fgets(i8* %5, i32 255, i32* %112)
%146 = icmp eq i32* %145, null
br i1 %146, label %161, label %147
147: ; preds = %142, %157
%148 = phi i32 [ %158, %157 ], [ 0, %142 ]
%149 = load i8, i8* %5
%150 = icmp eq i8 %149, 35
br i1 %150, label %157, label %151
151: ; preds = %147
%152 = sext i32 %148 to i64
%153 = getelementptr inbounds [2 x double], [2 x double]* %136, i64 %152, i64 0
%154 = getelementptr inbounds [2 x double], [2 x double]* %136, i64 %152, i64 1
%155 = 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* %153, double* %154)
%156 = add nsw i32 %148, 1
br label %157
157: ; preds = %147, %151
%158 = phi i32 [ %156, %151 ], [ %148, %147 ]
%159 = call i32* @fgets(i8* %5, i32 255, i32* %112)
%160 = icmp eq i32* %159, null
br i1 %160, label %161, label %147
161: ; preds = %157, %142
%162 = call i32 @fclose(i32* %112)
br i1 %60, label %198, label %163
163: ; preds = %161, %181
%164 = phi i64 [ %196, %181 ], [ 0, %161 ]
%165 = getelementptr inbounds double, double* %57, i64 %164
%166 = load double, double* %165
br i1 %138, label %181, label %167
167: ; preds = %163, %177
%168 = phi i64 [ %172, %177 ], [ 0, %163 ]
%169 = getelementptr inbounds [2 x double], [2 x double]* %136, i64 %168, i64 0
%170 = load double, double* %169
%171 = fcmp ult double %166, %170
%172 = add nuw nsw i64 %168, 1
br i1 %171, label %177, label %173
173: ; preds = %167
%174 = getelementptr inbounds [2 x double], [2 x double]* %136, i64 %172, i64 0
%175 = load double, double* %174
%176 = fcmp ugt double %166, %175
br i1 %176, label %177, label %179
177: ; preds = %167, %173
%178 = icmp eq i64 %172, %135
br i1 %178, label %181, label %167
179: ; preds = %173
%180 = trunc i64 %168 to i32
br label %181
181: ; preds = %177, %179, %163
%182 = phi i32 [ 0, %163 ], [ %180, %179 ], [ %132, %177 ]
%183 = zext i32 %182 to i64
%184 = getelementptr inbounds [2 x double], [2 x double]* %136, i64 %183, i64 1
%185 = load double, double* %184
%186 = add nuw nsw i32 %182, 1
%187 = zext i32 %186 to i64
%188 = getelementptr inbounds [2 x double], [2 x double]* %136, i64 %187, i64 1
%189 = load double, double* %188
%190 = getelementptr inbounds [2 x double], [2 x double]* %136, i64 %183, i64 0
%191 = load double, double* %190
%192 = getelementptr inbounds [2 x double], [2 x double]* %136, i64 %187, i64 0
%193 = load double, double* %192
%194 = call double @linterpolate(double %185, double %189, double %191, double %166, double %193)
%195 = getelementptr inbounds double, double* %137, i64 %164
store double %194, double* %195
%196 = add nuw nsw i64 %164, 1
%197 = icmp eq i64 %196, %29
br i1 %197, label %198, label %163
198: ; preds = %181, %161
%199 = call double @scalingCoefficient(i32 %26, double* %58, double* %137, double* %59)
%200 = call double @chiSquareTest(i32 %26, double* %58, double* %137, double* %59, double %199)
%201 = icmp ne i32 %2, 0
%202 = icmp ne i32 %26, 0
%203 = and i1 %201, %202
br i1 %203, label %204, label %214
204: ; preds = %198, %204
%205 = phi i64 [ %212, %204 ], [ 0, %198 ]
%206 = getelementptr inbounds double, double* %137, i64 %205
%207 = load double, double* %206
%208 = fmul double %199, %207
store double %208, double* %206
%209 = getelementptr inbounds double, double* %57, i64 %205
%210 = load double, double* %209
%211 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), double %210, double %208)
%212 = add nuw nsw i64 %205, 1
%213 = icmp eq i64 %212, %29
br i1 %213, label %214, label %204
214: ; preds = %204, %198
%215 = call double @sqrt(double %200)
%216 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0), double %215, double %199)
%217 = call double @sqrt(double %200)
ret double %217
}