#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 sqr(float);
float sqrt(float);
float get_kappa(float f0, float eta) {
  float nr = f0 * sqr(eta + 1.0) - sqr(eta - 1.0);
  return sqrt(nr / (1.0 - f0));
}


x86 assembly (clang, -O0):
<get_kappa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb3(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <sqr@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe90(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <sqr@plt>
movss  -0x14(%rbp),%xmm2
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe42(%rip),%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_kappa>:
sub    $0x18,%rsp
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x14(%rsp)
movss  0xec8(%rip),%xmm0
addss  %xmm1,%xmm0
call   1030 <sqr@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
addss  0xeaf(%rip),%xmm0
call   1030 <sqr@plt>
movss  0x14(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
mulss  %xmm1,%xmm2
subss  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
cvtss2sd %xmm1,%xmm1
movsd  0xe87(%rip),%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     119e <get_kappa+0x7e>
sqrtss %xmm0,%xmm0
add    $0x18,%rsp
ret
add    $0x18,%rsp
jmp    1040 <sqrt@plt>

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

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