#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 min(double, float);
float geometric_torrance_sparrow(float n_dot_h, float n_dot_v, float v_dot_h,
                                 float n_dot_l) {
  return min(1.0, min(2.0 * n_dot_h * n_dot_v / v_dot_h,
                      2.0 * n_dot_h * n_dot_l / v_dot_h));
}


x86 assembly (clang, -O0):
<geometric_torrance_sparrow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xecb(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe9c(%rip),%xmm1
mulsd  %xmm2,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm1
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
divsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
call   1030 <min@plt>
movaps %xmm0,%xmm1
movsd  0xe62(%rip),%xmm0
call   1030 <min@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geometric_torrance_sparrow>:
push   %rax
cvtss2sd %xmm0,%xmm4
addsd  %xmm4,%xmm4
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mulsd  %xmm4,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
divsd  %xmm1,%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
mulsd  %xmm4,%xmm2
divsd  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtsd2ss %xmm2,%xmm1
call   1030 <min@plt>
movapd %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm0
pop    %rax
jmp    1030 <min@plt>

LLVM IR (-O0):
define float @geometric_torrance_sparrow(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = fpext float %9 to double
%11 = fmul double 2.000000e+00, %10
%12 = load float, float* %6
%13 = fpext float %12 to double
%14 = fmul double %11, %13
%15 = load float, float* %7
%16 = fpext float %15 to double
%17 = fdiv double %14, %16
%18 = load float, float* %5
%19 = fpext float %18 to double
%20 = fmul double 2.000000e+00, %19
%21 = load float, float* %8
%22 = fpext float %21 to double
%23 = fmul double %20, %22
%24 = load float, float* %7
%25 = fpext float %24 to double
%26 = fdiv double %23, %25
%27 = fptrunc double %26 to float
%28 = call float @min(double %17, float %27)
%29 = call float @min(double 1.000000e+00, float %28)
ret float %29
}

LLVM IR (-O2):
define float @geometric_torrance_sparrow(float %0, float %1, float %2, float %3) {
%5 = fpext float %0 to double
%6 = fmul double %5, 2.000000e+00
%7 = fpext float %1 to double
%8 = fmul double %6, %7
%9 = fpext float %2 to double
%10 = fdiv double %8, %9
%11 = fpext float %3 to double
%12 = fmul double %6, %11
%13 = fdiv double %12, %9
%14 = fptrunc double %13 to float
%15 = tail call float @min(double %10, float %14)
%16 = tail call float @min(double 1.000000e+00, float %15)
ret float %16
}