#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 */
scalar_t__ sqrt(float);
float get_visibility(float n_dot_v, float n_dot_l, float alpha2) {
  float n_dot_v_2 = n_dot_v * n_dot_v;
  float n_dot_l_2 = n_dot_l * n_dot_l;
  float ggx_v = n_dot_l * (float)sqrt(n_dot_v_2 * (1 - alpha2) + alpha2);
  float ggx_l = n_dot_v * (float)sqrt(n_dot_l_2 * (1 - alpha2) + alpha2);
  return 0.5f / (ggx_v + ggx_l);
}


x86 assembly (clang, -O0):
<get_visibility>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xea8(%rip),%xmm2
subss  -0xc(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
movss  -0x24(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xe67(%rip),%xmm2
subss  -0xc(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
movss  -0x20(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm1
addss  -0x1c(%rbp),%xmm1
movss  0xe27(%rip),%xmm0
divss  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_visibility>:
sub    $0x18,%rsp
movss  %xmm1,0x4(%rsp)
movss  %xmm0,0x14(%rsp)
mulss  %xmm0,%xmm0
movaps %xmm1,%xmm3
mulss  %xmm1,%xmm3
movss  %xmm3,0x10(%rsp)
movss  0xec7(%rip),%xmm1
movss  %xmm2,0xc(%rsp)
subss  %xmm2,%xmm1
movss  %xmm1,0x8(%rsp)
mulss  %xmm1,%xmm0
addss  %xmm2,%xmm0
call   1030 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x8(%rsp),%xmm0
mulss  0x10(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
call   1030 <sqrt@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %rax,%xmm1
mulss  0x14(%rsp),%xmm1
addss  0x4(%rsp),%xmm1
movss  0xe67(%rip),%xmm0
divss  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @get_visibility(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%11 = load float, float* %4
%12 = load float, float* %4
%13 = fmul float %11, %12
store float %13, float* %7
%14 = load float, float* %5
%15 = load float, float* %5
%16 = fmul float %14, %15
store float %16, float* %8
%17 = load float, float* %5
%18 = load float, float* %7
%19 = load float, float* %6
%20 = fsub float 1.000000e+00, %19
%21 = load float, float* %6
%22 = call float @llvm.fmuladd.f32(float %18, float %20, float %21)
%23 = call i64 @sqrt(float %22)
%24 = sitofp i64 %23 to float
%25 = fmul float %17, %24
store float %25, float* %9
%26 = load float, float* %4
%27 = load float, float* %8
%28 = load float, float* %6
%29 = fsub float 1.000000e+00, %28
%30 = load float, float* %6
%31 = call float @llvm.fmuladd.f32(float %27, float %29, float %30)
%32 = call i64 @sqrt(float %31)
%33 = sitofp i64 %32 to float
%34 = fmul float %26, %33
store float %34, float* %10
%35 = load float, float* %9
%36 = load float, float* %10
%37 = fadd float %35, %36
%38 = fdiv float 5.000000e-01, %37
ret float %38
}

LLVM IR (-O2):
define float @get_visibility(float %0, float %1, float %2) {
%4 = fmul float %0, %0
%5 = fmul float %1, %1
%6 = fsub float 1.000000e+00, %2
%7 = tail call float @llvm.fmuladd.f32(float %4, float %6, float %2)
%8 = tail call i64 @sqrt(float %7)
%9 = sitofp i64 %8 to float
%10 = fmul float %9, %1
%11 = tail call float @llvm.fmuladd.f32(float %5, float %6, float %2)
%12 = tail call i64 @sqrt(float %11)
%13 = sitofp i64 %12 to float
%14 = fmul float %13, %0
%15 = fadd float %10, %14
%16 = fdiv float 5.000000e-01, %15
ret float %16
}