#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 exp(float);
float DistributionBeckmann(float roughness, float NdotH) {
  float a = roughness * roughness;
  float a2 = a * a;
  float NdotH_Sq = NdotH * NdotH;
  float expTerm = exp((NdotH_Sq - 1.0f) / (a2 * NdotH_Sq));
  float piTerm = (3.141592654f * a2 * NdotH_Sq * NdotH_Sq);
  return expTerm / piTerm;
}


x86 assembly (clang, -O0):
<DistributionBeckmann>:
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  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xea8(%rip),%xmm1
subss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
call   1030 <exp@plt>
movss  %xmm0,-0x18(%rbp)
movss  0xe80(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
divss  -0x1c(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DistributionBeckmann>:
push   %rax
movaps %xmm0,%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm2,%xmm2
movss  %xmm2,(%rsp)
mulss  %xmm1,%xmm1
movss  %xmm1,0x4(%rsp)
movss  0xecd(%rip),%xmm0
addss  %xmm1,%xmm0
mulss  %xmm1,%xmm2
divss  %xmm2,%xmm0
call   1030 <exp@plt>
movss  (%rsp),%xmm1
mulss  0xeb3(%rip),%xmm1
movss  0x4(%rsp),%xmm2
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
divss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @DistributionBeckmann(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %3
store float %1, float* %4
%10 = load float, float* %3
%11 = load float, float* %3
%12 = fmul float %10, %11
store float %12, float* %5
%13 = load float, float* %5
%14 = load float, float* %5
%15 = fmul float %13, %14
store float %15, float* %6
%16 = load float, float* %4
%17 = load float, float* %4
%18 = fmul float %16, %17
store float %18, float* %7
%19 = load float, float* %7
%20 = fsub float %19, 1.000000e+00
%21 = load float, float* %6
%22 = load float, float* %7
%23 = fmul float %21, %22
%24 = fdiv float %20, %23
%25 = call float @exp(float %24)
store float %25, float* %8
%26 = load float, float* %6
%27 = fmul float 0x400921FB60000000, %26
%28 = load float, float* %7
%29 = fmul float %27, %28
%30 = load float, float* %7
%31 = fmul float %29, %30
store float %31, float* %9
%32 = load float, float* %8
%33 = load float, float* %9
%34 = fdiv float %32, %33
ret float %34
}

LLVM IR (-O2):
define float @DistributionBeckmann(float %0, float %1) {
%3 = fmul float %0, %0
%4 = fmul float %3, %3
%5 = fmul float %1, %1
%6 = fadd float %5, -1.000000e+00
%7 = fmul float %4, %5
%8 = fdiv float %6, %7
%9 = tail call float @exp(float %8)
%10 = fmul float %4, 0x400921FB60000000
%11 = fmul float %5, %10
%12 = fmul float %5, %11
%13 = fdiv float %9, %12
ret float %13
}