#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 */
float mix(float, float, float);
float sqrt(float);
float get_eta(float f0, float f90) {
  float eta_min = (1.0 - f0) / (1.0 + f0);
  float sqrt_f0 = sqrt(f0);
  float eta_max = (1.0 + sqrt_f0) / (1.0 - sqrt_f0);
  return mix(eta_max, eta_min, f90);
}


x86 assembly (clang, -O0):
<get_eta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebd(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xea8(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <sqrt@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe77(%rip),%xmm0
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe62(%rip),%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
call   1030 <mix@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_eta>:
push   %rax
cvtss2sd %xmm0,%xmm2
movsd  0xed3(%rip),%xmm4
movapd %xmm4,%xmm3
subsd  %xmm2,%xmm3
addsd  %xmm4,%xmm2
divsd  %xmm2,%xmm3
cvtsd2ss %xmm3,%xmm3
movaps %xmm1,%xmm2
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1152 <get_eta+0x32>
sqrtss %xmm0,%xmm0
jmp    1175 <get_eta+0x55>
movss  %xmm2,0x4(%rsp)
movss  %xmm3,(%rsp)
call   1040 <sqrt@plt>
movss  (%rsp),%xmm3
movss  0x4(%rsp),%xmm2
movsd  0xe8b(%rip),%xmm4
cvtss2sd %xmm0,%xmm0
movaps %xmm0,%xmm1
addsd  %xmm4,%xmm1
subsd  %xmm0,%xmm4
divsd  %xmm4,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movaps %xmm3,%xmm1
pop    %rax
jmp    1030 <mix@plt>

LLVM IR (-O0):
define float @get_eta(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %3
store float %1, float* %4
%8 = load float, float* %3
%9 = fpext float %8 to double
%10 = fsub double 1.000000e+00, %9
%11 = load float, float* %3
%12 = fpext float %11 to double
%13 = fadd double 1.000000e+00, %12
%14 = fdiv double %10, %13
%15 = fptrunc double %14 to float
store float %15, float* %5
%16 = load float, float* %3
%17 = call float @sqrt(float %16)
store float %17, float* %6
%18 = load float, float* %6
%19 = fpext float %18 to double
%20 = fadd double 1.000000e+00, %19
%21 = load float, float* %6
%22 = fpext float %21 to double
%23 = fsub double 1.000000e+00, %22
%24 = fdiv double %20, %23
%25 = fptrunc double %24 to float
store float %25, float* %7
%26 = load float, float* %7
%27 = load float, float* %5
%28 = load float, float* %4
%29 = call float @mix(float %26, float %27, float %28)
ret float %29
}

LLVM IR (-O2):
define float @get_eta(float %0, float %1) {
%3 = fpext float %0 to double
%4 = fsub double 1.000000e+00, %3
%5 = fadd double %3, 1.000000e+00
%6 = fdiv double %4, %5
%7 = fptrunc double %6 to float
%8 = tail call float @sqrt(float %0)
%9 = fpext float %8 to double
%10 = fadd double %9, 1.000000e+00
%11 = fsub double 1.000000e+00, %9
%12 = fdiv double %10, %11
%13 = fptrunc double %12 to float
%14 = tail call float @mix(float %13, float %7, float %1)
ret float %14
}