#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 */
int /*<<< orphan*/ abort();
scalar_t__ abs(int);
int /*<<< orphan*/ assert(int);
double *calloc(int, int);
double exp(double);
double fmax(double, double);
int /*<<< orphan*/ free(double *);
double pow(double, double);
double sqrt(double);
extern double CRRBinomial(int EuropeanOption, int fCall, double S, double X,
                          double T, double r, double b, double v, int n) {
  double z, dt, u, d, p, Df, result;
  int i, j;
  double *OptionValue;
  assert(((S) == (S)) && (S) >= 0.000001 && (S) <= 1000000000000.0);
  assert(((X) == (X)) && (X) >= 0.000001 && (X) <= 1000000000000.0);
  assert(((T) == (T)) && (T) >= (1.0 / (253.0 * 24.0)) && (T) <= (20.0));
  assert(((r) == (r)) && (r) >= 0.0 && (r) <= 1000.0);
  assert(((b) == (b)) && (b) >= -1000.0 && (b) <= 1000.0);
  assert(((v) == (v)) && (v) >= 0.0000001 && v <= 100.99999);
  assert(n > 0);
  if ((OptionValue = calloc(n + 1, sizeof *OptionValue)) == NULL)
    abort();
  if (fCall)
    z = 1.0;
  else
    z = -1.0;
  dt = T / n;
  u = exp(v * sqrt(dt));
  d = 1.0 / u;
  p = (exp(b * dt) - d) / (u - d);
  Df = exp(-r * dt);
  for (i = 0; i <= n; i++)
    OptionValue[i] =
        fmax(0.0, z * (S * pow(u, (double)i) * pow(d, (double)(n - i)) - X));
  for (j = n - 1; j >= 0; j--) {
    for (i = 0; i <= j; i++) {
      if (EuropeanOption)
        OptionValue[i] =
            (p * OptionValue[i + 1] + (1 - p) * OptionValue[i]) * Df;
      else
        OptionValue[i] =
            fmax((z * (S * pow(u, (double)i) * pow(d, (double)abs(i - j)) - X)),
                 (p * OptionValue[i + 1] + (1 - p) * OptionValue[i]) * Df);
    }
  }
  result = OptionValue[0];
  assert(((result) == (result)));
  free(OptionValue);
  return result;
}


x86 assembly (clang, -O0):
<CRRBinomial>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
mov    %edx,-0x3c(%rbp)
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x89(%rbp)
jne    1205 <CRRBinomial+0x85>
jp     1205 <CRRBinomial+0x85>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
movsd  0xe21(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x89(%rbp)
jb     1205 <CRRBinomial+0x85>
movsd  0xe11(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
setae  %al
mov    %al,-0x89(%rbp)
mov    -0x89(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x18(%rbp),%xmm0
mov    %al,-0x8a(%rbp)
jne    1268 <CRRBinomial+0xe8>
jp     1268 <CRRBinomial+0xe8>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
movsd  0xdbe(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x8a(%rbp)
jb     1268 <CRRBinomial+0xe8>
movsd  0xdae(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
setae  %al
mov    %al,-0x8a(%rbp)
mov    -0x8a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x20(%rbp),%xmm0
mov    %al,-0x8b(%rbp)
jne    12cb <CRRBinomial+0x14b>
jp     12cb <CRRBinomial+0x14b>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
movsd  0xd6b(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x8b(%rbp)
jb     12cb <CRRBinomial+0x14b>
movsd  0xd5b(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
setae  %al
mov    %al,-0x8b(%rbp)
mov    -0x8b(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x28(%rbp),%xmm0
mov    %al,-0x8c(%rbp)
jne    1329 <CRRBinomial+0x1a9>
jp     1329 <CRRBinomial+0x1a9>
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x8c(%rbp)
jb     1329 <CRRBinomial+0x1a9>
movsd  0xd05(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
setae  %al
mov    %al,-0x8c(%rbp)
mov    -0x8c(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x30(%rbp),%xmm0
mov    %al,-0x8d(%rbp)
jne    138c <CRRBinomial+0x20c>
jp     138c <CRRBinomial+0x20c>
movsd  -0x30(%rbp),%xmm0
xor    %eax,%eax
movsd  0xcc2(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x8d(%rbp)
jb     138c <CRRBinomial+0x20c>
movsd  0xca2(%rip),%xmm0
ucomisd -0x30(%rbp),%xmm0
setae  %al
mov    %al,-0x8d(%rbp)
mov    -0x8d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movsd  -0x38(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x38(%rbp),%xmm0
mov    %al,-0x8e(%rbp)
jne    13ef <CRRBinomial+0x26f>
jp     13ef <CRRBinomial+0x26f>
movsd  -0x38(%rbp),%xmm0
xor    %eax,%eax
movsd  0xc67(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x8e(%rbp)
jb     13ef <CRRBinomial+0x26f>
movsd  0xc57(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
setae  %al
mov    %al,-0x8e(%rbp)
mov    -0x8e(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
cmpl   $0x0,-0x3c(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x3c(%rbp),%edi
add    $0x1,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,-0x88(%rbp)
cmp    $0x0,%rax
jne    1438 <CRRBinomial+0x2b8>
mov    $0x0,%al
call   1040 <abort@plt>
cmpl   $0x0,-0x8(%rbp)
je     1454 <CRRBinomial+0x2d4>
movsd  0xbfe(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1461 <CRRBinomial+0x2e1>
movsd  0xbe4(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x3c(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   10a0 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
call   1080 <exp@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xb9c(%rip),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
call   1080 <exp@plt>
subsd  -0x60(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
subsd  -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x50(%rbp),%xmm0
call   1080 <exp@plt>
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     15cf <CRRBinomial+0x44f>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
cvtsi2sdl -0x7c(%rbp),%xmm1
call   1090 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
mov    -0x3c(%rbp),%eax
sub    -0x7c(%rbp),%eax
cvtsi2sd %eax,%xmm1
call   1090 <pow@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movaps %xmm0,%xmm3
movsd  -0xa0(%rbp),%xmm0
ff
movsd  -0x18(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
maxsd  %xmm1,%xmm0
mov    -0x88(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    150f <CRRBinomial+0x38f>
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x80(%rbp)
cmpl   $0x0,-0x80(%rbp)
jl     1795 <CRRBinomial+0x615>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x80(%rbp),%eax
jg     1782 <CRRBinomial+0x602>
cmpl   $0x0,-0x4(%rbp)
je     1658 <CRRBinomial+0x4d8>
movsd  -0x68(%rbp),%xmm0
mov    -0x88(%rbp),%rax
mov    -0x7c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  0xa27(%rip),%xmm1
subsd  -0x68(%rbp),%xmm1
mov    -0x88(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x70(%rbp),%xmm0
mov    -0x88(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    176f <CRRBinomial+0x5ef>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
cvtsi2sdl -0x7c(%rbp),%xmm1
call   1090 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x7c(%rbp),%edi
sub    -0x80(%rbp),%edi
call   1050 <abs@plt>
movsd  -0xc8(%rbp),%xmm0
ff
cvtsi2sd %rax,%xmm1
call   1090 <pow@plt>
movsd  -0xc0(%rbp),%xmm3
ff
movaps %xmm0,%xmm2
movsd  -0xb8(%rbp),%xmm0
ff
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm0,%xmm3
movsd  -0x68(%rbp),%xmm2
mov    -0x88(%rbp),%rax
mov    -0x7c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  0x929(%rip),%xmm0
subsd  -0x68(%rbp),%xmm0
mov    -0x88(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
mulsd  -0x70(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
maxsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
mov    -0x88(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1774 <CRRBinomial+0x5f4>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    15e9 <CRRBinomial+0x469>
jmp    1787 <CRRBinomial+0x607>
mov    -0x80(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x80(%rbp)
jmp    15d8 <CRRBinomial+0x458>
mov    -0x88(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
ucomisd -0x78(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x78(%rbp),%xmm0
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CRRBinomial>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xe63(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xe5e(%rip),%xmm6
movsd  %xmm0,0x48(%rsp)
ucomisd %xmm0,%xmm6
mov    %edx,%r14d
movsd  %xmm5,0x8(%rsp)
movsd  %xmm4,0x10(%rsp)
movaps %xmm3,0x20(%rsp)
movsd  %xmm2,(%rsp)
movaps %xmm1,0x30(%rsp)
mov    %esi,%r15d
mov    %edi,%r13d
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1070 <assert@plt>
movapd 0x30(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xe06(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xe01(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1070 <assert@plt>
movsd  (%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xde4(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xddf(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1070 <assert@plt>
xorpd  %xmm0,%xmm0
movapd 0x20(%rsp),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
movsd  0xdbd(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1070 <assert@plt>
movsd  0x10(%rsp),%xmm0
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xd9f(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xd8a(%rip),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1070 <assert@plt>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xd74(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xd6f(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1070 <assert@plt>
xor    %edi,%edi
test   %r14d,%r14d
setg   %dil
call   1070 <assert@plt>
lea    0x1(%r14),%r12d
mov    %r12d,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
test   %rax,%rax
je     15be <CRRBinomial+0x43e>
mov    %rax,%rbx
xor    %ebp,%ebp
test   %r15d,%r15d
sete   %bpl
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
lea    0xd33(%rip),%r15
movsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
ucomisd 0xd1a(%rip),%xmm0
movsd  %xmm0,(%rsp)
jb     133b <CRRBinomial+0x1bb>
sqrtsd %xmm0,%xmm0
jmp    1340 <CRRBinomial+0x1c0>
call   10a0 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
movsd  (%r15,%rbp,8),%xmm2
movsd  %xmm2,0x40(%rsp)
mulsd  %xmm1,%xmm0
call   1080 <exp@plt>
movsd  0xcdd(%rip),%xmm1
movsd  %xmm0,0x8(%rsp)
divsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  (%rsp),%xmm0
call   1080 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
xorpd  0xcc9(%rip),%xmm0
mulsd  (%rsp),%xmm0
call   1080 <exp@plt>
movsd  %xmm0,0x20(%rsp)
test   %r14d,%r14d
js     142b <CRRBinomial+0x2ab>
movapd 0xca8(%rip),%xmm0
xorpd  0x30(%rsp),%xmm0
movapd %xmm0,0x50(%rsp)
mov    %r12d,%r15d
xor    %ebp,%ebp
mov    %r14d,%r12d
nopl   0x0(%rax)
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
movsd  0x8(%rsp),%xmm0
call   1090 <pow@plt>
mulsd  0x48(%rsp),%xmm0
movsd  %xmm0,(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %r12d,%xmm1
movsd  0x18(%rsp),%xmm0
call   1090 <pow@plt>
mulsd  (%rsp),%xmm0
addsd  0x50(%rsp),%xmm0
mulsd  0x40(%rsp),%xmm0
maxsd  0xc2f(%rip),%xmm0
movsd  %xmm0,(%rbx,%rbp,8)
add    $0x1,%rbp
add    $0xffffffff,%r12d
cmp    %rbp,%r15
jne    13d0 <CRRBinomial+0x250>
test   %r14d,%r14d
movsd  0x8(%rsp),%xmm2
movsd  0xc04(%rip),%xmm5
movsd  0x18(%rsp),%xmm3
movsd  0x10(%rsp),%xmm6
movsd  0x20(%rsp),%xmm7
jle    158a <CRRBinomial+0x40a>
subsd  %xmm3,%xmm6
movapd %xmm2,%xmm0
subsd  %xmm3,%xmm0
divsd  %xmm0,%xmm6
subsd  %xmm6,%xmm5
movapd 0x30(%rsp),%xmm0
xorpd  0xbea(%rip),%xmm0
movapd %xmm0,0x30(%rsp)
mov    %r14d,%r14d
movsd  %xmm5,0x50(%rsp)
movsd  %xmm6,0x10(%rsp)
jmp    149a <CRRBinomial+0x31a>
nopl   (%rax)
cmp    $0x2,%r15
jl     158a <CRRBinomial+0x40a>
mov    %r14,%r15
add    $0xffffffffffffffff,%r14
xor    %ebp,%ebp
jmp    155f <CRRBinomial+0x3df>
nopl   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
movapd %xmm2,%xmm0
call   1090 <pow@plt>
mulsd  0x48(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
sub    %r14d,%edi
call   1050 <abs@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movsd  0x18(%rsp),%xmm0
call   1090 <pow@plt>
movsd  0x20(%rsp),%xmm7
movsd  0x10(%rsp),%xmm6
movsd  0x50(%rsp),%xmm5
movsd  0x40(%rsp),%xmm4
mulsd  (%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
mulsd  %xmm4,%xmm0
movsd  (%rbx,%rbp,8),%xmm1
mulsd  %xmm5,%xmm1
movsd  0x8(%rbx,%rbp,8),%xmm2
mulsd  %xmm6,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm7,%xmm2
movapd %xmm0,%xmm1
cmpunordsd %xmm0,%xmm1
movapd %xmm1,%xmm3
andpd  %xmm2,%xmm3
maxsd  %xmm0,%xmm2
andnpd %xmm2,%xmm1
movsd  0x8(%rsp),%xmm2
orpd   %xmm3,%xmm1
movlpd %xmm1,(%rbx,%rbp,8)
add    $0x1,%rbp
cmp    %r15,%rbp
je     1490 <CRRBinomial+0x310>
test   %r13d,%r13d
je     14b0 <CRRBinomial+0x330>
movsd  (%rbx,%rbp,8),%xmm0
mulsd  %xmm5,%xmm0
movsd  0x8(%rbx,%rbp,8),%xmm1
mulsd  %xmm6,%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm7,%xmm1
movsd  %xmm1,(%rbx,%rbp,8)
jmp    1552 <CRRBinomial+0x3d2>
movsd  (%rbx),%xmm0
movsd  %xmm0,(%rsp)
xor    %edi,%edi
ucomisd %xmm0,%xmm0
setnp  %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movsd  (%rsp),%xmm0
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define double @CRRBinomial(i32 %0, i32 %1, double %2, double %3, double %4, double %5, double %6, double %7, i32 %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca i32
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca i32
%27 = alloca i32
%28 = alloca double*
store i32 %0, i32* %10
store i32 %1, i32* %11
store double %2, double* %12
store double %3, double* %13
store double %4, double* %14
store double %5, double* %15
store double %6, double* %16
store double %7, double* %17
store i32 %8, i32* %18
%29 = load double, double* %12
%30 = load double, double* %12
%31 = fcmp oeq double %29, %30
br i1 %31, label %32, label %38
32: ; preds = %9
%33 = load double, double* %12
%34 = fcmp oge double %33, 0x3EB0C6F7A0B5ED8D
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load double, double* %12
%37 = fcmp ole double %36, 1.000000e+12
br label %38
38: ; preds = %35, %32, %9
%39 = phi i1 [ false, %32 ], [ false, %9 ], [ %37, %35 ]
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = load double, double* %13
%43 = load double, double* %13
%44 = fcmp oeq double %42, %43
br i1 %44, label %45, label %51
45: ; preds = %38
%46 = load double, double* %13
%47 = fcmp oge double %46, 0x3EB0C6F7A0B5ED8D
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load double, double* %13
%50 = fcmp ole double %49, 1.000000e+12
br label %51
51: ; preds = %48, %45, %38
%52 = phi i1 [ false, %45 ], [ false, %38 ], [ %50, %48 ]
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
%55 = load double, double* %14
%56 = load double, double* %14
%57 = fcmp oeq double %55, %56
br i1 %57, label %58, label %64
58: ; preds = %51
%59 = load double, double* %14
%60 = fcmp oge double %59, 0x3F2596179C29D2CE
br i1 %60, label %61, label %64
61: ; preds = %58
%62 = load double, double* %14
%63 = fcmp ole double %62, 2.000000e+01
br label %64
64: ; preds = %61, %58, %51
%65 = phi i1 [ false, %58 ], [ false, %51 ], [ %63, %61 ]
%66 = zext i1 %65 to i32
%67 = call i32 @assert(i32 %66)
%68 = load double, double* %15
%69 = load double, double* %15
%70 = fcmp oeq double %68, %69
br i1 %70, label %71, label %77
71: ; preds = %64
%72 = load double, double* %15
%73 = fcmp oge double %72, 0.000000e+00
br i1 %73, label %74, label %77
74: ; preds = %71
%75 = load double, double* %15
%76 = fcmp ole double %75, 1.000000e+03
br label %77
77: ; preds = %74, %71, %64
%78 = phi i1 [ false, %71 ], [ false, %64 ], [ %76, %74 ]
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
%81 = load double, double* %16
%82 = load double, double* %16
%83 = fcmp oeq double %81, %82
br i1 %83, label %84, label %90
84: ; preds = %77
%85 = load double, double* %16
%86 = fcmp oge double %85, -1.000000e+03
br i1 %86, label %87, label %90
87: ; preds = %84
%88 = load double, double* %16
%89 = fcmp ole double %88, 1.000000e+03
br label %90
90: ; preds = %87, %84, %77
%91 = phi i1 [ false, %84 ], [ false, %77 ], [ %89, %87 ]
%92 = zext i1 %91 to i32
%93 = call i32 @assert(i32 %92)
%94 = load double, double* %17
%95 = load double, double* %17
%96 = fcmp oeq double %94, %95
br i1 %96, label %97, label %103
97: ; preds = %90
%98 = load double, double* %17
%99 = fcmp oge double %98, 0x3E7AD7F29ABCAF48
br i1 %99, label %100, label %103
100: ; preds = %97
%101 = load double, double* %17
%102 = fcmp ole double %101, 0x40593FFFD60E94EE
br label %103
103: ; preds = %100, %97, %90
%104 = phi i1 [ false, %97 ], [ false, %90 ], [ %102, %100 ]
%105 = zext i1 %104 to i32
%106 = call i32 @assert(i32 %105)
%107 = load i32, i32* %18
%108 = icmp sgt i32 %107, 0
%109 = zext i1 %108 to i32
%110 = call i32 @assert(i32 %109)
%111 = load i32, i32* %18
%112 = add nsw i32 %111, 1
%113 = call double* @calloc(i32 %112, i32 8)
store double* %113, double** %28
%114 = icmp eq double* %113, null
br i1 %114, label %115, label %117
115: ; preds = %103
%116 = call i32 (...) @abort()
unreachable
117: ; preds = %103
%118 = load i32, i32* %11
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %121
120: ; preds = %117
store double 1.000000e+00, double* %19
br label %122
121: ; preds = %117
store double -1.000000e+00, double* %19
br label %122
122: ; preds = %121, %120
%123 = load double, double* %14
%124 = load i32, i32* %18
%125 = sitofp i32 %124 to double
%126 = fdiv double %123, %125
store double %126, double* %20
%127 = load double, double* %17
%128 = load double, double* %20
%129 = call double @sqrt(double %128)
%130 = fmul double %127, %129
%131 = call double @exp(double %130)
store double %131, double* %21
%132 = load double, double* %21
%133 = fdiv double 1.000000e+00, %132
store double %133, double* %22
%134 = load double, double* %16
%135 = load double, double* %20
%136 = fmul double %134, %135
%137 = call double @exp(double %136)
%138 = load double, double* %22
%139 = fsub double %137, %138
%140 = load double, double* %21
%141 = load double, double* %22
%142 = fsub double %140, %141
%143 = fdiv double %139, %142
store double %143, double* %23
%144 = load double, double* %15
%145 = fneg double %144
%146 = load double, double* %20
%147 = fmul double %145, %146
%148 = call double @exp(double %147)
store double %148, double* %24
store i32 0, i32* %26
br label %149
149: ; preds = %176, %122
%150 = load i32, i32* %26
%151 = load i32, i32* %18
%152 = icmp sle i32 %150, %151
br i1 %152, label %153, label %179
153: ; preds = %149
%154 = load double, double* %19
%155 = load double, double* %12
%156 = load double, double* %21
%157 = load i32, i32* %26
%158 = sitofp i32 %157 to double
%159 = call double @pow(double %156, double %158)
%160 = fmul double %155, %159
%161 = load double, double* %22
%162 = load i32, i32* %18
%163 = load i32, i32* %26
%164 = sub nsw i32 %162, %163
%165 = sitofp i32 %164 to double
%166 = call double @pow(double %161, double %165)
%167 = load double, double* %13
%168 = fneg double %167
%169 = call double @llvm.fmuladd.f64(double %160, double %166, double %168)
%170 = fmul double %154, %169
%171 = call double @llvm.maxnum.f64(double 0.000000e+00, double %170)
%172 = load double*, double** %28
%173 = load i32, i32* %26
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
store double %171, double* %175
br label %176
176: ; preds = %153
%177 = load i32, i32* %26
%178 = add nsw i32 %177, 1
store i32 %178, i32* %26
br label %149
179: ; preds = %149
%180 = load i32, i32* %18
%181 = sub nsw i32 %180, 1
store i32 %181, i32* %27
br label %182
182: ; preds = %263, %179
%183 = load i32, i32* %27
%184 = icmp sge i32 %183, 0
br i1 %184, label %185, label %266
185: ; preds = %182
store i32 0, i32* %26
br label %186
186: ; preds = %259, %185
%187 = load i32, i32* %26
%188 = load i32, i32* %27
%189 = icmp sle i32 %187, %188
br i1 %189, label %190, label %262
190: ; preds = %186
%191 = load i32, i32* %10
%192 = icmp ne i32 %191, 0
br i1 %192, label %193, label %216
193: ; preds = %190
%194 = load double, double* %23
%195 = load double*, double** %28
%196 = load i32, i32* %26
%197 = add nsw i32 %196, 1
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds double, double* %195, i64 %198
%200 = load double, double* %199
%201 = load double, double* %23
%202 = fsub double 1.000000e+00, %201
%203 = load double*, double** %28
%204 = load i32, i32* %26
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds double, double* %203, i64 %205
%207 = load double, double* %206
%208 = fmul double %202, %207
%209 = call double @llvm.fmuladd.f64(double %194, double %200, double %208)
%210 = load double, double* %24
%211 = fmul double %209, %210
%212 = load double*, double** %28
%213 = load i32, i32* %26
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds double, double* %212, i64 %214
store double %211, double* %215
br label %258
216: ; preds = %190
%217 = load double, double* %19
%218 = load double, double* %12
%219 = load double, double* %21
%220 = load i32, i32* %26
%221 = sitofp i32 %220 to double
%222 = call double @pow(double %219, double %221)
%223 = fmul double %218, %222
%224 = load double, double* %22
%225 = load i32, i32* %26
%226 = load i32, i32* %27
%227 = sub nsw i32 %225, %226
%228 = call i64 @abs(i32 %227)
%229 = sitofp i64 %228 to double
%230 = call double @pow(double %224, double %229)
%231 = load double, double* %13
%232 = fneg double %231
%233 = call double @llvm.fmuladd.f64(double %223, double %230, double %232)
%234 = fmul double %217, %233
%235 = load double, double* %23
%236 = load double*, double** %28
%237 = load i32, i32* %26
%238 = add nsw i32 %237, 1
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds double, double* %236, i64 %239
%241 = load double, double* %240
%242 = load double, double* %23
%243 = fsub double 1.000000e+00, %242
%244 = load double*, double** %28
%245 = load i32, i32* %26
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds double, double* %244, i64 %246
%248 = load double, double* %247
%249 = fmul double %243, %248
%250 = call double @llvm.fmuladd.f64(double %235, double %241, double %249)
%251 = load double, double* %24
%252 = fmul double %250, %251
%253 = call double @llvm.maxnum.f64(double %234, double %252)
%254 = load double*, double** %28
%255 = load i32, i32* %26
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds double, double* %254, i64 %256
store double %253, double* %257
br label %258
258: ; preds = %216, %193
br label %259
259: ; preds = %258
%260 = load i32, i32* %26
%261 = add nsw i32 %260, 1
store i32 %261, i32* %26
br label %186
262: ; preds = %186
br label %263
263: ; preds = %262
%264 = load i32, i32* %27
%265 = add nsw i32 %264, -1
store i32 %265, i32* %27
br label %182
266: ; preds = %182
%267 = load double*, double** %28
%268 = getelementptr inbounds double, double* %267, i64 0
%269 = load double, double* %268
store double %269, double* %25
%270 = load double, double* %25
%271 = load double, double* %25
%272 = fcmp oeq double %270, %271
%273 = zext i1 %272 to i32
%274 = call i32 @assert(i32 %273)
%275 = load double*, double** %28
%276 = call i32 @free(double* %275)
%277 = load double, double* %25
ret double %277
}

LLVM IR (-O2):
define double @CRRBinomial(i32 %0, i32 %1, double %2, double %3, double %4, double %5, double %6, double %7, i32 %8) {
%10 = fcmp ord double %2, 0.000000e+00
%11 = fcmp oge double %2, 0x3EB0C6F7A0B5ED8D
%12 = and i1 %10, %11
%13 = fcmp ole double %2, 1.000000e+12
%14 = and i1 %13, %12
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = fcmp ord double %3, 0.000000e+00
%18 = fcmp oge double %3, 0x3EB0C6F7A0B5ED8D
%19 = and i1 %17, %18
%20 = fcmp ole double %3, 1.000000e+12
%21 = and i1 %20, %19
%22 = zext i1 %21 to i32
%23 = tail call i32 @assert(i32 %22)
%24 = fcmp ord double %4, 0.000000e+00
%25 = fcmp oge double %4, 0x3F2596179C29D2CE
%26 = and i1 %24, %25
%27 = fcmp ole double %4, 2.000000e+01
%28 = and i1 %27, %26
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = fcmp oge double %5, 0.000000e+00
%32 = fcmp ole double %5, 1.000000e+03
%33 = and i1 %31, %32
%34 = zext i1 %33 to i32
%35 = tail call i32 @assert(i32 %34)
%36 = fcmp ord double %6, 0.000000e+00
%37 = fcmp oge double %6, -1.000000e+03
%38 = and i1 %36, %37
%39 = fcmp ole double %6, 1.000000e+03
%40 = and i1 %39, %38
%41 = zext i1 %40 to i32
%42 = tail call i32 @assert(i32 %41)
%43 = fcmp ord double %7, 0.000000e+00
%44 = fcmp oge double %7, 0x3E7AD7F29ABCAF48
%45 = and i1 %43, %44
%46 = fcmp ole double %7, 0x40593FFFD60E94EE
%47 = and i1 %46, %45
%48 = zext i1 %47 to i32
%49 = tail call i32 @assert(i32 %48)
%50 = icmp sgt i32 %8, 0
%51 = zext i1 %50 to i32
%52 = tail call i32 @assert(i32 %51)
%53 = add i32 %8, 1
%54 = tail call double* @calloc(i32 %53, i32 8)
%55 = icmp eq double* %54, null
br i1 %55, label %56, label %58
56: ; preds = %9
%57 = tail call i32 (...) @abort()
unreachable
58: ; preds = %9
%59 = icmp eq i32 %1, 0
%60 = select i1 %59, double -1.000000e+00, double 1.000000e+00
%61 = sitofp i32 %8 to double
%62 = fdiv double %4, %61
%63 = tail call double @sqrt(double %62)
%64 = fmul double %63, %7
%65 = tail call double @exp(double %64)
%66 = fdiv double 1.000000e+00, %65
%67 = fmul double %62, %6
%68 = tail call double @exp(double %67)
%69 = fsub double %68, %66
%70 = fsub double %65, %66
%71 = fdiv double %69, %70
%72 = fneg double %5
%73 = fmul double %62, %72
%74 = tail call double @exp(double %73)
%75 = icmp slt i32 %8, 0
br i1 %75, label %79, label %76
76: ; preds = %58
%77 = fneg double %3
%78 = zext i32 %53 to i64
br label %85
79: ; preds = %85, %58
br i1 %50, label %80, label %140
80: ; preds = %79
%81 = icmp eq i32 %0, 0
%82 = fsub double 1.000000e+00, %71
%83 = fneg double %3
%84 = zext i32 %8 to i64
br label %102
85: ; preds = %76, %85
%86 = phi i64 [ 0, %76 ], [ %98, %85 ]
%87 = trunc i64 %86 to i32
%88 = sitofp i32 %87 to double
%89 = tail call double @pow(double %65, double %88)
%90 = fmul double %89, %2
%91 = sub nsw i32 %8, %87
%92 = sitofp i32 %91 to double
%93 = tail call double @pow(double %66, double %92)
%94 = tail call double @llvm.fmuladd.f64(double %90, double %93, double %77)
%95 = fmul double %60, %94
%96 = tail call double @llvm.maxnum.f64(double %95, double 0.000000e+00)
%97 = getelementptr inbounds double, double* %54, i64 %86
store double %96, double* %97
%98 = add nuw nsw i64 %86, 1
%99 = icmp eq i64 %98, %78
br i1 %99, label %79, label %85
100: ; preds = %137
%101 = icmp sgt i64 %103, 1
br i1 %101, label %102, label %140
102: ; preds = %100, %80
%103 = phi i64 [ %84, %80 ], [ %104, %100 ]
%104 = add nsw i64 %103, -1
%105 = trunc i64 %104 to i32
br label %106
106: ; preds = %102, %137
%107 = phi i64 [ 0, %102 ], [ %138, %137 ]
br i1 %81, label %117, label %108
108: ; preds = %106
%109 = add nuw nsw i64 %107, 1
%110 = getelementptr inbounds double, double* %54, i64 %109
%111 = load double, double* %110
%112 = getelementptr inbounds double, double* %54, i64 %107
%113 = load double, double* %112
%114 = fmul double %82, %113
%115 = tail call double @llvm.fmuladd.f64(double %71, double %111, double %114)
%116 = fmul double %74, %115
store double %116, double* %112
br label %137
117: ; preds = %106
%118 = trunc i64 %107 to i32
%119 = sitofp i32 %118 to double
%120 = tail call double @pow(double %65, double %119)
%121 = fmul double %120, %2
%122 = sub nsw i32 %118, %105
%123 = tail call i64 @abs(i32 %122)
%124 = sitofp i64 %123 to double
%125 = tail call double @pow(double %66, double %124)
%126 = tail call double @llvm.fmuladd.f64(double %121, double %125, double %83)
%127 = fmul double %60, %126
%128 = add nuw nsw i64 %107, 1
%129 = getelementptr inbounds double, double* %54, i64 %128
%130 = load double, double* %129
%131 = getelementptr inbounds double, double* %54, i64 %107
%132 = load double, double* %131
%133 = fmul double %82, %132
%134 = tail call double @llvm.fmuladd.f64(double %71, double %130, double %133)
%135 = fmul double %74, %134
%136 = tail call double @llvm.maxnum.f64(double %127, double %135)
store double %136, double* %131
br label %137
137: ; preds = %108, %117
%138 = phi i64 [ %109, %108 ], [ %128, %117 ]
%139 = icmp eq i64 %138, %103
br i1 %139, label %100, label %106
140: ; preds = %100, %79
%141 = load double, double* %54
%142 = fcmp ord double %141, 0.000000e+00
%143 = zext i1 %142 to i32
%144 = tail call i32 @assert(i32 %143)
%145 = tail call i32 @free(double* %54)
ret double %141
}