// Lighting / Shadows

cbuffer FrameConstants : register(b0)
{
  float4x4 g_xView : packoffset(c0);
  float4x4 g_xProj : packoffset(c4);
  float4x4 g_xViewProj : packoffset(c8);
  float4x4 g_xInvView : packoffset(c12);
  float4x4 g_xInvProj : packoffset(c16);
  float4x4 g_xInvViewProj : packoffset(c20);
  float3 g_xCamPos : packoffset(c24);
  float2 g_xRcpScreenDims : packoffset(c25);
  float2 g_xDepthProjViewUnpack : packoffset(c25.z);
  float4 g_axViewFrustumPlanes[6] : packoffset(c26);
}

cbuffer ShadowReadConstants : register(b5)
{
  float g_f2DFilterSize : packoffset(c0);
  float g_fCubeFilterSize : packoffset(c0.y);
  float g_fCubeClampWidth : packoffset(c0.z);
  float g_fSunWidth : packoffset(c0.w);
}

cbuffer PointParams : register(b4)
{
  float2 g_xCameraTanHalfFOV : packoffset(c0);
  float2 g_xTwoOverScreenDims : packoffset(c0.z);
  float3 g_xLightPos : packoffset(c1);
  float g_fLightRadius : packoffset(c1.w);
  float4x4 g_xLightOrientation : packoffset(c2);
  float4x4 g_xCustomVolumeMatrix : packoffset(c6);
  float3 g_xLightDir : packoffset(c10);
  float g_fRcpLightRadius : packoffset(c10.w);
  float g_fLightFalloffScale : packoffset(c11);
  float g_fLightFalloffPower : packoffset(c11.y);
  float g_fLightAngleOuter : packoffset(c11.z);
  float g_fRcpLightAngleRange : packoffset(c11.w);
  float3 g_xLightColour : packoffset(c12);
  bool g_bUseLimitAngles : packoffset(c12.w);
  float g_fArcCosLimitAngle : packoffset(c13);
  float g_fRcpProjCubeLerpDist : packoffset(c13.y);
  bool g_bUseProjCube : packoffset(c13.z);
  bool g_bUseDualProjCube : packoffset(c13.w);
  float g_fLightMeshRadius : packoffset(c14);
  float2 g_xDepthProjection : packoffset(c14.y);
  float g_fShadowStrength : packoffset(c14.w);
}

SamplerState g_xPointClamp_s : register(s1);
SamplerState g_xTrilinearClamp_s : register(s3);
SamplerComparisonState g_xShadowCmpSampler_s : register(s8);
Texture2D<float4> g_xMaterialsTexture : register(t0);
Texture2D<float4> g_xNormalBuffer : register(t24);
Texture2D<float4> g_xAlbedoBuffer : register(t25);
TextureCube<float4> g_xProjCubeMap : register(t26);
TextureCube<float4> g_xProjCubeMapBlurred : register(t27);
Texture2D<float4> g_xShadowCubeMap : register(t28);


// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main( 
  float4 v0 : SV_Position0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = (int2)v0.xy;
  r0.zw = float2(0,0);
  r1.xyzw = g_xNormalBuffer.Load(r0.xyw).xyzw;
  r0.xyzw = g_xAlbedoBuffer.Load(r0.xyz).xyzw;
  r2.x = dot(r1.xy, r1.xy);
  r3.z = r2.x * 2 + -1;
  r2.x = rsqrt(r2.x);
  r1.xy = r2.xx * r1.xy;
  r2.x = -r3.z * r3.z + 1;
  r2.x = sqrt(r2.x);
  r3.xy = r2.xx * r1.xy;
  r1.xy = g_xCameraTanHalfFOV.xy * r1.ww;
  r2.xy = v0.xy * g_xTwoOverScreenDims.xy + float2(-1,-1);
  r1.xy = r2.xy * r1.xy;
float4 stereo = StereoParams.Load(0);
float4 params = IniParams.Load(0);
r1.x -= stereo.x * (r1.w - stereo.y)*g_xInvProj._m00;
  r2.xyz = g_xInvView._m01_m11_m21 * r1.yyy;
  r2.xyz = g_xInvView._m00_m10_m20 * r1.xxx + r2.xyz;
  r1.xyw = g_xInvView._m02_m12_m22 * r1.www + r2.xyz;
  r1.xyw = g_xInvView._m03_m13_m23 + r1.xyw;
  r2.xyz = g_xLightPos.xyz + -r1.xyw;
  r2.w = dot(r2.xyz, r2.xyz);
  r3.w = rsqrt(r2.w);
  r4.xyz = r3.www * r2.xyz;
  r2.w = sqrt(r2.w);
  r3.w = g_fRcpLightRadius * r2.w;
  r4.w = -r2.w * g_fRcpLightRadius + 1;
  r4.w = saturate(g_fLightFalloffScale * r4.w);
  r4.w = log2(r4.w);
  r4.w = g_fLightFalloffPower * r4.w;
  r4.w = exp2(r4.w);
  r5.x = dot(r4.xyz, g_xLightDir.xyz);
  r5.x = g_fLightAngleOuter + r5.x;
  r5.x = saturate(g_fRcpLightAngleRange * r5.x);
  r5.x = r5.x * r4.w;
  r4.w = g_bUseLimitAngles ? r5.x : r4.w;
  r5.x = -9.99999975e-005 + r4.w;
  r5.x = cmp(r5.x < 0);
  if (r5.x != 0) discard;
  r5.x = cmp(0 < g_fShadowStrength);
  if (r5.x != 0) {
    r5.xyz = float3(-1,1,-1) * r2.xyz;
    r5.w = max(abs(r5.y), abs(r5.z));
    r5.w = max(abs(r5.x), r5.w);
    r6.xyz = cmp(abs(r5.xyz) == r5.www);
    r7.xyz = r6.xyz ? float3(1,1,1) : 0;
    r6.z = dot(r7.xyz, r5.xyz);
    r6.w = cmp(0 < r6.z);
    r6.z = cmp(r6.z < 0);
    r6.z = (int)r6.z + (int)-r6.w;
    r6.z = (int)r6.z;
    r8.x = saturate(-r6.z);
    r8.y = dot(r7.zy, float2(2,1));
    r7.xyzw = float4(0,-1,0,1) * r6.zzzz;
    r6.zw = r6.yy ? float2(1,0) : r7.wz;
    r7.zw = r6.yy ? r7.zw : float2(-1,0);
    r6.yz = r6.xx ? r7.xy : r6.zw;
    r6.xw = r6.xx ? float2(-1,0) : r7.zw;
    r5.xyz = r5.xyz / r5.www;
    r7.x = dot(r6.yz, r5.xz);
    r7.y = dot(r6.xw, r5.yz);
    r5.xy = r7.xy * float2(0.5,0.5) + float2(0.5,0.5);
    r5.z = g_xDepthProjection.y / r5.w;
    r5.z = g_xDepthProjection.x + r5.z;
    r5.w = 1 + -g_fCubeClampWidth;
    r5.xy = max(g_fCubeClampWidth, r5.xy);
    r5.xy = min(r5.xy, r5.ww);
    r5.xy = r5.xy + r8.xy;
    r5.xy = float2(0.5,0.333333343) * r5.xy;
    r5.x = g_xShadowCubeMap.SampleCmp(g_xShadowCmpSampler_s, r5.xy, r5.z).x;
    r5.yz = float2(0,0);
    while (true) {
      r5.w = cmp((int)r5.z >= 12);
      if (r5.w != 0) break;
      r5.y = r5.y + r5.x;
      r5.z = (int)r5.z + 1;
    }
    r5.x = g_fShadowStrength * r5.y;
    o0.w = -r5.x * 0.0833333358 + 1;
  } else {
    o0.w = 1;
  }
  r5.xyz = g_xLightColour.xyz * r4.www;
  if (g_bUseProjCube != 0) {
    r6.x = dot(r4.xyz, g_xLightOrientation._m00_m10_m20);
    r6.y = dot(r4.xyz, g_xLightOrientation._m01_m11_m21);
    r6.z = dot(r4.xyz, g_xLightOrientation._m02_m12_m22);
    r4.xyzw = g_xProjCubeMap.Sample(g_xTrilinearClamp_s, r6.xyz).xyzw;
    if (g_bUseDualProjCube != 0) {
      r6.xyzw = g_xProjCubeMapBlurred.Sample(g_xTrilinearClamp_s, r6.xyz).xyzw;
      r3.w = g_fRcpProjCubeLerpDist * r3.w;
      r3.w = min(1, r3.w);
      r6.xyz = r6.xyz + -r4.xyz;
      r4.xyz = r3.www * r6.xyz + r4.xyz;
    }
    r5.xyz = r5.xyz * r4.xyz;
  }
  r1.xyw = g_xCamPos.xyz + -r1.xyw;
  r3.w = dot(r1.xyw, r1.xyw);
  r3.w = rsqrt(r3.w);
  r4.xyz = r3.www * r1.xyw;
  r2.xyz = r2.xyz / r2.www;
  r2.w = dot(r5.xyz, float3(0.333000004,0.333000004,0.333000004));
  r4.w = dot(r3.xyz, r2.xyz);
  r4.w = min(1, r4.w);
  r6.yw = float2(0.994140625,0.998046875);
  r6.z = r0.w;
  r7.xyzw = g_xMaterialsTexture.Sample(g_xPointClamp_s, r6.yz).xyzw;
  r0.w = r7.w + r7.w;
  r6.x = r4.w * 0.490234375 + 0.4921875;
  r7.xyzw = g_xMaterialsTexture.Sample(g_xTrilinearClamp_s, r6.xz).xyzw;
  r5.w = r7.x + r7.x;
  r7.xyz = r5.www * r5.xyz;
  r8.xyz = r0.xyz * r2.www + -r5.xyz;
  r5.xyz = r0.www * r8.xyz + r5.xyz;
  r6.xyzw = g_xMaterialsTexture.Sample(g_xTrilinearClamp_s, r6.wz).xyzw;
  r0.w = r6.w + r6.w;
  r2.w = 256 * r6.x;
  r2.w = r2.w * r2.w;
  r1.xyw = r1.xyw * r3.www + r2.xyz;
  r2.x = dot(r1.xyw, r1.xyw);
  r2.x = rsqrt(r2.x);
  r1.xyw = r2.xxx * r1.xyw;
  r1.x = dot(r3.xyz, r1.xyw);
  r1.x = max(9.99999997e-007, r1.x);
  r1.x = log2(r1.x);
  r1.x = r2.w * r1.x;
  r1.x = exp2(r1.x);
  r1.x = r2.w * r1.x;
  r1.x = 0.03125 * r1.x;
  r1.y = max(0, r4.w);
  r1.w = saturate(dot(r3.xyz, r4.xyz));
  r2.x = 0.5 + r4.w;
  r2.x = max(0, r2.x);
  r1.w = 1 + -r1.w;
  r2.y = r1.w * r1.w;
  r2.y = r2.y * r2.y;
  r1.w = r2.y * r1.w;
  r0.w = r1.w * r0.w;
  r0.w = r0.w * r2.x;
  r0.w = 2.5 * r0.w;
  r0.w = r1.x * r1.y + r0.w;
  r0.w = r0.w * r1.z;
  r1.xyz = r5.xyz * r0.www;
  r0.xyz = r7.xyz * r0.xyz + r1.xyz;
  o0.xyz = min(float3(31.875,31.875,31.875), r0.xyz);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//
// Buffer Definitions: 
//
// cbuffer FrameConstants
// {
//
//   float4x4 g_xView;                  // Offset:    0 Size:    64 [unused]
//   float4x4 g_xProj;                  // Offset:   64 Size:    64 [unused]
//   float4x4 g_xViewProj;              // Offset:  128 Size:    64 [unused]
//   float4x4 g_xInvView;               // Offset:  192 Size:    64
//   float4x4 g_xInvProj;               // Offset:  256 Size:    64 [unused]
//   float4x4 g_xInvViewProj;           // Offset:  320 Size:    64 [unused]
//   float3 g_xCamPos;                  // Offset:  384 Size:    12
//   float2 g_xRcpScreenDims;           // Offset:  400 Size:     8 [unused]
//   float2 g_xDepthProjViewUnpack;     // Offset:  408 Size:     8 [unused]
//   float4 g_axViewFrustumPlanes[6];   // Offset:  416 Size:    96 [unused]
//
// }
//
// cbuffer ShadowReadConstants
// {
//
//   float g_f2DFilterSize;             // Offset:    0 Size:     4 [unused]
//   float g_fCubeFilterSize;           // Offset:    4 Size:     4 [unused]
//   float g_fCubeClampWidth;           // Offset:    8 Size:     4
//   float g_fSunWidth;                 // Offset:   12 Size:     4 [unused]
//
// }
//
// cbuffer PointParams
// {
//
//   float2 g_xCameraTanHalfFOV;        // Offset:    0 Size:     8
//   float2 g_xTwoOverScreenDims;       // Offset:    8 Size:     8
//   float3 g_xLightPos;                // Offset:   16 Size:    12
//   float g_fLightRadius;              // Offset:   28 Size:     4 [unused]
//   float4x4 g_xLightOrientation;      // Offset:   32 Size:    64
//   float4x4 g_xCustomVolumeMatrix;    // Offset:   96 Size:    64 [unused]
//   float3 g_xLightDir;                // Offset:  160 Size:    12
//   float g_fRcpLightRadius;           // Offset:  172 Size:     4
//   float g_fLightFalloffScale;        // Offset:  176 Size:     4
//   float g_fLightFalloffPower;        // Offset:  180 Size:     4
//   float g_fLightAngleOuter;          // Offset:  184 Size:     4
//   float g_fRcpLightAngleRange;       // Offset:  188 Size:     4
//   float3 g_xLightColour;             // Offset:  192 Size:    12
//   bool g_bUseLimitAngles;            // Offset:  204 Size:     4
//   float g_fArcCosLimitAngle;         // Offset:  208 Size:     4 [unused]
//   float g_fRcpProjCubeLerpDist;      // Offset:  212 Size:     4
//   bool g_bUseProjCube;               // Offset:  216 Size:     4
//   bool g_bUseDualProjCube;           // Offset:  220 Size:     4
//   float g_fLightMeshRadius;          // Offset:  224 Size:     4 [unused]
//   float2 g_xDepthProjection;         // Offset:  228 Size:     8
//   float g_fShadowStrength;           // Offset:  236 Size:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_xPointClamp                     sampler      NA          NA    1        1
// g_xTrilinearClamp                 sampler      NA          NA    3        1
// g_xShadowCmpSampler             sampler_c      NA          NA    8        1
// g_xMaterialsTexture               texture  float4          2d    0        1
// g_xNormalBuffer                   texture  float4          2d   24        1
// g_xAlbedoBuffer                   texture  float4          2d   25        1
// g_xProjCubeMap                    texture  float4        cube   26        1
// g_xProjCubeMapBlurred             texture  float4        cube   27        1
// g_xShadowCubeMap                  texture  float4          2d   28        1
// FrameConstants                    cbuffer      NA          NA    0        1
// PointParams                       cbuffer      NA          NA    4        1
// ShadowReadConstants               cbuffer      NA          NA    5        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[25], immediateIndexed
dcl_constantbuffer cb5[1], immediateIndexed
dcl_constantbuffer cb4[15], immediateIndexed
dcl_sampler s1, mode_default
dcl_sampler s3, mode_default
dcl_sampler s8, mode_comparison
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t24
dcl_resource_texture2d (float,float,float,float) t25
dcl_resource_texturecube (float,float,float,float) t26
dcl_resource_texturecube (float,float,float,float) t27
dcl_resource_texture2d (float,float,float,float) t28
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_output o0.xyzw
dcl_temps 9
ftoi r0.xy, v0.xyxx
mov r0.zw, l(0,0,0,0)
ld r1.xyzw, r0.xyww, t24.xyzw
ld r0.xyzw, r0.xyzw, t25.xyzw
dp2 r2.x, r1.xyxx, r1.xyxx
mad r3.z, r2.x, l(2.000000), l(-1.000000)
rsq r2.x, r2.x
mul r1.xy, r1.xyxx, r2.xxxx
mad r2.x, -r3.z, r3.z, l(1.000000)
sqrt r2.x, r2.x
mul r3.xy, r1.xyxx, r2.xxxx
mul r1.xy, r1.wwww, cb4[0].xyxx
mad r2.xy, v0.xyxx, cb4[0].zwzz, l(-1.000000, -1.000000, 0.000000, 0.000000)
mul r1.xy, r1.xyxx, r2.xyxx
mul r2.xyz, r1.yyyy, cb0[13].xyzx
mad r2.xyz, cb0[12].xyzx, r1.xxxx, r2.xyzx
mad r1.xyw, cb0[14].xyxz, r1.wwww, r2.xyxz
add r1.xyw, r1.xyxw, cb0[15].xyxz
add r2.xyz, -r1.xywx, cb4[1].xyzx
dp3 r2.w, r2.xyzx, r2.xyzx
rsq r3.w, r2.w
mul r4.xyz, r2.xyzx, r3.wwww
sqrt r2.w, r2.w
mul r3.w, r2.w, cb4[10].w
mad r4.w, -r2.w, cb4[10].w, l(1.000000)
mul_sat r4.w, r4.w, cb4[11].x
log r4.w, r4.w
mul r4.w, r4.w, cb4[11].y
exp r4.w, r4.w
dp3 r5.x, r4.xyzx, cb4[10].xyzx
add r5.x, r5.x, cb4[11].z
mul_sat r5.x, r5.x, cb4[11].w
mul r5.x, r4.w, r5.x
movc r4.w, cb4[12].w, r5.x, r4.w
add r5.x, r4.w, l(-0.000100)
lt r5.x, r5.x, l(0.000000)
discard_nz r5.x
lt r5.x, l(0.000000), cb4[14].w
if_nz r5.x
  mul r5.xyz, r2.xyzx, l(-1.000000, 1.000000, -1.000000, 0.000000)
  max r5.w, |r5.z|, |r5.y|
  max r5.w, r5.w, |r5.x|
  eq r6.xyz, |r5.xyzx|, r5.wwww
  and r7.xyz, r6.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0)
  dp3 r6.z, r7.xyzx, r5.xyzx
  lt r6.w, l(0.000000), r6.z
  lt r6.z, r6.z, l(0.000000)
  iadd r6.z, r6.z, -r6.w
  itof r6.z, r6.z
  mov_sat r8.x, -r6.z
  dp2 r8.y, r7.zyzz, l(2.000000, 1.000000, 0.000000, 0.000000)
  mul r7.xyzw, r6.zzzz, l(0.000000, -1.000000, 0.000000, 1.000000)
  movc r6.zw, r6.yyyy, l(0,0,1.000000,0), r7.wwwz
  movc r7.zw, r6.yyyy, r7.zzzw, l(0,0,-1.000000,0)
  movc r6.yz, r6.xxxx, r7.xxyx, r6.zzwz
  movc r6.xw, r6.xxxx, l(-1.000000,0,0,0), r7.zzzw
  div r5.xyz, r5.xyzx, r5.wwww
  dp2 r7.x, r6.yzyy, r5.xzxx
  dp2 r7.y, r6.xwxx, r5.yzyy
  mad r5.xy, r7.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
  div r5.z, cb4[14].z, r5.w
  add r5.z, r5.z, cb4[14].y
  add r5.w, -cb5[0].z, l(1.000000)
  max r5.xy, r5.xyxx, cb5[0].zzzz
  min r5.xy, r5.wwww, r5.xyxx
  add r5.xy, r8.xyxx, r5.xyxx
  mul r5.xy, r5.xyxx, l(0.500000, 0.333333, 0.000000, 0.000000)
  sample_c r5.x, r5.xyxx, t28.xxxx, s8, r5.z
  mov r5.yz, l(0,0,0,0)
  loop 
    ige r5.w, r5.z, l(12)
    breakc_nz r5.w
    add r5.y, r5.x, r5.y
    iadd r5.z, r5.z, l(1)
  endloop 
  mul r5.x, r5.y, cb4[14].w
  mad o0.w, -r5.x, l(0.083333), l(1.000000)
else 
  mov o0.w, l(1.000000)
endif 
mul r5.xyz, r4.wwww, cb4[12].xyzx
if_nz cb4[13].z
  dp3 r6.x, r4.xyzx, cb4[2].xyzx
  dp3 r6.y, r4.xyzx, cb4[3].xyzx
  dp3 r6.z, r4.xyzx, cb4[4].xyzx
  sample r4.xyzw, r6.xyzx, t26.xyzw, s3
  if_nz cb4[13].w
    sample r6.xyzw, r6.xyzx, t27.xyzw, s3
    mul r3.w, r3.w, cb4[13].y
    min r3.w, r3.w, l(1.000000)
    add r6.xyz, -r4.xyzx, r6.xyzx
    mad r4.xyz, r3.wwww, r6.xyzx, r4.xyzx
  endif 
  mul r5.xyz, r4.xyzx, r5.xyzx
endif 
add r1.xyw, -r1.xyxw, cb0[24].xyxz
dp3 r3.w, r1.xywx, r1.xywx
rsq r3.w, r3.w
mul r4.xyz, r1.xywx, r3.wwww
div r2.xyz, r2.xyzx, r2.wwww
dp3 r2.w, r5.xyzx, l(0.333000, 0.333000, 0.333000, 0.000000)
dp3 r4.w, r3.xyzx, r2.xyzx
min r4.w, r4.w, l(1.000000)
mov r6.yw, l(0,0.994141,0,0.998047)
mov r6.z, r0.w
sample r7.xyzw, r6.yzyy, t0.xyzw, s1
add r0.w, r7.w, r7.w
mad r6.x, r4.w, l(0.490234), l(0.492188)
sample r7.xyzw, r6.xzxx, t0.xyzw, s3
add r5.w, r7.x, r7.x
mul r7.xyz, r5.xyzx, r5.wwww
mad r8.xyz, r0.xyzx, r2.wwww, -r5.xyzx
mad r5.xyz, r0.wwww, r8.xyzx, r5.xyzx
sample r6.xyzw, r6.wzww, t0.xyzw, s3
add r0.w, r6.w, r6.w
mul r2.w, r6.x, l(256.000000)
mul r2.w, r2.w, r2.w
mad r1.xyw, r1.xyxw, r3.wwww, r2.xyxz
dp3 r2.x, r1.xywx, r1.xywx
rsq r2.x, r2.x
mul r1.xyw, r1.xyxw, r2.xxxx
dp3 r1.x, r3.xyzx, r1.xywx
max r1.x, r1.x, l(0.000001)
log r1.x, r1.x
mul r1.x, r1.x, r2.w
exp r1.x, r1.x
mul r1.x, r1.x, r2.w
mul r1.x, r1.x, l(0.031250)
max r1.y, r4.w, l(0.000000)
dp3_sat r1.w, r3.xyzx, r4.xyzx
add r2.x, r4.w, l(0.500000)
max r2.x, r2.x, l(0.000000)
add r1.w, -r1.w, l(1.000000)
mul r2.y, r1.w, r1.w
mul r2.y, r2.y, r2.y
mul r1.w, r1.w, r2.y
mul r0.w, r0.w, r1.w
mul r0.w, r2.x, r0.w
mul r0.w, r0.w, l(2.500000)
mad r0.w, r1.x, r1.y, r0.w
mul r0.w, r1.z, r0.w
mul r1.xyz, r0.wwww, r5.xyzx
mad r0.xyz, r7.xyzx, r0.xyzx, r1.xyzx
min o0.xyz, r0.xyzx, l(31.875000, 31.875000, 31.875000, 0.000000)
ret 
// Approximately 145 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
