#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 */

/* Variables and functions */
double drand48();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int rand_lp();
double rnorm(double, double);
int /*<<< orphan*/ stderr;
void random_sample(double *tumor, int n_tumor, double *normal, int n_nml, int n,
                   int bin_size, int *bin, int n_bins, int paired, int insert,
                   int sd) {
  int i, k, pos;
  double U, rn_insert, U1;
  int N = n_tumor + n_nml, max_pos, min_pos;
  double tmp, ave_dist, offset;
  tmp = (tumor[n_tumor - 1] > normal[n_nml - 1] ? tumor[n_tumor - 1]
                                                : normal[n_nml - 1]);
  max_pos = (int)tmp;
  if (max_pos / bin_size > n_bins - 1) {
    fprintf(stderr,
            "Error in random_sample: not enough space for binned data\n");
    exit(1);
  }
  tmp = (tumor[0] < normal[0] ? tumor[0] : normal[0]);
  min_pos = (int)tmp;
  ave_dist = ((double)max_pos - min_pos) / ((double)n_nml + n_tumor) + 1;
  for (i = 0; i < n_bins; i++) {
    bin[i] = 0;
  }
  if (paired != 1) {
    int pos1, pos2;
    for (i = 0; i < n; i++) {
      U = N * drand48();
      U1 = 2 * drand48() - 1;
      offset = U1 * ave_dist;
      if (U > n_tumor) {
        k = ((int)U - n_tumor) % n_nml;
        pos = (int)normal[k];
        pos = pos > 0 ? pos : 1;
        pos = pos < max_pos ? pos : max_pos;
      } else {
        k = ((int)U) % n_tumor;
        pos = (int)tumor[k];
        pos = pos > 0 ? pos : 1;
        pos = pos < max_pos ? pos : max_pos;
      }
      pos1 = pos;
      pos = pos + offset;
      pos = pos > 0 ? pos : 1;
      pos = pos < max_pos ? pos : max_pos;
      pos2 = pos;
      if (drand48() < 0.5) {
        if (drand48() < 0.95)
          bin[pos1 / bin_size]++;
        if (drand48() < 0.05)
          bin[pos2 / bin_size]++;
      } else {
        if (drand48() < 0.05)
          bin[pos1 / bin_size]++;
        if (drand48() < 0.95)
          bin[pos2 / bin_size]++;
      }
    }
  } else {
    for (i = 0; i < n / 2; i++) {
      U = N * rand_lp();
      if (U > n_tumor) {
        k = ((int)U - n_tumor) % n_nml;
        pos = (int)normal[k];
        bin[pos / bin_size]++;
      } else {
        k = ((int)U) % n_tumor;
        pos = (int)tumor[k];
        bin[pos / bin_size]++;
      }
      rn_insert = rnorm((double)insert, (double)sd);
      pos = pos + rn_insert;
      pos = pos > 0 ? pos : 1;
      pos = pos < max_pos ? pos : max_pos;
      bin[pos / bin_size]++;
    }
  }
  return;
}


x86 assembly (clang, -O0):
<random_sample>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0xc(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    11d0 <random_sample+0x80>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    11e7 <random_sample+0x97>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
cvttsd2si -0x60(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    122d <random_sample+0xdd>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
lea    0xe0a(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    125c <random_sample+0x10c>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    126c <random_sample+0x11c>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
cvttsd2si -0x60(%rbp),%eax
mov    %eax,-0x54(%rbp)
cvtsi2sdl -0x50(%rbp),%xmm0
cvtsi2sdl -0x54(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xd57(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    12e2 <random_sample+0x192>
mov    0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12b9 <random_sample+0x169>
cmpl   $0x1,0x20(%rbp)
je     1624 <random_sample+0x4d4>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    161f <random_sample+0x4cf>
cvtsi2sdl -0x4c(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    $0x0,%al
call   1070 <drand48@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    $0x0,%al
call   1070 <drand48@plt>
addsd  %xmm0,%xmm0
movsd  0xcce(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    13e7 <random_sample+0x297>
cvttsd2si -0x38(%rbp),%eax
sub    -0xc(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %edx,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jle    139d <random_sample+0x24d>
mov    -0x30(%rbp),%eax
mov    %eax,-0x94(%rbp)
jmp    13ad <random_sample+0x25d>
mov    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    13ad <random_sample+0x25d>
mov    -0x94(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    13d0 <random_sample+0x280>
mov    -0x30(%rbp),%eax
mov    %eax,-0x98(%rbp)
jmp    13d9 <random_sample+0x289>
mov    -0x50(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x98(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1460 <random_sample+0x310>
cvttsd2si -0x38(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jle    141b <random_sample+0x2cb>
mov    -0x30(%rbp),%eax
mov    %eax,-0x9c(%rbp)
jmp    142b <random_sample+0x2db>
mov    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    142b <random_sample+0x2db>
mov    -0x9c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    144e <random_sample+0x2fe>
mov    -0x30(%rbp),%eax
mov    %eax,-0xa0(%rbp)
jmp    1457 <random_sample+0x307>
mov    -0x50(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0xa0(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x74(%rbp)
cvtsi2sdl -0x30(%rbp),%xmm0
addsd  -0x70(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jle    148f <random_sample+0x33f>
mov    -0x30(%rbp),%eax
mov    %eax,-0xa4(%rbp)
jmp    149f <random_sample+0x34f>
mov    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    149f <random_sample+0x34f>
mov    -0xa4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    14c2 <random_sample+0x372>
mov    -0x30(%rbp),%eax
mov    %eax,-0xa8(%rbp)
jmp    14cb <random_sample+0x37b>
mov    -0x50(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0xa8(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    $0x0,%al
call   1070 <drand48@plt>
movaps %xmm0,%xmm1
movsd  0xb24(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1581 <random_sample+0x431>
mov    $0x0,%al
call   1070 <drand48@plt>
movaps %xmm0,%xmm1
movsd  0xb18(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1539 <random_sample+0x3e9>
mov    0x10(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x74(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,%ecx
mov    -0xb0(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    $0x0,%al
call   1070 <drand48@plt>
movaps %xmm0,%xmm1
movsd  0xacd(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    157c <random_sample+0x42c>
mov    0x10(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x78(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,%ecx
mov    -0xb8(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    160c <random_sample+0x4bc>
mov    $0x0,%al
call   1070 <drand48@plt>
movaps %xmm0,%xmm1
movsd  0xa85(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    15c4 <random_sample+0x474>
mov    0x10(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x74(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,%ecx
mov    -0xc0(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    $0x0,%al
call   1070 <drand48@plt>
movaps %xmm0,%xmm1
movsd  0xa4a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1607 <random_sample+0x4b7>
mov    0x10(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0x78(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,%ecx
mov    -0xc8(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    160c <random_sample+0x4bc>
jmp    1611 <random_sample+0x4c1>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12f3 <random_sample+0x1a3>
jmp    17d1 <random_sample+0x681>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xcc(%rbp),%eax
cmp    %ecx,%eax
jge    17cc <random_sample+0x67c>
mov    -0x4c(%rbp),%eax
mov    %eax,-0xd0(%rbp)
mov    $0x0,%al
call   1050 <rand_lp@plt>
mov    %eax,%ecx
mov    -0xd0(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    16d2 <random_sample+0x582>
cvttsd2si -0x38(%rbp),%eax
sub    -0xc(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %edx,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%eax
mov    %eax,-0x30(%rbp)
mov    0x10(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0x30(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,%ecx
mov    -0xd8(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    1715 <random_sample+0x5c5>
cvttsd2si -0x38(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%eax
mov    %eax,-0x30(%rbp)
mov    0x10(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x30(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,%ecx
mov    -0xe0(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
cvtsi2sdl 0x28(%rbp),%xmm0
cvtsi2sdl 0x30(%rbp),%xmm1
call   1040 <rnorm@plt>
movsd  %xmm0,-0x40(%rbp)
cvtsi2sdl -0x30(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jle    1752 <random_sample+0x602>
mov    -0x30(%rbp),%eax
mov    %eax,-0xe4(%rbp)
jmp    1762 <random_sample+0x612>
mov    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1762 <random_sample+0x612>
mov    -0xe4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    1785 <random_sample+0x635>
mov    -0x30(%rbp),%eax
mov    %eax,-0xe8(%rbp)
jmp    178e <random_sample+0x63e>
mov    -0x50(%rbp),%eax
mov    %eax,-0xe8(%rbp)
mov    -0xe8(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x10(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    -0x30(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,%ecx
mov    -0xf0(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    162b <random_sample+0x4db>
jmp    17d1 <random_sample+0x681>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_sample>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%rbp
movslq %esi,%rax
movsd  -0x8(%rdi,%rax,8),%xmm0
mov    %rcx,0x8(%rsp)
movslq %ecx,%rax
maxsd  -0x8(%rdx,%rax,8),%xmm0
cvttsd2si %xmm0,%r15d
mov    0x88(%rsp),%ecx
mov    %r15d,%eax
cltd
idiv   %r9d
cmp    %ecx,%eax
jge    14b4 <random_sample+0x354>
mov    %r9d,%r12d
mov    %r8d,%r13d
mov    %esi,%ebx
mov    0x90(%rsp),%edx
mov    0x80(%rsp),%rax
mov    %rdi,0x38(%rsp)
movsd  (%rdi),%xmm1
mov    %rbp,0x40(%rsp)
minsd  0x0(%rbp),%xmm1
test   %ecx,%ecx
jle    11f1 <random_sample+0x91>
mov    %edx,%ebp
mov    %ecx,%edx
shl    $0x2,%rdx
mov    %rax,%rdi
xor    %esi,%esi
movapd %xmm1,0x10(%rsp)
call   1030 <memset@plt>
mov    %ebp,%edx
movapd 0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x30(%rsp)
mov    0x8(%rsp),%rax
lea    (%rax,%rbx,1),%r14d
cmp    $0x1,%edx
jne    12f9 <random_sample+0x199>
cmp    $0x2,%r13d
jl     14a5 <random_sample+0x345>
mov    %r13d,%ebp
shr    $0x1f,%ebp
add    %r13d,%ebp
sar    %ebp
xorps  %xmm0,%xmm0
cvtsi2sdl 0x98(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl 0xa0(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
mov    %rbx,%r13
jmp    1266 <random_sample+0x106>
xchg   %ax,%ax
cltd
idiv   %r12d
cltq
addl   $0x1,(%rbx,%rax,4)
add    $0xffffffff,%ebp
mov    %r13,%rbx
je     14a5 <random_sample+0x345>
xor    %eax,%eax
call   1060 <rand_lp@plt>
imul   %r14d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
ucomisd 0x30(%rsp),%xmm0
jbe    1290 <random_sample+0x130>
sub    %ebx,%eax
cltd
idivl  0x8(%rsp)
mov    0x40(%rsp),%rax
jmp    1298 <random_sample+0x138>
xchg   %ax,%ax
cltd
idiv   %ebx
mov    0x38(%rsp),%rax
mov    0x80(%rsp),%rbx
movslq %edx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movapd %xmm0,0x10(%rsp)
cvttsd2si %xmm0,%eax
cltd
idiv   %r12d
cltq
addl   $0x1,(%rbx,%rax,4)
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1050 <rnorm@plt>
cvttpd2dq 0x10(%rsp),%xmm1
cvtdq2pd %xmm1,%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
test   %eax,%eax
jg     12e8 <random_sample+0x188>
mov    $0x1,%eax
cmp    %r15d,%eax
jl     1250 <random_sample+0xf0>
mov    %r15d,%eax
jmp    1250 <random_sample+0xf0>
test   %r13d,%r13d
jle    14a5 <random_sample+0x345>
cvttpd2dq %xmm1,%xmm0
cvtsi2sd %r15d,%xmm2
cvtdq2pd %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x8(%rsp),%xmm1
subsd  %xmm0,%xmm2
addsd  0x30(%rsp),%xmm1
divsd  %xmm1,%xmm2
addsd  0xcd2(%rip),%xmm2
movsd  %xmm2,0x28(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
movsd  %xmm0,0x20(%rsp)
jmp    135a <random_sample+0x1fa>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%r13d
je     14a5 <random_sample+0x345>
xor    %eax,%eax
call   1080 <drand48@plt>
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1080 <drand48@plt>
addsd  %xmm0,%xmm0
addsd  0xc88(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
ucomisd 0x30(%rsp),%xmm1
cvttsd2si %xmm1,%eax
jbe    13a0 <random_sample+0x240>
sub    %ebx,%eax
cltd
idivl  0x8(%rsp)
mov    0x40(%rsp),%rax
jmp    13a8 <random_sample+0x248>
cltd
idiv   %ebx
mov    0x38(%rsp),%rax
movslq %edx,%rcx
cvttsd2si (%rax,%rcx,8),%r14d
test   %r14d,%r14d
jg     13bc <random_sample+0x25c>
mov    $0x1,%r14d
cmp    %r15d,%r14d
jl     13c4 <random_sample+0x264>
mov    %r15d,%r14d
mulsd  0x28(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%ebp
test   %ebp,%ebp
jg     13e3 <random_sample+0x283>
mov    $0x1,%ebp
cmp    %r15d,%ebp
jl     13eb <random_sample+0x28b>
mov    %r15d,%ebp
xor    %eax,%eax
call   1080 <drand48@plt>
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1080 <drand48@plt>
movsd  0xc09(%rip),%xmm1
ucomisd 0x10(%rsp),%xmm1
jbe    1450 <random_sample+0x2f0>
movsd  0xc09(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1432 <random_sample+0x2d2>
mov    %r14d,%eax
cltd
idiv   %r12d
cltq
mov    0x80(%rsp),%rcx
addl   $0x1,(%rcx,%rax,4)
xor    %eax,%eax
call   1080 <drand48@plt>
movsd  0xbd7(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1350 <random_sample+0x1f0>
jmp    148c <random_sample+0x32c>
nopl   (%rax)
movsd  0xbc0(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1473 <random_sample+0x313>
mov    %r14d,%eax
cltd
idiv   %r12d
cltq
mov    0x80(%rsp),%rcx
addl   $0x1,(%rcx,%rax,4)
xor    %eax,%eax
call   1080 <drand48@plt>
movsd  0xb9e(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1350 <random_sample+0x1f0>
mov    %ebp,%eax
cltd
idiv   %r12d
cltq
mov    0x80(%rsp),%rcx
addl   $0x1,(%rcx,%rax,4)
jmp    1350 <random_sample+0x1f0>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b25(%rip),%rax
mov    (%rax),%edi
lea    0xb64(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [58 x i8] c"Error in random_sample: not enough space for binned data\0A\00"
define void @random_sample(double* nocapture %0, i32 %1, double* nocapture %2, i32 %3, i32 %4, i32 %5, i32* nocapture %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = bitcast i32* %6 to i8*
%13 = add nsw i32 %3, %1
%14 = add nsw i32 %1, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %0, i64 %15
%17 = load double, double* %16
%18 = add nsw i32 %3, -1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %2, i64 %19
%21 = load double, double* %20
%22 = fcmp ogt double %17, %21
%23 = select i1 %22, double %17, double %21
%24 = fptosi double %23 to i32
%25 = sdiv i32 %24, %5
%26 = icmp slt i32 %25, %7
br i1 %26, label %31, label %27
27: ; preds = %11
%28 = load i32, i32* @stderr
%29 = tail call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%30 = tail call i32 @exit(i32 1)
unreachable
31: ; preds = %11
%32 = load double, double* %0
%33 = load double, double* %2
%34 = fcmp olt double %32, %33
%35 = select i1 %34, double %32, double %33
%36 = fptosi double %35 to i32
%37 = sitofp i32 %24 to double
%38 = sitofp i32 %36 to double
%39 = fsub double %37, %38
%40 = sitofp i32 %3 to double
%41 = sitofp i32 %1 to double
%42 = fadd double %41, %40
%43 = fdiv double %39, %42
%44 = fadd double %43, 1.000000e+00
%45 = icmp sgt i32 %7, 0
br i1 %45, label %46, label %49
46: ; preds = %31
%47 = zext i32 %7 to i64
%48 = shl nuw nsw i64 %47, 2
br label %49
49: ; preds = %46, %31
%50 = icmp eq i32 %8, 1
br i1 %50, label %55, label %51
51: ; preds = %49
%52 = icmp sgt i32 %4, 0
br i1 %52, label %53, label %165
53: ; preds = %51
%54 = sitofp i32 %13 to double
br label %61
55: ; preds = %49
%56 = sdiv i32 %4, 2
%57 = icmp sgt i32 %4, 1
br i1 %57, label %58, label %165
58: ; preds = %55
%59 = sitofp i32 %9 to double
%60 = sitofp i32 %10 to double
br label %127
61: ; preds = %53, %124
%62 = phi i32 [ 0, %53 ], [ %125, %124 ]
%63 = tail call double (...) @drand48()
%64 = fmul double %63, %54
%65 = tail call double (...) @drand48()
%66 = tail call double @llvm.fmuladd.f64(double %65, double 2.000000e+00, double -1.000000e+00)
%67 = fmul double %44, %66
%68 = fcmp ogt double %64, %41
%69 = fptosi double %64 to i32
br i1 %68, label %70, label %73
70: ; preds = %61
%71 = sub nsw i32 %69, %1
%72 = srem i32 %71, %3
br label %75
73: ; preds = %61
%74 = srem i32 %69, %1
br label %75
75: ; preds = %73, %70
%76 = phi i32 [ %74, %73 ], [ %72, %70 ]
%77 = phi double* [ %0, %73 ], [ %2, %70 ]
%78 = sext i32 %76 to i64
%79 = getelementptr inbounds double, double* %77, i64 %78
%80 = load double, double* %79
%81 = fptosi double %80 to i32
%82 = icmp sgt i32 %81, 1
%83 = select i1 %82, i32 %81, i32 1
%84 = icmp slt i32 %83, %24
%85 = select i1 %84, i32 %83, i32 %24
%86 = sitofp i32 %85 to double
%87 = fadd double %67, %86
%88 = fptosi double %87 to i32
%89 = icmp sgt i32 %88, 1
%90 = select i1 %89, i32 %88, i32 1
%91 = icmp slt i32 %90, %24
%92 = select i1 %91, i32 %90, i32 %24
%93 = tail call double (...) @drand48()
%94 = fcmp olt double %93, 5.000000e-01
%95 = tail call double (...) @drand48()
br i1 %94, label %96, label %107
96: ; preds = %75
%97 = fcmp olt double %95, 0x3FEE666666666666
br i1 %97, label %98, label %104
98: ; preds = %96
%99 = sdiv i32 %85, %5
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i32, i32* %6, i64 %100
%102 = load i32, i32* %101
%103 = add nsw i32 %102, 1
store i32 %103, i32* %101
br label %104
104: ; preds = %98, %96
%105 = tail call double (...) @drand48()
%106 = fcmp olt double %105, 5.000000e-02
br i1 %106, label %118, label %124
107: ; preds = %75
%108 = fcmp olt double %95, 5.000000e-02
br i1 %108, label %109, label %115
109: ; preds = %107
%110 = sdiv i32 %85, %5
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i32, i32* %6, i64 %111
%113 = load i32, i32* %112
%114 = add nsw i32 %113, 1
store i32 %114, i32* %112
br label %115
115: ; preds = %109, %107
%116 = tail call double (...) @drand48()
%117 = fcmp olt double %116, 0x3FEE666666666666
br i1 %117, label %118, label %124
118: ; preds = %115, %104
%119 = sdiv i32 %92, %5
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i32, i32* %6, i64 %120
%122 = load i32, i32* %121
%123 = add nsw i32 %122, 1
store i32 %123, i32* %121
br label %124
124: ; preds = %118, %104, %115
%125 = add nuw nsw i32 %62, 1
%126 = icmp eq i32 %125, %4
br i1 %126, label %165, label %61
127: ; preds = %58, %138
%128 = phi i32 [ 0, %58 ], [ %163, %138 ]
%129 = tail call i32 (...) @rand_lp()
%130 = mul nsw i32 %129, %13
%131 = sitofp i32 %130 to double
%132 = fcmp ogt double %131, %41
br i1 %132, label %133, label %136
133: ; preds = %127
%134 = sub nsw i32 %130, %1
%135 = srem i32 %134, %3
br label %138
136: ; preds = %127
%137 = srem i32 %130, %1
br label %138
138: ; preds = %136, %133
%139 = phi i32 [ %137, %136 ], [ %135, %133 ]
%140 = phi double* [ %0, %136 ], [ %2, %133 ]
%141 = sext i32 %139 to i64
%142 = getelementptr inbounds double, double* %140, i64 %141
%143 = load double, double* %142
%144 = fptosi double %143 to i32
%145 = sdiv i32 %144, %5
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i32, i32* %6, i64 %146
%148 = load i32, i32* %147
%149 = add nsw i32 %148, 1
store i32 %149, i32* %147
%150 = tail call double @rnorm(double %59, double %60)
%151 = sitofp i32 %144 to double
%152 = fadd double %150, %151
%153 = fptosi double %152 to i32
%154 = icmp sgt i32 %153, 1
%155 = select i1 %154, i32 %153, i32 1
%156 = icmp slt i32 %155, %24
%157 = select i1 %156, i32 %155, i32 %24
%158 = sdiv i32 %157, %5
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds i32, i32* %6, i64 %159
%161 = load i32, i32* %160
%162 = add nsw i32 %161, 1
store i32 %162, i32* %160
%163 = add nuw nsw i32 %128, 1
%164 = icmp eq i32 %163, %56
br i1 %164, label %165, label %127
165: ; preds = %124, %138, %51, %55
ret void
}