#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 log(float);
float GTR1(float NdotH, float a) {
  if (a >= 1)
    return 1 / 3.14159265358979323846264;
  float a2 = a * a;
  float t = 1 + (a2 - 1) * NdotH * NdotH;
  return (a2 - 1) / (3.14159265358979323846264 * log(a2) * t);
}


x86 assembly (clang, -O0):
<GTR1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xed1(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     114a <GTR1+0x3a>
movss  0xec4(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11db <GTR1+0xcb>
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xe9a(%rip),%xmm1
subss  %xmm1,%xmm0
mulss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe80(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xe6a(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
movsd  0xe4b(%rip),%xmm1
mulsd  %xmm2,%xmm1
movss  -0x14(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GTR1>:
sub    $0x18,%rsp
ucomiss 0xee9(%rip),%xmm1
jae    117e <GTR1+0x6e>
mulss  %xmm1,%xmm1
movss  0xedf(%rip),%xmm3
addss  %xmm1,%xmm3
cvtss2sd %xmm3,%xmm2
movsd  %xmm2,0x10(%rsp)
mulss  %xmm0,%xmm3
mulss  %xmm0,%xmm3
addss  0xebd(%rip),%xmm3
movss  %xmm3,0xc(%rsp)
movaps %xmm1,%xmm0
call   1030 <log@plt>
mulsd  0xeb3(%rip),%xmm0
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x18,%rsp
ret
movss  0xe7a(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @GTR1(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
%8 = load float, float* %5
%9 = fcmp oge float %8, 1.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %2
store float 0x3FD45F3060000000, float* %3
br label %32
11: ; preds = %2
%12 = load float, float* %5
%13 = load float, float* %5
%14 = fmul float %12, %13
store float %14, float* %6
%15 = load float, float* %6
%16 = fsub float %15, 1.000000e+00
%17 = load float, float* %4
%18 = fmul float %16, %17
%19 = load float, float* %4
%20 = call float @llvm.fmuladd.f32(float %18, float %19, float 1.000000e+00)
store float %20, float* %7
%21 = load float, float* %6
%22 = fsub float %21, 1.000000e+00
%23 = fpext float %22 to double
%24 = load float, float* %6
%25 = call double @log(float %24)
%26 = fmul double 0x400921FB54442D18, %25
%27 = load float, float* %7
%28 = fpext float %27 to double
%29 = fmul double %26, %28
%30 = fdiv double %23, %29
%31 = fptrunc double %30 to float
store float %31, float* %3
br label %32
32: ; preds = %11, %10
%33 = load float, float* %3
ret float %33
}

LLVM IR (-O2):
define float @GTR1(float %0, float %1) {
%3 = fcmp ult float %1, 1.000000e+00
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = fmul float %1, %1
%6 = fadd float %5, -1.000000e+00
%7 = fmul float %6, %0
%8 = tail call float @llvm.fmuladd.f32(float %7, float %0, float 1.000000e+00)
%9 = fpext float %6 to double
%10 = tail call double @log(float %5)
%11 = fmul double %10, 0x400921FB54442D18
%12 = fpext float %8 to double
%13 = fmul double %11, %12
%14 = fdiv double %9, %13
%15 = fptrunc double %14 to float
br label %16
16: ; preds = %2, %4
%17 = phi float [ %15, %4 ], [ 0x3FD45F3060000000, %2 ]
ret float %17
}