float bnldev(float pp, int n, int *idum) {
  int j;
  static int nold = (-1);
  float am, em, g, angle, p, bnl, sq, t, y;
  static float pold = (-1.0), pc, plog, pclog, en, oldg;
  float ran1(), gammln();
  p = (pp <= 0.5 ? pp : 1.0 - pp);
  am = n * p;
  if (n < 25) {
    bnl = 0.0;
    for (j = 1; j <= n; j++)
      if (ran1(idum) < p)
        bnl += 1.0;
  } else if (am < 1.0) {
    g = exp(-am);
    t = 1.0;
    for (j = 0; j <= n; j++) {
      t *= ran1(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 * ran1(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 (ran1(idum) > t);
    bnl = em;
  }
  if (p != pp)
    bnl = n - bnl;
  return bnl;
}


x86 assembly (clang, -O0):
<bnldev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe6b(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11b2 <bnldev+0x42>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11cc <bnldev+0x5c>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe45(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
mulss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
cmpl   $0x19,-0x8(%rbp)
jge    1260 <bnldev+0xf0>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     125b <bnldev+0xeb>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <ran1@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1248 <bnldev+0xd8>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdcd(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    124d <bnldev+0xdd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1202 <bnldev+0x92>
jmp    1608 <bnldev+0x498>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd97(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    132d <bnldev+0x1bd>
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <exp@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xd81(%rip),%xmm0
movss  %xmm0,-0x34(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12ff <bnldev+0x18f>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <ran1@plt>
mulss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm1
movss  -0x20(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    12ec <bnldev+0x17c>
jmp    12ff <bnldev+0x18f>
jmp    12f1 <bnldev+0x181>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12b3 <bnldev+0x143>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1316 <bnldev+0x1a6>
mov    -0x14(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    131c <bnldev+0x1ac>
mov    -0x8(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    1603 <bnldev+0x493>
mov    -0x8(%rbp),%eax
cmp    0x2d22(%rip),%eax
je     1379 <bnldev+0x209>
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,0x2d27(%rip)
movss  0x2d1f(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xcab(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    $0x1,%al
call   1080 <gammln@plt>
movss  %xmm0,0x2d04(%rip)
mov    -0x8(%rbp),%eax
mov    %eax,0x2cdf(%rip)
movss  -0x28(%rbp),%xmm0
ucomiss 0x2cd7(%rip),%xmm0
jne    1396 <bnldev+0x226>
jp     1396 <bnldev+0x226>
jmp    13fb <bnldev+0x28b>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xc61(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x2cad(%rip)
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1060 <log@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x2c97(%rip)
movss  0x2c8b(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
call   1060 <log@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x2c7e(%rip)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,0x2c61(%rip)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xc04(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  0x2c4c(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
jmp    1433 <bnldev+0x2c3>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <ran1@plt>
cvtss2sd %xmm0,%xmm1
movsd  0xbce(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <tan@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x30(%rbp),%xmm0
movss  -0x38(%rbp),%xmm2
movss  -0x18(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
mov    $0x1,%al
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x45(%rbp)
ja     14d0 <bnldev+0x360>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x2bba(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xb46(%rip),%xmm2
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    1433 <bnldev+0x2c3>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1090 <floor@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xb1d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x38(%rbp),%xmm1
mulss  -0x38(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xaeb(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movss  0x2b42(%rip),%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xac0(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    $0x1,%al
call   1080 <gammln@plt>
movaps %xmm0,%xmm1
movss  -0x58(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
movss  0x2b04(%rip),%xmm0
subss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xa8b(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    $0x1,%al
call   1080 <gammln@plt>
movaps %xmm0,%xmm1
movss  -0x54(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  -0x1c(%rbp),%xmm1
movss  0x2ac7(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0x2abf(%rip),%xmm0
subss  -0x1c(%rbp),%xmm0
movss  0x2aae(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <ran1@plt>
ucomiss -0x34(%rbp),%xmm0
ja     142e <bnldev+0x2be>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    1608 <bnldev+0x498>
movss  -0x28(%rbp),%xmm0
ucomiss -0x4(%rbp),%xmm0
jne    1622 <bnldev+0x4b2>
jp     1622 <bnldev+0x4b2>
jmp    1631 <bnldev+0x4c1>
cvtsi2ssl -0x8(%rbp),%xmm0
subss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bnldev>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
movss  0xe7b(%rip),%xmm4
movaps %xmm4,%xmm1
movaps %xmm0,%xmm3
cmpnless 0xe70(%rip),%xmm3
subss  %xmm0,%xmm1
andps  %xmm3,%xmm1
andnps %xmm0,%xmm3
orps   %xmm1,%xmm3
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
cmp    $0x18,%edi
movss  %xmm3,0x4(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm1,0x20(%rsp)
jg     120f <bnldev+0x9f>
test   %ebp,%ebp
jle    136c <bnldev+0x1fc>
xorps  %xmm0,%xmm0
nopl   0x0(%rax,%rax,1)
movaps %xmm0,0x10(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <ran1@plt>
movaps %xmm0,%xmm2
movaps 0x10(%rsp),%xmm1
movaps %xmm1,%xmm0
addss  0xe0e(%rip),%xmm0
cmpltss 0x4(%rsp),%xmm2
andps  %xmm2,%xmm0
andnps %xmm1,%xmm2
orps   %xmm0,%xmm2
movaps %xmm2,%xmm0
add    $0xffffffff,%ebp
jne    11d0 <bnldev+0x60>
jmp    1507 <bnldev+0x397>
movaps %xmm3,%xmm2
mulss  %xmm1,%xmm3
ucomiss %xmm3,%xmm4
jbe    1289 <bnldev+0x119>
xorps  0xe0e(%rip),%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
call   1030 <exp@plt>
movss  0xdca(%rip),%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
add    $0x1,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movss  %xmm1,0x10(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <ran1@plt>
movaps %xmm0,%xmm1
mulss  0x10(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
ucomiss %xmm1,%xmm0
ja     1374 <bnldev+0x204>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1250 <bnldev+0xe0>
movaps 0x20(%rsp),%xmm2
jmp    1507 <bnldev+0x397>
cmp    %ebp,0x2dc9(%rip)
movaps %xmm3,0x10(%rsp)
je     12d7 <bnldev+0x167>
movaps 0x20(%rsp),%xmm0
movss  %xmm0,0x2dcd(%rip)
cvtss2sd %xmm0,%xmm0
addsd  0xd61(%rip),%xmm0
mov    $0x1,%al
call   1080 <gammln@plt>
movss  0xd42(%rip),%xmm4
movaps 0x10(%rsp),%xmm3
movss  0x4(%rsp),%xmm2
movss  %xmm0,0x2da3(%rip)
mov    %ebp,0x2d81(%rip)
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
movss  0x2d76(%rip),%xmm0
ucomiss %xmm2,%xmm0
jne    12ed <bnldev+0x17d>
jnp    1348 <bnldev+0x1d8>
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
subss  %xmm2,%xmm4
movss  %xmm4,0x2d64(%rip)
movsd  %xmm1,0x8(%rsp)
call   1060 <log@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x2d51(%rip)
movss  0x2d45(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
call   1060 <log@plt>
movsd  0x8(%rsp),%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x2d32(%rip)
movss  0x4(%rsp),%xmm0
movss  %xmm0,0x2d14(%rip)
addsd  %xmm1,%xmm1
movss  0x2d10(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1380 <bnldev+0x210>
sqrtsd %xmm0,%xmm0
jmp    1385 <bnldev+0x215>
xorps  %xmm2,%xmm2
jmp    1507 <bnldev+0x397>
xorps  %xmm2,%xmm2
cvtsi2ss %ebx,%xmm2
jmp    1507 <bnldev+0x397>
call   1070 <sqrt@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
cvtss2sd %xmm0,%xmm0
mulsd  0xc7d(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <ran1@plt>
cvtss2sd %xmm0,%xmm0
mulsd  0xc5a(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <tan@plt>
xorps  %xmm2,%xmm2
cvtsd2ss %xmm0,%xmm2
movss  0x8(%rsp),%xmm0
mulss  %xmm2,%xmm0
addss  0x10(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     13b0 <bnldev+0x240>
cvtss2sd %xmm0,%xmm0
movss  0x2c71(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  0xc05(%rip),%xmm1
ucomisd %xmm1,%xmm0
jae    13b0 <bnldev+0x240>
movss  %xmm2,(%rsp)
call   1090 <floor@plt>
xorps  %xmm2,%xmm2
cvtsd2ss %xmm0,%xmm2
movaps %xmm2,0x30(%rsp)
movss  (%rsp),%xmm0
mulss  %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  0xbd1(%rip),%xmm3
addsd  %xmm3,%xmm1
mulsd  0x40(%rsp),%xmm1
movsd  %xmm1,0x48(%rsp)
movss  0x2c1d(%rip),%xmm0
movss  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
addsd  %xmm3,%xmm0
mov    $0x1,%al
call   1080 <gammln@plt>
movss  (%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,(%rsp)
movss  0x2bec(%rip),%xmm0
subss  0x30(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xb7a(%rip),%xmm0
mov    $0x1,%al
call   1080 <gammln@plt>
movss  (%rsp),%xmm1
subss  %xmm0,%xmm1
movss  0x2bba(%rip),%xmm0
movaps 0x30(%rsp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0x2bad(%rip),%xmm1
subss  %xmm2,%xmm1
mulss  0x2b9d(%rip),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  0x48(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <ran1@plt>
movaps 0x30(%rsp),%xmm2
ucomiss (%rsp),%xmm0
ja     13b0 <bnldev+0x240>
movaps 0x20(%rsp),%xmm1
subss  %xmm2,%xmm1
movaps 0x50(%rsp),%xmm0
cmpneqss 0x4(%rsp),%xmm0
andps  %xmm0,%xmm1
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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