#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 fabs(double);
double rq_pricing_average_rate_turnbullwakeman(short, double, double, double,
                                               double, double, double, double,
                                               double, double);
double rq_pricing_average_rate_turnbullwakeman_greeks(
    short call, double S, double SA, double X, double r, double rf, double v,
    double T, double T2, double T_period, double *delta, double delta_shift,
    double *gamma, double gamma_shift, double *vega, double vega_shift,
    double *theta, double theta_shift, double *rho, double rho_shift) {
  double delta_up = 0.0;
  double delta_down = 0.0;
  double gamma_up = 0.0;
  double gamma_down = 0.0;
  double vega_up = 0.0;
  double vega_down = 0.0;
  double theta_up = 0.0;
  double rho_up = 0.0;
  double rho_down = 0.0;
  double price = 0.0;
  price = rq_pricing_average_rate_turnbullwakeman(call, S, SA, X, r, rf, v, T,
                                                  T2, T_period);
  if (delta) {
    delta_up = rq_pricing_average_rate_turnbullwakeman(
        call, S + delta_shift, SA, X, r, rf, v, T, T2, T_period);
    delta_down = rq_pricing_average_rate_turnbullwakeman(
        call, S - delta_shift, SA, X, r, rf, v, T, T2, T_period);
    *delta = (delta_up - delta_down) / (2.0 * delta_shift);
    if (gamma) {
      gamma_up = rq_pricing_average_rate_turnbullwakeman(
          call, S + 2 * gamma_shift, SA, X, r, rf, v, T, T2, T_period);
      gamma_down = rq_pricing_average_rate_turnbullwakeman(
          call, S - 2 * gamma_shift, SA, X, r, rf, v, T, T2, T_period);
      gamma_up = (gamma_up - 2 * delta_up + price);
      gamma_down = (gamma_down - 2 * delta_down + price);
      *gamma = (fabs(gamma_up) + fabs(gamma_down)) /
               (2.0 * gamma_shift * gamma_shift);
    }
  }
  if (theta) {
    theta_up = rq_pricing_average_rate_turnbullwakeman(
        call, S, SA, X, r, rf, v, T + theta_shift, T2, T_period);
    *theta = (price - theta_up) / price;
  }
  if (rho) {
    rho_up = rq_pricing_average_rate_turnbullwakeman(
        call, S, SA, X, r + rho_shift, rf, v, T, T2, T_period);
    rho_down = rq_pricing_average_rate_turnbullwakeman(
        call, S, SA, X, r - rho_shift, rf, v, T, T2, T_period);
    *rho = (rho_up - rho_down) / (2.0 * rho_shift);
  }
  if (vega) {
    vega_up = rq_pricing_average_rate_turnbullwakeman(
        call, S, SA, X, r, rf, v + vega_shift, T, T2, T_period);
    vega_down = rq_pricing_average_rate_turnbullwakeman(
        call, S, SA, X, r, rf, v - vega_shift, T, T2, T_period);
    *vega = (vega_up - vega_down) / (2.0 * vega_shift);
  }
  return price;
}


x86 assembly (clang, -O0):
<rq_pricing_average_rate_turnbullwakeman_greeks>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %di,%ax
movsd  0x38(%rbp),%xmm8
movsd  0x30(%rbp),%xmm8
movsd  0x28(%rbp),%xmm8
movsd  0x20(%rbp),%xmm8
movsd  0x18(%rbp),%xmm8
movsd  0x10(%rbp),%xmm8
mov    %ax,-0x2(%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)
movsd  %xmm6,-0x40(%rbp)
movsd  %xmm7,-0x48(%rbp)
mov    %rsi,-0x50(%rbp)
mov    %rdx,-0x58(%rbp)
mov    %rcx,-0x60(%rbp)
mov    %r8,-0x68(%rbp)
mov    %r9,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0x2(%rbp),%ax
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  0x10(%rbp),%xmm8
movswl %ax,%edi
movsd  %xmm8,(%rsp)
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,-0xc0(%rbp)
ff
cmpq   $0x0,-0x50(%rbp)
je     1440 <rq_pricing_average_rate_turnbullwakeman_greeks+0x330>
mov    -0x2(%rbp),%ax
movsd  -0x10(%rbp),%xmm0
addsd  0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  0x10(%rbp),%xmm8
movswl %ax,%edi
movsd  %xmm8,(%rsp)
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,-0x78(%rbp)
mov    -0x2(%rbp),%ax
movsd  -0x10(%rbp),%xmm0
subsd  0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  0x10(%rbp),%xmm8
movswl %ax,%edi
movsd  %xmm8,(%rsp)
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
subsd  -0x80(%rbp),%xmm0
movsd  0xd1d(%rip),%xmm1
mulsd  0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x58(%rbp)
je     143b <rq_pricing_average_rate_turnbullwakeman_greeks+0x32b>
mov    -0x2(%rbp),%ax
movsd  -0x10(%rbp),%xmm1
movsd  0x20(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  0x10(%rbp),%xmm8
movswl %ax,%edi
movsd  %xmm8,(%rsp)
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x2(%rbp),%ax
movsd  -0x10(%rbp),%xmm0
movsd  0x20(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  0x10(%rbp),%xmm8
movswl %ax,%edi
movsd  %xmm8,(%rsp)
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x78(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
addsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x80(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
addsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movaps 0xc0e(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x90(%rbp),%xmm1
ff
movaps 0xbfb(%rip),%xmm2
pand   %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  0xbdb(%rip),%xmm1
mulsd  0x20(%rbp),%xmm1
mulsd  0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1440 <rq_pricing_average_rate_turnbullwakeman_greeks+0x330>
cmpq   $0x0,-0x68(%rbp)
je     14b8 <rq_pricing_average_rate_turnbullwakeman_greeks+0x3a8>
mov    -0x2(%rbp),%ax
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
addsd  0x30(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  0x10(%rbp),%xmm8
movswl %ax,%edi
movsd  %xmm8,(%rsp)
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
subsd  -0xa8(%rbp),%xmm0
ff
divsd  -0xc0(%rbp),%xmm0
ff
mov    -0x68(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x70(%rbp)
je     1586 <rq_pricing_average_rate_turnbullwakeman_greeks+0x476>
mov    -0x2(%rbp),%ax
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
addsd  0x38(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  0x10(%rbp),%xmm8
movswl %ax,%edi
movsd  %xmm8,(%rsp)
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x2(%rbp),%ax
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
subsd  0x38(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  0x10(%rbp),%xmm8
movswl %ax,%edi
movsd  %xmm8,(%rsp)
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
subsd  -0xb8(%rbp),%xmm0
ff
movsd  0xa8b(%rip),%xmm1
mulsd  0x38(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x70(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x60(%rbp)
je     1654 <rq_pricing_average_rate_turnbullwakeman_greeks+0x544>
mov    -0x2(%rbp),%ax
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
addsd  0x28(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  0x10(%rbp),%xmm8
movswl %ax,%edi
movsd  %xmm8,(%rsp)
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x2(%rbp),%ax
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
subsd  0x28(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  0x10(%rbp),%xmm8
movswl %ax,%edi
movsd  %xmm8,(%rsp)
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
subsd  -0xa0(%rbp),%xmm0
ff
movsd  0x9bd(%rip),%xmm1
mulsd  0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x60(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0xc0(%rbp),%xmm0
ff
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_pricing_average_rate_turnbullwakeman_greeks>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9,%r15
mov    %r8,%r13
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %edi,%ebp
movsd  0xc0(%rsp),%xmm8
movsd  %xmm8,(%rsp)
movsd  %xmm0,0x10(%rsp)
movsd  %xmm1,0x40(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm4,0x28(%rsp)
movsd  %xmm5,0x30(%rsp)
movsd  %xmm6,0x48(%rsp)
movsd  %xmm7,0x38(%rsp)
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,0x58(%rsp)
movswl %bp,%ebp
test   %rbx,%rbx
je     1367 <rq_pricing_average_rate_turnbullwakeman_greeks+0x257>
movsd  0x10(%rsp),%xmm0
addsd  0xc8(%rsp),%xmm0
movsd  0xc0(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %ebp,%edi
movsd  0x40(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
movsd  0x30(%rsp),%xmm5
movsd  0x48(%rsp),%xmm6
movsd  0x38(%rsp),%xmm7
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,0x50(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0xc8(%rsp),%xmm0
movsd  0xc0(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %ebp,%edi
movsd  0x40(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
movsd  0x30(%rsp),%xmm5
movsd  0x48(%rsp),%xmm6
movsd  0x38(%rsp),%xmm7
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movapd %xmm0,%xmm1
movsd  0x50(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xc8(%rsp),%xmm2
addsd  %xmm2,%xmm2
divsd  %xmm2,%xmm0
movsd  %xmm0,(%rbx)
test   %r12,%r12
je     1367 <rq_pricing_average_rate_turnbullwakeman_greeks+0x257>
movsd  0xd0(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x60(%rsp)
addsd  0x10(%rsp),%xmm0
movsd  %xmm1,0x68(%rsp)
movsd  0xc0(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %ebp,%edi
movsd  0x40(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
movsd  0x30(%rsp),%xmm5
movsd  0x48(%rsp),%xmm6
movsd  0x38(%rsp),%xmm7
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movapd %xmm0,0x70(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x60(%rsp),%xmm0
movsd  0xc0(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %ebp,%edi
movsd  0x40(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
movsd  0x30(%rsp),%xmm5
movsd  0x48(%rsp),%xmm6
movsd  0x38(%rsp),%xmm7
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  0x50(%rsp),%xmm1
addsd  %xmm1,%xmm1
movapd 0x70(%rsp),%xmm2
subsd  %xmm1,%xmm2
movsd  0x58(%rsp),%xmm1
addsd  %xmm1,%xmm2
movapd %xmm2,%xmm3
movsd  0x68(%rsp),%xmm2
addsd  %xmm2,%xmm2
subsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movapd 0xcbe(%rip),%xmm1
andpd  %xmm1,%xmm3
andpd  %xmm1,%xmm0
addsd  %xmm3,%xmm0
movsd  0x60(%rsp),%xmm1
mulsd  0xd0(%rsp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r12)
test   %r13,%r13
je     13d2 <rq_pricing_average_rate_turnbullwakeman_greeks+0x2c2>
movsd  0xe0(%rsp),%xmm6
addsd  0x48(%rsp),%xmm6
movsd  0xc0(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
movsd  0x10(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
movsd  0x30(%rsp),%xmm5
movsd  0x38(%rsp),%xmm7
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  0x58(%rsp),%xmm2
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
divsd  %xmm2,%xmm1
movsd  %xmm1,0x0(%r13)
test   %r15,%r15
movsd  0x38(%rsp),%xmm10
movsd  0x30(%rsp),%xmm5
movsd  0x28(%rsp),%xmm11
movsd  0x20(%rsp),%xmm3
movsd  0x18(%rsp),%xmm2
movsd  0x40(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
movsd  0xc0(%rsp),%xmm4
je     14f8 <rq_pricing_average_rate_turnbullwakeman_greeks+0x3e8>
movsd  0x20(%rsp),%xmm3
addsd  0xe8(%rsp),%xmm3
movsd  %xmm4,(%rsp)
mov    %ebp,%edi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm2
movsd  0x28(%rsp),%xmm4
movsd  0x30(%rsp),%xmm5
movsd  0x48(%rsp),%xmm6
movsd  0x38(%rsp),%xmm7
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,0x50(%rsp)
movsd  0x20(%rsp),%xmm3
subsd  0xe8(%rsp),%xmm3
movsd  0xc0(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
movsd  0x10(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x28(%rsp),%xmm4
movsd  0x30(%rsp),%xmm5
movsd  0x48(%rsp),%xmm6
movsd  0x38(%rsp),%xmm7
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  0xc0(%rsp),%xmm4
movsd  0x40(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm11
movsd  0x30(%rsp),%xmm5
movsd  0x38(%rsp),%xmm10
movsd  0x50(%rsp),%xmm7
subsd  %xmm0,%xmm7
movsd  0x10(%rsp),%xmm0
movsd  0xe8(%rsp),%xmm6
addsd  %xmm6,%xmm6
divsd  %xmm6,%xmm7
movsd  %xmm7,(%r15)
test   %r14,%r14
movsd  0x48(%rsp),%xmm9
je     159d <rq_pricing_average_rate_turnbullwakeman_greeks+0x48d>
addsd  0xd8(%rsp),%xmm5
movsd  %xmm4,(%rsp)
mov    %ebp,%edi
movaps %xmm11,%xmm4
movaps %xmm9,%xmm6
movaps %xmm10,%xmm7
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  %xmm0,0x50(%rsp)
movsd  0x30(%rsp),%xmm5
subsd  0xd8(%rsp),%xmm5
movsd  0xc0(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
movsd  0x10(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
movsd  0x48(%rsp),%xmm6
movsd  0x38(%rsp),%xmm7
call   1030 <rq_pricing_average_rate_turnbullwakeman@plt>
movsd  0x50(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0xd8(%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
movsd  0x58(%rsp),%xmm0
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @rq_pricing_average_rate_turnbullwakeman_greeks(i16 signext %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double* %10, double %11, double* %12, double %13, double* %14, double %15, double* %16, double %17, double* %18, double %19) {
%21 = alloca i16
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double*
%32 = alloca double
%33 = alloca double*
%34 = alloca double
%35 = alloca double*
%36 = alloca double
%37 = alloca double*
%38 = alloca double
%39 = alloca double*
%40 = alloca double
%41 = alloca double
%42 = alloca double
%43 = alloca double
%44 = alloca double
%45 = alloca double
%46 = alloca double
%47 = alloca double
%48 = alloca double
%49 = alloca double
%50 = alloca double
store i16 %0, i16* %21
store double %1, double* %22
store double %2, double* %23
store double %3, double* %24
store double %4, double* %25
store double %5, double* %26
store double %6, double* %27
store double %7, double* %28
store double %8, double* %29
store double %9, double* %30
store double* %10, double** %31
store double %11, double* %32
store double* %12, double** %33
store double %13, double* %34
store double* %14, double** %35
store double %15, double* %36
store double* %16, double** %37
store double %17, double* %38
store double* %18, double** %39
store double %19, double* %40
store double 0.000000e+00, double* %41
store double 0.000000e+00, double* %42
store double 0.000000e+00, double* %43
store double 0.000000e+00, double* %44
store double 0.000000e+00, double* %45
store double 0.000000e+00, double* %46
store double 0.000000e+00, double* %47
store double 0.000000e+00, double* %48
store double 0.000000e+00, double* %49
store double 0.000000e+00, double* %50
%51 = load i16, i16* %21
%52 = load double, double* %22
%53 = load double, double* %23
%54 = load double, double* %24
%55 = load double, double* %25
%56 = load double, double* %26
%57 = load double, double* %27
%58 = load double, double* %28
%59 = load double, double* %29
%60 = load double, double* %30
%61 = call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %51, double %52, double %53, double %54, double %55, double %56, double %57, double %58, double %59, double %60)
store double %61, double* %50
%62 = load double*, double** %31
%63 = icmp ne double* %62, null
br i1 %63, label %64, label %149
64: ; preds = %20
%65 = load i16, i16* %21
%66 = load double, double* %22
%67 = load double, double* %32
%68 = fadd double %66, %67
%69 = load double, double* %23
%70 = load double, double* %24
%71 = load double, double* %25
%72 = load double, double* %26
%73 = load double, double* %27
%74 = load double, double* %28
%75 = load double, double* %29
%76 = load double, double* %30
%77 = call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %65, double %68, double %69, double %70, double %71, double %72, double %73, double %74, double %75, double %76)
store double %77, double* %41
%78 = load i16, i16* %21
%79 = load double, double* %22
%80 = load double, double* %32
%81 = fsub double %79, %80
%82 = load double, double* %23
%83 = load double, double* %24
%84 = load double, double* %25
%85 = load double, double* %26
%86 = load double, double* %27
%87 = load double, double* %28
%88 = load double, double* %29
%89 = load double, double* %30
%90 = call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %78, double %81, double %82, double %83, double %84, double %85, double %86, double %87, double %88, double %89)
store double %90, double* %42
%91 = load double, double* %41
%92 = load double, double* %42
%93 = fsub double %91, %92
%94 = load double, double* %32
%95 = fmul double 2.000000e+00, %94
%96 = fdiv double %93, %95
%97 = load double*, double** %31
store double %96, double* %97
%98 = load double*, double** %33
%99 = icmp ne double* %98, null
br i1 %99, label %100, label %148
100: ; preds = %64
%101 = load i16, i16* %21
%102 = load double, double* %22
%103 = load double, double* %34
%104 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %103, double %102)
%105 = load double, double* %23
%106 = load double, double* %24
%107 = load double, double* %25
%108 = load double, double* %26
%109 = load double, double* %27
%110 = load double, double* %28
%111 = load double, double* %29
%112 = load double, double* %30
%113 = call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %101, double %104, double %105, double %106, double %107, double %108, double %109, double %110, double %111, double %112)
store double %113, double* %43
%114 = load i16, i16* %21
%115 = load double, double* %22
%116 = load double, double* %34
%117 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %116, double %115)
%118 = load double, double* %23
%119 = load double, double* %24
%120 = load double, double* %25
%121 = load double, double* %26
%122 = load double, double* %27
%123 = load double, double* %28
%124 = load double, double* %29
%125 = load double, double* %30
%126 = call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %114, double %117, double %118, double %119, double %120, double %121, double %122, double %123, double %124, double %125)
store double %126, double* %44
%127 = load double, double* %43
%128 = load double, double* %41
%129 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %128, double %127)
%130 = load double, double* %50
%131 = fadd double %129, %130
store double %131, double* %43
%132 = load double, double* %44
%133 = load double, double* %42
%134 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %133, double %132)
%135 = load double, double* %50
%136 = fadd double %134, %135
store double %136, double* %44
%137 = load double, double* %43
%138 = call double @llvm.fabs.f64(double %137)
%139 = load double, double* %44
%140 = call double @llvm.fabs.f64(double %139)
%141 = fadd double %138, %140
%142 = load double, double* %34
%143 = fmul double 2.000000e+00, %142
%144 = load double, double* %34
%145 = fmul double %143, %144
%146 = fdiv double %141, %145
%147 = load double*, double** %33
store double %146, double* %147
br label %148
148: ; preds = %100, %64
br label %149
149: ; preds = %148, %20
%150 = load double*, double** %37
%151 = icmp ne double* %150, null
br i1 %151, label %152, label %172
152: ; preds = %149
%153 = load i16, i16* %21
%154 = load double, double* %22
%155 = load double, double* %23
%156 = load double, double* %24
%157 = load double, double* %25
%158 = load double, double* %26
%159 = load double, double* %27
%160 = load double, double* %28
%161 = load double, double* %38
%162 = fadd double %160, %161
%163 = load double, double* %29
%164 = load double, double* %30
%165 = call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %153, double %154, double %155, double %156, double %157, double %158, double %159, double %162, double %163, double %164)
store double %165, double* %47
%166 = load double, double* %50
%167 = load double, double* %47
%168 = fsub double %166, %167
%169 = load double, double* %50
%170 = fdiv double %168, %169
%171 = load double*, double** %37
store double %170, double* %171
br label %172
172: ; preds = %152, %149
%173 = load double*, double** %39
%174 = icmp ne double* %173, null
br i1 %174, label %175, label %209
175: ; preds = %172
%176 = load i16, i16* %21
%177 = load double, double* %22
%178 = load double, double* %23
%179 = load double, double* %24
%180 = load double, double* %25
%181 = load double, double* %40
%182 = fadd double %180, %181
%183 = load double, double* %26
%184 = load double, double* %27
%185 = load double, double* %28
%186 = load double, double* %29
%187 = load double, double* %30
%188 = call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %176, double %177, double %178, double %179, double %182, double %183, double %184, double %185, double %186, double %187)
store double %188, double* %48
%189 = load i16, i16* %21
%190 = load double, double* %22
%191 = load double, double* %23
%192 = load double, double* %24
%193 = load double, double* %25
%194 = load double, double* %40
%195 = fsub double %193, %194
%196 = load double, double* %26
%197 = load double, double* %27
%198 = load double, double* %28
%199 = load double, double* %29
%200 = load double, double* %30
%201 = call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %189, double %190, double %191, double %192, double %195, double %196, double %197, double %198, double %199, double %200)
store double %201, double* %49
%202 = load double, double* %48
%203 = load double, double* %49
%204 = fsub double %202, %203
%205 = load double, double* %40
%206 = fmul double 2.000000e+00, %205
%207 = fdiv double %204, %206
%208 = load double*, double** %39
store double %207, double* %208
br label %209
209: ; preds = %175, %172
%210 = load double*, double** %35
%211 = icmp ne double* %210, null
br i1 %211, label %212, label %246
212: ; preds = %209
%213 = load i16, i16* %21
%214 = load double, double* %22
%215 = load double, double* %23
%216 = load double, double* %24
%217 = load double, double* %25
%218 = load double, double* %26
%219 = load double, double* %27
%220 = load double, double* %36
%221 = fadd double %219, %220
%222 = load double, double* %28
%223 = load double, double* %29
%224 = load double, double* %30
%225 = call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %213, double %214, double %215, double %216, double %217, double %218, double %221, double %222, double %223, double %224)
store double %225, double* %45
%226 = load i16, i16* %21
%227 = load double, double* %22
%228 = load double, double* %23
%229 = load double, double* %24
%230 = load double, double* %25
%231 = load double, double* %26
%232 = load double, double* %27
%233 = load double, double* %36
%234 = fsub double %232, %233
%235 = load double, double* %28
%236 = load double, double* %29
%237 = load double, double* %30
%238 = call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %226, double %227, double %228, double %229, double %230, double %231, double %234, double %235, double %236, double %237)
store double %238, double* %46
%239 = load double, double* %45
%240 = load double, double* %46
%241 = fsub double %239, %240
%242 = load double, double* %36
%243 = fmul double 2.000000e+00, %242
%244 = fdiv double %241, %243
%245 = load double*, double** %35
store double %244, double* %245
br label %246
246: ; preds = %212, %209
%247 = load double, double* %50
ret double %247
}

LLVM IR (-O2):
define double @rq_pricing_average_rate_turnbullwakeman_greeks(i16 signext %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double* writeonly %10, double %11, double* writeonly %12, double %13, double* writeonly %14, double %15, double* writeonly %16, double %17, double* writeonly %18, double %19) {
%21 = tail call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9)
%22 = icmp eq double* %10, null
br i1 %22, label %47, label %23
23: ; preds = %20
%24 = fadd double %1, %11
%25 = tail call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %0, double %24, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9)
%26 = fsub double %1, %11
%27 = tail call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %0, double %26, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9)
%28 = fsub double %25, %27
%29 = fmul double %11, 2.000000e+00
%30 = fdiv double %28, %29
store double %30, double* %10
%31 = icmp eq double* %12, null
br i1 %31, label %47, label %32
32: ; preds = %23
%33 = tail call double @llvm.fmuladd.f64(double %13, double 2.000000e+00, double %1)
%34 = tail call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %0, double %33, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9)
%35 = tail call double @llvm.fmuladd.f64(double %13, double -2.000000e+00, double %1)
%36 = tail call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %0, double %35, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9)
%37 = tail call double @llvm.fmuladd.f64(double %25, double -2.000000e+00, double %34)
%38 = fadd double %21, %37
%39 = tail call double @llvm.fmuladd.f64(double %27, double -2.000000e+00, double %36)
%40 = fadd double %21, %39
%41 = tail call double @llvm.fabs.f64(double %38)
%42 = tail call double @llvm.fabs.f64(double %40)
%43 = fadd double %41, %42
%44 = fmul double %13, 2.000000e+00
%45 = fmul double %44, %13
%46 = fdiv double %43, %45
store double %46, double* %12
br label %47
47: ; preds = %23, %32, %20
%48 = icmp eq double* %16, null
br i1 %48, label %54, label %49
49: ; preds = %47
%50 = fadd double %7, %17
%51 = tail call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %0, double %1, double %2, double %3, double %4, double %5, double %6, double %50, double %8, double %9)
%52 = fsub double %21, %51
%53 = fdiv double %52, %21
store double %53, double* %16
br label %54
54: ; preds = %49, %47
%55 = icmp eq double* %18, null
br i1 %55, label %64, label %56
56: ; preds = %54
%57 = fadd double %4, %19
%58 = tail call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %0, double %1, double %2, double %3, double %57, double %5, double %6, double %7, double %8, double %9)
%59 = fsub double %4, %19
%60 = tail call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %0, double %1, double %2, double %3, double %59, double %5, double %6, double %7, double %8, double %9)
%61 = fsub double %58, %60
%62 = fmul double %19, 2.000000e+00
%63 = fdiv double %61, %62
store double %63, double* %18
br label %64
64: ; preds = %56, %54
%65 = icmp eq double* %14, null
br i1 %65, label %74, label %66
66: ; preds = %64
%67 = fadd double %6, %15
%68 = tail call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %0, double %1, double %2, double %3, double %4, double %5, double %67, double %7, double %8, double %9)
%69 = fsub double %6, %15
%70 = tail call double @rq_pricing_average_rate_turnbullwakeman(i16 signext %0, double %1, double %2, double %3, double %4, double %5, double %69, double %7, double %8, double %9)
%71 = fsub double %68, %70
%72 = fmul double %15, 2.000000e+00
%73 = fdiv double %71, %72
store double %73, double* %14
br label %74
74: ; preds = %66, %64
ret double %21
}