#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 exp(float);
float floor(float);
float gammln(float);
float log(float);
double ran3(long *);
float sqrt(double);
float tan(float);
float bnldev(float pp, int n, long *idum) {
  long j;
  long nold = (-1);
  float am, em, G, angle, p, bnl, sq, t, y;
  static float pold = (-1.0), pc, plog, pclog, en, oldg;
  p = (pp <= 0.5 ? pp : 1.0 - pp);
  am = n * p;
  if (n < 25) {
    bnl = 0.0;
    for (j = 1; j <= n; j++)
      if (ran3(idum) < p)
        ++bnl;
  } else if (am < 1.0) {
    G = exp(-am);
    t = 1.0;
    for (j = 0; j <= n; j++) {
      t *= ran3(idum);
      if (t < G)
        break;
    }
    bnl = (j <= n ? j : n);
  } else {
    if (n != nold) {
      en = n;
      oldg = gammln(en + 1.0);
      nold = n;
    }
    if (p != pold) {
      pc = 1.0 - p;
      plog = log(p);
      pclog = log(pc);
      pold = p;
    }
    sq = sqrt(2.0 * am * pc);
    do {
      do {
        angle = 3.141592654 * ran3(idum);
        y = tan(angle);
        em = sq * y + am;
      } while (em < 0.0 || em >= (en + 1.0));
      em = floor(em);
      t = 1.2 * sq * (1.0 + y * y) *
          exp(oldg - gammln(em + 1.0) - gammln(en - em + 1.0) + em * plog +
              (en - em) * pclog);
    } while (ran3(idum) > t);
    bnl = em;
  }
  if (p != pp)
    bnl = n - bnl;
  return bnl;
}


x86 assembly (clang, -O0):
<bnldev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0xffffffffffffffff,-0x20(%rbp)
ff
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe63(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11ba <bnldev+0x4a>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    11d4 <bnldev+0x64>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe3d(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
mulss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
cmpl   $0x19,-0x8(%rbp)
jge    1268 <bnldev+0xf8>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jg     1263 <bnldev+0xf3>
mov    -0x10(%rbp),%rdi
call   1050 <ran3@plt>
movaps %xmm0,%xmm1
movss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    124d <bnldev+0xdd>
movss  0xde5(%rip),%xmm0
addss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
jmp    1252 <bnldev+0xe2>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    120b <bnldev+0x9b>
jmp    160d <bnldev+0x49d>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd8f(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1352 <bnldev+0x1e2>
movss  -0x24(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1030 <exp@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  0xd7d(%rip),%xmm0
movss  %xmm0,-0x40(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jg     1319 <bnldev+0x1a9>
mov    -0x10(%rbp),%rdi
call   1050 <ran3@plt>
movaps %xmm0,%xmm1
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm1
movss  -0x2c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1303 <bnldev+0x193>
jmp    1319 <bnldev+0x1a9>
jmp    1308 <bnldev+0x198>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    12b8 <bnldev+0x148>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jg     1337 <bnldev+0x1c7>
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    133f <bnldev+0x1cf>
movslq -0x8(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x38(%rbp)
jmp    1608 <bnldev+0x498>
movslq -0x8(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     139e <bnldev+0x22e>
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,0x2cff(%rip)
movss  0x2cf7(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc87(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1080 <gammln@plt>
movss  %xmm0,0x2cda(%rip)
movslq -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movss  -0x34(%rbp),%xmm0
ucomiss 0x2cae(%rip),%xmm0
jne    13bb <bnldev+0x24b>
jp     13bb <bnldev+0x24b>
jmp    1410 <bnldev+0x2a0>
movss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xc3c(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x2c84(%rip)
movss  -0x34(%rbp),%xmm0
call   1060 <log@plt>
movss  %xmm0,0x2c76(%rip)
movss  0x2c6a(%rip),%xmm0
call   1060 <log@plt>
movss  %xmm0,0x2c65(%rip)
movss  -0x34(%rbp),%xmm0
movss  %xmm0,0x2c48(%rip)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xbef(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  0x2c33(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movss  %xmm0,-0x3c(%rbp)
jmp    1444 <bnldev+0x2d4>
mov    -0x10(%rbp),%rdi
call   1050 <ran3@plt>
movaps %xmm0,%xmm1
movsd  0xbc0(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
call   1040 <tan@plt>
movss  %xmm0,-0x44(%rbp)
movss  -0x3c(%rbp),%xmm0
movss  -0x44(%rbp),%xmm2
movss  -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
mov    $0x1,%al
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x59(%rbp)
ja     14d6 <bnldev+0x366>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x2bb0(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xb40(%rip),%xmm2
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    1444 <bnldev+0x2d4>
movss  -0x28(%rbp),%xmm0
call   1090 <floor@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xb1f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x44(%rbp),%xmm1
mulss  -0x44(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xaed(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movss  0x2b40(%rip),%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xac2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1080 <gammln@plt>
movaps %xmm0,%xmm1
movss  -0x70(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  0x2b00(%rip),%xmm0
subss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xa8b(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1080 <gammln@plt>
movaps %xmm0,%xmm1
movss  -0x6c(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  -0x28(%rbp),%xmm1
movss  0x2ac1(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0x2ab9(%rip),%xmm0
subss  -0x28(%rbp),%xmm0
movss  0x2aa8(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <ran3@plt>
movss  -0x40(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     143f <bnldev+0x2cf>
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
jmp    160d <bnldev+0x49d>
movss  -0x34(%rbp),%xmm0
ucomiss -0x4(%rbp),%xmm0
jne    1627 <bnldev+0x4b7>
jp     1627 <bnldev+0x4b7>
jmp    1636 <bnldev+0x4c6>
cvtsi2ssl -0x8(%rbp),%xmm0
subss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bnldev>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movss  0xe79(%rip),%xmm3
movaps %xmm3,%xmm1
movaps %xmm0,%xmm4
cmpnless 0xe6e(%rip),%xmm4
subss  %xmm0,%xmm1
andps  %xmm4,%xmm1
andnps %xmm0,%xmm4
orps   %xmm1,%xmm4
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
cmp    $0x18,%edi
movss  %xmm4,0x8(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm1,0x50(%rsp)
jg     1231 <bnldev+0xc1>
test   %ebp,%ebp
jle    14c1 <bnldev+0x351>
movaps %xmm4,%xmm2
mov    %ebp,%ebp
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
movsd  %xmm0,0x28(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,%xmm2
jmp    11fd <bnldev+0x8d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movaps %xmm2,%xmm0
add    $0xffffffffffffffff,%rbp
je     14c4 <bnldev+0x354>
movss  %xmm0,0x30(%rsp)
movaps %xmm2,0x10(%rsp)
mov    %rbx,%rdi
call   1060 <ran3@plt>
movaps 0x10(%rsp),%xmm2
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
addss  0xdd9(%rip),%xmm2
ja     11f0 <bnldev+0x80>
movss  0x30(%rsp),%xmm2
jmp    11f0 <bnldev+0x80>
mulss  %xmm1,%xmm4
movss  %xmm3,0xc(%rsp)
ucomiss %xmm4,%xmm3
jbe    12b4 <bnldev+0x144>
xorps  0xde9(%rip),%xmm4
movaps %xmm4,%xmm0
call   1040 <exp@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
mov    %ebp,%r14d
lea    0x1(%r14),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1060 <ran3@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  0x10(%rsp),%xmm1
ucomiss %xmm0,%xmm1
ja     12aa <bnldev+0x13a>
movss  %xmm0,0xc(%rsp)
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1270 <bnldev+0x100>
mov    %r14,%rbp
cvtsi2ss %rbp,%xmm2
jmp    14c4 <bnldev+0x354>
movaps %xmm4,0x30(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
movsd  %xmm0,0x10(%rsp)
movss  %xmm1,0x2d9e(%rip)
movss  0xd2a(%rip),%xmm0
addss  %xmm1,%xmm0
call   1090 <gammln@plt>
movss  %xmm0,0x2d89(%rip)
movss  0x2d69(%rip),%xmm1
movss  0x8(%rsp),%xmm0
ucomiss %xmm0,%xmm1
jne    12fc <bnldev+0x18c>
jnp    1340 <bnldev+0x1d0>
movss  0xcfc(%rip),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x2d50(%rip)
call   1070 <log@plt>
movss  %xmm0,0x2d47(%rip)
movss  0x2d3b(%rip),%xmm0
call   1070 <log@plt>
movss  %xmm0,0x2d36(%rip)
movss  0x8(%rsp),%xmm0
movss  %xmm0,0x2d18(%rip)
movsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm1
movss  0x2d0e(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
call   1080 <sqrt@plt>
movss  %xmm0,0x28(%rsp)
cvtss2sd %xmm0,%xmm0
mulsd  0xc9f(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <ran3@plt>
mulsd  0xc88(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <tan@plt>
movaps %xmm0,%xmm3
movss  0x28(%rsp),%xmm0
mulss  %xmm3,%xmm0
addss  0x30(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     1380 <bnldev+0x210>
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movss  0x2ca8(%rip),%xmm2
cvtss2sd %xmm2,%xmm2
addsd  0xc50(%rip),%xmm2
ucomisd %xmm2,%xmm1
jae    1380 <bnldev+0x210>
movss  %xmm3,0x4(%rsp)
call   1030 <floorf@plt>
movaps %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm1
mulss  %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
addsd  0xc24(%rip),%xmm1
mulsd  0x40(%rsp),%xmm1
movsd  %xmm1,0x48(%rsp)
movss  0x2c60(%rip),%xmm1
movss  %xmm1,0x4(%rsp)
movss  0xbe2(%rip),%xmm1
addss  %xmm1,%xmm0
call   1090 <gammln@plt>
movss  0x4(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  0x2c2d(%rip),%xmm0
subss  0x10(%rsp),%xmm0
addss  0xbb3(%rip),%xmm0
call   1090 <gammln@plt>
movss  0x4(%rsp),%xmm3
subss  %xmm0,%xmm3
movss  0x2c00(%rip),%xmm1
movaps 0x10(%rsp),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm3,%xmm1
movss  0x2bf3(%rip),%xmm0
subss  %xmm2,%xmm0
mulss  0x2be3(%rip),%xmm0
addss  %xmm1,%xmm0
call   1040 <exp@plt>
mulsd  0x48(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1060 <ran3@plt>
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     1380 <bnldev+0x210>
movaps 0x10(%rsp),%xmm2
jmp    14c4 <bnldev+0x354>
xorps  %xmm2,%xmm2
movaps 0x50(%rsp),%xmm1
subss  %xmm2,%xmm1
movaps 0x60(%rsp),%xmm0
cmpneqss 0x8(%rsp),%xmm0
andps  %xmm0,%xmm1
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@bnldev.pold = internal global float -1.000000e+00
@bnldev.pc = internal global float 0.000000e+00
@bnldev.plog = internal global float 0.000000e+00
@bnldev.pclog = internal global float 0.000000e+00
@bnldev.en = internal global float 0.000000e+00
@bnldev.oldg = internal global float 0.000000e+00
define float @bnldev(float %0, i32 %1, i64* %2) {
%4 = alloca float
%5 = alloca i32
%6 = alloca i64*
%7 = alloca i64
%8 = alloca i64
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
store float %0, float* %4
store i32 %1, i32* %5
store i64* %2, i64** %6
store i64 -1, i64* %8
%18 = load float, float* %4
%19 = fpext float %18 to double
%20 = fcmp ole double %19, 5.000000e-01
br i1 %20, label %21, label %24
21: ; preds = %3
%22 = load float, float* %4
%23 = fpext float %22 to double
br label %28
24: ; preds = %3
%25 = load float, float* %4
%26 = fpext float %25 to double
%27 = fsub double 1.000000e+00, %26
br label %28
28: ; preds = %24, %21
%29 = phi double [ %23, %21 ], [ %27, %24 ]
%30 = fptrunc double %29 to float
store float %30, float* %13
%31 = load i32, i32* %5
%32 = sitofp i32 %31 to float
%33 = load float, float* %13
%34 = fmul float %32, %33
store float %34, float* %9
%35 = load i32, i32* %5
%36 = icmp slt i32 %35, 25
br i1 %36, label %37, label %57
37: ; preds = %28
store float 0.000000e+00, float* %14
store i64 1, i64* %7
br label %38
38: ; preds = %53, %37
%39 = load i64, i64* %7
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = icmp sle i64 %39, %41
br i1 %42, label %43, label %56
43: ; preds = %38
%44 = load i64*, i64** %6
%45 = call double @ran3(i64* %44)
%46 = load float, float* %13
%47 = fpext float %46 to double
%48 = fcmp olt double %45, %47
br i1 %48, label %49, label %52
49: ; preds = %43
%50 = load float, float* %14
%51 = fadd float %50, 1.000000e+00
store float %51, float* %14
br label %52
52: ; preds = %49, %43
br label %53
53: ; preds = %52
%54 = load i64, i64* %7
%55 = add nsw i64 %54, 1
store i64 %55, i64* %7
br label %38
56: ; preds = %38
br label %208
57: ; preds = %28
%58 = load float, float* %9
%59 = fpext float %58 to double
%60 = fcmp olt double %59, 1.000000e+00
br i1 %60, label %61, label %99
61: ; preds = %57
%62 = load float, float* %9
%63 = fneg float %62
%64 = call double @exp(float %63)
%65 = fptrunc double %64 to float
store float %65, float* %11
store float 1.000000e+00, float* %16
store i64 0, i64* %7
br label %66
66: ; preds = %83, %61
%67 = load i64, i64* %7
%68 = load i32, i32* %5
%69 = sext i32 %68 to i64
%70 = icmp sle i64 %67, %69
br i1 %70, label %71, label %86
71: ; preds = %66
%72 = load i64*, i64** %6
%73 = call double @ran3(i64* %72)
%74 = load float, float* %16
%75 = fpext float %74 to double
%76 = fmul double %75, %73
%77 = fptrunc double %76 to float
store float %77, float* %16
%78 = load float, float* %16
%79 = load float, float* %11
%80 = fcmp olt float %78, %79
br i1 %80, label %81, label %82
81: ; preds = %71
br label %86
82: ; preds = %71
br label %83
83: ; preds = %82
%84 = load i64, i64* %7
%85 = add nsw i64 %84, 1
store i64 %85, i64* %7
br label %66
86: ; preds = %81, %66
%87 = load i64, i64* %7
%88 = load i32, i32* %5
%89 = sext i32 %88 to i64
%90 = icmp sle i64 %87, %89
br i1 %90, label %91, label %93
91: ; preds = %86
%92 = load i64, i64* %7
br label %96
93: ; preds = %86
%94 = load i32, i32* %5
%95 = sext i32 %94 to i64
br label %96
96: ; preds = %93, %91
%97 = phi i64 [ %92, %91 ], [ %95, %93 ]
%98 = sitofp i64 %97 to float
store float %98, float* %14
br label %207
99: ; preds = %57
%100 = load i32, i32* %5
%101 = sext i32 %100 to i64
%102 = load i64, i64* %8
%103 = icmp ne i64 %101, %102
br i1 %103, label %104, label %114
104: ; preds = %99
%105 = load i32, i32* %5
%106 = sitofp i32 %105 to float
store float %106, float* @bnldev.en
%107 = load float, float* @bnldev.en
%108 = fpext float %107 to double
%109 = fadd double %108, 1.000000e+00
%110 = fptrunc double %109 to float
%111 = call float @gammln(float %110)
store float %111, float* @bnldev.oldg
%112 = load i32, i32* %5
%113 = sext i32 %112 to i64
store i64 %113, i64* %8
br label %114
114: ; preds = %104, %99
%115 = load float, float* %13
%116 = load float, float* @bnldev.pold
%117 = fcmp une float %115, %116
br i1 %117, label %118, label %128
118: ; preds = %114
%119 = load float, float* %13
%120 = fpext float %119 to double
%121 = fsub double 1.000000e+00, %120
%122 = fptrunc double %121 to float
store float %122, float* @bnldev.pc
%123 = load float, float* %13
%124 = call float @log(float %123)
store float %124, float* @bnldev.plog
%125 = load float, float* @bnldev.pc
%126 = call float @log(float %125)
store float %126, float* @bnldev.pclog
%127 = load float, float* %13
store float %127, float* @bnldev.pold
br label %128
128: ; preds = %118, %114
%129 = load float, float* %9
%130 = fpext float %129 to double
%131 = fmul double 2.000000e+00, %130
%132 = load float, float* @bnldev.pc
%133 = fpext float %132 to double
%134 = fmul double %131, %133
%135 = call float @sqrt(double %134)
store float %135, float* %15
br label %136
136: ; preds = %199, %128
br label %137
137: ; preds = %159, %136
%138 = load i64*, i64** %6
%139 = call double @ran3(i64* %138)
%140 = fmul double 0x400921FB54524550, %139
%141 = fptrunc double %140 to float
store float %141, float* %12
%142 = load float, float* %12
%143 = call float @tan(float %142)
store float %143, float* %17
%144 = load float, float* %15
%145 = load float, float* %17
%146 = load float, float* %9
%147 = call float @llvm.fmuladd.f32(float %144, float %145, float %146)
store float %147, float* %10
br label %148
148: ; preds = %137
%149 = load float, float* %10
%150 = fpext float %149 to double
%151 = fcmp olt double %150, 0.000000e+00
br i1 %151, label %159, label %152
152: ; preds = %148
%153 = load float, float* %10
%154 = fpext float %153 to double
%155 = load float, float* @bnldev.en
%156 = fpext float %155 to double
%157 = fadd double %156, 1.000000e+00
%158 = fcmp oge double %154, %157
br label %159
159: ; preds = %152, %148
%160 = phi i1 [ true, %148 ], [ %158, %152 ]
br i1 %160, label %137, label %161
161: ; preds = %159
%162 = load float, float* %10
%163 = call float @floor(float %162)
store float %163, float* %10
%164 = load float, float* %15
%165 = fpext float %164 to double
%166 = fmul double 1.200000e+00, %165
%167 = load float, float* %17
%168 = load float, float* %17
%169 = fmul float %167, %168
%170 = fpext float %169 to double
%171 = fadd double 1.000000e+00, %170
%172 = fmul double %166, %171
%173 = load float, float* @bnldev.oldg
%174 = load float, float* %10
%175 = fpext float %174 to double
%176 = fadd double %175, 1.000000e+00
%177 = fptrunc double %176 to float
%178 = call float @gammln(float %177)
%179 = fsub float %173, %178
%180 = load float, float* @bnldev.en
%181 = load float, float* %10
%182 = fsub float %180, %181
%183 = fpext float %182 to double
%184 = fadd double %183, 1.000000e+00
%185 = fptrunc double %184 to float
%186 = call float @gammln(float %185)
%187 = fsub float %179, %186
%188 = load float, float* %10
%189 = load float, float* @bnldev.plog
%190 = call float @llvm.fmuladd.f32(float %188, float %189, float %187)
%191 = load float, float* @bnldev.en
%192 = load float, float* %10
%193 = fsub float %191, %192
%194 = load float, float* @bnldev.pclog
%195 = call float @llvm.fmuladd.f32(float %193, float %194, float %190)
%196 = call double @exp(float %195)
%197 = fmul double %172, %196
%198 = fptrunc double %197 to float
store float %198, float* %16
br label %199
199: ; preds = %161
%200 = load i64*, i64** %6
%201 = call double @ran3(i64* %200)
%202 = load float, float* %16
%203 = fpext float %202 to double
%204 = fcmp ogt double %201, %203
br i1 %204, label %136, label %205
205: ; preds = %199
%206 = load float, float* %10
store float %206, float* %14
br label %207
207: ; preds = %205, %96
br label %208
208: ; preds = %207, %56
%209 = load float, float* %13
%210 = load float, float* %4
%211 = fcmp une float %209, %210
br i1 %211, label %212, label %217
212: ; preds = %208
%213 = load i32, i32* %5
%214 = sitofp i32 %213 to float
%215 = load float, float* %14
%216 = fsub float %214, %215
store float %216, float* %14
br label %217
217: ; preds = %212, %208
%218 = load float, float* %14
ret float %218
}

LLVM IR (-O2):
@bnldev.pold = internal unnamed_addr global float -1.000000e+00
@bnldev.pc = internal unnamed_addr global float 0.000000e+00
@bnldev.plog = internal unnamed_addr global float 0.000000e+00
@bnldev.pclog = internal unnamed_addr global float 0.000000e+00
@bnldev.en = internal unnamed_addr global float 0.000000e+00
@bnldev.oldg = internal unnamed_addr global float 0.000000e+00
define float @bnldev(float %0, i32 %1, i64* %2) {
%4 = fcmp ugt float %0, 5.000000e-01
%5 = fsub float 1.000000e+00, %0
%6 = select i1 %4, float %5, float %0
%7 = sitofp i32 %1 to float
%8 = fmul float %6, %7
%9 = icmp slt i32 %1, 25
br i1 %9, label %10, label %24
10: ; preds = %3
%11 = icmp slt i32 %1, 1
br i1 %11, label %105, label %12
12: ; preds = %10
%13 = zext i32 %1 to i64
%14 = fpext float %6 to double
br label %15
15: ; preds = %12, %15
%16 = phi i64 [ 1, %12 ], [ %22, %15 ]
%17 = phi float [ 0.000000e+00, %12 ], [ %21, %15 ]
%18 = tail call double @ran3(i64* %2)
%19 = fcmp olt double %18, %14
%20 = fadd float %17, 1.000000e+00
%21 = select i1 %19, float %20, float %17
%22 = add nuw nsw i64 %16, 1
%23 = icmp eq i64 %16, %13
br i1 %23, label %105, label %15
24: ; preds = %3
%25 = fpext float %8 to double
%26 = fcmp olt float %8, 1.000000e+00
br i1 %26, label %27, label %46
27: ; preds = %24
%28 = fneg float %8
%29 = tail call double @exp(float %28)
%30 = fptrunc double %29 to float
%31 = zext i32 %1 to i64
br label %32
32: ; preds = %27, %40
%33 = phi i64 [ %41, %40 ], [ 0, %27 ]
%34 = phi float [ %38, %40 ], [ 1.000000e+00, %27 ]
%35 = tail call double @ran3(i64* %2)
%36 = fpext float %34 to double
%37 = fmul double %35, %36
%38 = fptrunc double %37 to float
%39 = fcmp olt float %38, %30
br i1 %39, label %43, label %40
40: ; preds = %32
%41 = add nuw nsw i64 %33, 1
%42 = icmp eq i64 %33, %31
br i1 %42, label %43, label %32
43: ; preds = %40, %32
%44 = phi i64 [ %31, %40 ], [ %33, %32 ]
%45 = sitofp i64 %44 to float
br label %105
46: ; preds = %24
store float %7, float* @bnldev.en
%47 = fadd float %7, 1.000000e+00
%48 = tail call float @gammln(float %47)
store float %48, float* @bnldev.oldg
%49 = load float, float* @bnldev.pold
%50 = fcmp une float %49, %6
br i1 %50, label %51, label %56
51: ; preds = %46
%52 = fsub float 1.000000e+00, %6
store float %52, float* @bnldev.pc
%53 = tail call float @log(float %6)
store float %53, float* @bnldev.plog
%54 = load float, float* @bnldev.pc
%55 = tail call float @log(float %54)
store float %55, float* @bnldev.pclog
store float %6, float* @bnldev.pold
br label %56
56: ; preds = %51, %46
%57 = fmul double %25, 2.000000e+00
%58 = load float, float* @bnldev.pc
%59 = fpext float %58 to double
%60 = fmul double %57, %59
%61 = tail call float @sqrt(double %60)
%62 = fpext float %61 to double
%63 = fmul double %62, 1.200000e+00
br label %64
64: ; preds = %104, %56
%65 = tail call double @ran3(i64* %2)
%66 = fmul double %65, 0x400921FB54524550
%67 = fptrunc double %66 to float
%68 = tail call float @tan(float %67)
%69 = tail call float @llvm.fmuladd.f32(float %61, float %68, float %8)
%70 = fcmp olt float %69, 0.000000e+00
br i1 %70, label %104, label %71
71: ; preds = %64
%72 = fpext float %69 to double
%73 = load float, float* @bnldev.en
%74 = fpext float %73 to double
%75 = fadd double %74, 1.000000e+00
%76 = fcmp ugt double %75, %72
br i1 %76, label %77, label %104
77: ; preds = %71
%78 = tail call float @llvm.floor.f32(float %69)
%79 = fmul float %68, %68
%80 = fpext float %79 to double
%81 = fadd double %80, 1.000000e+00
%82 = fmul double %63, %81
%83 = load float, float* @bnldev.oldg
%84 = fadd float %78, 1.000000e+00
%85 = tail call float @gammln(float %84)
%86 = fsub float %83, %85
%87 = load float, float* @bnldev.en
%88 = fsub float %87, %78
%89 = fadd float %88, 1.000000e+00
%90 = tail call float @gammln(float %89)
%91 = fsub float %86, %90
%92 = load float, float* @bnldev.plog
%93 = tail call float @llvm.fmuladd.f32(float %78, float %92, float %91)
%94 = load float, float* @bnldev.en
%95 = fsub float %94, %78
%96 = load float, float* @bnldev.pclog
%97 = tail call float @llvm.fmuladd.f32(float %95, float %96, float %93)
%98 = tail call double @exp(float %97)
%99 = fmul double %82, %98
%100 = fptrunc double %99 to float
%101 = tail call double @ran3(i64* %2)
%102 = fpext float %100 to double
%103 = fcmp ogt double %101, %102
br i1 %103, label %104, label %105
104: ; preds = %77, %71, %64
br label %64
105: ; preds = %77, %15, %10, %43
%106 = phi float [ %45, %43 ], [ 0.000000e+00, %10 ], [ %21, %15 ], [ %78, %77 ]
%107 = fcmp une float %6, %0
%108 = fsub float %7, %106
%109 = select i1 %107, float %108, float %106
ret float %109
}