#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);
int pow(double, int);
double rq_pricing_cumul_norm_dist(double);
double sqrt(double);
double rq_pricing_blackscholes_french(short call, double S, double X, double T,
                                      double t1, double r, double b, double v) {
  double ret = 0.0;
  double d1 = (log(S / X) + b * T + pow(v, 2) / 2 * t1) / (v * sqrt(t1));
  double d2 = d1 - v * sqrt(t1);
  if (call)
    ret = S * exp((b - r) * T) * rq_pricing_cumul_norm_dist(d1) -
          X * exp(-r * T) * rq_pricing_cumul_norm_dist(d2);
  else
    ret = X * exp(-r * T) * rq_pricing_cumul_norm_dist(-d2) -
          S * exp((b - r) * T) * rq_pricing_cumul_norm_dist(-d1);
  return ret;
}


x86 assembly (clang, -O0):
<rq_pricing_blackscholes_french>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%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)
movsd  %xmm6,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
movsd  -0x80(%rbp),%xmm1
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  -0x78(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
cmpw   $0x0,-0x2(%rbp)
je     1356 <rq_pricing_blackscholes_french+0x206>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x30(%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  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x88(%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,-0x48(%rbp)
jmp    1465 <rq_pricing_blackscholes_french+0x315>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x30(%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  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%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  %xmm0,-0xb8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  -0xc0(%rbp),%xmm1
ff
movsd  -0xb8(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xb0(%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,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_pricing_blackscholes_french>:
push   %rbx
sub    $0x70,%rsp
movsd  %xmm6,0x30(%rsp)
movsd  %xmm5,0x8(%rsp)
movaps %xmm4,0x50(%rsp)
movsd  %xmm3,0x28(%rsp)
movsd  %xmm2,(%rsp)
mov    %edi,%ebx
movsd  %xmm0,0x48(%rsp)
movsd  %xmm1,0x40(%rsp)
divsd  %xmm1,%xmm0
call   1050 <log@plt>
movsd  0x8(%rsp),%xmm1
mulsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x30(%rsp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
movsd  0x28(%rsp),%xmm3
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
mulsd  %xmm3,%xmm1
addsd  0x10(%rsp),%xmm1
xorps  %xmm4,%xmm4
sqrtsd %xmm3,%xmm4
xorpd  %xmm5,%xmm5
ucomisd %xmm5,%xmm3
movapd %xmm4,%xmm0
jae    120d <rq_pricing_blackscholes_french+0xbd>
movapd %xmm3,%xmm0
movapd %xmm1,0x10(%rsp)
movsd  %xmm4,0x68(%rsp)
call   1070 <sqrt@plt>
xorpd  %xmm5,%xmm5
movsd  0x68(%rsp),%xmm4
movsd  0x28(%rsp),%xmm3
movapd 0x10(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
mulsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
ucomisd %xmm5,%xmm3
movapd %xmm1,0x10(%rsp)
jae    1240 <rq_pricing_blackscholes_french+0xf0>
movapd %xmm3,%xmm0
call   1070 <sqrt@plt>
movsd  0x30(%rsp),%xmm2
movapd 0x10(%rsp),%xmm1
movapd %xmm0,%xmm4
mulsd  %xmm4,%xmm2
subsd  %xmm2,%xmm1
movapd %xmm1,0x30(%rsp)
test   %bx,%bx
je     12cd <rq_pricing_blackscholes_french+0x17d>
movsd  0x8(%rsp),%xmm0
subsd  0x50(%rsp),%xmm0
mulsd  (%rsp),%xmm0
call   1040 <exp@plt>
mulsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  %xmm0,0x10(%rsp)
movapd 0x50(%rsp),%xmm0
xorpd  0xd6d(%rip),%xmm0
mulsd  (%rsp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,(%rsp)
movapd 0x30(%rsp),%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  (%rsp),%xmm1
mulsd  0x40(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
jmp    1351 <rq_pricing_blackscholes_french+0x201>
movapd 0x50(%rsp),%xmm0
xorpd  0xd25(%rip),%xmm0
mulsd  (%rsp),%xmm0
call   1040 <exp@plt>
mulsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
movaps 0x30(%rsp),%xmm0
xorps  0xd03(%rip),%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  0x50(%rsp),%xmm0
mulsd  (%rsp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
xorpd  0xccf(%rip),%xmm0
call   1030 <rq_pricing_cumul_norm_dist@plt>
movsd  (%rsp),%xmm1
mulsd  0x48(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x30(%rsp),%xmm0
mulsd  0x28(%rsp),%xmm0
subsd  %xmm1,%xmm0
add    $0x70,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define double @rq_pricing_blackscholes_french(i16 signext %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = fdiv double %1, %2
%10 = tail call double @log(double %9)
%11 = tail call double @llvm.fmuladd.f64(double %6, double %3, double %10)
%12 = tail call i32 @pow(double %7, i32 2)
%13 = sdiv i32 %12, 2
%14 = sitofp i32 %13 to double
%15 = tail call double @llvm.fmuladd.f64(double %14, double %4, double %11)
%16 = tail call double @sqrt(double %4)
%17 = fmul double %16, %7
%18 = fdiv double %15, %17
%19 = tail call double @sqrt(double %4)
%20 = fneg double %7
%21 = tail call double @llvm.fmuladd.f64(double %20, double %19, double %18)
%22 = icmp eq i16 %0, 0
br i1 %22, label %37, label %23
23: ; preds = %8
%24 = fsub double %6, %5
%25 = fmul double %24, %3
%26 = tail call double @exp(double %25)
%27 = fmul double %26, %1
%28 = tail call double @rq_pricing_cumul_norm_dist(double %18)
%29 = fneg double %5
%30 = fmul double %29, %3
%31 = tail call double @exp(double %30)
%32 = tail call double @rq_pricing_cumul_norm_dist(double %21)
%33 = fneg double %31
%34 = fmul double %33, %2
%35 = fmul double %34, %32
%36 = tail call double @llvm.fmuladd.f64(double %27, double %28, double %35)
br label %53
37: ; preds = %8
%38 = fneg double %5
%39 = fmul double %38, %3
%40 = tail call double @exp(double %39)
%41 = fmul double %40, %2
%42 = fneg double %21
%43 = tail call double @rq_pricing_cumul_norm_dist(double %42)
%44 = fsub double %6, %5
%45 = fmul double %44, %3
%46 = tail call double @exp(double %45)
%47 = fneg double %18
%48 = tail call double @rq_pricing_cumul_norm_dist(double %47)
%49 = fneg double %46
%50 = fmul double %49, %1
%51 = fmul double %50, %48
%52 = tail call double @llvm.fmuladd.f64(double %41, double %43, double %51)
br label %53
53: ; preds = %37, %23
%54 = phi double [ %36, %23 ], [ %52, %37 ]
ret double %54
}