#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 square(float);
float GeometricSchlick(float a, float NoV, float NoL) {
  float k = square(a + 1) / 8.0;
  float GV = NoV * (1 - k) + k;
  float GL = NoL * (1 - k) + k;
  return 0.25 / (GV * GL);
}


x86 assembly (clang, -O0):
<GeometricSchlick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  0xee1(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
call   1030 <square@plt>
movsd  0xec7(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xeb5(%rip),%xmm2
subss  -0x10(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe91(%rip),%xmm2
subss  -0x10(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe54(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GeometricSchlick>:
push   %rax
movss  %xmm2,0x4(%rsp)
movss  %xmm1,(%rsp)
addss  0xedc(%rip),%xmm0
call   1030 <square@plt>
mulsd  0xed7(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0xec3(%rip),%xmm1
subss  %xmm0,%xmm1
movss  (%rsp),%xmm2
mulss  %xmm1,%xmm2
addss  %xmm0,%xmm2
mulss  0x4(%rsp),%xmm1
addss  %xmm0,%xmm1
mulss  %xmm2,%xmm1
movss  0xea0(%rip),%xmm0
divss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @GeometricSchlick(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%10 = load float, float* %4
%11 = fadd float %10, 1.000000e+00
%12 = call double @square(float %11)
%13 = fdiv double %12, 8.000000e+00
%14 = fptrunc double %13 to float
store float %14, float* %7
%15 = load float, float* %5
%16 = load float, float* %7
%17 = fsub float 1.000000e+00, %16
%18 = load float, float* %7
%19 = call float @llvm.fmuladd.f32(float %15, float %17, float %18)
store float %19, float* %8
%20 = load float, float* %6
%21 = load float, float* %7
%22 = fsub float 1.000000e+00, %21
%23 = load float, float* %7
%24 = call float @llvm.fmuladd.f32(float %20, float %22, float %23)
store float %24, float* %9
%25 = load float, float* %8
%26 = load float, float* %9
%27 = fmul float %25, %26
%28 = fpext float %27 to double
%29 = fdiv double 2.500000e-01, %28
%30 = fptrunc double %29 to float
ret float %30
}

LLVM IR (-O2):
define float @GeometricSchlick(float %0, float %1, float %2) {
%4 = fadd float %0, 1.000000e+00
%5 = tail call double @square(float %4)
%6 = fmul double %5, 1.250000e-01
%7 = fptrunc double %6 to float
%8 = fsub float 1.000000e+00, %7
%9 = tail call float @llvm.fmuladd.f32(float %1, float %8, float %7)
%10 = tail call float @llvm.fmuladd.f32(float %2, float %8, float %7)
%11 = fmul float %9, %10
%12 = fdiv float 2.500000e-01, %11
ret float %12
}