#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double RAND_MAX;
int *calloc(int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, ...);
int /*<<< orphan*/ printf(char *);
double rand();
int /*<<< orphan*/ srand(int);
int time(int /*<<< orphan*/ *);
int main() {
  double ratioC;
  double e = 2.7182818, rmax = 2147483647;
  int i, j, cy, cx, size, seed, null, Nsize, nn, n1, n2, nnodes, rowstart;
  int *ncountC, *ncountR;
  FILE *f0, *f1, *fMC, *fMR;
  if (f0 = fopen("parameters.ini", "r"))
    fscanf(f0, "%d %lf", &size, &ratioC);
  else {
    f0 = fopen("parameters.ini", "w");
    fprintf(f0, "50 0.4\nN_vert_comps ratio_C");
    printf("Edit Values in \"parameters.ini\" then rerun");
    return 0;
  }
  Nsize = (size + 1) * (size + 1) + (size - 1) * (size - 1);
  nnodes = (size + 1) * (size - 1) + 2;
  ncountC = calloc(nnodes, sizeof(int));
  ncountR = calloc(nnodes, sizeof(int));
  for (nn = 0; nn < nnodes; nn++) {
    ncountC[nn] = 0;
    ncountR[nn] = 0;
  }
  fclose(f0);
  rmax = RAND_MAX;
  if (f1 = fopen("seed", "r")) {
    fscanf(f1, "%d", &seed);
    srand(seed);
    fclose(f1);
  } else
    srand(time(NULL));
  f1 = fopen("seed", "w");
  fprintf(f1, "%d", rand());
  fclose(f1);
  fMC = fopen("matrixC.mat", "w");
  fMR = fopen("matrixR.mat", "w");
  for (cy = 0; cy < size + 1; cy++) {
    rowstart = cy * (size - 1);
    n1 = 0;
    n2 = rowstart + 1;
    if ((rand() / rmax) < ratioC) {
      fprintf(fMC, "%d %d -1\n", n2, n1);
      fprintf(fMC, "%d %d -1\n", n1, n2);
      ncountC[n2] += 1;
      ncountC[n1] += 1;
    } else {
      fprintf(fMR, "%d %d -1\n", n2, n1);
      fprintf(fMR, "%d %d -1\n", n1, n2);
      ncountR[n2] += 1;
      ncountR[n1] += 1;
    }
    for (cx = 1; cx < size - 1; cx++) {
      n1 = rowstart + cx;
      n2 = rowstart + cx + 1;
      if ((rand() / rmax) < ratioC) {
        fprintf(fMC, "%d %d -1\n", n2, n1);
        fprintf(fMC, "%d %d -1\n", n1, n2);
        ncountC[n2] += 1;
        ncountC[n1] += 1;
      } else {
        fprintf(fMR, "%d %d -1\n", n2, n1);
        fprintf(fMR, "%d %d -1\n", n1, n2);
        ncountR[n2] += 1;
        ncountR[n1] += 1;
      }
    }
    n1 = (cy + 1) * (size - 1);
    n2 = nnodes - 1;
    if ((rand() / rmax) < ratioC) {
      fprintf(fMC, "%d %d -1\n", n2, n1);
      fprintf(fMC, "%d %d -1\n", n1, n2);
      ncountC[n2] += 1;
      ncountC[n1] += 1;
    } else {
      fprintf(fMR, "%d %d -1\n", n2, n1);
      fprintf(fMR, "%d %d -1\n", n1, n2);
      ncountR[n2] += 1;
      ncountR[n1] += 1;
    }
  }
  for (cy = 0; cy < size; cy++) {
    rowstart = cy * (size - 1);
    for (cx = 1; cx < size; cx++) {
      n1 = rowstart + cx;
      n2 = rowstart + cx + (size - 1);
      if ((rand() / rmax) < ratioC) {
        fprintf(fMC, "%d %d -1\n", n2, n1);
        fprintf(fMC, "%d %d -1\n", n1, n2);
        ncountC[n2] += 1;
        ncountC[n1] += 1;
      } else {
        fprintf(fMR, "%d %d -1\n", n2, n1);
        fprintf(fMR, "%d %d -1\n", n1, n2);
        ncountR[n2] += 1;
        ncountR[n1] += 1;
      }
    }
  }
  for (nn = 0; nn < nnodes; nn++) {
    if (ncountC[nn] > 0)
      fprintf(fMC, "%d %d %d\n", nn, nn, ncountC[nn]);
    if (ncountR[nn] > 0)
      fprintf(fMR, "%d %d %d\n", nn, nn, ncountR[nn]);
  }
  fclose(fMC);
  fclose(fMR);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xe5e(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe49(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xe4d(%rip),%rdi
lea    0xe55(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x70(%rbp)
cmp    $0x0,%rax
je     11fc <main+0x6c>
mov    -0x70(%rbp),%rdi
lea    0xe39(%rip),%rsi
lea    -0x34(%rbp),%rdx
lea    -0x10(%rbp),%rcx
mov    $0x0,%al
call   1050 <fscanf@plt>
jmp    123d <main+0xad>
lea    0xe0d(%rip),%rdi
lea    0xe1e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rdi
lea    0xe0c(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    0xe1a(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    18c3 <main+0x733>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x34(%rbp),%edx
sub    $0x1,%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x40(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
add    $0x2,%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x50(%rbp),%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    12d6 <main+0x146>
mov    -0x60(%rbp),%rax
movslq -0x44(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x68(%rbp),%rax
movslq -0x44(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    129e <main+0x10e>
mov    -0x70(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2d02(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xd7b(%rip),%rdi
lea    0xd22(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x78(%rbp)
cmp    $0x0,%rax
je     133c <main+0x1ac>
mov    -0x78(%rbp),%rdi
lea    0xd5b(%rip),%rsi
lea    -0x38(%rbp),%rdx
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    -0x38(%rbp),%edi
call   1060 <srand@plt>
mov    -0x78(%rbp),%rdi
call   1030 <fclose@plt>
jmp    134c <main+0x1bc>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0xd1e(%rip),%rdi
lea    0xcce(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
mov    -0x90(%rbp),%rdi
lea    0xcf3(%rip),%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    -0x78(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xcdf(%rip),%rdi
lea    0xc87(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x80(%rbp)
lea    0xcd4(%rip),%rdi
lea    0xc70(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x88(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    16d0 <main+0x540>
mov    -0x2c(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x54(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
movaps %xmm0,%xmm1
divsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1470 <main+0x2e0>
mov    -0x80(%rbp),%rdi
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%ecx
lea    0xc67(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x80(%rbp),%rdi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0xc4f(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x60(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x60(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    14c8 <main+0x338>
mov    -0x88(%rbp),%rdi
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%ecx
lea    0xc0d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x88(%rbp),%rdi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0xbf2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x68(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x68(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
movl   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    15d5 <main+0x445>
mov    -0x54(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x54(%rbp),%eax
add    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
movaps %xmm0,%xmm1
divsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    156a <main+0x3da>
mov    -0x80(%rbp),%rdi
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%ecx
lea    0xb6d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x80(%rbp),%rdi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0xb55(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x60(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x60(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    15c2 <main+0x432>
mov    -0x88(%rbp),%rdi
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%ecx
lea    0xb13(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x88(%rbp),%rdi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0xaf8(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x68(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x68(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    15c7 <main+0x437>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    14cf <main+0x33f>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x48(%rbp)
mov    -0x50(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
movaps %xmm0,%xmm1
divsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1665 <main+0x4d5>
mov    -0x80(%rbp),%rdi
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%ecx
lea    0xa72(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x80(%rbp),%rdi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0xa5a(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x60(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x60(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    16bd <main+0x52d>
mov    -0x88(%rbp),%rdi
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%ecx
lea    0xa18(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x88(%rbp),%rdi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0x9fd(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x68(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x68(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    16c2 <main+0x532>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13cb <main+0x23b>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1812 <main+0x682>
mov    -0x2c(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x54(%rbp)
movl   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    17ff <main+0x66f>
mov    -0x54(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x54(%rbp),%eax
add    -0x30(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x4c(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
movaps %xmm0,%xmm1
divsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1794 <main+0x604>
mov    -0x80(%rbp),%rdi
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%ecx
lea    0x943(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x80(%rbp),%rdi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0x92b(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x60(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x60(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    17ec <main+0x65c>
mov    -0x88(%rbp),%rdi
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%ecx
lea    0x8e9(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x88(%rbp),%rdi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0x8ce(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x68(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x68(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    17f1 <main+0x661>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    16f9 <main+0x569>
jmp    1804 <main+0x674>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    16d7 <main+0x547>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    18a7 <main+0x717>
mov    -0x60(%rbp),%rax
movslq -0x44(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    185b <main+0x6cb>
mov    -0x80(%rbp),%rdi
mov    -0x44(%rbp),%edx
mov    -0x44(%rbp),%ecx
mov    -0x60(%rbp),%rax
movslq -0x44(%rbp),%rsi
mov    (%rax,%rsi,4),%r8d
lea    0x847(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x68(%rbp),%rax
movslq -0x44(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    1894 <main+0x704>
mov    -0x88(%rbp),%rdi
mov    -0x44(%rbp),%edx
mov    -0x44(%rbp),%ecx
mov    -0x68(%rbp),%rax
movslq -0x44(%rbp),%rsi
mov    (%rax,%rsi,4),%r8d
lea    0x80e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1899 <main+0x709>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1819 <main+0x689>
mov    -0x80(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x88(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xe3b(%rip),%rdi
lea    0xe43(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     12c7 <main+0x117>
mov    %rax,%rbx
lea    0xe2d(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x40(%rsp),%rcx
mov    %rax,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
movslq 0xc(%rsp),%rbp
lea    0x1(%rbp),%rax
add    $0xffffffffffffffff,%rbp
imul   %rax,%rbp
lea    0x2(%rbp),%r12d
mov    %r12d,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,%r14
mov    %r12d,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,%r15
mov    %rbp,%rax
mov    %rbp,0x48(%rsp)
cmp    $0xffffffff,%ebp
jl     125b <main+0xab>
mov    %r12d,%ebp
shl    $0x2,%rbp
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1050 <memset@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1050 <memset@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    0x2d7e(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x38(%rsp)
lea    0xde6(%rip),%rdi
lea    0xd8d(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
mov    %r14,0x10(%rsp)
mov    %r15,0x20(%rsp)
mov    %r12d,0x5c(%rsp)
je     1304 <main+0x154>
mov    %rax,%rbx
lea    0xdc1(%rip),%rsi
lea    0x64(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    0x64(%rsp),%edi
call   1070 <srand@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    1312 <main+0x162>
lea    0xd32(%rip),%rdi
lea    0xd43(%rip),%rsi
call   10b0 <fopen@plt>
lea    0xd39(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10c0 <fwrite@plt>
lea    0xd3c(%rip),%rdi
call   1040 <printf@plt>
jmp    16e3 <main+0x533>
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
lea    0xd48(%rip),%rdi
lea    0xcf8(%rip),%rbx
mov    %rbx,%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   10d0 <rand@plt>
lea    0xd2d(%rip),%rsi
mov    %rbp,%rdi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
lea    0xd17(%rip),%rdi
mov    %rbx,%rsi
call   10b0 <fopen@plt>
mov    %rax,%r15
lea    0xd11(%rip),%rdi
mov    %rbx,%rsi
call   10b0 <fopen@plt>
mov    %rax,0x18(%rsp)
mov    0xc(%rsp),%r13d
test   %r13d,%r13d
mov    %r15,0x30(%rsp)
js     1656 <main+0x4a6>
mov    0x48(%rsp),%rax
add    $0x1,%eax
mov    %eax,0x60(%rsp)
lea    0xcea(%rip),%rbx
xor    %eax,%eax
mov    0x18(%rsp),%r14
jmp    1452 <main+0x2a2>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%ebp
mov    0x10(%rsp),%r13
mov    0x50(%rsp),%rax
add    $0x1,%eax
mov    %eax,0x28(%rsp)
imul   %eax,%ebp
xor    %eax,%eax
call   10d0 <rand@plt>
divsd  0x38(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
ucomisd %xmm0,%xmm1
mov    0x18(%rsp),%r14
mov    %r14,%rbx
cmova  %r15,%rbx
mov    0x20(%rsp),%r15
cmova  %r13,%r15
mov    %rbx,%rdi
lea    0xc84(%rip),%r12
mov    %r12,%rsi
mov    0x60(%rsp),%r13d
mov    %r13d,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rbx
mov    %r12,%rsi
mov    %ebp,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x48(%rsp),%rax
addl   $0x1,0x4(%r15,%rax,4)
movslq %ebp,%rax
addl   $0x1,(%r15,%rax,4)
mov    0x30(%rsp),%r15
mov    0xc(%rsp),%r13d
cmp    %r13d,0x50(%rsp)
mov    0x28(%rsp),%eax
jge    1585 <main+0x3d5>
mov    %rax,0x50(%rsp)
add    $0xffffffff,%r13d
imul   %eax,%r13d
lea    0x1(%r13),%r12d
xor    %eax,%eax
call   10d0 <rand@plt>
divsd  0x38(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
ucomisd %xmm0,%xmm1
mov    %r14,%rbp
cmova  %r15,%rbp
mov    %rbx,%r14
mov    0x20(%rsp),%rbx
cmova  0x10(%rsp),%rbx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    %r12d,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
movslq %r13d,%rax
addl   $0x1,0x4(%rbx,%rax,4)
addl   $0x1,(%rbx)
mov    0xc(%rsp),%ebp
cmp    $0x3,%ebp
jl     13b0 <main+0x200>
lea    0x2(%rax),%r12d
lea    0x4(,%rax,4),%rax
mov    %rax,0x28(%rsp)
mov    $0x1,%ebx
jmp    154c <main+0x39c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    0x28(%rsp),%r15
mov    %rbp,%rdi
lea    0xb82(%rip),%r14
mov    %r14,%rsi
mov    %r12d,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
mov    %r12d,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
addl   $0x1,(%r15,%rbx,4)
addl   $0x1,-0x4(%r15,%rbx,4)
add    $0x1,%rbx
movslq 0xc(%rsp),%rbp
add    $0xffffffffffffffff,%rbp
add    $0x1,%r12d
cmp    %rbp,%rbx
mov    0x30(%rsp),%r15
jge    13b3 <main+0x203>
xor    %eax,%eax
call   10d0 <rand@plt>
divsd  0x38(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
lea    -0x1(%r12),%r13d
ucomisd %xmm0,%xmm1
mov    %r15,%rbp
mov    0x10(%rsp),%r15
ja     14f0 <main+0x340>
mov    0x18(%rsp),%rbp
mov    0x20(%rsp),%r15
jmp    14f0 <main+0x340>
test   %r13d,%r13d
jle    1656 <main+0x4a6>
xor    %eax,%eax
jmp    15b0 <main+0x400>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x28(%rsp),%eax
add    $0x1,%eax
cmp    %r13d,%eax
jge    1656 <main+0x4a6>
cmp    $0x2,%r13d
mov    %eax,0x28(%rsp)
jl     15a0 <main+0x3f0>
lea    -0x1(%r13),%ebp
imul   %eax,%ebp
movslq %ebp,%r14
add    $0x1,%r14
mov    $0x1,%r12d
jmp    1620 <main+0x470>
mov    %rbx,%rdi
lea    0xaa7(%rip),%rsi
mov    %r13d,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rbx,%rdi
lea    0xa91(%rip),%rsi
mov    %ebp,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
movslq %r13d,%rax
addl   $0x1,(%r15,%rax,4)
addl   $0x1,(%r15,%r14,4)
add    $0x1,%r12
movslq 0xc(%rsp),%r13
add    $0x1,%r14
cmp    %r13,%r12
mov    0x30(%rsp),%r15
jge    15a0 <main+0x3f0>
add    %ebp,%r13d
add    $0x1,%ebp
xor    %eax,%eax
call   10d0 <rand@plt>
divsd  0x38(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
ucomisd %xmm0,%xmm1
mov    %r15,%rbx
mov    0x10(%rsp),%r15
ja     15d0 <main+0x420>
mov    0x18(%rsp),%rbx
mov    0x20(%rsp),%r15
jmp    15d0 <main+0x420>
cmpl   $0xffffffff,0x48(%rsp)
mov    0x10(%rsp),%r15
mov    0x20(%rsp),%r12
mov    0x18(%rsp),%r13
jl     16d1 <main+0x521>
mov    0x5c(%rsp),%eax
cmp    $0x2,%eax
mov    $0x1,%ebx
cmovge %eax,%ebx
lea    0xa09(%rip),%r14
xor    %ebp,%ebp
jmp    1699 <main+0x4e9>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     16d1 <main+0x521>
mov    (%r15,%rbp,4),%r8d
test   %r8d,%r8d
jle    16b5 <main+0x505>
mov    0x30(%rsp),%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%r12,%rbp,4),%r8d
test   %r8d,%r8d
jle    1690 <main+0x4e0>
mov    %r13,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1690 <main+0x4e0>
mov    0x30(%rsp),%rdi
call   1030 <fclose@plt>
mov    %r13,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"parameters.ini\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"%d %lf\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [28 x i8] c"50 0.4\0AN_vert_comps ratio_C\00"
@.str.5 = [43 x i8] c"Edit Values in \22parameters.ini\22 then rerun\00"
@RAND_MAX = global double 0.000000e+00
@.str.6 = [5 x i8] c"seed\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [12 x i8] c"matrixC.mat\00"
@.str.9 = [12 x i8] c"matrixR.mat\00"
@.str.10 = [10 x i8] c"%d %d -1\0A\00"
@.str.11 = [10 x i8] c"%d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca i32*
store i32 0, i32* %1
store double 0x4005BF0A87427F01, double* %3
store double 0x41DFFFFFFFC00000, double* %4
%24 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %20
%25 = icmp ne i32* %24, null
br i1 %25, label %26, label %29
26: ; preds = %0
%27 = load i32*, i32** %20
%28 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %9, double* %2)
br label %34
29: ; preds = %0
%30 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %30, i32** %20
%31 = load i32*, i32** %20
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %407
34: ; preds = %26
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
%39 = mul nsw i32 %36, %38
%40 = load i32, i32* %9
%41 = sub nsw i32 %40, 1
%42 = load i32, i32* %9
%43 = sub nsw i32 %42, 1
%44 = mul nsw i32 %41, %43
%45 = add nsw i32 %39, %44
store i32 %45, i32* %12
%46 = load i32, i32* %9
%47 = add nsw i32 %46, 1
%48 = load i32, i32* %9
%49 = sub nsw i32 %48, 1
%50 = mul nsw i32 %47, %49
%51 = add nsw i32 %50, 2
store i32 %51, i32* %16
%52 = load i32, i32* %16
%53 = call i32* @calloc(i32 %52, i32 4)
store i32* %53, i32** %18
%54 = load i32, i32* %16
%55 = call i32* @calloc(i32 %54, i32 4)
store i32* %55, i32** %19
store i32 0, i32* %13
br label %56
56: ; preds = %69, %34
%57 = load i32, i32* %13
%58 = load i32, i32* %16
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %72
60: ; preds = %56
%61 = load i32*, i32** %18
%62 = load i32, i32* %13
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i32, i32* %61, i64 %63
store i32 0, i32* %64
%65 = load i32*, i32** %19
%66 = load i32, i32* %13
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i32, i32* %65, i64 %67
store i32 0, i32* %68
br label %69
69: ; preds = %60
%70 = load i32, i32* %13
%71 = add nsw i32 %70, 1
store i32 %71, i32* %13
br label %56
72: ; preds = %56
%73 = load i32*, i32** %20
%74 = call i32 @fclose(i32* %73)
%75 = load double, double* @RAND_MAX
store double %75, double* %4
%76 = call i32* @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %76, i32** %21
%77 = icmp ne i32* %76, null
br i1 %77, label %78, label %85
78: ; preds = %72
%79 = load i32*, i32** %21
%80 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %79, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %10)
%81 = load i32, i32* %10
%82 = call i32 @srand(i32 %81)
%83 = load i32*, i32** %21
%84 = call i32 @fclose(i32* %83)
br label %88
85: ; preds = %72
%86 = call i32 @time(i32* null)
%87 = call i32 @srand(i32 %86)
br label %88
88: ; preds = %85, %78
%89 = call i32* @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %89, i32** %21
%90 = load i32*, i32** %21
%91 = call double (...) @rand()
%92 = call i32 (i32*, i8*, ...) @fprintf(i32* %90, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %91)
%93 = load i32*, i32** %21
%94 = call i32 @fclose(i32* %93)
%95 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %95, i32** %22
%96 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %96, i32** %23
store i32 0, i32* %7
br label %97
97: ; preds = %277, %88
%98 = load i32, i32* %7
%99 = load i32, i32* %9
%100 = add nsw i32 %99, 1
%101 = icmp slt i32 %98, %100
br i1 %101, label %102, label %280
102: ; preds = %97
%103 = load i32, i32* %7
%104 = load i32, i32* %9
%105 = sub nsw i32 %104, 1
%106 = mul nsw i32 %103, %105
store i32 %106, i32* %17
store i32 0, i32* %14
%107 = load i32, i32* %17
%108 = add nsw i32 %107, 1
store i32 %108, i32* %15
%109 = call double (...) @rand()
%110 = load double, double* %4
%111 = fdiv double %109, %110
%112 = load double, double* %2
%113 = fcmp olt double %111, %112
br i1 %113, label %114, label %135
114: ; preds = %102
%115 = load i32*, i32** %22
%116 = load i32, i32* %15
%117 = load i32, i32* %14
%118 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %116, i32 %117)
%119 = load i32*, i32** %22
%120 = load i32, i32* %14
%121 = load i32, i32* %15
%122 = call i32 (i32*, i8*, ...) @fprintf(i32* %119, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %120, i32 %121)
%123 = load i32*, i32** %18
%124 = load i32, i32* %15
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i32, i32* %123, i64 %125
%127 = load i32, i32* %126
%128 = add nsw i32 %127, 1
store i32 %128, i32* %126
%129 = load i32*, i32** %18
%130 = load i32, i32* %14
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i32, i32* %129, i64 %131
%133 = load i32, i32* %132
%134 = add nsw i32 %133, 1
store i32 %134, i32* %132
br label %156
135: ; preds = %102
%136 = load i32*, i32** %23
%137 = load i32, i32* %15
%138 = load i32, i32* %14
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %136, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %137, i32 %138)
%140 = load i32*, i32** %23
%141 = load i32, i32* %14
%142 = load i32, i32* %15
%143 = call i32 (i32*, i8*, ...) @fprintf(i32* %140, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %141, i32 %142)
%144 = load i32*, i32** %19
%145 = load i32, i32* %15
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i32, i32* %144, i64 %146
%148 = load i32, i32* %147
%149 = add nsw i32 %148, 1
store i32 %149, i32* %147
%150 = load i32*, i32** %19
%151 = load i32, i32* %14
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i32, i32* %150, i64 %152
%154 = load i32, i32* %153
%155 = add nsw i32 %154, 1
store i32 %155, i32* %153
br label %156
156: ; preds = %135, %114
store i32 1, i32* %8
br label %157
157: ; preds = %218, %156
%158 = load i32, i32* %8
%159 = load i32, i32* %9
%160 = sub nsw i32 %159, 1
%161 = icmp slt i32 %158, %160
br i1 %161, label %162, label %221
162: ; preds = %157
%163 = load i32, i32* %17
%164 = load i32, i32* %8
%165 = add nsw i32 %163, %164
store i32 %165, i32* %14
%166 = load i32, i32* %17
%167 = load i32, i32* %8
%168 = add nsw i32 %166, %167
%169 = add nsw i32 %168, 1
store i32 %169, i32* %15
%170 = call double (...) @rand()
%171 = load double, double* %4
%172 = fdiv double %170, %171
%173 = load double, double* %2
%174 = fcmp olt double %172, %173
br i1 %174, label %175, label %196
175: ; preds = %162
%176 = load i32*, i32** %22
%177 = load i32, i32* %15
%178 = load i32, i32* %14
%179 = call i32 (i32*, i8*, ...) @fprintf(i32* %176, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %177, i32 %178)
%180 = load i32*, i32** %22
%181 = load i32, i32* %14
%182 = load i32, i32* %15
%183 = call i32 (i32*, i8*, ...) @fprintf(i32* %180, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %181, i32 %182)
%184 = load i32*, i32** %18
%185 = load i32, i32* %15
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds i32, i32* %184, i64 %186
%188 = load i32, i32* %187
%189 = add nsw i32 %188, 1
store i32 %189, i32* %187
%190 = load i32*, i32** %18
%191 = load i32, i32* %14
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds i32, i32* %190, i64 %192
%194 = load i32, i32* %193
%195 = add nsw i32 %194, 1
store i32 %195, i32* %193
br label %217
196: ; preds = %162
%197 = load i32*, i32** %23
%198 = load i32, i32* %15
%199 = load i32, i32* %14
%200 = call i32 (i32*, i8*, ...) @fprintf(i32* %197, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %198, i32 %199)
%201 = load i32*, i32** %23
%202 = load i32, i32* %14
%203 = load i32, i32* %15
%204 = call i32 (i32*, i8*, ...) @fprintf(i32* %201, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %202, i32 %203)
%205 = load i32*, i32** %19
%206 = load i32, i32* %15
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds i32, i32* %205, i64 %207
%209 = load i32, i32* %208
%210 = add nsw i32 %209, 1
store i32 %210, i32* %208
%211 = load i32*, i32** %19
%212 = load i32, i32* %14
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds i32, i32* %211, i64 %213
%215 = load i32, i32* %214
%216 = add nsw i32 %215, 1
store i32 %216, i32* %214
br label %217
217: ; preds = %196, %175
br label %218
218: ; preds = %217
%219 = load i32, i32* %8
%220 = add nsw i32 %219, 1
store i32 %220, i32* %8
br label %157
221: ; preds = %157
%222 = load i32, i32* %7
%223 = add nsw i32 %222, 1
%224 = load i32, i32* %9
%225 = sub nsw i32 %224, 1
%226 = mul nsw i32 %223, %225
store i32 %226, i32* %14
%227 = load i32, i32* %16
%228 = sub nsw i32 %227, 1
store i32 %228, i32* %15
%229 = call double (...) @rand()
%230 = load double, double* %4
%231 = fdiv double %229, %230
%232 = load double, double* %2
%233 = fcmp olt double %231, %232
br i1 %233, label %234, label %255
234: ; preds = %221
%235 = load i32*, i32** %22
%236 = load i32, i32* %15
%237 = load i32, i32* %14
%238 = call i32 (i32*, i8*, ...) @fprintf(i32* %235, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %236, i32 %237)
%239 = load i32*, i32** %22
%240 = load i32, i32* %14
%241 = load i32, i32* %15
%242 = call i32 (i32*, i8*, ...) @fprintf(i32* %239, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %240, i32 %241)
%243 = load i32*, i32** %18
%244 = load i32, i32* %15
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds i32, i32* %243, i64 %245
%247 = load i32, i32* %246
%248 = add nsw i32 %247, 1
store i32 %248, i32* %246
%249 = load i32*, i32** %18
%250 = load i32, i32* %14
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds i32, i32* %249, i64 %251
%253 = load i32, i32* %252
%254 = add nsw i32 %253, 1
store i32 %254, i32* %252
br label %276
255: ; preds = %221
%256 = load i32*, i32** %23
%257 = load i32, i32* %15
%258 = load i32, i32* %14
%259 = call i32 (i32*, i8*, ...) @fprintf(i32* %256, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %257, i32 %258)
%260 = load i32*, i32** %23
%261 = load i32, i32* %14
%262 = load i32, i32* %15
%263 = call i32 (i32*, i8*, ...) @fprintf(i32* %260, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %261, i32 %262)
%264 = load i32*, i32** %19
%265 = load i32, i32* %15
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds i32, i32* %264, i64 %266
%268 = load i32, i32* %267
%269 = add nsw i32 %268, 1
store i32 %269, i32* %267
%270 = load i32*, i32** %19
%271 = load i32, i32* %14
%272 = sext i32 %271 to i64
%273 = getelementptr inbounds i32, i32* %270, i64 %272
%274 = load i32, i32* %273
%275 = add nsw i32 %274, 1
store i32 %275, i32* %273
br label %276
276: ; preds = %255, %234
br label %277
277: ; preds = %276
%278 = load i32, i32* %7
%279 = add nsw i32 %278, 1
store i32 %279, i32* %7
br label %97
280: ; preds = %97
store i32 0, i32* %7
br label %281
281: ; preds = %356, %280
%282 = load i32, i32* %7
%283 = load i32, i32* %9
%284 = icmp slt i32 %282, %283
br i1 %284, label %285, label %359
285: ; preds = %281
%286 = load i32, i32* %7
%287 = load i32, i32* %9
%288 = sub nsw i32 %287, 1
%289 = mul nsw i32 %286, %288
store i32 %289, i32* %17
store i32 1, i32* %8
br label %290
290: ; preds = %352, %285
%291 = load i32, i32* %8
%292 = load i32, i32* %9
%293 = icmp slt i32 %291, %292
br i1 %293, label %294, label %355
294: ; preds = %290
%295 = load i32, i32* %17
%296 = load i32, i32* %8
%297 = add nsw i32 %295, %296
store i32 %297, i32* %14
%298 = load i32, i32* %17
%299 = load i32, i32* %8
%300 = add nsw i32 %298, %299
%301 = load i32, i32* %9
%302 = sub nsw i32 %301, 1
%303 = add nsw i32 %300, %302
store i32 %303, i32* %15
%304 = call double (...) @rand()
%305 = load double, double* %4
%306 = fdiv double %304, %305
%307 = load double, double* %2
%308 = fcmp olt double %306, %307
br i1 %308, label %309, label %330
309: ; preds = %294
%310 = load i32*, i32** %22
%311 = load i32, i32* %15
%312 = load i32, i32* %14
%313 = call i32 (i32*, i8*, ...) @fprintf(i32* %310, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %311, i32 %312)
%314 = load i32*, i32** %22
%315 = load i32, i32* %14
%316 = load i32, i32* %15
%317 = call i32 (i32*, i8*, ...) @fprintf(i32* %314, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %315, i32 %316)
%318 = load i32*, i32** %18
%319 = load i32, i32* %15
%320 = sext i32 %319 to i64
%321 = getelementptr inbounds i32, i32* %318, i64 %320
%322 = load i32, i32* %321
%323 = add nsw i32 %322, 1
store i32 %323, i32* %321
%324 = load i32*, i32** %18
%325 = load i32, i32* %14
%326 = sext i32 %325 to i64
%327 = getelementptr inbounds i32, i32* %324, i64 %326
%328 = load i32, i32* %327
%329 = add nsw i32 %328, 1
store i32 %329, i32* %327
br label %351
330: ; preds = %294
%331 = load i32*, i32** %23
%332 = load i32, i32* %15
%333 = load i32, i32* %14
%334 = call i32 (i32*, i8*, ...) @fprintf(i32* %331, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %332, i32 %333)
%335 = load i32*, i32** %23
%336 = load i32, i32* %14
%337 = load i32, i32* %15
%338 = call i32 (i32*, i8*, ...) @fprintf(i32* %335, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %336, i32 %337)
%339 = load i32*, i32** %19
%340 = load i32, i32* %15
%341 = sext i32 %340 to i64
%342 = getelementptr inbounds i32, i32* %339, i64 %341
%343 = load i32, i32* %342
%344 = add nsw i32 %343, 1
store i32 %344, i32* %342
%345 = load i32*, i32** %19
%346 = load i32, i32* %14
%347 = sext i32 %346 to i64
%348 = getelementptr inbounds i32, i32* %345, i64 %347
%349 = load i32, i32* %348
%350 = add nsw i32 %349, 1
store i32 %350, i32* %348
br label %351
351: ; preds = %330, %309
br label %352
352: ; preds = %351
%353 = load i32, i32* %8
%354 = add nsw i32 %353, 1
store i32 %354, i32* %8
br label %290
355: ; preds = %290
br label %356
356: ; preds = %355
%357 = load i32, i32* %7
%358 = add nsw i32 %357, 1
store i32 %358, i32* %7
br label %281
359: ; preds = %281
store i32 0, i32* %13
br label %360
360: ; preds = %399, %359
%361 = load i32, i32* %13
%362 = load i32, i32* %16
%363 = icmp slt i32 %361, %362
br i1 %363, label %364, label %402
364: ; preds = %360
%365 = load i32*, i32** %18
%366 = load i32, i32* %13
%367 = sext i32 %366 to i64
%368 = getelementptr inbounds i32, i32* %365, i64 %367
%369 = load i32, i32* %368
%370 = icmp sgt i32 %369, 0
br i1 %370, label %371, label %381
371: ; preds = %364
%372 = load i32*, i32** %22
%373 = load i32, i32* %13
%374 = load i32, i32* %13
%375 = load i32*, i32** %18
%376 = load i32, i32* %13
%377 = sext i32 %376 to i64
%378 = getelementptr inbounds i32, i32* %375, i64 %377
%379 = load i32, i32* %378
%380 = call i32 (i32*, i8*, ...) @fprintf(i32* %372, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i32 %373, i32 %374, i32 %379)
br label %381
381: ; preds = %371, %364
%382 = load i32*, i32** %19
%383 = load i32, i32* %13
%384 = sext i32 %383 to i64
%385 = getelementptr inbounds i32, i32* %382, i64 %384
%386 = load i32, i32* %385
%387 = icmp sgt i32 %386, 0
br i1 %387, label %388, label %398
388: ; preds = %381
%389 = load i32*, i32** %23
%390 = load i32, i32* %13
%391 = load i32, i32* %13
%392 = load i32*, i32** %19
%393 = load i32, i32* %13
%394 = sext i32 %393 to i64
%395 = getelementptr inbounds i32, i32* %392, i64 %394
%396 = load i32, i32* %395
%397 = call i32 (i32*, i8*, ...) @fprintf(i32* %389, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i32 %390, i32 %391, i32 %396)
br label %398
398: ; preds = %388, %381
br label %399
399: ; preds = %398
%400 = load i32, i32* %13
%401 = add nsw i32 %400, 1
store i32 %401, i32* %13
br label %360
402: ; preds = %360
%403 = load i32*, i32** %22
%404 = call i32 @fclose(i32* %403)
%405 = load i32*, i32** %23
%406 = call i32 @fclose(i32* %405)
store i32 0, i32* %1
br label %407
407: ; preds = %402, %29
%408 = load i32, i32* %1
ret i32 %408
}

LLVM IR (-O2):
@.str = [15 x i8] c"parameters.ini\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"%d %lf\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [28 x i8] c"50 0.4\0AN_vert_comps ratio_C\00"
@.str.5 = [43 x i8] c"Edit Values in \22parameters.ini\22 then rerun\00"
@RAND_MAX = global double 0.000000e+00
@.str.6 = [5 x i8] c"seed\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [12 x i8] c"matrixC.mat\00"
@.str.9 = [12 x i8] c"matrixR.mat\00"
@.str.10 = [10 x i8] c"%d %d -1\0A\00"
@.str.11 = [10 x i8] c"%d %d %d\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca i32
%3 = alloca i32
%4 = bitcast double* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %24, label %9
9: ; preds = %0
%10 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %2, double* %1)
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
%13 = add nsw i32 %11, -1
%14 = mul nsw i32 %12, %13
%15 = add nsw i32 %14, 2
%16 = call i32* @calloc(i32 %15, i32 4)
%17 = call i32* @calloc(i32 %15, i32 4)
%18 = icmp sgt i32 %14, -2
br i1 %18, label %19, label %28
19: ; preds = %9
%20 = bitcast i32* %17 to i8*
%21 = bitcast i32* %16 to i8*
%22 = zext i32 %15 to i64
%23 = shl nuw nsw i64 %22, 2
br label %28
24: ; preds = %0
%25 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%26 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i64 27, i64 1, i32* %25)
%27 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
br label %192
28: ; preds = %19, %9
%29 = call i32 @fclose(i32* %7)
%30 = load double, double* @RAND_MAX
%31 = call i32* @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %38, label %33
33: ; preds = %28
%34 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %3)
%35 = load i32, i32* %3
%36 = call i32 @srand(i32 %35)
%37 = call i32 @fclose(i32* %31)
br label %41
38: ; preds = %28
%39 = call i32 @time(i32* null)
%40 = call i32 @srand(i32 %39)
br label %41
41: ; preds = %38, %33
%42 = call i32* @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%43 = call double (...) @rand()
%44 = call i32 (i32*, i8*, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %43)
%45 = call i32 @fclose(i32* %42)
%46 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%47 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%48 = load i32, i32* %2
%49 = icmp slt i32 %48, 0
br i1 %49, label %129, label %50
50: ; preds = %41
%51 = add nsw i32 %14, 1
%52 = sext i32 %51 to i64
br label %55
53: ; preds = %107
%54 = icmp sgt i32 %127, 0
br i1 %54, label %133, label %129
55: ; preds = %50, %107
%56 = phi i32 [ %48, %50 ], [ %127, %107 ]
%57 = phi i32 [ 0, %50 ], [ %109, %107 ]
%58 = add nsw i32 %56, -1
%59 = mul nsw i32 %58, %57
%60 = add nsw i32 %59, 1
%61 = call double (...) @rand()
%62 = fdiv double %61, %30
%63 = load double, double* %1
%64 = fcmp olt double %62, %63
%65 = select i1 %64, i32* %46, i32* %47
%66 = select i1 %64, i32* %16, i32* %17
%67 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %60, i32 0)
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 0, i32 %60)
%69 = sext i32 %60 to i64
%70 = getelementptr inbounds i32, i32* %66, i64 %69
%71 = load i32, i32* %70
%72 = add nsw i32 %71, 1
store i32 %72, i32* %70
%73 = load i32, i32* %66
%74 = add nsw i32 %73, 1
store i32 %74, i32* %66
%75 = load i32, i32* %2
%76 = add nsw i32 %75, -1
%77 = icmp sgt i32 %75, 2
br i1 %77, label %78, label %107
78: ; preds = %55
%79 = sext i32 %59 to i64
br label %80
80: ; preds = %78, %80
%81 = phi i64 [ 1, %78 ], [ %102, %80 ]
%82 = trunc i64 %81 to i32
%83 = add nsw i64 %81, %79
%84 = add nsw i32 %59, %82
%85 = add nsw i64 %83, 1
%86 = add nsw i32 %84, 1
%87 = call double (...) @rand()
%88 = fdiv double %87, %30
%89 = load double, double* %1
%90 = fcmp olt double %88, %89
%91 = trunc i64 %83 to i32
%92 = select i1 %90, i32* %46, i32* %47
%93 = select i1 %90, i32* %16, i32* %17
%94 = call i32 (i32*, i8*, ...) @fprintf(i32* %92, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %86, i32 %91)
%95 = call i32 (i32*, i8*, ...) @fprintf(i32* %92, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %91, i32 %86)
%96 = getelementptr inbounds i32, i32* %93, i64 %85
%97 = load i32, i32* %96
%98 = add nsw i32 %97, 1
store i32 %98, i32* %96
%99 = getelementptr inbounds i32, i32* %93, i64 %83
%100 = load i32, i32* %99
%101 = add nsw i32 %100, 1
store i32 %101, i32* %99
%102 = add nuw nsw i64 %81, 1
%103 = load i32, i32* %2
%104 = add nsw i32 %103, -1
%105 = sext i32 %104 to i64
%106 = icmp slt i64 %102, %105
br i1 %106, label %80, label %107
107: ; preds = %80, %55
%108 = phi i32 [ %76, %55 ], [ %104, %80 ]
%109 = add nuw nsw i32 %57, 1
%110 = mul nsw i32 %108, %109
%111 = call double (...) @rand()
%112 = fdiv double %111, %30
%113 = load double, double* %1
%114 = fcmp olt double %112, %113
%115 = select i1 %114, i32* %46, i32* %47
%116 = select i1 %114, i32* %16, i32* %17
%117 = getelementptr inbounds i32, i32* %116, i64 %52
%118 = select i1 %114, i32* %16, i32* %17
%119 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %51, i32 %110)
%120 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %110, i32 %51)
%121 = load i32, i32* %117
%122 = add nsw i32 %121, 1
store i32 %122, i32* %117
%123 = sext i32 %110 to i64
%124 = getelementptr inbounds i32, i32* %118, i64 %123
%125 = load i32, i32* %124
%126 = add nsw i32 %125, 1
store i32 %126, i32* %124
%127 = load i32, i32* %2
%128 = icmp slt i32 %57, %127
br i1 %128, label %55, label %53
129: ; preds = %167, %41, %53
br i1 %18, label %130, label %189
130: ; preds = %129
%131 = call i32 @llvm.smax.i32(i32 %15, i32 1)
%132 = zext i32 %131 to i64
br label %171
133: ; preds = %53, %167
%134 = phi i32 [ %168, %167 ], [ %127, %53 ]
%135 = phi i32 [ %169, %167 ], [ 0, %53 ]
%136 = icmp sgt i32 %134, 1
br i1 %136, label %137, label %167
137: ; preds = %133
%138 = add nsw i32 %134, -1
%139 = mul nsw i32 %138, %135
%140 = sext i32 %139 to i64
br label %141
141: ; preds = %137, %141
%142 = phi i64 [ 1, %137 ], [ %163, %141 ]
%143 = phi i32 [ %134, %137 ], [ %164, %141 ]
%144 = add nsw i64 %142, %140
%145 = add nsw i32 %143, -1
%146 = trunc i64 %144 to i32
%147 = add nsw i32 %145, %146
%148 = call double (...) @rand()
%149 = fdiv double %148, %30
%150 = load double, double* %1
%151 = fcmp olt double %149, %150
%152 = select i1 %151, i32* %46, i32* %47
%153 = select i1 %151, i32* %16, i32* %17
%154 = call i32 (i32*, i8*, ...) @fprintf(i32* %152, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %147, i32 %146)
%155 = call i32 (i32*, i8*, ...) @fprintf(i32* %152, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %146, i32 %147)
%156 = sext i32 %147 to i64
%157 = getelementptr inbounds i32, i32* %153, i64 %156
%158 = load i32, i32* %157
%159 = add nsw i32 %158, 1
store i32 %159, i32* %157
%160 = getelementptr inbounds i32, i32* %153, i64 %144
%161 = load i32, i32* %160
%162 = add nsw i32 %161, 1
store i32 %162, i32* %160
%163 = add nuw nsw i64 %142, 1
%164 = load i32, i32* %2
%165 = sext i32 %164 to i64
%166 = icmp slt i64 %163, %165
br i1 %166, label %141, label %167
167: ; preds = %141, %133
%168 = phi i32 [ %134, %133 ], [ %164, %141 ]
%169 = add nuw nsw i32 %135, 1
%170 = icmp slt i32 %169, %168
br i1 %170, label %133, label %129
171: ; preds = %130, %186
%172 = phi i64 [ 0, %130 ], [ %187, %186 ]
%173 = getelementptr inbounds i32, i32* %16, i64 %172
%174 = load i32, i32* %173
%175 = icmp sgt i32 %174, 0
br i1 %175, label %176, label %179
176: ; preds = %171
%177 = trunc i64 %172 to i32
%178 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i32 %177, i32 %177, i32 %174)
br label %179
179: ; preds = %176, %171
%180 = getelementptr inbounds i32, i32* %17, i64 %172
%181 = load i32, i32* %180
%182 = icmp sgt i32 %181, 0
br i1 %182, label %183, label %186
183: ; preds = %179
%184 = trunc i64 %172 to i32
%185 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i32 %184, i32 %184, i32 %181)
br label %186
186: ; preds = %179, %183
%187 = add nuw nsw i64 %172, 1
%188 = icmp eq i64 %187, %132
br i1 %188, label %189, label %171
189: ; preds = %186, %129
%190 = call i32 @fclose(i32* %46)
%191 = call i32 @fclose(i32* %47)
br label %192
192: ; preds = %189, %24
ret i32 0
}