#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 sin(double);
double get_maxcosi(double e, double omega, double r1, double r2) {
  double v1, v2, v3;
  v1 = 1. + e * sin(omega);
  v2 = 1. - e * e;
  v3 = r1 + r2;
  return v3 * v1 / v2;
}


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

x86 assembly (clang, -O2):
<get_maxcosi>:
sub    $0x18,%rsp
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm0,(%rsp)
movapd %xmm1,%xmm0
call   1030 <sin@plt>
movsd  (%rsp),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xec1(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
movsd  0x8(%rsp),%xmm2
addsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm0
divsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @get_maxcosi(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%12 = load double, double* %5
%13 = load double, double* %6
%14 = call double @sin(double %13)
%15 = call double @llvm.fmuladd.f64(double %12, double %14, double 1.000000e+00)
store double %15, double* %9
%16 = load double, double* %5
%17 = load double, double* %5
%18 = fneg double %16
%19 = call double @llvm.fmuladd.f64(double %18, double %17, double 1.000000e+00)
store double %19, double* %10
%20 = load double, double* %7
%21 = load double, double* %8
%22 = fadd double %20, %21
store double %22, double* %11
%23 = load double, double* %11
%24 = load double, double* %9
%25 = fmul double %23, %24
%26 = load double, double* %10
%27 = fdiv double %25, %26
ret double %27
}

LLVM IR (-O2):
define double @get_maxcosi(double %0, double %1, double %2, double %3) {
%5 = tail call double @sin(double %1)
%6 = tail call double @llvm.fmuladd.f64(double %0, double %5, double 1.000000e+00)
%7 = fneg double %0
%8 = tail call double @llvm.fmuladd.f64(double %7, double %0, double 1.000000e+00)
%9 = fadd double %2, %3
%10 = fmul double %9, %6
%11 = fdiv double %10, %8
ret double %11
}