#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 sqrt(float);
float F0ToRefractiveIndex(float F0) {
  float sqrx = sqrt(F0);
  return (-F0 - 1.f) / (F0 - 1.f) - 2.f * sqrx / (-1.f + sqrx) / (1.f + sqrx);
}


x86 assembly (clang, -O0):
<F0ToRefractiveIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xeba(%rip),%xmm1
subss  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xea9(%rip),%xmm2
subss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  0xea1(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
movss  0xe90(%rip),%xmm2
addss  -0x8(%rbp),%xmm2
divss  %xmm2,%xmm1
movss  0xe7b(%rip),%xmm2
addss  -0x8(%rbp),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<F0ToRefractiveIndex>:
sub    $0x18,%rsp
movaps %xmm0,%xmm3
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm3
jb     1128 <F0ToRefractiveIndex+0x18>
xorps  %xmm0,%xmm0
sqrtss %xmm3,%xmm0
jmp    1138 <F0ToRefractiveIndex+0x28>
movaps %xmm3,%xmm0
movaps %xmm3,(%rsp)
call   1030 <sqrt@plt>
movaps (%rsp),%xmm3
movss  0xec0(%rip),%xmm2
subss  %xmm3,%xmm2
unpcklps %xmm0,%xmm3
movaps %xmm3,%xmm1
addps  %xmm3,%xmm1
shufps $0x1,%xmm2,%xmm1
shufps $0xe2,%xmm2,%xmm1
addps  0xeb4(%rip),%xmm3
addss  0xea0(%rip),%xmm0
divps  %xmm3,%xmm1
movaps %xmm1,%xmm2
shufps $0x55,%xmm1,%xmm2
divss  %xmm0,%xmm2
subss  %xmm2,%xmm1
movaps %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @F0ToRefractiveIndex(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = call float @sqrt(float %4)
store float %5, float* %3
%6 = load float, float* %2
%7 = fneg float %6
%8 = fsub float %7, 1.000000e+00
%9 = load float, float* %2
%10 = fsub float %9, 1.000000e+00
%11 = fdiv float %8, %10
%12 = load float, float* %3
%13 = fmul float 2.000000e+00, %12
%14 = load float, float* %3
%15 = fadd float -1.000000e+00, %14
%16 = fdiv float %13, %15
%17 = load float, float* %3
%18 = fadd float 1.000000e+00, %17
%19 = fdiv float %16, %18
%20 = fsub float %11, %19
ret float %20
}

LLVM IR (-O2):
define float @F0ToRefractiveIndex(float %0) {
%2 = tail call float @sqrt(float %0)
%3 = insertelement <2 x float> poison, float %0, i64 0
%4 = insertelement <2 x float> %3, float %2, i64 1
%5 = fsub <2 x float> <float -1.000000e+00, float poison>, %4
%6 = fmul <2 x float> %4, <float poison, float 2.000000e+00>
%7 = shufflevector <2 x float> %5, <2 x float> %6, <2 x i32> <i32 0, i32 3>
%8 = fadd <2 x float> %4, <float -1.000000e+00, float -1.000000e+00>
%9 = fdiv <2 x float> %7, %8
%10 = fadd float %2, 1.000000e+00
%11 = extractelement <2 x float> %9, i64 1
%12 = fdiv float %11, %10
%13 = extractelement <2 x float> %9, i64 0
%14 = fsub float %13, %12
ret float %14
}