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


x86 assembly (clang, -O0):
<rq_pricing_fra_arrears>:
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  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%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  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x28(%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_arrears>:
sub    $0x48,%rsp
movsd  %xmm4,0x18(%rsp)
movapd %xmm3,0x30(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x28(%rsp)
movapd %xmm3,%xmm0
mulsd  %xmm4,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
mulsd  0x28(%rsp),%xmm0
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd 0x30(%rsp),%xmm0
xorpd  0xe65(%rip),%xmm0
mulsd  0x18(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @rq_pricing_fra_arrears(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* %9
%15 = load double, double* %10
%16 = fmul double %14, %15
%17 = call double @exp(double %16)
%18 = load double, double* %7
%19 = load double, double* %8
%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 = load double, double* %10
%25 = load double, double* %8
%26 = fsub double %24, %25
%27 = fmul double %23, %26
%28 = call double @exp(double %27)
store double %28, double* %12
%29 = load double, double* %11
%30 = load double, double* %12
%31 = fsub double %29, %30
store double %31, double* %13
%32 = load double, double* %13
%33 = load double, double* %9
%34 = fneg double %33
%35 = load double, double* %10
%36 = fmul double %34, %35
%37 = call double @exp(double %36)
%38 = fmul double %32, %37
ret double %38
}

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