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

/* Variables and functions */
int /*<<< orphan*/ cost_iteration(double **, double *, double *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ reset_coeff(double *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ sscanf(char *, char *, double *);
char *strtok(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  double data[506][14] = {0.0};
  double coeff[14] = {0.0};
  double alpha = 0.000001;
  char *line = NULL;
  size_t len = 0;
  ssize_t read;
  char *token = NULL;
  char **tokens;
  int count = 0;
  int i, j, k;
  srand(time(NULL));
  FILE *f = fopen("../data/data.csv", "r");
  if (f == NULL) {
    printf("Failed to read file!\nExiting...\n");
    return -1;
  }
  while ((read = getline(&line, &len, f)) != -1) {
    count++;
    if (0 == 1) {
      printf("Retrieved line of length %zu Count : %d:\n", read, count);
      printf("%s", line);
    }
    token = strtok(line, ",");
    sscanf(token, "%lf", &data[count - 1][0]);
    for (i = 1; i < 14; i++) {
      token = strtok(NULL, ",");
      sscanf(token, "%lf", &data[count - 1][i]);
    }
  }
  fclose(f);
  if (0 == 1) {
    printf("Data Matrix: \n");
    for (i = 0; i < 506; i++) {
      for (j = 0; j < 14; j++)
        printf("%lf  ", data[i][j]);
      printf("\n");
    }
  }
  FILE *f2 = fopen("../data/gradient_cost.dat", "w");
  count = 0;
  printf("Calculation is started...\n\n");
  reset_coeff(coeff);
  int rand_num;
  double sum = 0.0;
  int m = 506 / 2;
  double hypothesis = 0.0;
  int rand_nums[506] = {0};
  double cost[100000] = {0.0};
  for (i = 0; i < m; i++) {
    rand_nums[i] = rand() % 506;
  }
  while (count < 10000) {
    for (j = 0; j < 14; j++) {
      sum = 0;
      for (i = 0; i < m; i++) {
        hypothesis = 0.0;
        for (k = 1; k < 14; k++) {
          hypothesis = hypothesis + (coeff[k] * data[rand_nums[i]][k - 1]);
        }
        hypothesis = hypothesis + coeff[0];
        sum = sum + ((hypothesis - data[rand_nums[i]][14 - 1]) *
                     data[rand_nums[i]][j - 1]);
      }
      coeff[j] = coeff[j] - alpha * (1.0 / m) * sum;
    }
    cost_iteration(data, coeff, cost, count);
    fprintf(f2, "%.12e\n", cost[count]);
    count = count + 1;
  }
  printf("\n\n The cost iteration data for gradient descent algorithm are "
         "written into gradient_cost.dat file!\n\nExiting..\n");
  fclose(f2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd1b40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xdd70(%rbp),%rdi
xor    %esi,%esi
mov    $0xdd60,%edx
call   1050 <memset@plt>
lea    -0xdde0(%rbp),%rdi
xor    %esi,%esi
mov    $0x70,%edx
call   1050 <memset@plt>
movsd  0xdf0(%rip),%xmm0
movsd  %xmm0,-0xdde8(%rbp)
ff
movq   $0x0,-0xddf0(%rbp)
movq   $0x0,-0xddf8(%rbp)
movq   $0x0,-0xde08(%rbp)
movl   $0x0,-0xde14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0xdb6(%rip),%rdi
lea    0xdc0(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0xde28(%rbp)
cmpq   $0x0,-0xde28(%rbp)
jne    1295 <main+0xc5>
lea    0xda1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    16dd <main+0x50d>
jmp    129a <main+0xca>
mov    -0xde28(%rbp),%rdx
lea    -0xddf0(%rbp),%rdi
lea    -0xddf8(%rbp),%rsi
call   10e0 <getline@plt>
mov    %eax,-0xddfc(%rbp)
cmp    $0xffffffff,%eax
je     1399 <main+0x1c9>
mov    -0xde14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xde14(%rbp)
mov    -0xddf0(%rbp),%rdi
lea    0xd64(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,-0xde08(%rbp)
mov    -0xde08(%rbp),%rdi
mov    -0xde14(%rbp),%eax
sub    $0x1,%eax
cltq
lea    -0xdd70(%rbp),%rdx
imul   $0x70,%rax,%rax
add    %rax,%rdx
lea    0xd33(%rip),%rsi
call   10a0 <sscanf@plt>
movl   $0x1,-0xde18(%rbp)
cmpl   $0xe,-0xde18(%rbp)
jge    1394 <main+0x1c4>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd0a(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,-0xde08(%rbp)
mov    -0xde08(%rbp),%rdi
mov    -0xde14(%rbp),%eax
sub    $0x1,%eax
cltq
lea    -0xdd70(%rbp),%rdx
imul   $0x70,%rax,%rax
add    %rax,%rdx
movslq -0xde18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xccb(%rip),%rsi
call   10a0 <sscanf@plt>
mov    -0xde18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xde18(%rbp)
jmp    1322 <main+0x152>
jmp    129a <main+0xca>
mov    -0xde28(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xc9e(%rip),%rdi
lea    0xcb1(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0xde30(%rbp)
movl   $0x0,-0xde14(%rbp)
lea    0xc96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xdde0(%rbp),%rdi
call   10b0 <reset_coeff@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xde40(%rbp)
ff
movl   $0xfd,-0xde44(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xde50(%rbp)
ff
lea    -0xe640(%rbp),%rdi
xor    %esi,%esi
mov    $0x7e8,%edx
call   1050 <memset@plt>
lea    -0xd1b40(%rbp),%rdi
xor    %esi,%esi
mov    $0xc3500,%edx
call   1050 <memset@plt>
movl   $0x0,-0xde18(%rbp)
mov    -0xde18(%rbp),%eax
cmp    -0xde44(%rbp),%eax
jge    1476 <main+0x2a6>
mov    $0x0,%al
call   10f0 <rand@plt>
mov    $0x1fa,%ecx
cltd
idiv   %ecx
movslq -0xde18(%rbp),%rax
mov    %edx,-0xe640(%rbp,%rax,4)
mov    -0xde18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xde18(%rbp)
jmp    1433 <main+0x263>
jmp    147b <main+0x2ab>
cmpl   $0x2710,-0xde14(%rbp)
jge    16c3 <main+0x4f3>
movl   $0x0,-0xde1c(%rbp)
cmpl   $0xe,-0xde1c(%rbp)
jge    166c <main+0x49c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xde40(%rbp)
ff
movl   $0x0,-0xde18(%rbp)
mov    -0xde18(%rbp),%eax
cmp    -0xde44(%rbp),%eax
jge    15f1 <main+0x421>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xde50(%rbp)
ff
movl   $0x1,-0xde20(%rbp)
cmpl   $0xe,-0xde20(%rbp)
jge    1555 <main+0x385>
movsd  -0xde50(%rbp),%xmm1
ff
movslq -0xde20(%rbp),%rax
movsd  -0xdde0(%rbp,%rax,8),%xmm0
ff ff
movslq -0xde18(%rbp),%rax
movslq -0xe640(%rbp,%rax,4),%rcx
ff
lea    -0xdd70(%rbp),%rax
imul   $0x70,%rcx,%rcx
add    %rcx,%rax
mov    -0xde20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xde50(%rbp)
ff
mov    -0xde20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xde20(%rbp)
jmp    14de <main+0x30e>
movsd  -0xde50(%rbp),%xmm0
ff
addsd  -0xdde0(%rbp),%xmm0
ff
movsd  %xmm0,-0xde50(%rbp)
ff
movsd  -0xde40(%rbp),%xmm1
ff
movsd  -0xde50(%rbp),%xmm0
ff
movslq -0xde18(%rbp),%rax
movslq -0xe640(%rbp,%rax,4),%rcx
ff
lea    -0xdd70(%rbp),%rax
imul   $0x70,%rcx,%rcx
add    %rcx,%rax
subsd  0x68(%rax),%xmm0
movslq -0xde18(%rbp),%rax
movslq -0xe640(%rbp,%rax,4),%rcx
ff
lea    -0xdd70(%rbp),%rax
imul   $0x70,%rcx,%rcx
add    %rcx,%rax
mov    -0xde1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xde40(%rbp)
ff
mov    -0xde18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xde18(%rbp)
jmp    14b7 <main+0x2e7>
movslq -0xde1c(%rbp),%rax
movsd  -0xdde0(%rbp,%rax,8),%xmm1
ff ff
movsd  -0xdde8(%rbp),%xmm0
ff
cvtsi2sdl -0xde44(%rbp),%xmm3
ff
movsd  0x9ef(%rip),%xmm2
divsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
movsd  -0xde40(%rbp),%xmm2
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0xde1c(%rbp),%rax
movsd  %xmm0,-0xdde0(%rbp,%rax,8)
ff ff
mov    -0xde1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xde1c(%rbp)
jmp    1495 <main+0x2c5>
lea    -0xdd70(%rbp),%rdi
lea    -0xdde0(%rbp),%rsi
lea    -0xd1b40(%rbp),%rdx
mov    -0xde14(%rbp),%ecx
call   1090 <cost_iteration@plt>
mov    -0xde30(%rbp),%rdi
movslq -0xde14(%rbp),%rax
movsd  -0xd1b40(%rbp,%rax,8),%xmm0
f2 ff
lea    0x9d8(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0xde14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xde14(%rbp)
jmp    147b <main+0x2ab>
lea    0x9bf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xde30(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0xd1b40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd1ae8,%rsp
lea    0x880(%rsp),%rbx
mov    $0xdd60,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
xorpd  %xmm0,%xmm0
movapd %xmm0,0x80(%rsp)
movapd %xmm0,0x70(%rsp)
movapd %xmm0,0x60(%rsp)
movapd %xmm0,0x50(%rsp)
movapd %xmm0,0x40(%rsp)
movapd %xmm0,0x30(%rsp)
movapd %xmm0,0x20(%rsp)
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0xdc1(%rip),%rdi
lea    0xdcb(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1709 <main+0x539>
mov    %rax,%r14
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
mov    %rax,%rdx
call   10e0 <getline@plt>
cmp    $0xffffffff,%eax
je     141a <main+0x24a>
lea    0xd9c(%rip),%r15
lea    0xd97(%rip),%r12
mov    %rsp,%r13
lea    0x8(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp),%rdi
mov    %r15,%rsi
call   10d0 <strtok@plt>
mov    %rax,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x8(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x10(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x18(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x20(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x28(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x30(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x38(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x40(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x48(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x50(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x58(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x60(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   10d0 <strtok@plt>
lea    0x68(%rbx),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   10a0 <sscanf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   10e0 <getline@plt>
add    $0x70,%rbx
cmp    $0xffffffff,%eax
jne    12a0 <main+0xd0>
mov    %r14,%rdi
call   1040 <fclose@plt>
lea    0xc00(%rip),%rdi
lea    0xc13(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
lea    0xc0d(%rip),%rdi
call   1030 <puts@plt>
lea    0x20(%rsp),%rdi
call   10b0 <reset_coeff@plt>
lea    0x90(%rsp),%rdi
mov    $0x7e8,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0xe5e0(%rsp),%rdi
mov    $0xc3500,%edx
xor    %esi,%esi
call   1050 <memset@plt>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10f0 <rand@plt>
cltq
imul   $0xffffffff81848da9,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x8,%ecx
add    %edx,%ecx
imul   $0x1fa,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x90(%rsp,%rbp,4)
add    $0x1,%rbp
cmp    $0xfd,%rbp
jne    1480 <main+0x2b0>
xor    %ebp,%ebp
lea    0x880(%rsp),%r14
lea    0x20(%rsp),%r15
lea    0xe5e0(%rsp),%r12
lea    0xb6b(%rip),%r13
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    -0x1(%rax),%rcx
movsd  0x30(%rsp),%xmm10
movsd  0x38(%rsp),%xmm11
movsd  0x40(%rsp),%xmm12
movsd  0x48(%rsp),%xmm13
movsd  0x50(%rsp),%xmm14
movsd  0x58(%rsp),%xmm15
movsd  0x60(%rsp),%xmm9
movsd  0x68(%rsp),%xmm2
movsd  0x70(%rsp),%xmm3
movsd  0x78(%rsp),%xmm4
movsd  0x80(%rsp),%xmm5
xorpd  %xmm0,%xmm0
movsd  0x88(%rsp),%xmm6
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
movslq 0x90(%rsp,%rdx,4),%rsi
imul   $0x70,%rsi,%rsi
movsd  0x880(%rsp,%rsi,1),%xmm7
mulsd  0x10(%rsp),%xmm7
movsd  0x888(%rsp,%rsi,1),%xmm8
mulsd  %xmm10,%xmm8
addsd  0xa66(%rip),%xmm7
addsd  %xmm7,%xmm8
movsd  0x890(%rsp,%rsi,1),%xmm7
mulsd  %xmm11,%xmm7
addsd  %xmm8,%xmm7
movsd  0x898(%rsp,%rsi,1),%xmm1
mulsd  %xmm12,%xmm1
addsd  %xmm7,%xmm1
movsd  0x8a0(%rsp,%rsi,1),%xmm7
mulsd  %xmm13,%xmm7
addsd  %xmm1,%xmm7
movsd  0x8a8(%rsp,%rsi,1),%xmm1
mulsd  %xmm14,%xmm1
addsd  %xmm7,%xmm1
movsd  0x8b0(%rsp,%rsi,1),%xmm7
mulsd  %xmm15,%xmm7
addsd  %xmm1,%xmm7
movsd  0x8b8(%rsp,%rsi,1),%xmm1
mulsd  %xmm9,%xmm1
addsd  %xmm7,%xmm1
movsd  0x8c0(%rsp,%rsi,1),%xmm7
mulsd  %xmm2,%xmm7
addsd  %xmm1,%xmm7
movsd  0x8c8(%rsp,%rsi,1),%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm7,%xmm1
movsd  0x8d0(%rsp,%rsi,1),%xmm7
mulsd  %xmm4,%xmm7
addsd  %xmm1,%xmm7
movsd  0x8d8(%rsp,%rsi,1),%xmm1
mulsd  %xmm5,%xmm1
addsd  %xmm7,%xmm1
movsd  0x8e0(%rsp,%rsi,1),%xmm7
mulsd  %xmm6,%xmm7
addsd  %xmm1,%xmm7
lea    0x880(%rsp,%rsi,1),%rdi
addsd  0x18(%rsp),%xmm7
subsd  0x8e8(%rsp,%rsi,1),%xmm7
mulsd  (%rdi,%rcx,8),%xmm7
addsd  %xmm7,%xmm0
add    $0x1,%rdx
cmp    $0xfd,%rdx
jne    1570 <main+0x3a0>
mulsd  0x95e(%rip),%xmm0
addsd  0x20(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x20(%rsp,%rax,8)
add    $0x1,%rax
cmp    $0xe,%rax
jne    14f0 <main+0x320>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %ebp,%ecx
call   1090 <cost_iteration@plt>
movsd  0xe5e0(%rsp,%rbp,8),%xmm0
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <fprintf@plt>
add    $0x1,%rbp
cmp    $0x2710,%rbp
jne    14e0 <main+0x310>
lea    0x96f(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    171a <main+0x54a>
lea    0x9c5(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0xd1ae8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"../data/data.csv\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [33 x i8] c"Failed to read file!\0AExiting...\0A\00"
@.str.3 = [2 x i8] c",\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [26 x i8] c"../data/gradient_cost.dat\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [28 x i8] c"Calculation is started...\0A\0A\00"
@.str.8 = [7 x i8] c"%.12e\0A\00"
@.str.9 = [111 x i8] c"\0A\0A The cost iteration data for gradient descent algorithm are written into gradient_cost.dat file!\0A\0AExiting..\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [506 x [14 x double]]
%3 = alloca [14 x double]
%4 = alloca double
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32
%17 = alloca double
%18 = alloca i32
%19 = alloca double
%20 = alloca [506 x i32]
%21 = alloca [100000 x double]
store i32 0, i32* %1
%22 = bitcast [506 x [14 x double]]* %2 to i8*
%23 = bitcast [14 x double]* %3 to i8*
store double 0x3EB0C6F7A0B5ED8D, double* %4
store i8* null, i8** %5
store i64 0, i64* %6
store i8* null, i8** %8
store i32 0, i32* %10
%24 = call i32 @time(i32* null)
%25 = call i32 @srand(i32 %24)
%26 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %14
%27 = load i32*, i32** %14
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %31
29: ; preds = %0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %195
31: ; preds = %0
br label %32
32: ; preds = %65, %31
%33 = load i32*, i32** %14
%34 = call i32 @getline(i8** %5, i64* %6, i32* %33)
store i32 %34, i32* %7
%35 = icmp ne i32 %34, -1
br i1 %35, label %36, label %66
36: ; preds = %32
%37 = load i32, i32* %10
%38 = add nsw i32 %37, 1
store i32 %38, i32* %10
%39 = load i8*, i8** %5
%40 = call i8* @strtok(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %40, i8** %8
%41 = load i8*, i8** %8
%42 = load i32, i32* %10
%43 = sub nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %2, i64 0, i64 %44
%46 = getelementptr inbounds [14 x double], [14 x double]* %45, i64 0, i64 0
%47 = call i32 @sscanf(i8* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %46)
store i32 1, i32* %11
br label %48
48: ; preds = %62, %36
%49 = load i32, i32* %11
%50 = icmp slt i32 %49, 14
br i1 %50, label %51, label %65
51: ; preds = %48
%52 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %52, i8** %8
%53 = load i8*, i8** %8
%54 = load i32, i32* %10
%55 = sub nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %2, i64 0, i64 %56
%58 = load i32, i32* %11
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [14 x double], [14 x double]* %57, i64 0, i64 %59
%61 = call i32 @sscanf(i8* %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %60)
br label %62
62: ; preds = %51
%63 = load i32, i32* %11
%64 = add nsw i32 %63, 1
store i32 %64, i32* %11
br label %48
65: ; preds = %48
br label %32
66: ; preds = %32
%67 = load i32*, i32** %14
%68 = call i32 @fclose(i32* %67)
%69 = call i32* @fopen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %69, i32** %15
store i32 0, i32* %10
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%71 = getelementptr inbounds [14 x double], [14 x double]* %3, i64 0, i64 0
%72 = call i32 @reset_coeff(double* %71)
store double 0.000000e+00, double* %17
store i32 253, i32* %18
store double 0.000000e+00, double* %19
%73 = bitcast [506 x i32]* %20 to i8*
%74 = bitcast [100000 x double]* %21 to i8*
store i32 0, i32* %11
br label %75
75: ; preds = %85, %66
%76 = load i32, i32* %11
%77 = load i32, i32* %18
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %88
79: ; preds = %75
%80 = call i32 (...) @rand()
%81 = srem i32 %80, 506
%82 = load i32, i32* %11
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [506 x i32], [506 x i32]* %20, i64 0, i64 %83
store i32 %81, i32* %84
br label %85
85: ; preds = %79
%86 = load i32, i32* %11
%87 = add nsw i32 %86, 1
store i32 %87, i32* %11
br label %75
88: ; preds = %75
br label %89
89: ; preds = %176, %88
%90 = load i32, i32* %10
%91 = icmp slt i32 %90, 10000
br i1 %91, label %92, label %191
92: ; preds = %89
store i32 0, i32* %12
br label %93
93: ; preds = %173, %92
%94 = load i32, i32* %12
%95 = icmp slt i32 %94, 14
br i1 %95, label %96, label %176
96: ; preds = %93
store double 0.000000e+00, double* %17
store i32 0, i32* %11
br label %97
97: ; preds = %154, %96
%98 = load i32, i32* %11
%99 = load i32, i32* %18
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %157
101: ; preds = %97
store double 0.000000e+00, double* %19
store i32 1, i32* %13
br label %102
102: ; preds = %123, %101
%103 = load i32, i32* %13
%104 = icmp slt i32 %103, 14
br i1 %104, label %105, label %126
105: ; preds = %102
%106 = load double, double* %19
%107 = load i32, i32* %13
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [14 x double], [14 x double]* %3, i64 0, i64 %108
%110 = load double, double* %109
%111 = load i32, i32* %11
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [506 x i32], [506 x i32]* %20, i64 0, i64 %112
%114 = load i32, i32* %113
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %2, i64 0, i64 %115
%117 = load i32, i32* %13
%118 = sub nsw i32 %117, 1
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [14 x double], [14 x double]* %116, i64 0, i64 %119
%121 = load double, double* %120
%122 = call double @llvm.fmuladd.f64(double %110, double %121, double %106)
store double %122, double* %19
br label %123
123: ; preds = %105
%124 = load i32, i32* %13
%125 = add nsw i32 %124, 1
store i32 %125, i32* %13
br label %102
126: ; preds = %102
%127 = load double, double* %19
%128 = getelementptr inbounds [14 x double], [14 x double]* %3, i64 0, i64 0
%129 = load double, double* %128
%130 = fadd double %127, %129
store double %130, double* %19
%131 = load double, double* %17
%132 = load double, double* %19
%133 = load i32, i32* %11
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [506 x i32], [506 x i32]* %20, i64 0, i64 %134
%136 = load i32, i32* %135
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %2, i64 0, i64 %137
%139 = getelementptr inbounds [14 x double], [14 x double]* %138, i64 0, i64 13
%140 = load double, double* %139
%141 = fsub double %132, %140
%142 = load i32, i32* %11
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds [506 x i32], [506 x i32]* %20, i64 0, i64 %143
%145 = load i32, i32* %144
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %2, i64 0, i64 %146
%148 = load i32, i32* %12
%149 = sub nsw i32 %148, 1
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds [14 x double], [14 x double]* %147, i64 0, i64 %150
%152 = load double, double* %151
%153 = call double @llvm.fmuladd.f64(double %141, double %152, double %131)
store double %153, double* %17
br label %154
154: ; preds = %126
%155 = load i32, i32* %11
%156 = add nsw i32 %155, 1
store i32 %156, i32* %11
br label %97
157: ; preds = %97
%158 = load i32, i32* %12
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds [14 x double], [14 x double]* %3, i64 0, i64 %159
%161 = load double, double* %160
%162 = load double, double* %4
%163 = load i32, i32* %18
%164 = sitofp i32 %163 to double
%165 = fdiv double 1.000000e+00, %164
%166 = fmul double %162, %165
%167 = load double, double* %17
%168 = fneg double %166
%169 = call double @llvm.fmuladd.f64(double %168, double %167, double %161)
%170 = load i32, i32* %12
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds [14 x double], [14 x double]* %3, i64 0, i64 %171
store double %169, double* %172
br label %173
173: ; preds = %157
%174 = load i32, i32* %12
%175 = add nsw i32 %174, 1
store i32 %175, i32* %12
br label %93
176: ; preds = %93
%177 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %2, i64 0, i64 0
%178 = bitcast [14 x double]* %177 to double**
%179 = getelementptr inbounds [14 x double], [14 x double]* %3, i64 0, i64 0
%180 = getelementptr inbounds [100000 x double], [100000 x double]* %21, i64 0, i64 0
%181 = load i32, i32* %10
%182 = call i32 @cost_iteration(double** %178, double* %179, double* %180, i32 %181)
%183 = load i32*, i32** %15
%184 = load i32, i32* %10
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds [100000 x double], [100000 x double]* %21, i64 0, i64 %185
%187 = load double, double* %186
%188 = call i32 @fprintf(i32* %183, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), double %187)
%189 = load i32, i32* %10
%190 = add nsw i32 %189, 1
store i32 %190, i32* %10
br label %89
191: ; preds = %89
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str.9, i64 0, i64 0))
%193 = load i32*, i32** %15
%194 = call i32 @fclose(i32* %193)
br label %195
195: ; preds = %191, %29
%196 = load i32, i32* %1
ret i32 %196
}

LLVM IR (-O2):
@.str = [17 x i8] c"../data/data.csv\00"
@.str.1 = [2 x i8] c"r\00"
@.str.3 = [2 x i8] c",\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [26 x i8] c"../data/gradient_cost.dat\00"
@.str.6 = [2 x i8] c"w\00"
@.str.8 = [7 x i8] c"%.12e\0A\00"
@str = [27 x i8] c"Calculation is started...\0A\00"
@str.10 = [110 x i8] c"\0A\0A The cost iteration data for gradient descent algorithm are written into gradient_cost.dat file!\0A\0AExiting..\00"
@str.11 = [32 x i8] c"Failed to read file!\0AExiting...\00"
define i32 @main() {
%1 = alloca [506 x [14 x double]]
%2 = alloca [14 x double]
%3 = alloca i8*
%4 = alloca i64
%5 = alloca [506 x i32]
%6 = alloca [100000 x double]
%7 = bitcast [506 x [14 x double]]* %1 to i8*
%8 = bitcast [14 x double]* %2 to i8*
%9 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%10 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%11 = tail call i32 @time(i32* null)
%12 = tail call i32 @srand(i32 %11)
%13 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %18, label %15
15: ; preds = %0
%16 = call i32 @getline(i8** %3, i64* %4, i32* %13)
%17 = icmp eq i32 %16, -1
br i1 %17, label %68, label %20
18: ; preds = %0
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.11, i64 0, i64 0))
br label %189
20: ; preds = %15, %20
%21 = phi i64 [ %65, %20 ], [ 0, %15 ]
%22 = load i8*, i8** %3
%23 = call i8* @strtok(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%24 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 0
%25 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %24)
%26 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 1
%28 = call i32 @sscanf(i8* %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %27)
%29 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%30 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 2
%31 = call i32 @sscanf(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %30)
%32 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%33 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 3
%34 = call i32 @sscanf(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %33)
%35 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%36 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 4
%37 = call i32 @sscanf(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %36)
%38 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%39 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 5
%40 = call i32 @sscanf(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %39)
%41 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%42 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 6
%43 = call i32 @sscanf(i8* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %42)
%44 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%45 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 7
%46 = call i32 @sscanf(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %45)
%47 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%48 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 8
%49 = call i32 @sscanf(i8* %47, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %48)
%50 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%51 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 9
%52 = call i32 @sscanf(i8* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %51)
%53 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%54 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 10
%55 = call i32 @sscanf(i8* %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %54)
%56 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%57 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 11
%58 = call i32 @sscanf(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %57)
%59 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%60 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 12
%61 = call i32 @sscanf(i8* %59, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %60)
%62 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%63 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %21, i64 13
%64 = call i32 @sscanf(i8* %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %63)
%65 = add nuw i64 %21, 1
%66 = call i32 @getline(i8** %3, i64* %4, i32* %13)
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %20
68: ; preds = %20, %15
%69 = call i32 @fclose(i32* %13)
%70 = call i32* @fopen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%72 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 0
%73 = call i32 @reset_coeff(double* %72)
%74 = bitcast [506 x i32]* %5 to i8*
%75 = bitcast [100000 x double]* %6 to i8*
br label %92
76: ; preds = %92
%77 = bitcast [506 x [14 x double]]* %1 to double**
%78 = getelementptr inbounds [100000 x double], [100000 x double]* %6, i64 0, i64 0
%79 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 1
%80 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 2
%81 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 3
%82 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 4
%83 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 5
%84 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 6
%85 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 7
%86 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 8
%87 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 9
%88 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 10
%89 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 11
%90 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 12
%91 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 13
br label %99
92: ; preds = %68, %92
%93 = phi i64 [ 0, %68 ], [ %97, %92 ]
%94 = call i32 (...) @rand()
%95 = srem i32 %94, 506
%96 = getelementptr inbounds [506 x i32], [506 x i32]* %5, i64 0, i64 %93
store i32 %95, i32* %96
%97 = add nuw nsw i64 %93, 1
%98 = icmp eq i64 %97, 253
br i1 %98, label %76, label %92
99: ; preds = %76, %178
%100 = phi i64 [ 0, %76 ], [ %184, %178 ]
br label %101
101: ; preds = %99, %172
%102 = phi i64 [ 0, %99 ], [ %176, %172 ]
%103 = load double, double* %72
%104 = add nsw i64 %102, -1
%105 = load double, double* %79
%106 = load double, double* %80
%107 = load double, double* %81
%108 = load double, double* %82
%109 = load double, double* %83
%110 = load double, double* %84
%111 = load double, double* %85
%112 = load double, double* %86
%113 = load double, double* %87
%114 = load double, double* %88
%115 = load double, double* %89
%116 = load double, double* %90
%117 = load double, double* %91
br label %118
118: ; preds = %101, %118
%119 = phi i64 [ 0, %101 ], [ %170, %118 ]
%120 = phi double [ 0.000000e+00, %101 ], [ %169, %118 ]
%121 = getelementptr inbounds [506 x i32], [506 x i32]* %5, i64 0, i64 %119
%122 = load i32, i32* %121
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 0
%125 = load double, double* %124
%126 = call double @llvm.fmuladd.f64(double %105, double %125, double 0.000000e+00)
%127 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 1
%128 = load double, double* %127
%129 = call double @llvm.fmuladd.f64(double %106, double %128, double %126)
%130 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 2
%131 = load double, double* %130
%132 = call double @llvm.fmuladd.f64(double %107, double %131, double %129)
%133 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 3
%134 = load double, double* %133
%135 = call double @llvm.fmuladd.f64(double %108, double %134, double %132)
%136 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 4
%137 = load double, double* %136
%138 = call double @llvm.fmuladd.f64(double %109, double %137, double %135)
%139 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 5
%140 = load double, double* %139
%141 = call double @llvm.fmuladd.f64(double %110, double %140, double %138)
%142 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 6
%143 = load double, double* %142
%144 = call double @llvm.fmuladd.f64(double %111, double %143, double %141)
%145 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 7
%146 = load double, double* %145
%147 = call double @llvm.fmuladd.f64(double %112, double %146, double %144)
%148 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 8
%149 = load double, double* %148
%150 = call double @llvm.fmuladd.f64(double %113, double %149, double %147)
%151 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 9
%152 = load double, double* %151
%153 = call double @llvm.fmuladd.f64(double %114, double %152, double %150)
%154 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 10
%155 = load double, double* %154
%156 = call double @llvm.fmuladd.f64(double %115, double %155, double %153)
%157 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 11
%158 = load double, double* %157
%159 = call double @llvm.fmuladd.f64(double %116, double %158, double %156)
%160 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 12
%161 = load double, double* %160
%162 = call double @llvm.fmuladd.f64(double %117, double %161, double %159)
%163 = fadd double %162, %103
%164 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 13
%165 = load double, double* %164
%166 = fsub double %163, %165
%167 = getelementptr inbounds [506 x [14 x double]], [506 x [14 x double]]* %1, i64 0, i64 %123, i64 %104
%168 = load double, double* %167
%169 = call double @llvm.fmuladd.f64(double %166, double %168, double %120)
%170 = add nuw nsw i64 %119, 1
%171 = icmp eq i64 %170, 253
br i1 %171, label %172, label %118
172: ; preds = %118
%173 = getelementptr inbounds [14 x double], [14 x double]* %2, i64 0, i64 %102
%174 = load double, double* %173
%175 = call double @llvm.fmuladd.f64(double %169, double 0xBE30F9E550A7E53C, double %174)
store double %175, double* %173
%176 = add nuw nsw i64 %102, 1
%177 = icmp eq i64 %176, 14
br i1 %177, label %178, label %101
178: ; preds = %172
%179 = trunc i64 %100 to i32
%180 = call i32 @cost_iteration(double** %77, double* %72, double* %78, i32 %179)
%181 = getelementptr inbounds [100000 x double], [100000 x double]* %6, i64 0, i64 %100
%182 = load double, double* %181
%183 = call i32 @fprintf(i32* %70, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), double %182)
%184 = add nuw nsw i64 %100, 1
%185 = icmp eq i64 %184, 10000
br i1 %185, label %186, label %99
186: ; preds = %178
%187 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([110 x i8], [110 x i8]* @str.10, i64 0, i64 0))
%188 = call i32 @fclose(i32* %70)
br label %189
189: ; preds = %186, %18
%190 = phi i32 [ -1, %18 ], [ 0, %186 ]
ret i32 %190
}