#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*/ free(int *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, ...);
int /*<<< orphan*/ printf(char *);
double rand();
int /*<<< orphan*/ srand(int);
int time(int /*<<< orphan*/ *);
int main() {
  double rnd_x, rnd_y, ratioC, Csig, Rsig, Cn, Rn, C0, R0;
  double e = 2.7182818, rmax = 2147483647;
  int i, j, cy, cx, size, Sx, Sy, seed, null, Nsize;
  int *fval;
  int fval1;
  FILE *f0, *f1, *f1a, *f1b, *f2, *f3, *fMC, *fMR;
  if (f0 = fopen("parameters.ini", "r"))
    fscanf(f0, "%d %lf %lf %lf %lf %lf %d %d", &size, &ratioC, &C0, &Csig, &R0,
           &Rsig, &Sx, &Sy);
  else {
    f0 = fopen("parameters.ini", "w");
    fprintf(
        f0,
        "50 0.4 1 0.333 1 0.333 1 1\nN_vert_comps ratio_C C0 sigma_C(fraction "
        "of C0) R0 sigma_R(fraction of R0) x_squash y_squash");
    printf("Edit Values in \"parameters.ini\" then rerun");
    return 0;
  }
  Nsize = (size + 1) * (size + 1) + (size - 1) * (size - 1);
  fval = calloc(4 * (size + 10) * (size + 10), sizeof(double));
  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);
  f0 = fopen("circuit.cir", "w");
  fprintf(f0, "Random RC Network\n");
  for (cy = 0; cy < size + 1; cy++)
    for (cx = 1; cx < size - 1; cx++) {
      if ((rand() / rmax) < ratioC) {
        fprintf(f0, "Cx%dy%dX x%dy%d x%dy%d %en\n", cx, cy, cx, cy, cx + 1, cy,
                C0);
        fprintf(f0, "Rx%dy%dX x%dy%d x%dy%d 1G\n", cx, cy, cx, cy, cx + 1, cy);
      } else {
        fprintf(f0, "Rx%dy%dX x%dy%d x%dy%d %ek\n", cx, cy, cx, cy, cx + 1, cy,
                R0);
      }
    }
  for (cy = 0; cy < size; cy++)
    for (cx = 1; cx < size; cx++) {
      if ((rand() / rmax) < ratioC) {
        fprintf(f0, "Cx%dy%dY x%dy%d x%dy%d %en\n", cx, cy, cx, cy, cx, cy + 1,
                C0);
        fprintf(f0, "Rx%dy%dY x%dy%d x%dy%d 1G\n", cx, cy, cx, cy, cx, cy + 1);
      } else {
        fprintf(f0, "Rx%dy%dY x%dy%d x%dy%d %ek\n", cx, cy, cx, cy, cx, cy + 1,
                R0);
      }
    }
  for (cy = 0; cy < size + 1; cy++) {
    if ((rand() / rmax) < ratioC) {
      fprintf(f0, "Cx0y%dX 0 x1y%d %en\n", cy, cy, C0);
      fprintf(f0, "Rx0y%dX 0 x1y%d 1G\n", cy, cy);
    } else {
      fprintf(f0, "Rx0y%dX 0 x1y%d %ek\n", cy, cy, R0);
    }
    if ((rand() / rmax) < ratioC) {
      fprintf(f0, "Cx%dy%dX x%dy%d VOUT %en\n", size - 1, cy, size - 1, cy, C0);
      fprintf(f0, "Rx%dy%dX x%dy%d VOUT 1G\n", size - 1, cy, size - 1, cy);
    } else {
      fprintf(f0, "Rx%dy%dX x%dy%d VOUT %ek\n", size - 1, cy, size - 1, cy, R0);
    }
  }
  fprintf(f0, "V1 R1_N 0 AC 50\nR1 VOUT R1_N 100Meg\n");
  fclose(f0);
  free(fval);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x108,%rsp
movl   $0x0,-0xc(%rbp)
movsd  0xe4d(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe38(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
lea    0xe3c(%rip),%rdi
lea    0xf15(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0xa8(%rbp)
cmp    $0x0,%rax
je     1241 <main+0xa1>
mov    -0xa8(%rbp),%rdi
lea    0xe20(%rip),%rsi
lea    -0x7c(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x50(%rbp),%r8
lea    -0x30(%rbp),%r9
lea    -0x58(%rbp),%rbx
lea    -0x38(%rbp),%r11
lea    -0x80(%rbp),%r10
lea    -0x84(%rbp),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    $0x0,%al
call   1060 <fscanf@plt>
jmp    1288 <main+0xe8>
lea    0xdc8(%rip),%rdi
lea    0xded(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rdi
lea    0xdd5(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
lea    0xe3f(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0xc(%rbp)
jmp    179d <main+0x5fd>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    -0x7c(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    -0x7c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x7c(%rbp),%edx
sub    $0x1,%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x90(%rbp)
mov    -0x7c(%rbp),%edi
add    $0xa,%edi
shl    $0x2,%edi
mov    -0x7c(%rbp),%eax
add    $0xa,%eax
imul   %eax,%edi
mov    $0x8,%esi
call   1080 <calloc@plt>
mov    %rax,-0x98(%rbp)
mov    -0xa8(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2d04(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
lea    0xded(%rip),%rdi
lea    0xdf5(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0xb0(%rbp)
cmp    $0x0,%rax
je     1349 <main+0x1a9>
mov    -0xb0(%rbp),%rdi
lea    0xd1a(%rip),%rsi
lea    -0x88(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x88(%rbp),%edi
call   1070 <srand@plt>
mov    -0xb0(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1359 <main+0x1b9>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
lea    0xd81(%rip),%rdi
lea    0xcd5(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
mov    $0x0,%al
call   10c0 <rand@plt>
mov    -0xe8(%rbp),%rdi
lea    0xca3(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0xb0(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xd36(%rip),%rdi
lea    0xc85(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rdi
lea    0xd21(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    -0x7c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    14fd <main+0x35d>
movl   $0x1,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    -0x7c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    14ea <main+0x34a>
mov    $0x0,%al
call   10c0 <rand@plt>
movaps %xmm0,%xmm1
divsd  -0x68(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    149c <main+0x2fc>
mov    -0xa8(%rbp),%rdi
mov    -0x78(%rbp),%edx
mov    -0x74(%rbp),%ecx
mov    -0x78(%rbp),%r8d
mov    -0x74(%rbp),%r9d
mov    -0x78(%rbp),%r10d
add    $0x1,%r10d
mov    -0x74(%rbp),%eax
movsd  -0x50(%rbp),%xmm0
lea    0xcb3(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0xa8(%rbp),%rdi
mov    -0x78(%rbp),%edx
mov    -0x74(%rbp),%ecx
mov    -0x78(%rbp),%r8d
mov    -0x74(%rbp),%r9d
mov    -0x78(%rbp),%r10d
add    $0x1,%r10d
mov    -0x74(%rbp),%eax
lea    0xc99(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    14d7 <main+0x337>
mov    -0xa8(%rbp),%rdi
mov    -0x78(%rbp),%edx
mov    -0x74(%rbp),%ecx
mov    -0x78(%rbp),%r8d
mov    -0x74(%rbp),%r9d
mov    -0x78(%rbp),%r10d
add    $0x1,%r10d
mov    -0x74(%rbp),%eax
movsd  -0x58(%rbp),%xmm0
lea    0xc74(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x1,%al
call   1090 <fprintf@plt>
jmp    14dc <main+0x33c>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    13f7 <main+0x257>
jmp    14ef <main+0x34f>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    13df <main+0x23f>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jge    1615 <main+0x475>
movl   $0x1,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jge    1602 <main+0x462>
mov    $0x0,%al
call   10c0 <rand@plt>
movaps %xmm0,%xmm1
divsd  -0x68(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    15b5 <main+0x415>
mov    -0xa8(%rbp),%rdi
mov    -0x78(%rbp),%edx
mov    -0x74(%rbp),%ecx
mov    -0x78(%rbp),%r8d
mov    -0x74(%rbp),%r9d
mov    -0x78(%rbp),%r10d
mov    -0x74(%rbp),%eax
add    $0x1,%eax
movsd  -0x50(%rbp),%xmm0
lea    0xbec(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0xa8(%rbp),%rdi
mov    -0x78(%rbp),%edx
mov    -0x74(%rbp),%ecx
mov    -0x78(%rbp),%r8d
mov    -0x74(%rbp),%r9d
mov    -0x78(%rbp),%r10d
mov    -0x74(%rbp),%eax
add    $0x1,%eax
lea    0xbd3(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    15ef <main+0x44f>
mov    -0xa8(%rbp),%rdi
mov    -0x78(%rbp),%edx
mov    -0x74(%rbp),%ecx
mov    -0x78(%rbp),%r8d
mov    -0x74(%rbp),%r9d
mov    -0x78(%rbp),%r10d
mov    -0x74(%rbp),%eax
add    $0x1,%eax
movsd  -0x58(%rbp),%xmm0
lea    0xbaf(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x1,%al
call   1090 <fprintf@plt>
jmp    15f4 <main+0x454>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1517 <main+0x377>
jmp    1607 <main+0x467>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1504 <main+0x364>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    -0x7c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1769 <main+0x5c9>
mov    $0x0,%al
call   10c0 <rand@plt>
movaps %xmm0,%xmm1
divsd  -0x68(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    168b <main+0x4eb>
mov    -0xa8(%rbp),%rdi
mov    -0x74(%rbp),%edx
mov    -0x74(%rbp),%ecx
movsd  -0x50(%rbp),%xmm0
lea    0xb47(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0xa8(%rbp),%rdi
mov    -0x74(%rbp),%edx
mov    -0x74(%rbp),%ecx
lea    0xb41(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    16ab <main+0x50b>
mov    -0xa8(%rbp),%rdi
mov    -0x74(%rbp),%edx
mov    -0x74(%rbp),%ecx
movsd  -0x58(%rbp),%xmm0
lea    0xb30(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    $0x0,%al
call   10c0 <rand@plt>
movaps %xmm0,%xmm1
divsd  -0x68(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1727 <main+0x587>
mov    -0xa8(%rbp),%rdi
mov    -0x7c(%rbp),%edx
sub    $0x1,%edx
mov    -0x74(%rbp),%ecx
mov    -0x7c(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x74(%rbp),%r9d
movsd  -0x50(%rbp),%xmm0
lea    0xaf8(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0xa8(%rbp),%rdi
mov    -0x7c(%rbp),%edx
sub    $0x1,%edx
mov    -0x74(%rbp),%ecx
mov    -0x7c(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x74(%rbp),%r9d
lea    0xae8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1756 <main+0x5b6>
mov    -0xa8(%rbp),%rdi
mov    -0x7c(%rbp),%edx
sub    $0x1,%edx
mov    -0x74(%rbp),%ecx
mov    -0x7c(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x74(%rbp),%r9d
movsd  -0x58(%rbp),%xmm0
lea    0xacd(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
jmp    175b <main+0x5bb>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    161c <main+0x47c>
mov    -0xa8(%rbp),%rdi
lea    0xabf(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0xa8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x108,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xe3b(%rip),%rdi
lea    0xf14(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     129d <main+0xed>
mov    %rax,%rbx
lea    0x40(%rsp),%rbp
lea    0x44(%rsp),%r10
lea    0x48(%rsp),%r11
lea    0x18(%rsp),%r14
lea    0xe17(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x28(%rsp),%rcx
lea    0x20(%rsp),%r8
lea    0x50(%rsp),%r9
mov    %rax,%rdi
xor    %eax,%eax
push   %rbp
push   %r10
push   %r11
push   %r14
call   1060 <fscanf@plt>
add    $0x20,%rsp
mov    0xc(%rsp),%edi
add    $0xa,%edi
imul   %edi,%edi
shl    $0x2,%edi
mov    $0x8,%esi
call   1080 <calloc@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2d9e(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xe76(%rip),%rdi
lea    0xe7e(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
mov    %rbp,0x38(%rsp)
je     12da <main+0x12a>
mov    %rax,%rbx
lea    0xdae(%rip),%rsi
lea    0x34(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    0x34(%rsp),%edi
call   1070 <srand@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
jmp    12e8 <main+0x138>
lea    0xd5c(%rip),%rdi
lea    0xd81(%rip),%rsi
call   10b0 <fopen@plt>
lea    0xd77(%rip),%rdi
mov    $0x77,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10c0 <fwrite@plt>
lea    0xdd6(%rip),%rdi
call   1050 <printf@plt>
jmp    1647 <main+0x497>
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
lea    0xde2(%rip),%rdi
lea    0xd36(%rip),%rbx
mov    %rbx,%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   10d0 <rand@plt>
lea    0xd1a(%rip),%rsi
mov    %rbp,%rdi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
lea    0xdae(%rip),%rdi
mov    %rbx,%rsi
call   10b0 <fopen@plt>
mov    %rax,%r13
lea    0xda8(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10c0 <fwrite@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     161c <main+0x46c>
lea    0xdb2(%rip),%r15
lea    0xdc6(%rip),%r12
xor    %ebp,%ebp
jmp    137d <main+0x1cd>
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbp),%ecx
cmp    %eax,%ebp
mov    %ecx,%ebp
jge    1424 <main+0x274>
cmp    $0x3,%eax
jl     1370 <main+0x1c0>
mov    $0x1,%ebx
jmp    13c3 <main+0x213>
nopl   0x0(%rax)
movsd  0x18(%rsp),%xmm0
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %ebp,%r9d
mov    $0x1,%al
push   %rbp
push   %r14
call   1090 <fprintf@plt>
add    $0x10,%rsp
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %r14d,%ebx
cmp    %ecx,%r14d
jge    1370 <main+0x1c0>
xor    %eax,%eax
call   10d0 <rand@plt>
divsd  0x10(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
lea    0x1(%rbx),%r14d
ucomisd %xmm0,%xmm1
jbe    1390 <main+0x1e0>
movsd  0x20(%rsp),%xmm0
mov    %r13,%rdi
lea    0xd05(%rip),%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %ebp,%r9d
mov    $0x1,%al
push   %rbp
push   %r14
call   1090 <fprintf@plt>
add    $0x10,%rsp
mov    %r13,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %ebp,%r9d
xor    %eax,%eax
push   %rbp
push   %r14
call   1090 <fprintf@plt>
jmp    13b0 <main+0x200>
test   %eax,%eax
jle    14ec <main+0x33c>
lea    0xd31(%rip),%r15
lea    0xd45(%rip),%r12
xor    %ebp,%ebp
jmp    144c <main+0x29c>
xchg   %ax,%ax
mov    %r14d,%ebp
cmp    %eax,%r14d
jge    14ec <main+0x33c>
lea    0x1(%rbp),%r14d
cmp    $0x2,%eax
jl     1440 <main+0x290>
mov    $0x1,%ebx
jmp    148f <main+0x2df>
nopl   0x0(%rax)
movsd  0x18(%rsp),%xmm0
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %ebp,%r9d
mov    $0x1,%al
push   %r14
push   %rbx
call   1090 <fprintf@plt>
add    $0x10,%rsp
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    %eax,%ebx
jge    1440 <main+0x290>
xor    %eax,%eax
call   10d0 <rand@plt>
divsd  0x10(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    1460 <main+0x2b0>
movsd  0x20(%rsp),%xmm0
mov    %r13,%rdi
lea    0xc90(%rip),%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %ebp,%r9d
mov    $0x1,%al
push   %r14
push   %rbx
call   1090 <fprintf@plt>
add    $0x10,%rsp
mov    %r13,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %ebp,%r9d
xor    %eax,%eax
push   %r14
push   %rbx
call   1090 <fprintf@plt>
jmp    1480 <main+0x2d0>
test   %eax,%eax
js     161c <main+0x46c>
mov    $0xffffffff,%ebp
lea    0xcd9(%rip),%rbx
lea    0xcec(%rip),%r14
lea    0xcfe(%rip),%r15
lea    0xcaf(%rip),%r12
jmp    1545 <main+0x395>
nopw   0x0(%rax,%rax,1)
movsd  0x18(%rsp),%xmm0
mov    %r13,%rdi
mov    %r15,%rsi
mov    %ebp,%ecx
mov    %edx,%r8d
mov    %ebp,%r9d
mov    $0x1,%al
call   1090 <fprintf@plt>
cmp    0xc(%rsp),%ebp
jge    161c <main+0x46c>
add    $0x1,%ebp
xor    %eax,%eax
call   10d0 <rand@plt>
divsd  0x10(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    15a0 <main+0x3f0>
movsd  0x20(%rsp),%xmm0
mov    %r13,%rdi
lea    0xc2a(%rip),%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    %r13,%rdi
lea    0xc2a(%rip),%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    15b7 <main+0x407>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x18(%rsp),%xmm0
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
mov    $0x1,%al
call   1090 <fprintf@plt>
xor    %eax,%eax
call   10d0 <rand@plt>
divsd  0x10(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
mov    0xc(%rsp),%edx
add    $0xffffffff,%edx
ucomisd %xmm0,%xmm1
jbe    1520 <main+0x370>
movsd  0x20(%rsp),%xmm0
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %ebp,%ecx
mov    %edx,%r8d
mov    %ebp,%r9d
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    0xc(%rsp),%edx
add    $0xffffffff,%edx
mov    %r13,%rdi
mov    %r14,%rsi
mov    %ebp,%ecx
mov    %edx,%r8d
mov    %ebp,%r9d
xor    %eax,%eax
call   1090 <fprintf@plt>
cmp    0xc(%rsp),%ebp
jl     1545 <main+0x395>
lea    0xc03(%rip),%rdi
mov    $0x24,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10c0 <fwrite@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x58,%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 = [29 x i8] c"%d %lf %lf %lf %lf %lf %d %d\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [120 x i8] c"50 0.4 1 0.333 1 0.333 1 1\0AN_vert_comps ratio_C C0 sigma_C(fraction of C0) R0 sigma_R(fraction of R0) x_squash y_squash\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"circuit.cir\00"
@.str.9 = [19 x i8] c"Random RC Network\0A\00"
@.str.10 = [28 x i8] c"Cx%dy%dX x%dy%d x%dy%d %en\0A\00"
@.str.11 = [27 x i8] c"Rx%dy%dX x%dy%d x%dy%d 1G\0A\00"
@.str.12 = [28 x i8] c"Rx%dy%dX x%dy%d x%dy%d %ek\0A\00"
@.str.13 = [28 x i8] c"Cx%dy%dY x%dy%d x%dy%d %en\0A\00"
@.str.14 = [27 x i8] c"Rx%dy%dY x%dy%d x%dy%d 1G\0A\00"
@.str.15 = [28 x i8] c"Rx%dy%dY x%dy%d x%dy%d %ek\0A\00"
@.str.16 = [21 x i8] c"Cx0y%dX 0 x1y%d %en\0A\00"
@.str.17 = [20 x i8] c"Rx0y%dX 0 x1y%d 1G\0A\00"
@.str.18 = [21 x i8] c"Rx0y%dX 0 x1y%d %ek\0A\00"
@.str.19 = [26 x i8] c"Cx%dy%dX x%dy%d VOUT %en\0A\00"
@.str.20 = [25 x i8] c"Rx%dy%dX x%dy%d VOUT 1G\0A\00"
@.str.21 = [26 x i8] c"Rx%dy%dX x%dy%d VOUT %ek\0A\00"
@.str.22 = [37 x i8] c"V1 R1_N 0 AC 50\0AR1 VOUT R1_N 100Meg\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%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*
%24 = alloca i32
%25 = alloca i32*
%26 = alloca i32*
%27 = alloca i32*
%28 = alloca i32*
%29 = alloca i32*
%30 = alloca i32*
%31 = alloca i32*
%32 = alloca i32*
store i32 0, i32* %1
store double 0x4005BF0A87427F01, double* %11
store double 0x41DFFFFFFFC00000, double* %12
%33 = 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* %33, i32** %25
%34 = icmp ne i32* %33, null
br i1 %34, label %35, label %38
35: ; preds = %0
%36 = load i32*, i32** %25
%37 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %36, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32* %17, double* %4, double* %9, double* %5, double* %10, double* %6, i32* %18, i32* %19)
br label %43
38: ; preds = %0
%39 = 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* %39, i32** %25
%40 = load i32*, i32** %25
%41 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([120 x i8], [120 x i8]* @.str.4, i64 0, i64 0))
%42 = 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 %271
43: ; preds = %35
%44 = load i32, i32* %17
%45 = add nsw i32 %44, 1
%46 = load i32, i32* %17
%47 = add nsw i32 %46, 1
%48 = mul nsw i32 %45, %47
%49 = load i32, i32* %17
%50 = sub nsw i32 %49, 1
%51 = load i32, i32* %17
%52 = sub nsw i32 %51, 1
%53 = mul nsw i32 %50, %52
%54 = add nsw i32 %48, %53
store i32 %54, i32* %22
%55 = load i32, i32* %17
%56 = add nsw i32 %55, 10
%57 = mul nsw i32 4, %56
%58 = load i32, i32* %17
%59 = add nsw i32 %58, 10
%60 = mul nsw i32 %57, %59
%61 = call i32* @calloc(i32 %60, i32 8)
store i32* %61, i32** %23
%62 = load i32*, i32** %25
%63 = call i32 @fclose(i32* %62)
%64 = load double, double* @RAND_MAX
store double %64, double* %12
%65 = 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* %65, i32** %26
%66 = icmp ne i32* %65, null
br i1 %66, label %67, label %74
67: ; preds = %43
%68 = load i32*, i32** %26
%69 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %20)
%70 = load i32, i32* %20
%71 = call i32 @srand(i32 %70)
%72 = load i32*, i32** %26
%73 = call i32 @fclose(i32* %72)
br label %77
74: ; preds = %43
%75 = call i32 @time(i32* null)
%76 = call i32 @srand(i32 %75)
br label %77
77: ; preds = %74, %67
%78 = 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* %78, i32** %26
%79 = load i32*, i32** %26
%80 = call double (...) @rand()
%81 = call i32 (i32*, i8*, ...) @fprintf(i32* %79, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %80)
%82 = load i32*, i32** %26
%83 = call i32 @fclose(i32* %82)
%84 = 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* %84, i32** %25
%85 = load i32*, i32** %25
%86 = call i32 (i32*, i8*, ...) @fprintf(i32* %85, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %15
br label %87
87: ; preds = %140, %77
%88 = load i32, i32* %15
%89 = load i32, i32* %17
%90 = add nsw i32 %89, 1
%91 = icmp slt i32 %88, %90
br i1 %91, label %92, label %143
92: ; preds = %87
store i32 1, i32* %16
br label %93
93: ; preds = %136, %92
%94 = load i32, i32* %16
%95 = load i32, i32* %17
%96 = sub nsw i32 %95, 1
%97 = icmp slt i32 %94, %96
br i1 %97, label %98, label %139
98: ; preds = %93
%99 = call double (...) @rand()
%100 = load double, double* %12
%101 = fdiv double %99, %100
%102 = load double, double* %4
%103 = fcmp olt double %101, %102
br i1 %103, label %104, label %124
104: ; preds = %98
%105 = load i32*, i32** %25
%106 = load i32, i32* %16
%107 = load i32, i32* %15
%108 = load i32, i32* %16
%109 = load i32, i32* %15
%110 = load i32, i32* %16
%111 = add nsw i32 %110, 1
%112 = load i32, i32* %15
%113 = load double, double* %9
%114 = call i32 (i32*, i8*, ...) @fprintf(i32* %105, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i32 %106, i32 %107, i32 %108, i32 %109, i32 %111, i32 %112, double %113)
%115 = load i32*, i32** %25
%116 = load i32, i32* %16
%117 = load i32, i32* %15
%118 = load i32, i32* %16
%119 = load i32, i32* %15
%120 = load i32, i32* %16
%121 = add nsw i32 %120, 1
%122 = load i32, i32* %15
%123 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i32 %116, i32 %117, i32 %118, i32 %119, i32 %121, i32 %122)
br label %135
124: ; preds = %98
%125 = load i32*, i32** %25
%126 = load i32, i32* %16
%127 = load i32, i32* %15
%128 = load i32, i32* %16
%129 = load i32, i32* %15
%130 = load i32, i32* %16
%131 = add nsw i32 %130, 1
%132 = load i32, i32* %15
%133 = load double, double* %10
%134 = call i32 (i32*, i8*, ...) @fprintf(i32* %125, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i32 %126, i32 %127, i32 %128, i32 %129, i32 %131, i32 %132, double %133)
br label %135
135: ; preds = %124, %104
br label %136
136: ; preds = %135
%137 = load i32, i32* %16
%138 = add nsw i32 %137, 1
store i32 %138, i32* %16
br label %93
139: ; preds = %93
br label %140
140: ; preds = %139
%141 = load i32, i32* %15
%142 = add nsw i32 %141, 1
store i32 %142, i32* %15
br label %87
143: ; preds = %87
store i32 0, i32* %15
br label %144
144: ; preds = %195, %143
%145 = load i32, i32* %15
%146 = load i32, i32* %17
%147 = icmp slt i32 %145, %146
br i1 %147, label %148, label %198
148: ; preds = %144
store i32 1, i32* %16
br label %149
149: ; preds = %191, %148
%150 = load i32, i32* %16
%151 = load i32, i32* %17
%152 = icmp slt i32 %150, %151
br i1 %152, label %153, label %194
153: ; preds = %149
%154 = call double (...) @rand()
%155 = load double, double* %12
%156 = fdiv double %154, %155
%157 = load double, double* %4
%158 = fcmp olt double %156, %157
br i1 %158, label %159, label %179
159: ; preds = %153
%160 = load i32*, i32** %25
%161 = load i32, i32* %16
%162 = load i32, i32* %15
%163 = load i32, i32* %16
%164 = load i32, i32* %15
%165 = load i32, i32* %16
%166 = load i32, i32* %15
%167 = add nsw i32 %166, 1
%168 = load double, double* %9
%169 = call i32 (i32*, i8*, ...) @fprintf(i32* %160, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i32 %161, i32 %162, i32 %163, i32 %164, i32 %165, i32 %167, double %168)
%170 = load i32*, i32** %25
%171 = load i32, i32* %16
%172 = load i32, i32* %15
%173 = load i32, i32* %16
%174 = load i32, i32* %15
%175 = load i32, i32* %16
%176 = load i32, i32* %15
%177 = add nsw i32 %176, 1
%178 = call i32 (i32*, i8*, ...) @fprintf(i32* %170, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0), i32 %171, i32 %172, i32 %173, i32 %174, i32 %175, i32 %177)
br label %190
179: ; preds = %153
%180 = load i32*, i32** %25
%181 = load i32, i32* %16
%182 = load i32, i32* %15
%183 = load i32, i32* %16
%184 = load i32, i32* %15
%185 = load i32, i32* %16
%186 = load i32, i32* %15
%187 = add nsw i32 %186, 1
%188 = load double, double* %10
%189 = call i32 (i32*, i8*, ...) @fprintf(i32* %180, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, i64 0, i64 0), i32 %181, i32 %182, i32 %183, i32 %184, i32 %185, i32 %187, double %188)
br label %190
190: ; preds = %179, %159
br label %191
191: ; preds = %190
%192 = load i32, i32* %16
%193 = add nsw i32 %192, 1
store i32 %193, i32* %16
br label %149
194: ; preds = %149
br label %195
195: ; preds = %194
%196 = load i32, i32* %15
%197 = add nsw i32 %196, 1
store i32 %197, i32* %15
br label %144
198: ; preds = %144
store i32 0, i32* %15
br label %199
199: ; preds = %261, %198
%200 = load i32, i32* %15
%201 = load i32, i32* %17
%202 = add nsw i32 %201, 1
%203 = icmp slt i32 %200, %202
br i1 %203, label %204, label %264
204: ; preds = %199
%205 = call double (...) @rand()
%206 = load double, double* %12
%207 = fdiv double %205, %206
%208 = load double, double* %4
%209 = fcmp olt double %207, %208
br i1 %209, label %210, label %220
210: ; preds = %204
%211 = load i32*, i32** %25
%212 = load i32, i32* %15
%213 = load i32, i32* %15
%214 = load double, double* %9
%215 = call i32 (i32*, i8*, ...) @fprintf(i32* %211, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %212, i32 %213, double %214)
%216 = load i32*, i32** %25
%217 = load i32, i32* %15
%218 = load i32, i32* %15
%219 = call i32 (i32*, i8*, ...) @fprintf(i32* %216, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.17, i64 0, i64 0), i32 %217, i32 %218)
br label %226
220: ; preds = %204
%221 = load i32*, i32** %25
%222 = load i32, i32* %15
%223 = load i32, i32* %15
%224 = load double, double* %10
%225 = call i32 (i32*, i8*, ...) @fprintf(i32* %221, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.18, i64 0, i64 0), i32 %222, i32 %223, double %224)
br label %226
226: ; preds = %220, %210
%227 = call double (...) @rand()
%228 = load double, double* %12
%229 = fdiv double %227, %228
%230 = load double, double* %4
%231 = fcmp olt double %229, %230
br i1 %231, label %232, label %250
232: ; preds = %226
%233 = load i32*, i32** %25
%234 = load i32, i32* %17
%235 = sub nsw i32 %234, 1
%236 = load i32, i32* %15
%237 = load i32, i32* %17
%238 = sub nsw i32 %237, 1
%239 = load i32, i32* %15
%240 = load double, double* %9
%241 = call i32 (i32*, i8*, ...) @fprintf(i32* %233, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0), i32 %235, i32 %236, i32 %238, i32 %239, double %240)
%242 = load i32*, i32** %25
%243 = load i32, i32* %17
%244 = sub nsw i32 %243, 1
%245 = load i32, i32* %15
%246 = load i32, i32* %17
%247 = sub nsw i32 %246, 1
%248 = load i32, i32* %15
%249 = call i32 (i32*, i8*, ...) @fprintf(i32* %242, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.20, i64 0, i64 0), i32 %244, i32 %245, i32 %247, i32 %248)
br label %260
250: ; preds = %226
%251 = load i32*, i32** %25
%252 = load i32, i32* %17
%253 = sub nsw i32 %252, 1
%254 = load i32, i32* %15
%255 = load i32, i32* %17
%256 = sub nsw i32 %255, 1
%257 = load i32, i32* %15
%258 = load double, double* %10
%259 = call i32 (i32*, i8*, ...) @fprintf(i32* %251, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.21, i64 0, i64 0), i32 %253, i32 %254, i32 %256, i32 %257, double %258)
br label %260
260: ; preds = %250, %232
br label %261
261: ; preds = %260
%262 = load i32, i32* %15
%263 = add nsw i32 %262, 1
store i32 %263, i32* %15
br label %199
264: ; preds = %199
%265 = load i32*, i32** %25
%266 = call i32 (i32*, i8*, ...) @fprintf(i32* %265, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.22, i64 0, i64 0))
%267 = load i32*, i32** %25
%268 = call i32 @fclose(i32* %267)
%269 = load i32*, i32** %23
%270 = call i32 @free(i32* %269)
store i32 0, i32* %1
br label %271
271: ; preds = %264, %38
%272 = load i32, i32* %1
ret i32 %272
}

LLVM IR (-O2):
@.str = [15 x i8] c"parameters.ini\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"%d %lf %lf %lf %lf %lf %d %d\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [120 x i8] c"50 0.4 1 0.333 1 0.333 1 1\0AN_vert_comps ratio_C C0 sigma_C(fraction of C0) R0 sigma_R(fraction of R0) x_squash y_squash\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"circuit.cir\00"
@.str.9 = [19 x i8] c"Random RC Network\0A\00"
@.str.10 = [28 x i8] c"Cx%dy%dX x%dy%d x%dy%d %en\0A\00"
@.str.11 = [27 x i8] c"Rx%dy%dX x%dy%d x%dy%d 1G\0A\00"
@.str.12 = [28 x i8] c"Rx%dy%dX x%dy%d x%dy%d %ek\0A\00"
@.str.13 = [28 x i8] c"Cx%dy%dY x%dy%d x%dy%d %en\0A\00"
@.str.14 = [27 x i8] c"Rx%dy%dY x%dy%d x%dy%d 1G\0A\00"
@.str.15 = [28 x i8] c"Rx%dy%dY x%dy%d x%dy%d %ek\0A\00"
@.str.16 = [21 x i8] c"Cx0y%dX 0 x1y%d %en\0A\00"
@.str.17 = [20 x i8] c"Rx0y%dX 0 x1y%d 1G\0A\00"
@.str.18 = [21 x i8] c"Rx0y%dX 0 x1y%d %ek\0A\00"
@.str.19 = [26 x i8] c"Cx%dy%dX x%dy%d VOUT %en\0A\00"
@.str.20 = [25 x i8] c"Rx%dy%dX x%dy%d VOUT 1G\0A\00"
@.str.21 = [26 x i8] c"Rx%dy%dX x%dy%d VOUT %ek\0A\00"
@.str.22 = [37 x i8] c"V1 R1_N 0 AC 50\0AR1 VOUT R1_N 100Meg\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = bitcast double* %1 to i8*
%11 = bitcast double* %2 to i8*
%12 = bitcast double* %3 to i8*
%13 = bitcast double* %4 to i8*
%14 = bitcast double* %5 to i8*
%15 = bitcast i32* %6 to i8*
%16 = bitcast i32* %7 to i8*
%17 = bitcast i32* %8 to i8*
%18 = bitcast i32* %9 to i8*
%19 = 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))
%20 = icmp eq i32* %19, null
br i1 %20, label %32, label %21
21: ; preds = %0
%22 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %19, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32* %6, double* %1, double* %4, double* %2, double* %5, double* %3, i32* %7, i32* %8)
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 10
%25 = shl nsw i32 %24, 2
%26 = mul nsw i32 %25, %24
%27 = call i32* @calloc(i32 %26, i32 8)
%28 = call i32 @fclose(i32* %19)
%29 = load double, double* @RAND_MAX
%30 = 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))
%31 = icmp eq i32* %30, null
br i1 %31, label %41, label %36
32: ; preds = %0
%33 = 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))
%34 = tail call i64 @fwrite(i8* getelementptr inbounds ([120 x i8], [120 x i8]* @.str.4, i64 0, i64 0), i64 119, i64 1, i32* %33)
%35 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
br label %146
36: ; preds = %21
%37 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %9)
%38 = load i32, i32* %9
%39 = call i32 @srand(i32 %38)
%40 = call i32 @fclose(i32* %30)
br label %44
41: ; preds = %21
%42 = call i32 @time(i32* null)
%43 = call i32 @srand(i32 %42)
br label %44
44: ; preds = %41, %36
%45 = 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))
%46 = call double (...) @rand()
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %46)
%48 = call i32 @fclose(i32* %45)
%49 = 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))
%50 = call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i64 18, i64 1, i32* %49)
%51 = load i32, i32* %6
%52 = icmp slt i32 %51, 0
br i1 %52, label %142, label %53
53: ; preds = %44, %77
%54 = phi i32 [ %78, %77 ], [ %51, %44 ]
%55 = phi i32 [ %79, %77 ], [ 0, %44 ]
%56 = icmp sgt i32 %54, 2
br i1 %56, label %59, label %77
57: ; preds = %77
%58 = icmp sgt i32 %78, 0
br i1 %58, label %81, label %86
59: ; preds = %53, %73
%60 = phi i32 [ %65, %73 ], [ 1, %53 ]
%61 = call double (...) @rand()
%62 = fdiv double %61, %29
%63 = load double, double* %1
%64 = fcmp olt double %62, %63
%65 = add nuw nsw i32 %60, 1
br i1 %64, label %66, label %70
66: ; preds = %59
%67 = load double, double* %4
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i32 %60, i32 %55, i32 %60, i32 %55, i32 %65, i32 %55, double %67)
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i32 %60, i32 %55, i32 %60, i32 %55, i32 %65, i32 %55)
br label %73
70: ; preds = %59
%71 = load double, double* %5
%72 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i32 %60, i32 %55, i32 %60, i32 %55, i32 %65, i32 %55, double %71)
br label %73
73: ; preds = %66, %70
%74 = load i32, i32* %6
%75 = add nsw i32 %74, -1
%76 = icmp slt i32 %65, %75
br i1 %76, label %59, label %77
77: ; preds = %73, %53
%78 = phi i32 [ %54, %53 ], [ %74, %73 ]
%79 = add nuw nsw i32 %55, 1
%80 = icmp slt i32 %55, %78
br i1 %80, label %53, label %57
81: ; preds = %57, %106
%82 = phi i32 [ %107, %106 ], [ %78, %57 ]
%83 = phi i32 [ %85, %106 ], [ 0, %57 ]
%84 = icmp sgt i32 %82, 1
%85 = add nuw nsw i32 %83, 1
br i1 %84, label %89, label %106
86: ; preds = %106, %57
%87 = phi i32 [ %78, %57 ], [ %107, %106 ]
%88 = icmp slt i32 %87, 0
br i1 %88, label %142, label %109
89: ; preds = %81, %102
%90 = phi i32 [ %103, %102 ], [ 1, %81 ]
%91 = call double (...) @rand()
%92 = fdiv double %91, %29
%93 = load double, double* %1
%94 = fcmp olt double %92, %93
br i1 %94, label %95, label %99
95: ; preds = %89
%96 = load double, double* %4
%97 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i32 %90, i32 %83, i32 %90, i32 %83, i32 %90, i32 %85, double %96)
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0), i32 %90, i32 %83, i32 %90, i32 %83, i32 %90, i32 %85)
br label %102
99: ; preds = %89
%100 = load double, double* %5
%101 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, i64 0, i64 0), i32 %90, i32 %83, i32 %90, i32 %83, i32 %90, i32 %85, double %100)
br label %102
102: ; preds = %95, %99
%103 = add nuw nsw i32 %90, 1
%104 = load i32, i32* %6
%105 = icmp slt i32 %103, %104
br i1 %105, label %89, label %106
106: ; preds = %102, %81
%107 = phi i32 [ %82, %81 ], [ %104, %102 ]
%108 = icmp slt i32 %85, %107
br i1 %108, label %81, label %86
109: ; preds = %86, %138
%110 = phi i32 [ %139, %138 ], [ 0, %86 ]
%111 = call double (...) @rand()
%112 = fdiv double %111, %29
%113 = load double, double* %1
%114 = fcmp olt double %112, %113
br i1 %114, label %115, label %119
115: ; preds = %109
%116 = load double, double* %4
%117 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %110, i32 %110, double %116)
%118 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.17, i64 0, i64 0), i32 %110, i32 %110)
br label %122
119: ; preds = %109
%120 = load double, double* %5
%121 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.18, i64 0, i64 0), i32 %110, i32 %110, double %120)
br label %122
122: ; preds = %119, %115
%123 = call double (...) @rand()
%124 = fdiv double %123, %29
%125 = load double, double* %1
%126 = fcmp olt double %124, %125
%127 = load i32, i32* %6
%128 = add nsw i32 %127, -1
br i1 %126, label %129, label %135
129: ; preds = %122
%130 = load double, double* %4
%131 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0), i32 %128, i32 %110, i32 %128, i32 %110, double %130)
%132 = load i32, i32* %6
%133 = add nsw i32 %132, -1
%134 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.20, i64 0, i64 0), i32 %133, i32 %110, i32 %133, i32 %110)
br label %138
135: ; preds = %122
%136 = load double, double* %5
%137 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.21, i64 0, i64 0), i32 %128, i32 %110, i32 %128, i32 %110, double %136)
br label %138
138: ; preds = %129, %135
%139 = add nuw nsw i32 %110, 1
%140 = load i32, i32* %6
%141 = icmp slt i32 %110, %140
br i1 %141, label %109, label %142
142: ; preds = %138, %44, %86
%143 = call i64 @fwrite(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.22, i64 0, i64 0), i64 36, i64 1, i32* %49)
%144 = call i32 @fclose(i32* %49)
%145 = call i32 @free(i32* %27)
br label %146
146: ; preds = %142, %32
ret i32 0
}