#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 */
int /*<<< orphan*/ max(float, float);
float pow(int /*<<< orphan*/, float);
float rcp(float);
float DistributionBlinnPhong(float roughness, float NdotH) {
  float a = roughness * roughness;
  float a2 = a * a;
  float n = 2.0f / a2 - 2.0f;
  return (n + 2.0f) * rcp(2.0f * 3.141592654f) * pow(max(NdotH, 0.0f), n);
}


x86 assembly (clang, -O0):
<DistributionBlinnPhong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe9c(%rip),%xmm0
divss  -0x10(%rbp),%xmm0
movss  0xe8f(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe7e(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe68(%rip),%xmm0
call   1040 <rcp@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
call   1030 <max@plt>
mov    %eax,%edi
movss  -0x14(%rbp),%xmm0
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DistributionBlinnPhong>:
sub    $0x18,%rsp
movss  %xmm1,0x14(%rsp)
mulss  %xmm0,%xmm0
mulss  %xmm0,%xmm0
movss  0xeb6(%rip),%xmm2
movaps %xmm2,%xmm1
divss  %xmm0,%xmm1
addss  0xeab(%rip),%xmm1
movss  %xmm1,0x10(%rsp)
addss  %xmm1,%xmm2
movss  %xmm2,0xc(%rsp)
movss  0xe97(%rip),%xmm0
call   1040 <rcp@plt>
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
xorps  %xmm1,%xmm1
movss  0x14(%rsp),%xmm0
call   1030 <max@plt>
mov    %eax,%edi
movss  0x10(%rsp),%xmm0
call   1050 <pow@plt>
mulss  0xc(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @DistributionBlinnPhong(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %3
store float %1, float* %4
%8 = load float, float* %3
%9 = load float, float* %3
%10 = fmul float %8, %9
store float %10, float* %5
%11 = load float, float* %5
%12 = load float, float* %5
%13 = fmul float %11, %12
store float %13, float* %6
%14 = load float, float* %6
%15 = fdiv float 2.000000e+00, %14
%16 = fsub float %15, 2.000000e+00
store float %16, float* %7
%17 = load float, float* %7
%18 = fadd float %17, 2.000000e+00
%19 = call float @rcp(float 0x401921FB60000000)
%20 = fmul float %18, %19
%21 = load float, float* %4
%22 = call i32 @max(float %21, float 0.000000e+00)
%23 = load float, float* %7
%24 = call float @pow(i32 %22, float %23)
%25 = fmul float %20, %24
ret float %25
}

LLVM IR (-O2):
define float @DistributionBlinnPhong(float %0, float %1) {
%3 = fmul float %0, %0
%4 = fmul float %3, %3
%5 = fdiv float 2.000000e+00, %4
%6 = fadd float %5, -2.000000e+00
%7 = fadd float %6, 2.000000e+00
%8 = tail call float @rcp(float 0x401921FB60000000)
%9 = fmul float %7, %8
%10 = tail call i32 @max(float %1, float 0.000000e+00)
%11 = tail call float @pow(i32 %10, float %6)
%12 = fmul float %9, %11
ret float %12
}