#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 saturate(float);
float CalculateRadiusLimitAttenuation(float distanceSq, float lightRadius) {
  float D = distanceSq;
  D *= D;
  D *= D;
  float R = lightRadius;
  R *= R;
  R *= R;
  R *= R;
  return 1.f - saturate(3.f * D / R);
}


x86 assembly (clang, -O0):
<CalculateRadiusLimitAttenuation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe7b(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
call   1030 <saturate@plt>
movaps %xmm0,%xmm1
movss  0xe5d(%rip),%xmm0
subss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculateRadiusLimitAttenuation>:
push   %rax
unpcklps %xmm1,%xmm0
mulps  %xmm0,%xmm0
mulps  %xmm0,%xmm0
movss  0xede(%rip),%xmm1
movaps %xmm0,%xmm2
movss  %xmm1,%xmm2
mulps  %xmm2,%xmm0
movaps %xmm0,%xmm1
shufps $0x55,%xmm0,%xmm1
divss  %xmm1,%xmm0
call   1030 <saturate@plt>
movss  0xec0(%rip),%xmm1
subss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define float @CalculateRadiusLimitAttenuation(float %0, float %1) {
%3 = insertelement <2 x float> poison, float %0, i64 0
%4 = insertelement <2 x float> %3, float %1, i64 1
%5 = fmul <2 x float> %4, %4
%6 = fmul <2 x float> %5, %5
%7 = insertelement <2 x float> %6, float 3.000000e+00, i64 0
%8 = fmul <2 x float> %6, %7
%9 = extractelement <2 x float> %8, i64 0
%10 = extractelement <2 x float> %8, i64 1
%11 = fdiv float %9, %10
%12 = tail call float @saturate(float %11)
%13 = fsub float 1.000000e+00, %12
ret float %13
}