#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_bjerksund_stensland_approx(double, double, double, double,
                                             double, double);
double rq_pricing_bjerksund_stensland(int call, double S, double X, double r,
                                      double rf, double v, double T) {
  double b = r - rf;
  if (call)
    return rq_pricing_bjerksund_stensland_approx(S, X, T, r, b, v);
  else
    return rq_pricing_bjerksund_stensland_approx(X, S, T, r - b, -b, v);
}


x86 assembly (clang, -O0):
<rq_pricing_bjerksund_stensland>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
movsd  %xmm5,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     117f <rq_pricing_bjerksund_stensland+0x6f>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
call   1030 <rq_pricing_bjerksund_stensland_approx@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11c3 <rq_pricing_bjerksund_stensland+0xb3>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
subsd  -0x48(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm4
movq   %xmm4,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm4
movsd  -0x38(%rbp),%xmm5
call   1030 <rq_pricing_bjerksund_stensland_approx@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_pricing_bjerksund_stensland>:
movaps %xmm5,%xmm6
movaps %xmm4,%xmm5
movapd %xmm2,%xmm7
movaps %xmm0,%xmm2
movapd %xmm7,%xmm4
subsd  %xmm3,%xmm4
test   %edi,%edi
je     112e <rq_pricing_bjerksund_stensland+0x1e>
movaps %xmm2,%xmm0
jmp    1140 <rq_pricing_bjerksund_stensland+0x30>
subsd  %xmm4,%xmm7
xorpd  0xec6(%rip),%xmm4
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
movaps %xmm6,%xmm2
movapd %xmm7,%xmm3
jmp    1030 <rq_pricing_bjerksund_stensland_approx@plt>

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

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