#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 exp(double);
double log(double);
double rq_pricing_cumul_norm_dist(double);
double sqrt(double);
double rq_pricing_chooser_simple(double S, double X, double t1, double t2,
                                 double r, double b, double v) {
  double log_S_over_X = log(S / X);
  double v_sqr = v * v;
  double d = (log_S_over_X + (b + v_sqr / 2.0) * t2) / (v * sqrt(t2));
  double y = (log_S_over_X + b * t2 + v_sqr * t1 / 2.0) / (v * sqrt(t1));
  return S * exp((b - r) * t2) * rq_pricing_cumul_norm_dist(d) -
         X * exp(-r * t2) * rq_pricing_cumul_norm_dist(d - v * sqrt(t2)) -
         S * exp((b - r) * t2) * rq_pricing_cumul_norm_dist(-y) +
         X * exp(-r * t2) * rq_pricing_cumul_norm_dist(-y + v * sqrt(t1));
}


x86 assembly (clang, -O0):
<rq_pricing_chooser_simple>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  0xe58(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  -0xf0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xe8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x48(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  0xddb(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  -0xe0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  -0xc0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xb8(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movsd  -0xa8(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  -0x90(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  -0x78(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_pricing_chooser_simple>:
sub    $0x88,%rsp
movsd  %xmm6,0x20(%rsp)
movsd  %xmm5,0x10(%rsp)
movaps %xmm4,0x60(%rsp)
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x58(%rsp)
movsd  %xmm0,0x48(%rsp)
movsd  %xmm1,0x50(%rsp)
divsd  %xmm1,%xmm0
call   1050 <log@plt>
movsd  0x18(%rsp),%xmm3
movapd %xmm0,%xmm4
movsd  0x20(%rsp),%xmm1
mulsd  %xmm1,%xmm1
movsd  0xe6b(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm4,%xmm0
movsd  %xmm0,0x28(%rsp)
xorpd  %xmm5,%xmm5
ucomisd %xmm5,%xmm3
jb     11c0 <rq_pricing_chooser_simple+0x80>
xorps  %xmm0,%xmm0
sqrtsd %xmm3,%xmm0
jmp    11eb <rq_pricing_chooser_simple+0xab>
movapd %xmm3,%xmm0
movapd %xmm1,0x30(%rsp)
movsd  %xmm4,0x8(%rsp)
call   1060 <sqrt@plt>
xorpd  %xmm5,%xmm5
movsd  0x8(%rsp),%xmm4
movsd  0x18(%rsp),%xmm3
movapd 0x30(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,0x28(%rsp)
movsd  0x10(%rsp),%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm4,%xmm2
movsd  0x58(%rsp),%xmm0
mulsd  %xmm0,%xmm1
mulsd  0xddf(%rip),%xmm1
ucomisd %xmm5,%xmm0
jb     122d <rq_pricing_chooser_simple+0xed>
sqrtsd %xmm0,%xmm0
jmp    1250 <rq_pricing_chooser_simple+0x110>
movapd %xmm1,0x30(%rsp)
movsd  %xmm2,0x8(%rsp)
call   1060 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movapd 0x30(%rsp),%xmm1
addsd  %xmm2,%xmm1
movapd %xmm1,0x30(%rsp)
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x80(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x60(%rsp),%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x10(%rsp)
call   1040 <exp@plt>
mulsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x28(%rsp),%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  %xmm0,0x78(%rsp)
movapd 0x60(%rsp),%xmm0
xorpd  0xd61(%rip),%xmm0
mulsd  0x18(%rsp),%xmm0
movapd %xmm0,0x60(%rsp)
call   1040 <exp@plt>
movsd  0x18(%rsp),%xmm1
movsd  %xmm0,0x70(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     12df <rq_pricing_chooser_simple+0x19f>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    12e8 <rq_pricing_chooser_simple+0x1a8>
movapd %xmm1,%xmm0
call   1060 <sqrt@plt>
mulsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  0x70(%rsp),%xmm1
mulsd  0x50(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  0x78(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movapd 0x30(%rsp),%xmm0
xorpd  0xcca(%rip),%xmm0
divsd  0x80(%rsp),%xmm0
movapd %xmm0,0x30(%rsp)
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  0x10(%rsp),%xmm1
mulsd  0x48(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x60(%rsp),%xmm0
call   1040 <exp@plt>
mulsd  0x50(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x58(%rsp),%xmm0
ucomisd 0xc69(%rip),%xmm0
jb     13a7 <rq_pricing_chooser_simple+0x267>
sqrtsd %xmm0,%xmm0
jmp    13ac <rq_pricing_chooser_simple+0x26c>
call   1060 <sqrt@plt>
movsd  0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x30(%rsp),%xmm1
movapd %xmm1,%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x88,%rsp
ret

LLVM IR (-O0):
define double @rq_pricing_chooser_simple(double %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store double %0, double* %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
%19 = load double, double* %8
%20 = load double, double* %9
%21 = fdiv double %19, %20
%22 = call double @log(double %21)
store double %22, double* %15
%23 = load double, double* %14
%24 = load double, double* %14
%25 = fmul double %23, %24
store double %25, double* %16
%26 = load double, double* %15
%27 = load double, double* %13
%28 = load double, double* %16
%29 = fdiv double %28, 2.000000e+00
%30 = fadd double %27, %29
%31 = load double, double* %11
%32 = call double @llvm.fmuladd.f64(double %30, double %31, double %26)
%33 = load double, double* %14
%34 = load double, double* %11
%35 = call double @sqrt(double %34)
%36 = fmul double %33, %35
%37 = fdiv double %32, %36
store double %37, double* %17
%38 = load double, double* %15
%39 = load double, double* %13
%40 = load double, double* %11
%41 = call double @llvm.fmuladd.f64(double %39, double %40, double %38)
%42 = load double, double* %16
%43 = load double, double* %10
%44 = fmul double %42, %43
%45 = fdiv double %44, 2.000000e+00
%46 = fadd double %41, %45
%47 = load double, double* %14
%48 = load double, double* %10
%49 = call double @sqrt(double %48)
%50 = fmul double %47, %49
%51 = fdiv double %46, %50
store double %51, double* %18
%52 = load double, double* %8
%53 = load double, double* %13
%54 = load double, double* %12
%55 = fsub double %53, %54
%56 = load double, double* %11
%57 = fmul double %55, %56
%58 = call double @exp(double %57)
%59 = fmul double %52, %58
%60 = load double, double* %17
%61 = call double @rq_pricing_cumul_norm_dist(double %60)
%62 = load double, double* %9
%63 = load double, double* %12
%64 = fneg double %63
%65 = load double, double* %11
%66 = fmul double %64, %65
%67 = call double @exp(double %66)
%68 = fmul double %62, %67
%69 = load double, double* %17
%70 = load double, double* %14
%71 = load double, double* %11
%72 = call double @sqrt(double %71)
%73 = fneg double %70
%74 = call double @llvm.fmuladd.f64(double %73, double %72, double %69)
%75 = call double @rq_pricing_cumul_norm_dist(double %74)
%76 = fmul double %68, %75
%77 = fneg double %76
%78 = call double @llvm.fmuladd.f64(double %59, double %61, double %77)
%79 = load double, double* %8
%80 = load double, double* %13
%81 = load double, double* %12
%82 = fsub double %80, %81
%83 = load double, double* %11
%84 = fmul double %82, %83
%85 = call double @exp(double %84)
%86 = fmul double %79, %85
%87 = load double, double* %18
%88 = fneg double %87
%89 = call double @rq_pricing_cumul_norm_dist(double %88)
%90 = fneg double %86
%91 = call double @llvm.fmuladd.f64(double %90, double %89, double %78)
%92 = load double, double* %9
%93 = load double, double* %12
%94 = fneg double %93
%95 = load double, double* %11
%96 = fmul double %94, %95
%97 = call double @exp(double %96)
%98 = fmul double %92, %97
%99 = load double, double* %18
%100 = fneg double %99
%101 = load double, double* %14
%102 = load double, double* %10
%103 = call double @sqrt(double %102)
%104 = call double @llvm.fmuladd.f64(double %101, double %103, double %100)
%105 = call double @rq_pricing_cumul_norm_dist(double %104)
%106 = call double @llvm.fmuladd.f64(double %98, double %105, double %91)
ret double %106
}

LLVM IR (-O2):
define double @rq_pricing_chooser_simple(double %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = fdiv double %0, %1
%9 = tail call double @log(double %8)
%10 = fmul double %6, %6
%11 = fmul double %10, 5.000000e-01
%12 = fadd double %11, %5
%13 = tail call double @llvm.fmuladd.f64(double %12, double %3, double %9)
%14 = tail call double @sqrt(double %3)
%15 = fmul double %14, %6
%16 = fdiv double %13, %15
%17 = tail call double @llvm.fmuladd.f64(double %5, double %3, double %9)
%18 = fmul double %10, %2
%19 = fmul double %18, 5.000000e-01
%20 = fadd double %19, %17
%21 = tail call double @sqrt(double %2)
%22 = fmul double %21, %6
%23 = fsub double %5, %4
%24 = fmul double %23, %3
%25 = tail call double @exp(double %24)
%26 = fmul double %25, %0
%27 = tail call double @rq_pricing_cumul_norm_dist(double %16)
%28 = fneg double %4
%29 = fmul double %28, %3
%30 = tail call double @exp(double %29)
%31 = tail call double @sqrt(double %3)
%32 = fneg double %6
%33 = tail call double @llvm.fmuladd.f64(double %32, double %31, double %16)
%34 = tail call double @rq_pricing_cumul_norm_dist(double %33)
%35 = fneg double %30
%36 = fmul double %35, %1
%37 = fmul double %36, %34
%38 = tail call double @llvm.fmuladd.f64(double %26, double %27, double %37)
%39 = tail call double @exp(double %24)
%40 = fneg double %20
%41 = fdiv double %40, %22
%42 = tail call double @rq_pricing_cumul_norm_dist(double %41)
%43 = fneg double %39
%44 = fmul double %43, %0
%45 = tail call double @llvm.fmuladd.f64(double %44, double %42, double %38)
%46 = tail call double @exp(double %29)
%47 = fmul double %46, %1
%48 = tail call double @sqrt(double %2)
%49 = tail call double @llvm.fmuladd.f64(double %6, double %48, double %41)
%50 = tail call double @rq_pricing_cumul_norm_dist(double %49)
%51 = tail call double @llvm.fmuladd.f64(double %47, double %50, double %45)
ret double %51
}