#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 rq_pricing_fra_advance(double r_x, double r_s, double tau_s, double r_d,
                              double tau_d) {
  double fwd_df = exp(r_s * tau_s) / exp(r_d * tau_d);
  double strike_df = exp(-r_x * (tau_d - tau_s));
  double value = fwd_df - strike_df;
  return value * exp(-r_s * tau_s);
}


x86 assembly (clang, -O0):
<rq_pricing_fra_advance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_pricing_fra_advance>:
sub    $0x48,%rsp
movsd  %xmm4,0x8(%rsp)
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x10(%rsp)
movapd %xmm1,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1030 <exp@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movapd 0x20(%rsp),%xmm1
xorpd  0xe90(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movapd 0x30(%rsp),%xmm0
xorpd  0xe5f(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  (%rsp),%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @rq_pricing_fra_advance(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%14 = load double, double* %7
%15 = load double, double* %8
%16 = fmul double %14, %15
%17 = call double @exp(double %16)
%18 = load double, double* %9
%19 = load double, double* %10
%20 = fmul double %18, %19
%21 = call double @exp(double %20)
%22 = fdiv double %17, %21
store double %22, double* %11
%23 = load double, double* %6
%24 = fneg double %23
%25 = load double, double* %10
%26 = load double, double* %8
%27 = fsub double %25, %26
%28 = fmul double %24, %27
%29 = call double @exp(double %28)
store double %29, double* %12
%30 = load double, double* %11
%31 = load double, double* %12
%32 = fsub double %30, %31
store double %32, double* %13
%33 = load double, double* %13
%34 = load double, double* %7
%35 = fneg double %34
%36 = load double, double* %8
%37 = fmul double %35, %36
%38 = call double @exp(double %37)
%39 = fmul double %33, %38
ret double %39
}

LLVM IR (-O2):
define double @rq_pricing_fra_advance(double %0, double %1, double %2, double %3, double %4) {
%6 = fmul double %1, %2
%7 = tail call double @exp(double %6)
%8 = fmul double %3, %4
%9 = tail call double @exp(double %8)
%10 = fdiv double %7, %9
%11 = fneg double %0
%12 = fsub double %4, %2
%13 = fmul double %12, %11
%14 = tail call double @exp(double %13)
%15 = fsub double %10, %14
%16 = fneg double %1
%17 = fmul double %16, %2
%18 = tail call double @exp(double %17)
%19 = fmul double %15, %18
ret double %19
}