double AmericanExchangeOption(int fCall, double S1, double S2, double Q1,
                              double Q2, double T, double r, double b1,
                              double b2, double v1, double v2, double Rho) {
  const double v = sqrt(((v1) * (v1)) + ((v2) * (v2)) - 2.0 * Rho * v1 * v2);
  const double result =
      BSAmericanApprox(fCall, Q1 * S1, Q2 * S2, T, r - b2, b1 - b2, v);
  assert(((result) == (result)));
  return result;
}


x86 assembly (clang, -O0):
<AmericanExchangeOption>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  0x20(%rbp),%xmm8
movsd  0x18(%rbp),%xmm8
movsd  0x10(%rbp),%xmm8
mov    %edi,-0x4(%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)
movsd  0x10(%rbp),%xmm1
movsd  0x10(%rbp),%xmm2
movsd  0x18(%rbp),%xmm0
mulsd  0x18(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe67(%rip),%xmm0
mulsd  0x20(%rbp),%xmm0
mulsd  0x10(%rbp),%xmm0
movsd  0x18(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
subsd  -0x48(%rbp),%xmm3
movsd  -0x40(%rbp),%xmm4
subsd  -0x48(%rbp),%xmm4
movsd  -0x50(%rbp),%xmm5
mov    $0x6,%al
call   1040 <BSAmericanApprox@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
ucomisd -0x58(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
movsd  -0x58(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AmericanExchangeOption>:
push   %rbx
sub    $0x40,%rsp
movapd %xmm6,%xmm8
movapd %xmm5,%xmm10
movaps %xmm4,%xmm9
movapd %xmm2,%xmm11
movapd %xmm1,%xmm6
movapd %xmm0,%xmm4
mov    %edi,%ebx
movsd  0x60(%rsp),%xmm0
movsd  0x50(%rsp),%xmm1
movsd  0x58(%rsp),%xmm2
mulsd  0xe94(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1197 <AmericanExchangeOption+0x67>
xorps  %xmm5,%xmm5
sqrtsd %xmm0,%xmm5
jmp    1206 <AmericanExchangeOption+0xd6>
movsd  %xmm8,(%rsp)
movsd  %xmm10,0x38(%rsp)
movsd  %xmm9,0x30(%rsp)
movsd  %xmm7,0x28(%rsp)
movsd  %xmm6,0x20(%rsp)
movsd  %xmm4,0x18(%rsp)
movsd  %xmm3,0x10(%rsp)
movsd  %xmm11,0x8(%rsp)
call   1050 <sqrt@plt>
movsd  0x8(%rsp),%xmm11
movsd  0x10(%rsp),%xmm3
movsd  0x18(%rsp),%xmm4
movsd  0x20(%rsp),%xmm6
movsd  0x28(%rsp),%xmm7
movsd  0x30(%rsp),%xmm9
movsd  0x38(%rsp),%xmm10
movsd  (%rsp),%xmm8
movapd %xmm0,%xmm5
mulsd  %xmm11,%xmm4
mulsd  %xmm3,%xmm6
subsd  %xmm7,%xmm10
subsd  %xmm7,%xmm8
mov    %ebx,%edi
movapd %xmm4,%xmm0
movapd %xmm6,%xmm1
movaps %xmm9,%xmm2
movapd %xmm10,%xmm3
movapd %xmm8,%xmm4
mov    $0x6,%al
call   1040 <BSAmericanApprox@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <assert@plt>
movsd  (%rsp),%xmm0
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @AmericanExchangeOption(i32 %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11) {
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
store i32 %0, i32* %13
store double %1, double* %14
store double %2, double* %15
store double %3, double* %16
store double %4, double* %17
store double %5, double* %18
store double %6, double* %19
store double %7, double* %20
store double %8, double* %21
store double %9, double* %22
store double %10, double* %23
store double %11, double* %24
%27 = load double, double* %22
%28 = load double, double* %22
%29 = load double, double* %23
%30 = load double, double* %23
%31 = fmul double %29, %30
%32 = call double @llvm.fmuladd.f64(double %27, double %28, double %31)
%33 = load double, double* %24
%34 = fmul double 2.000000e+00, %33
%35 = load double, double* %22
%36 = fmul double %34, %35
%37 = load double, double* %23
%38 = fneg double %36
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double %32)
%40 = call double @sqrt(double %39)
store double %40, double* %25
%41 = load i32, i32* %13
%42 = load double, double* %16
%43 = load double, double* %14
%44 = fmul double %42, %43
%45 = load double, double* %17
%46 = load double, double* %15
%47 = fmul double %45, %46
%48 = load double, double* %18
%49 = load double, double* %19
%50 = load double, double* %21
%51 = fsub double %49, %50
%52 = load double, double* %20
%53 = load double, double* %21
%54 = fsub double %52, %53
%55 = load double, double* %25
%56 = call i32 (i32, double, double, double, double, double, double, ...) bitcast (i32 (...)* @BSAmericanApprox to i32 (i32, double, double, double, double, double, double, ...)*)(i32 %41, double %44, double %47, double %48, double %51, double %54, double %55)
%57 = sitofp i32 %56 to double
store double %57, double* %26
%58 = load double, double* %26
%59 = load double, double* %26
%60 = fcmp oeq double %58, %59
%61 = zext i1 %60 to i32
%62 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %61)
%63 = load double, double* %26
ret double %63
}

LLVM IR (-O2):
define double @AmericanExchangeOption(i32 %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11) {
%13 = fmul double %10, %10
%14 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %13)
%15 = fmul double %11, -2.000000e+00
%16 = fmul double %15, %9
%17 = tail call double @llvm.fmuladd.f64(double %16, double %10, double %14)
%18 = tail call double @sqrt(double %17)
%19 = fmul double %1, %3
%20 = fmul double %2, %4
%21 = fsub double %6, %8
%22 = fsub double %7, %8
%23 = tail call i32 (i32, double, double, double, double, double, double, ...) bitcast (i32 (...)* @BSAmericanApprox to i32 (i32, double, double, double, double, double, double, ...)*)(i32 %0, double %19, double %20, double %5, double %21, double %22, double %18)
%24 = sitofp i32 %23 to double
%25 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
ret double %24
}