#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 rq_pricing_barone_adesi_whaley_amer_call(double, double, double, double,
                                                double, double);
double rq_pricing_barone_adesi_whaley_amer_put(double, double, double, double,
                                               double, double);
double rq_pricing_barone_adesi_whaley(short call, double S, double X, double r,
                                      double rf, double v, double T) {
  double ret = 0.0;
  double b = r - rf;
  if (call)
    ret = rq_pricing_barone_adesi_whaley_amer_call(S, X, T, r, b, v);
  else
    ret = rq_pricing_barone_adesi_whaley_amer_put(S, X, T, r, b, v);
  return ret;
}


x86 assembly (clang, -O0):
<rq_pricing_barone_adesi_whaley>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %di,%ax
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)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
cmpw   $0x0,-0x2(%rbp)
je     119c <rq_pricing_barone_adesi_whaley+0x7c>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm4
movsd  -0x30(%rbp),%xmm5
call   1030 <rq_pricing_barone_adesi_whaley_amer_call@plt>
movsd  %xmm0,-0x40(%rbp)
jmp    11c4 <rq_pricing_barone_adesi_whaley+0xa4>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm4
movsd  -0x30(%rbp),%xmm5
call   1040 <rq_pricing_barone_adesi_whaley_amer_put@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_pricing_barone_adesi_whaley>:
movaps %xmm5,%xmm6
movaps %xmm4,%xmm5
movapd %xmm2,%xmm7
movapd %xmm2,%xmm4
subsd  %xmm3,%xmm4
movaps %xmm6,%xmm2
movapd %xmm7,%xmm3
test   %di,%di
je     1143 <rq_pricing_barone_adesi_whaley+0x23>
jmp    1030 <rq_pricing_barone_adesi_whaley_amer_call@plt>
jmp    1040 <rq_pricing_barone_adesi_whaley_amer_put@plt>

LLVM IR (-O0):
define double @rq_pricing_barone_adesi_whaley(i16 signext %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = alloca i16
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store i16 %0, i16* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
store double %6, double* %14
store double 0.000000e+00, double* %15
%17 = load double, double* %11
%18 = load double, double* %12
%19 = fsub double %17, %18
store double %19, double* %16
%20 = load i16, i16* %8
%21 = icmp ne i16 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %7
%23 = load double, double* %9
%24 = load double, double* %10
%25 = load double, double* %14
%26 = load double, double* %11
%27 = load double, double* %16
%28 = load double, double* %13
%29 = call double @rq_pricing_barone_adesi_whaley_amer_call(double %23, double %24, double %25, double %26, double %27, double %28)
store double %29, double* %15
br label %38
30: ; preds = %7
%31 = load double, double* %9
%32 = load double, double* %10
%33 = load double, double* %14
%34 = load double, double* %11
%35 = load double, double* %16
%36 = load double, double* %13
%37 = call double @rq_pricing_barone_adesi_whaley_amer_put(double %31, double %32, double %33, double %34, double %35, double %36)
store double %37, double* %15
br label %38
38: ; preds = %30, %22
%39 = load double, double* %15
ret double %39
}

LLVM IR (-O2):
define double @rq_pricing_barone_adesi_whaley(i16 signext %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = fsub double %3, %4
%9 = icmp eq i16 %0, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call double @rq_pricing_barone_adesi_whaley_amer_call(double %1, double %2, double %6, double %3, double %8, double %5)
br label %14
12: ; preds = %7
%13 = tail call double @rq_pricing_barone_adesi_whaley_amer_put(double %1, double %2, double %6, double %3, double %8, double %5)
br label %14
14: ; preds = %12, %10
%15 = phi double [ %11, %10 ], [ %13, %12 ]
ret double %15
}