// srvCrudeCullInfo (DSS)
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
//
//   using 3Dmigoto v1.3.11 on Sun Nov 25 15:21:27 2018
//
//
// Buffer Definitions:
//
// cbuffer _cbSharedPerViewData
// {
//
//   struct S_cbSharedPerViewData
//   {
//
//       row_major float4x4 mProjection;// Offset:    0
//       row_major float4x4 mProjectionPrev;// Offset:   64
//       row_major float4x4 mViewToViewport;// Offset:  128
//       row_major float4x4 mViewToWorld;// Offset:  192
//       row_major float4x4 mViewToWorldPrev;// Offset:  256
//       row_major float4x4 mFxWorldToSampleSpace;// Offset:  320
//       float4 vViewRemap;             // Offset:  384
//       float4 vViewDepthRemap;        // Offset:  400
//       float4 vEyeVectorUL;           // Offset:  416
//       float4 vEyeVectorLR;           // Offset:  432
//       float4 vEyeVectorDelta;        // Offset:  448
//       float4 vPixelToEyeVectorScaleBias;// Offset:  464
//       float4 vViewSpaceUpVector;     // Offset:  480
//       float4 vViewportSize;          // Offset:  496
//       float4 vTesselationEnabled;    // Offset:  512
//       float4 vEngineTime;            // Offset:  528
//       uint nFrameCounter;            // Offset:  544
//       float4 vShaderColor0;          // Offset:  560
//       float4 vShaderColor1;          // Offset:  576
//       float4 vShaderColor2;          // Offset:  592
//       float4 vShaderColor3;          // Offset:  608
//       float4 vShaderColor4;          // Offset:  624
//       float4 vClipPlane;             // Offset:  640
//       float4 vClipPlane0;            // Offset:  656
//       float4 vClipPlane1;            // Offset:  672
//       float4 vClipPlane2;            // Offset:  688
//       float4 vClipPlane3;            // Offset:  704
//       float4 vClipPlane4;            // Offset:  720
//       float4 vClipPlane5;            // Offset:  736
//       float4 vMippedDepthRemap;      // Offset:  752
//       float4 vSpecularOcclusionSettings;// Offset:  768
//       float4 vSaturatedAmbientOcclusionSettings;// Offset:  784
//       float4 vLightModelSettings;    // Offset:  800
//       float4 vHDRScale;              // Offset:  816
//       float4 vTweakableShaderParams; // Offset:  832
//       float4 vAtmosphericScatteringParameters;// Offset:  848
//       float4 vAtmosphericScatteringParameters2;// Offset:  864
//       float4 vAtmosphericScatteringParameters3;// Offset:  880
//       float3 vAtmosphericScatteringMieBeta;// Offset:  896
//       float3 vAtmosphericScatteringRayleighBeta;// Offset:  912
//       float3 vAtmosphericScatteringShadowedMieBeta;// Offset:  928
//       float3 vAtmosphericScatteringShadowedRayleighBeta;// Offset:  944
//       float3 vAttenuatedSunColor;    // Offset:  960
//       float3 vSunDirectionVS;        // Offset:  976
//       row_major float4x4 mViewToGlobalShadowVSPT;// Offset:  992
//       float4 vWindDirectionAndStrength;// Offset: 1056
//       float4 vWindDirectionAndStrengthPrev;// Offset: 1072
//       float4 vWindInitialDirectionAndStrength;// Offset: 1088
//       float4 vFxFadeParameters;      // Offset: 1104
//       float2 vFxSize;                // Offset: 1120
//       int nEnableGBufferSpecPowerAdjustment;// Offset: 1128
//       int nNumCSMCascades;           // Offset: 1132
//       float fCSMFadeAdd;             // Offset: 1136
//       int nEnableClothBias;          // Offset: 1140
//       int2 viNumTiles;               // Offset: 1144
//       int nLightTileDebugFlags;      // Offset: 1152
//       int nEnableBoxReflections;     // Offset: 1156
//       int nSelectedBoxReflectionId;  // Offset: 1160
//       int nEnableAtmosphericScatteringBackdrop;// Offset: 1164
//       int nEnableSampleFromUICameraBackbuffer;// Offset: 1168
//       int nFallbackRoomMask;         // Offset: 1172
//       float4 vClearColor;            // Offset: 1184
//       float3 vGlobalLightDirectionVS;// Offset: 1200
//       float3 vGlobalLightFrontColor; // Offset: 1216
//       float3 vGlobalLightBackColor;  // Offset: 1232
//       float4 vShadowAtlasSize;       // Offset: 1248
//       float2 vShadowPoissonScale;    // Offset: 1264
//       int nShadowSpotKernel;         // Offset: 1272
//       int nShadowCSMKernel;          // Offset: 1276
//       float4 vJitter;                // Offset: 1280
//       float4 vUnjitter;              // Offset: 1296
//       int nHashedAlphaPeriod;        // Offset: 1312
//       int nIsRenderingOffscreen;     // Offset: 1316
//
//   } cbSharedPerViewData;             // Offset:    0 Size:  1320
//
// }
//
// cbuffer _cbCalculateTileIndices
// {
//
//   struct S_cbCalculateTileIndices
//   {
//
//       int2 viNumTiles;               // Offset:    0
//       int2 viNumMacroTiles;          // Offset:    8
//       int nNumTotalTiles;            // Offset:   16
//       int nNumNonGates;              // Offset:   20
//       int nNumGates;                 // Offset:   24
//       int nDisableTransparent;       // Offset:   28
//
//   } cbCalculateTileIndices;          // Offset:    0 Size:    32
//
// }
//
// Resource bind info for srvCrudeCullInfo
// {
//
//   uint4 $Element;                    // Offset:    0 Size:    16
//
// }
//
// Resource bind info for srvMacroTiles
// {
//
//   uint $Element;                     // Offset:    0 Size:     4
//
// }
//
// Resource bind info for uavObjectIndices
// {
//
//   struct STileData
//   {
//
//       uint nFeatureFlags;            // Offset:    0
//       uint nStartRoomIndex;          // Offset:    4
//       uint anIndices[128];           // Offset:    8
//
//   } $Element;                        // Offset:    0 Size:   520
//
// }
//
// Resource bind info for uavObjectIndicesTransparent
// {
//
//   struct STileDataTransparent
//   {
//
//       uint nStartRoomIndex;          // Offset:    0
//       uint nRoomMask;                // Offset:    4
//       uint anIndices[128];           // Offset:    8
//
//   } $Element;                        // Offset:    0 Size:   520
//
// }
//
// Resource bind info for uavFeaturePermutationTileList
// {
//
//   uint $Element;                     // Offset:    0 Size:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// samplerPointClamp                 sampler      NA          NA    0        1
// srvDepthTexture                   texture  float4          2d    0        1
// srvCrudeCullInfo                  texture  struct         r/o    1        1
// srvMacroTiles                     texture  struct         r/o    2        1
// srvLightModelTexture              texture  float4          2d    3        1
// srvTransparencyMinMaxTexture      texture  float2          2d    4        1
// srvTransparencyBucketsTexture     texture    uint          2d    5        1
// uavObjectIndices                      UAV  struct         r/w    0        1
// uavObjectIndicesTransparent           UAV  struct         r/w    1        1
// uavFeaturePermutationTileList         UAV  struct         r/w    2        1
// uavFeaturePermutationDispatchIndirectBuffer        UAV    uint         buf    3        1
// _cbSharedPerViewData              cbuffer      NA          NA    2        1
// _cbCalculateTileIndices           cbuffer      NA          NA    5        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Input
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Output
cs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb2[32], immediateIndexed
dcl_constantbuffer cb5[2], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_structured t1, 16
dcl_resource_structured t2, 4
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (uint,uint,uint,uint) t5
dcl_uav_structured u0, 520
dcl_uav_structured u1, 520
dcl_uav_structured u2, 4
dcl_uav_typed_buffer (uint,uint,uint,uint) u3
dcl_uav_structured u4, 16
dcl_input vThreadIDInGroupFlattened
dcl_input vThreadGroupID.xy
dcl_input vThreadID.xy
dcl_temps 37
dcl_tgsm_structured g0, 4, 128
dcl_tgsm_structured g1, 4, 128
dcl_tgsm_structured g2, 256, 2
dcl_tgsm_structured g3, 4, 64
dcl_tgsm_structured g4, 4, 64
dcl_tgsm_structured g5, 4, 64
dcl_tgsm_structured g6, 4, 64
dcl_tgsm_structured g7, 4, 64
dcl_tgsm_structured g8, 4, 64
dcl_tgsm_structured g9, 4, 64
dcl_tgsm_structured g10, 4, 64
dcl_tgsm_structured g11, 4, 64
dcl_thread_group 8, 8, 1

dcl_resource_texture2d (float,float,float,float) t125
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture2d)(float,float,float,float) r35.xyzw, l(0, 0, 0, 0), t125.xyzw
ld_indexable(texture1d)(float,float,float,float) r36.xyzw, l(6, 0, 0, 0), t120.xyzw

//
// Initial variable locations:
//   vThreadGroupID.x <- gid.x; vThreadGroupID.y <- gid.y;
//   vThreadID.x <- dtid.x; vThreadID.y <- dtid.y;
//   vThreadIDInGroupFlattened.x <- nLinearGroupThreadId
//
#line 815 "common.fx"
imad r0.x, vThreadGroupID.y, cb5[0].x, vThreadGroupID.x  // r0.x <- <Mad24 return value>

#line 952 "C:\p4\PRJ_PRO\main\assembly\shaders\win32\lighttile.fx"
ushr r0.yz, vThreadGroupID.xxyx, l(0, 2, 2, 0)  // r0.y <- viMacroTileCoord.x; r0.z <- viMacroTileCoord.y
imad r0.y, r0.z, cb5[0].z, r0.y  // r0.y <- nLinearMacroTileId
imul null, r0.z, r0.y, l(1025)  // r0.z <- nMacroTileBase

#line 957
ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r0.z, r0.z, l(0), t2.xxxx  // r0.z <- nMacroTileData
ieq r0.w, r0.z, l(-1)
if_nz r0.w
  if_z vThreadIDInGroupFlattened.x

#line 964
    store_structured u1.x, r0.x, l(4), l(0)
    store_structured u0.xy, r0.x, l(0), l(0,0,0,0)

#line 969
    imm_atomic_iadd r1.x, u3, l(0), l(1)  // r1.x <- nWriteIdx
    imad r1.y, vThreadGroupID.y, l(0x00010000), vThreadGroupID.x
    store_structured u2.x, r1.x, l(0), r1.y
  endif
  ishl r1.x, vThreadIDInGroupFlattened.x, l(2)
  iadd r1.x, r1.x, l(8)
  store_structured u0.x, r0.x, r1.x, l(0)
  store_structured u1.x, r0.x, r1.x, l(0)
endif
if_z r0.w

#line 942
  utof r1.xy, vThreadID.xyxx

#line 955
  imad r0.y, r0.y, l(1025), l(1)  // r0.y <- nMacroTileIndicesBase

#line 979
  ushr r0.w, r0.z, l(16)  // r0.w <- nNumGates
  and r0.z, r0.z, l(0x0000ffff)  // r0.z <- nNumNonGates

#line 986
  mad r1.xy, r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(1.000000, 1.000000, 0.000000, 0.000000)
  mul r1.xy, r1.xyxx, cb2[31].xyxx  // r1.x <- vUV.x; r1.y <- vUV.y
  gather4_indexable(texture2d)(float,float,float,float) r2.xyzw, r1.xyxx, t0.xyzw, s0.x  // r2.x <- vOpaqueDepths.z; r2.y <- vOpaqueDepths.w; r2.z <- vOpaqueDepths.y; r2.w <- vOpaqueDepths.x
  gather4_indexable(texture2d)(float,float,float,float) r1.xyzw, r1.xyxx, t3.xyzw, s0.w  // r1.x <- vLightModels.z; r1.y <- vLightModels.w; r1.z <- vLightModels.y; r1.w <- vLightModels.x
  ne r3.xyzw, r2.wzxy, l(0.000000, 0.000000, 0.000000, 0.000000)
  and r3.xyzw, r3.xyzw, l(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000)
  mul r1.xyzw, r1.wzxy, r3.xyzw  // r1.x <- vLightModels.x; r1.y <- vLightModels.y; r1.z <- vLightModels.z; r1.w <- vLightModels.w

#line 1141 "common.fx"
  lt r3.xyzw, r1.xyzw, l(0.166667, 0.166667, 0.166667, 0.166667)

#line 993 "C:\p4\PRJ_PRO\main\assembly\shaders\win32\lighttile.fx"
  or r3.x, r3.y, r3.x
  or r3.x, r3.z, r3.x
  or r3.x, r3.w, r3.x  // r3.x <- bUsesStandardShading

#line 1146 "common.fx"
  ge r4.xyzw, r1.xyzw, l(0.166667, 0.166667, 0.166667, 0.166667)
  lt r5.xyzw, r1.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
  and r4.xyzw, r4.xyzw, r5.xyzw

#line 994 "C:\p4\PRJ_PRO\main\assembly\shaders\win32\lighttile.fx"
  or r3.y, r4.y, r4.x
  or r3.y, r4.z, r3.y
  or r3.y, r4.w, r3.y  // r3.y <- bUsesSkinShading

#line 1151 "common.fx"
  ge r1.xyzw, r1.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)

#line 995 "C:\p4\PRJ_PRO\main\assembly\shaders\win32\lighttile.fx"
  or r1.x, r1.y, r1.x
  or r1.x, r1.z, r1.x
  or r1.x, r1.w, r1.x  // r1.x <- bUsesHairShading

#line 1037 "common.fx"
  mad r4.xyzw, cb2[24].zzzz, r2.wzxy, -cb2[24].yyyy
  div r4.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000), r4.xyzw  // r4.w <- <RemapDepthLinear return value>

#line 998 "C:\p4\PRJ_PRO\main\assembly\shaders\win32\lighttile.fx"
  lt r2.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000), r2.wzxy
  and r2.xyzw, r2.xyzw, l(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000)
  mul r2.xyzw, r4.xyzw, r2.xyzw  // r2.x <- vMaskedOpaqueLinearDepths.x; r2.y <- vMaskedOpaqueLinearDepths.y; r2.z <- vMaskedOpaqueLinearDepths.z; r2.w <- vMaskedOpaqueLinearDepths.w
  min r1.yz, r4.yywy, r4.xxzx
  min r1.y, r1.z, r1.y  // r1.y <- fOpaqueLinearMinDepth
  max r1.zw, r2.yyyw, r2.xxxz
  max r1.z, r1.w, r1.z  // r1.z <- fOpaqueLinearMaxDepth

#line 1008
  if_z cb5[1].w
    mov r5.xy, vThreadGroupID.xyxx
    mov r5.zw, l(0,0,0,0)
    ld_indexable(texture2d)(float,float,float,float) r3.zw, r5.xyww, t4.zwxy  // r3.z <- vMinMax.x; r3.w <- vMinMax.y

#line 1013
    ld_indexable(texture2d)(uint,uint,uint,uint) r1.w, r5.xyzw, t5.yzwx  // r1.w <- nTransparencyBuckets
  else
    mov r3.zw, l(0,0,10000.000000,-10000.000000)  // r3.z <- fTransparencyLinearMinDepth; r3.w <- fTransparencyLinearMaxDepth
    mov r1.w, l(-1)  // r1.w <- nTransparencyBuckets
  endif

#line 1041
  store_structured g5.x, vThreadIDInGroupFlattened.x, l(0), r1.y
  store_structured g6.x, vThreadIDInGroupFlattened.x, l(0), r1.z
  store_structured g7.x, vThreadIDInGroupFlattened.x, l(0), r3.z
  store_structured g8.x, vThreadIDInGroupFlattened.x, l(0), r3.w
  sync_g_t
  ult r5.x, vThreadIDInGroupFlattened.x, l(32)
  if_nz r5.x
    iadd r5.y, vThreadIDInGroupFlattened.x, l(32)
    ld_structured r5.z, r5.y, l(0), g5.xxxx
    min r1.y, r1.y, r5.z
    store_structured g5.x, vThreadIDInGroupFlattened.x, l(0), r1.y
    ld_structured r1.y, r5.y, l(0), g6.xxxx
    max r1.y, r1.y, r1.z
    store_structured g6.x, vThreadIDInGroupFlattened.x, l(0), r1.y
    ld_structured r1.y, r5.y, l(0), g7.xxxx
    min r1.y, r1.y, r3.z
    store_structured g7.x, vThreadIDInGroupFlattened.x, l(0), r1.y
    ld_structured r1.y, r5.y, l(0), g8.xxxx
    max r1.y, r1.y, r3.w
    store_structured g8.x, vThreadIDInGroupFlattened.x, l(0), r1.y

#line 1052
  endif
  sync_g_t
  ld_structured r1.y, vThreadIDInGroupFlattened.x, l(0), g5.xxxx

#line 1073
  iadd r6.xyzw, vThreadIDInGroupFlattened.xxxx, l(16, 8, 4, 2)

#line 1055
  ld_structured r1.z, r6.x, l(0), g5.xxxx
  min r1.y, r1.z, r1.y
  store_structured g5.x, vThreadIDInGroupFlattened.x, l(0), r1.y
  ld_structured r1.z, vThreadIDInGroupFlattened.x, l(0), g6.xxxx
  ld_structured r3.z, r6.x, l(0), g6.xxxx
  max r1.z, r1.z, r3.z
  store_structured g6.x, vThreadIDInGroupFlattened.x, l(0), r1.z
  ld_structured r3.z, vThreadIDInGroupFlattened.x, l(0), g7.xxxx
  ld_structured r3.w, r6.x, l(0), g7.xxxx
  min r3.z, r3.w, r3.z
  store_structured g7.x, vThreadIDInGroupFlattened.x, l(0), r3.z
  ld_structured r3.w, vThreadIDInGroupFlattened.x, l(0), g8.xxxx
  ld_structured r5.y, r6.x, l(0), g8.xxxx
  max r3.w, r3.w, r5.y
  store_structured g8.x, vThreadIDInGroupFlattened.x, l(0), r3.w
  sync_g_t
  ld_structured r5.y, r6.y, l(0), g5.xxxx
  min r1.y, r1.y, r5.y
  store_structured g5.x, vThreadIDInGroupFlattened.x, l(0), r1.y
  ld_structured r5.y, r6.y, l(0), g6.xxxx
  max r1.z, r1.z, r5.y
  store_structured g6.x, vThreadIDInGroupFlattened.x, l(0), r1.z
  ld_structured r5.y, r6.y, l(0), g7.xxxx
  min r3.z, r3.z, r5.y
  store_structured g7.x, vThreadIDInGroupFlattened.x, l(0), r3.z
  ld_structured r5.y, r6.y, l(0), g8.xxxx
  max r3.w, r3.w, r5.y
  store_structured g8.x, vThreadIDInGroupFlattened.x, l(0), r3.w
  sync_g_t

#line 1067
  ld_structured r5.y, r6.z, l(0), g5.xxxx
  min r1.y, r1.y, r5.y
  store_structured g5.x, vThreadIDInGroupFlattened.x, l(0), r1.y
  ld_structured r5.y, r6.z, l(0), g6.xxxx
  max r1.z, r1.z, r5.y
  store_structured g6.x, vThreadIDInGroupFlattened.x, l(0), r1.z
  ld_structured r5.y, r6.z, l(0), g7.xxxx
  min r3.z, r3.z, r5.y
  store_structured g7.x, vThreadIDInGroupFlattened.x, l(0), r3.z
  ld_structured r5.y, r6.z, l(0), g8.xxxx
  max r3.w, r3.w, r5.y
  store_structured g8.x, vThreadIDInGroupFlattened.x, l(0), r3.w
  sync_g_t
  ld_structured r5.y, r6.w, l(0), g5.xxxx
  min r1.y, r1.y, r5.y
  store_structured g5.x, vThreadIDInGroupFlattened.x, l(0), r1.y
  ld_structured r5.y, r6.w, l(0), g6.xxxx
  max r1.z, r1.z, r5.y
  store_structured g6.x, vThreadIDInGroupFlattened.x, l(0), r1.z
  ld_structured r5.y, r6.w, l(0), g7.xxxx
  min r3.z, r3.z, r5.y
  store_structured g7.x, vThreadIDInGroupFlattened.x, l(0), r3.z
  ld_structured r5.y, r6.w, l(0), g8.xxxx
  max r3.w, r3.w, r5.y
  store_structured g8.x, vThreadIDInGroupFlattened.x, l(0), r3.w
  sync_g_t

#line 1079
  iadd r5.y, vThreadIDInGroupFlattened.x, l(1)
  ld_structured r5.z, r5.y, l(0), g5.xxxx
  min r1.y, r1.y, r5.z
  store_structured g5.x, vThreadIDInGroupFlattened.x, l(0), r1.y
  ld_structured r1.y, r5.y, l(0), g6.xxxx
  max r1.y, r1.y, r1.z
  store_structured g6.x, vThreadIDInGroupFlattened.x, l(0), r1.y
  ld_structured r1.y, r5.y, l(0), g7.xxxx
  min r1.y, r1.y, r3.z
  store_structured g7.x, vThreadIDInGroupFlattened.x, l(0), r1.y
  ld_structured r1.y, r5.y, l(0), g8.xxxx
  max r1.y, r1.y, r3.w
  store_structured g8.x, vThreadIDInGroupFlattened.x, l(0), r1.y
  sync_g_t
  ld_structured r1.y, l(0), l(0), g5.xxxx  // r1.y <- fOpaqueLinearMinDepth
  ld_structured r1.z, l(0), l(0), g6.xxxx  // r1.z <- fOpaqueLinearMaxDepth
  ld_structured r3.z, l(0), l(0), g7.xxxx  // r3.z <- fTransparencyLinearMinDepth
  ld_structured r3.w, l(0), l(0), g8.xxxx  // r3.w <- fTransparencyLinearMaxDepth

#line 1092
  max r1.z, r1.y, r1.z
  ge r5.z, r3.w, r3.z  // r5.z <- bHasTransparency

#line 1119
  if_nz r5.z

#line 382
    add r5.z, -r1.y, r1.z
    mad r5.z, r5.z, l(0.500000), r1.y  // r5.z <- fOpaqueLinearMidDepth

#line 390
    iadd r7.xyzw, r4.xyzw, -r5.zzzz  // r7.x <- nOpaqueLinearDepth00; r7.y <- nOpaqueLinearDepth01; r7.z <- nOpaqueLinearDepth10; r7.w <- nOpaqueLinearDepth11

#line 395
    iadd r8.xyzw, r2.xyzw, -r5.zzzz  // r8.x <- _nOpaqueLinearDepth00; r8.y <- _nOpaqueLinearDepth01; r8.z <- _nOpaqueLinearDepth10; r8.w <- _nOpaqueLinearDepth11
    umax r8.xy, r8.ywyy, r8.xzxx
    umax r5.w, r8.y, r8.x  // r5.w <- nOpaqueLinearMidDepth0
    umin r7.xy, r7.ywyy, r7.xzxx
    umin r7.x, r7.y, r7.x  // r7.x <- nOpaqueLinearMidDepth1

#line 419
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r5.w
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r7.x
    sync_g_t
    if_nz r5.x
      iadd r7.y, vThreadIDInGroupFlattened.x, l(32)
      ld_structured r7.z, r7.y, l(0), g9.xxxx
      umax r5.w, r5.w, r7.z
      store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r5.w
      ld_structured r5.w, r7.y, l(0), g10.xxxx
      umin r5.w, r5.w, r7.x
      store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r5.w
    endif
    sync_g_t
    ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g9.xxxx
    ld_structured r7.x, r6.x, l(0), g9.xxxx
    umax r5.w, r5.w, r7.x
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r5.w

#line 430
    ld_structured r7.x, vThreadIDInGroupFlattened.x, l(0), g10.xxxx
    ld_structured r7.y, r6.x, l(0), g10.xxxx
    umin r7.x, r7.y, r7.x
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r7.x
    sync_g_t
    ld_structured r7.y, r6.y, l(0), g9.xxxx
    umax r5.w, r5.w, r7.y
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r5.w
    ld_structured r7.y, r6.y, l(0), g10.xxxx
    umin r7.x, r7.y, r7.x
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r7.x
    sync_g_t
    ld_structured r7.y, r6.z, l(0), g9.xxxx
    umax r5.w, r5.w, r7.y
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r5.w
    ld_structured r7.y, r6.z, l(0), g10.xxxx
    umin r7.x, r7.y, r7.x
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r7.x
    sync_g_t

#line 441
    ld_structured r7.y, r6.w, l(0), g9.xxxx
    umax r5.w, r5.w, r7.y
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r5.w
    ld_structured r7.y, r6.w, l(0), g10.xxxx
    umin r7.x, r7.y, r7.x
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r7.x
    sync_g_t
    ld_structured r7.y, r5.y, l(0), g9.xxxx
    umax r5.w, r5.w, r7.y
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r5.w
    ld_structured r5.w, r5.y, l(0), g10.xxxx
    umin r5.w, r5.w, r7.x
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r5.w
    sync_g_t
    ld_structured r5.w, l(0), l(0), g9.xxxx
    iadd r5.w, r5.z, r5.w  // r5.w <- fOpaqueLinearMidDepth0
    ld_structured r7.x, l(0), l(0), g10.xxxx
    iadd r5.z, r5.z, r7.x  // r5.z <- fOpaqueLinearMidDepth1

#line 452
    max r5.w, r1.y, r5.w

#line 474
    ishl r7.xy, vThreadGroupID.xyxx, l(4, 4, 0, 0)
    utof r7.xy, r7.xyxx  // r7.x <- nTilePixelCoord00.x; r7.y <- nTilePixelCoord00.y
    add r7.xy, r7.xyxx, l(7.500000, 7.500000, 0.000000, 0.000000)
    mad r7.xy, r7.xyxx, cb2[29].xyxx, cb2[29].zwzz  // r7.x <- vTileCenterEye.x; r7.y <- vTileCenterEye.y

#line 478
    add r8.z, r1.y, r5.w
    mov r7.z, l(-0.500000)
    mul r8.xy, r8.zzzz, l(0.500000, 0.500000, 0.000000, 0.000000)
    mul r8.xyz, r7.xyzx, r8.xyzx  // r8.x <- vTileBoundingSphereCenter0.x; r8.y <- vTileBoundingSphereCenter0.y; r8.z <- vTileBoundingSphereCenter0.z

// Adjust tile center 0 -DarkStarSword
add r35.w, r8.z, -r35.y
mul r35.w, r35.w, r35.x
mul r35.w, r35.w, l(0.5)
div r35.w, r35.w, cb2[0].x
add r8.x, r8.x, r35.w

    mad r9.xy, |cb2[29].xyxx|, l(7.500000, 7.500000, 0.000000, 0.000000), |r7.xyxx|
    mov r9.z, l(1.000000)
    mad r10.xyz, r9.xyzx, r5.wwww, -|r8.xyzx|  // r10.x <- vDelta0.x; r10.y <- vDelta0.y; r10.z <- vDelta0.z
    dp3 r5.w, r10.xyzx, r10.xyzx  // r5.w <- fTileBoundingSphereRadiusSquared0
    sqrt r7.w, r5.w  // r7.w <- fTileBoundingSphereRadius0
    add r10.z, r1.z, r5.z
    mul r10.xy, r10.zzzz, l(0.500000, 0.500000, 0.000000, 0.000000)
    mul r10.xyz, r7.xyzx, r10.xyzx  // r10.x <- vTileBoundingSphereCenter1.x; r10.y <- vTileBoundingSphereCenter1.y; r10.z <- vTileBoundingSphereCenter1.z

// Adjust tile center 0 -DarkStarSword
add r35.w, r10.z, -r35.y
mul r35.w, r35.w, r35.x
mul r35.w, r35.w, l(0.5)
div r35.w, r35.w, cb2[0].x
add r10.x, r10.x, r35.w

    mad r11.xyz, r9.xyzx, r1.zzzz, -|r10.xyzx|  // r11.x <- vDelta1.x; r11.y <- vDelta1.y; r11.z <- vDelta1.z
    dp3 r5.z, r11.xyzx, r11.xyzx  // r5.z <- fTileBoundingSphereRadiusSquared1
    sqrt r9.w, r5.z  // r9.w <- fTileBoundingSphereRadius1

#line 492
    and r11.x, r1.w, l(0x0000ffff)
    firstbit_hi r11.y, r11.x
    ushr r11.z, r1.w, l(16)
    firstbit_lo r11.z, r11.z
    iadd r11.z, r11.z, l(16)  // r11.z <- nHighBit

#line 497
    add r11.w, -r3.z, r3.w
    iadd r11.y, -r11.y, l(32)
    utof r11.y, r11.y
    movc r11.x, r11.x, r11.y, l(0)
    mul r11.x, r11.w, r11.x
    mad r11.x, r11.x, l(0.031250), r3.z  // r11.x <- fTransparencyLinearMidDepth0
    utof r11.y, r11.z
    mul r11.y, r11.w, r11.y
    mad r11.y, r11.y, l(0.031250), r3.z  // r11.y <- fTransparencyLinearMidDepth1
    add r12.z, r3.z, r11.x
    mul r12.xy, r12.zzzz, l(0.500000, 0.500000, 0.000000, 0.000000)
    mul r12.xyz, r7.xyzx, r12.xyzx  // r12.x <- vTransparentTileBoundingSphereCenter0.x; r12.y <- vTransparentTileBoundingSphereCenter0.y; r12.z <- vTransparentTileBoundingSphereCenter0.z

// Adjust transparent tile center 0 -DarkStarSword
add r35.w, r12.z, -r35.y
mul r35.w, r35.w, r35.x
mul r35.w, r35.w, l(0.5)
div r35.w, r35.w, cb2[0].x
add r12.x, r12.x, r35.w

    mad r13.xyz, r9.xyzx, r11.xxxx, -|r12.xyzx|  // r13.x <- vTransparentDelta0.x; r13.y <- vTransparentDelta0.y; r13.z <- vTransparentDelta0.z
    dp3 r11.x, r13.xyzx, r13.xyzx  // r11.x <- fTransparentTileBoundingSphereRadiusSquared0
    sqrt r11.z, r11.x  // r11.z <- fTransparentTileBoundingSphereRadius0
    add r13.z, r3.w, r11.y
    mul r13.xy, r13.zzzz, l(0.500000, 0.500000, 0.000000, 0.000000)
    mul r13.xyz, r7.xyzx, r13.xyzx  // r13.x <- vTransparentTileBoundingSphereCenter1.x; r13.y <- vTransparentTileBoundingSphereCenter1.y; r13.z <- vTransparentTileBoundingSphereCenter1.z

// Adjust transparent tile center 1 -DarkStarSword
add r35.w, r13.z, -r35.y
mul r35.w, r35.w, r35.x
mul r35.w, r35.w, l(0.5)
div r35.w, r35.w, cb2[0].x
add r13.x, r13.x, r35.w

    mad r7.xyz, r9.xyzx, r11.yyyy, -|r13.xyzx|  // r7.x <- vTransparentDelta1.x; r7.y <- vTransparentDelta1.y; r7.z <- vTransparentDelta1.z

#line 508
    dp3 r7.x, r7.xyzx, r7.xyzx  // r7.x <- fTransparentTileBoundingSphereRadiusSquared1
    sqrt r7.y, r7.x  // r7.y <- fTransparentTileBoundingSphereRadius1

#line 514
    iadd r7.z, r0.z, l(63)
    ushr r7.z, r7.z, l(6)  // r7.z <- nNumNonGatePasses

#line 531
    if_nz r0.w
      iadd r9.x, r0.w, l(63)
      ushr r9.x, r9.x, l(6)  // r9.x <- nNumGatePasses

#line 78
      ishl r9.y, vThreadIDInGroupFlattened.x, l(2)

#line 86
      uge r14.xyzw, vThreadIDInGroupFlattened.xxxx, l(1, 2, 4, 8)
      iadd r15.xyzw, r9.yyyy, l(-4, -8, -16, -32)
      uge r16.xy, vThreadIDInGroupFlattened.xxxx, l(16, 32, 0, 0)
      iadd r16.zw, r9.yyyy, l(0, 0, -64, -128)

#line 328
      mov r8.w, l(1.000000)
      mov r10.w, l(1.000000)
      mov r12.w, l(1.000000)
      mov r13.w, l(1.000000)

#line 535
      mov r9.z, l(0)  // r9.z <- nNumFineIndices
      mov r11.y, l(0)  // r11.y <- nNumFineIndicesTransparent
      mov r17.xyz, l(0,0,0,0)  // r17.x <- nLaneVisibleRooms; r17.y <- nLaneVisibleRoomsTransparent; r17.z <- j
      loop
        uge r17.w, r17.z, r9.x
        breakc_nz r17.w
        bfi r17.w, l(26), l(6), r17.z, vThreadIDInGroupFlattened.x  // r17.w <- i

#line 540
        iadd r18.x, r0.y, r17.w
        ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r18.x, r18.x, l(0), t2.xxxx  // r18.x <- nObjectIdx

#line 553
        ult r17.w, r17.w, r0.w
        if_nz r17.w
          imul null, r17.w, r18.x, l(12)
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r19.xyzw, r17.w, l(0), t1.xyzw  // r19.x <- Data.x; r19.y <- Data.y; r19.z <- Data.z; r19.w <- Data.w

#line 560
          ubfe r18.yz, l(0, 14, 14, 0), l(0, 14, 14, 0), r19.xxyx  // r18.y <- nTileMinY; r18.z <- nTileDeltaY
          f16tof32 r17.w, r19.z  // r17.w <- fTileMinZ
          and r20.xyz, r19.wxyw, l(0x0000ffff, 0x00003fff, 0x00003fff, 0)  // r20.x <- nRoomIdx0; r20.y <- nTileMinX; r20.z <- nTileDeltaX
          ushr r19.xy, r19.wxww, l(16, 28, 0, 0)  // r19.x <- nRoomIdx1; r19.y <- nObjectType

//if_z vThreadIDInGroupFlattened.x
//	store_structured u4.x, vThreadGroupID.x, l(0), r17.w
//endif

add r35.z, r17.w, -r35.y       // fTileMinZ - convergence
mul r35.z, r35.z, r35.x        // * separation
mul r35.z, r35.z, l(0.5)       // clip -> screen
div r35.z, r35.z, r17.w        // Perspective divide
utof r36.y, cb5[0].x           //   (float)viNumTiles.x
mul r35.z, r35.z, r36.y        // * (float)viNumTiles.x

//mul r35.z, r35.z, r36.x        // IniParams debugging
//if_z vThreadIDInGroupFlattened.x
//	store_structured u4.y, vThreadGroupID.x, l(0), r35.z
//endif

round_ne r35.z, r35.z
ftoi r35.z, r35.z
if_nz r20.y
	iadd r20.y, r20.y, r35.z       // Adjust nTileMinX based on fTileMaxZ
endif
iadd r20.z, r20.z, |r35.z|     // Adjust nTileDeltaX to counter nTileMinX adjustment

// Disable tile bounds (bye bye performance) -DarkStarSword:
//mov r20.y, l(0)
//mov r20.z, cb5[0].x

#line 568
          imad r19.zw, r18.xxxx, l(0, 0, 12, 12), l(0, 0, 1, 3)
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r21.xyzw, r19.z, l(0), t1.xyzw  // r21.x <- vRow0.x; r21.y <- vRow0.y; r21.z <- vRow0.z; r21.w <- vRow0.w
          imad r18.w, r18.x, l(12), l(2)
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r22.xyzw, r18.w, l(0), t1.xyzw  // r22.x <- vRow1.x; r22.y <- vRow1.y; r22.z <- vRow1.z; r22.w <- vRow1.w
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r23.xyzw, r19.w, l(0), t1.xyzw  // r23.x <- vRow2.x; r23.y <- vRow2.y; r23.z <- vRow2.z; r23.w <- vRow2.w

#line 572
          imad r24.xyzw, r18.xxxx, l(12, 12, 12, 12), l(4, 5, 6, 7)

#line 569
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r25.xz, r24.x, l(0), t1.xxyx  // r25.x <- vHalfSize.x; r25.z <- vHalfSize.y
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r26.xyzw, r24.y, l(0), t1.xyzw  // r26.x <- vParams0.x; r26.y <- vParams0.y; r26.z <- vParams0.z; r26.w <- vParams0.w
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r27.xyzw, r24.z, l(0), t1.xyzw  // r27.x <- vParams1.x; r27.y <- vParams1.y; r27.z <- vParams1.z; r27.w <- vParams1.w
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r24.xyz, r24.w, l(0), t1.xyzx  // r24.x <- vPlane0.x; r24.y <- vPlane0.y; r24.z <- vPlane0.z

#line 576
          imad r28.xyzw, r18.xxxx, l(12, 12, 12, 12), l(8, 9, 10, 11)

#line 573
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r29.xyz, r28.x, l(0), t1.xyzx  // r29.x <- vPlane1.x; r29.y <- vPlane1.y; r29.z <- vPlane1.z
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r30.xyz, r28.y, l(0), t1.xyzx  // r30.x <- vPlane2.x; r30.y <- vPlane2.y; r30.z <- vPlane2.z
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r28.xyz, r28.z, l(0), t1.xyzx  // r28.x <- vPlane3.x; r28.y <- vPlane3.y; r28.z <- vPlane3.z
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r31.xyzw, r28.w, l(0), t1.xyzw  // r31.x <- vPlane4.x; r31.y <- vPlane4.y; r31.z <- vPlane4.z; r31.w <- vPlane4.w

#line 328
          dp4 r32.x, r21.xyzw, r8.xyzw  // r32.x <- vLocalPos.x; r32.x <- vLocalPos.x; r32.x <- vLocalPos.x; r32.x <- vLocalPos.x
          dp4 r32.y, r22.xyzw, r8.xyzw  // r32.y <- vLocalPos.y; r32.y <- vLocalPos.y; r32.y <- vLocalPos.y; r32.y <- vLocalPos.y
          dp4 r32.z, r23.xyzw, r8.xyzw  // r32.z <- vLocalPos.z; r32.z <- vLocalPos.z; r32.z <- vLocalPos.z; r32.z <- vLocalPos.z
          ge r18.w, r32.y, l(0.000000)
          movc r33.xyzw, r18.wwww, r26.xyzw, r27.xyzw  // r33.x <- vParams.x; r33.y <- vParams.y; r33.z <- vParams.z; r33.w <- vParams.w; r33.x <- vParams.x; r33.y <- vParams.y; r33.z <- vParams.z; r33.w <- vParams.w; r33.x <- vParams.x; r33.y <- vParams.y; r33.z <- vParams.z; r33.w <- vParams.w; r33.x <- vParams.x; r33.y <- vParams.y; r33.z <- vParams.z; r33.w <- vParams.w

#line 333
          mov r25.y, r33.x
          add r32.xzw, -r25.xxyz, |r32.xxyz|
          max r34.xyz, r32.xzwx, l(0.000000, 0.000000, 0.000000, 0.000000)  // r34.x <- vBoxDelta.x; r34.y <- vBoxDelta.y; r34.z <- vBoxDelta.z; r34.x <- vBoxDelta.x; r34.y <- vBoxDelta.y; r34.z <- vBoxDelta.z; r34.x <- vBoxDelta.x; r34.y <- vBoxDelta.y; r34.z <- vBoxDelta.z; r34.x <- vBoxDelta.x; r34.y <- vBoxDelta.y; r34.z <- vBoxDelta.z
          add r18.w, -|r32.y|, r33.x
          ge r18.w, r7.w, r18.w
          add r19.z, r33.y, r33.x
          add r19.z, -r19.z, |r32.y|
          ge r19.z, r7.w, r19.z
          and r18.w, r18.w, r19.z
          dp2 r19.z, r33.zwzz, r32.xzxx
          ge r19.z, r7.w, r19.z
          and r18.w, r18.w, r19.z
          dp2 r19.z, r33.wzww, r32.zwzz
          ge r19.z, r7.w, r19.z
          and r18.w, r18.w, r19.z  // r18.w <- bInsideFrustumB; r18.w <- bInsideFrustumB; r18.w <- bInsideFrustumB; r18.w <- bInsideFrustumB

#line 339
          dp3 r19.z, r8.xyzx, r24.xyzx  // r19.z <- fDistB0; r19.z <- fDistB0; r19.z <- fDistB0; r19.z <- fDistB0
          dp3 r19.w, r8.xyzx, r29.xyzx  // r19.w <- fDistB1; r19.w <- fDistB1; r19.w <- fDistB1; r19.w <- fDistB1
          dp3 r20.w, r8.xyzx, r30.xyzx  // r20.w <- fDistB2; r20.w <- fDistB2; r20.w <- fDistB2; r20.w <- fDistB2
          dp3 r24.w, r8.xyzx, r28.xyzx  // r24.w <- fDistB3; r24.w <- fDistB3; r24.w <- fDistB3; r24.w <- fDistB3
          dp3 r28.w, r8.xyzx, r31.xyzx
          add r28.w, r31.w, r28.w  // r28.w <- fDistB4; r28.w <- fDistB4; r28.w <- fDistB4; r28.w <- fDistB4
          max r19.z, r19.w, r19.z
          max r19.w, r20.w, r24.w
          max r19.z, r19.w, r19.z
          max r19.z, r28.w, r19.z  // r19.z <- fMaxDist; r19.z <- fMaxDist; r19.z <- fMaxDist; r19.z <- fMaxDist
          dp3 r19.w, r34.xyzx, r34.xyzx
          ge r19.w, r5.w, r19.w  // r19.w <- bInsideBox; r19.w <- bInsideBox; r19.w <- bInsideBox; r19.w <- bInsideBox
          ge r19.z, r7.w, r19.z  // r19.z <- bInsideGate; r19.z <- bInsideGate; r19.z <- bInsideGate; r19.z <- bInsideGate

#line 328
          dp4 r32.x, r21.xyzw, r10.xyzw  // r32.x <- vLocalPos.x; r32.x <- vLocalPos.x; r32.x <- vLocalPos.x
          dp4 r32.y, r22.xyzw, r10.xyzw
          dp4 r32.z, r23.xyzw, r10.xyzw  // r32.z <- vLocalPos.z; r32.z <- vLocalPos.z; r32.z <- vLocalPos.z
          ge r20.w, r32.y, l(0.000000)
          movc r33.xyzw, r20.wwww, r26.xyzw, r27.xyzw

#line 333
          mov r25.w, r33.x
          add r32.xzw, -r25.xxwz, |r32.xxyz|
          max r34.xyz, r32.xzwx, l(0.000000, 0.000000, 0.000000, 0.000000)
          add r20.w, -|r32.y|, r33.x
          ge r20.w, r9.w, r20.w
          add r24.w, r33.y, r33.x
          add r24.w, -r24.w, |r32.y|
          ge r24.w, r9.w, r24.w
          and r20.w, r20.w, r24.w
          dp2 r24.w, r33.zwzz, r32.xzxx
          ge r24.w, r9.w, r24.w
          and r20.w, r20.w, r24.w
          dp2 r24.w, r33.wzww, r32.zwzz
          ge r24.w, r9.w, r24.w
          and r20.w, r20.w, r24.w  // r20.w <- bInsideFrustumB; r20.w <- bInsideFrustumB; r20.w <- bInsideFrustumB

#line 339
          dp3 r24.w, r10.xyzx, r24.xyzx  // r24.w <- fDistB0; r24.w <- fDistB0; r24.w <- fDistB0
          dp3 r28.w, r10.xyzx, r29.xyzx  // r28.w <- fDistB1; r28.w <- fDistB1; r28.w <- fDistB1
          dp3 r29.w, r10.xyzx, r30.xyzx  // r29.w <- fDistB2; r29.w <- fDistB2; r29.w <- fDistB2
          dp3 r30.w, r10.xyzx, r28.xyzx  // r30.w <- fDistB3; r30.w <- fDistB3; r30.w <- fDistB3
          dp3 r32.x, r10.xyzx, r31.xyzx
          add r32.x, r31.w, r32.x  // r32.x <- fDistB4; r32.x <- fDistB4; r32.x <- fDistB4
          max r24.w, r24.w, r28.w
          max r28.w, r29.w, r30.w
          max r24.w, r24.w, r28.w
          max r24.w, r32.x, r24.w  // r24.w <- fMaxDist; r24.w <- fMaxDist; r24.w <- fMaxDist
          dp3 r28.w, r34.xyzx, r34.xyzx
          ge r28.w, r5.z, r28.w  // r28.w <- bInsideBox; r28.w <- bInsideBox; r28.w <- bInsideBox
          ge r24.w, r9.w, r24.w  // r24.w <- bInsideGate; r24.w <- bInsideGate; r24.w <- bInsideGate

#line 584
          or r19.w, r19.w, r28.w  // r19.w <- bInsideBox
          or r18.w, r18.w, r20.w  // r18.w <- bInsideFrustum
          or r19.z, r19.z, r24.w  // r19.z <- bInsideGate
          or r18.w, r18.w, r19.w  // r18.w <- bInsideFadeRegion
          iadd r19.w, -r20.y, vThreadGroupID.x
          ult r19.w, r19.w, r20.z
          iadd r18.y, -r18.y, vThreadGroupID.y
          ult r18.y, r18.y, r18.z
          and r18.y, r18.y, r19.w
          ge r18.z, r1.z, r17.w
          and r18.z, r18.z, r18.y
          or r18.w, r18.w, r19.z
          and r18.z, r18.w, r18.z  // r18.z <- bVisible

#line 328
          dp4 r32.x, r21.xyzw, r12.xyzw  // r32.x <- vLocalPos.x; r32.x <- vLocalPos.x
          dp4 r32.y, r22.xyzw, r12.xyzw
          dp4 r32.z, r23.xyzw, r12.xyzw  // r32.z <- vLocalPos.z; r32.z <- vLocalPos.z
          ge r18.w, r32.y, l(0.000000)
          movc r33.xyzw, r18.wwww, r26.xyzw, r27.xyzw

#line 333
          mov r25.y, r33.x
          add r20.yzw, -r25.xxyz, |r32.xxyz|
          max r32.xzw, r20.yyzw, l(0.000000, 0.000000, 0.000000, 0.000000)  // r32.x <- vBoxDelta.x; r32.z <- vBoxDelta.y; r32.w <- vBoxDelta.z; r32.x <- vBoxDelta.x; r32.z <- vBoxDelta.y; r32.w <- vBoxDelta.z
          add r18.w, -|r32.y|, r33.x
          ge r18.w, r11.z, r18.w
          add r19.z, r33.y, r33.x
          add r19.z, -r19.z, |r32.y|
          ge r19.z, r11.z, r19.z
          and r18.w, r18.w, r19.z
          dp2 r19.z, r33.zwzz, r20.yzyy
          ge r19.z, r11.z, r19.z
          and r18.w, r18.w, r19.z
          dp2 r19.z, r33.wzww, r20.zwzz
          ge r19.z, r11.z, r19.z
          and r18.w, r18.w, r19.z  // r18.w <- bInsideFrustumB; r18.w <- bInsideFrustumB

#line 339
          dp3 r19.z, r12.xyzx, r24.xyzx  // r19.z <- fDistB0; r19.z <- fDistB0
          dp3 r19.w, r12.xyzx, r29.xyzx  // r19.w <- fDistB1; r19.w <- fDistB1
          dp3 r20.y, r12.xyzx, r30.xyzx  // r20.y <- fDistB2; r20.y <- fDistB2
          dp3 r20.z, r12.xyzx, r28.xyzx  // r20.z <- fDistB3; r20.z <- fDistB3
          dp3 r20.w, r12.xyzx, r31.xyzx
          add r20.w, r31.w, r20.w  // r20.w <- fDistB4; r20.w <- fDistB4
          max r19.z, r19.w, r19.z
          max r19.w, r20.z, r20.y
          max r19.z, r19.w, r19.z
          max r19.z, r20.w, r19.z  // r19.z <- fMaxDist; r19.z <- fMaxDist
          dp3 r19.w, r32.xzwx, r32.xzwx
          ge r19.zw, r11.zzzx, r19.zzzw  // r19.w <- bInsideBox; r19.z <- bInsideGate; r19.w <- bInsideBox; r19.z <- bInsideGate

#line 328
          dp4 r21.x, r21.xyzw, r13.xyzw  // r21.x <- vLocalPos.x
          dp4 r21.y, r22.xyzw, r13.xyzw  // r21.y <- vLocalPos.y
          dp4 r21.z, r23.xyzw, r13.xyzw  // r21.z <- vLocalPos.z
          ge r20.y, r21.y, l(0.000000)
          movc r22.xyzw, r20.yyyy, r26.xyzw, r27.xyzw  // r22.x <- vParams.x; r22.y <- vParams.y; r22.z <- vParams.z; r22.w <- vParams.w

#line 333
          mov r25.w, r22.x
          add r20.yzw, -r25.xxwz, |r21.xxyz|
          max r21.xzw, r20.yyzw, l(0.000000, 0.000000, 0.000000, 0.000000)  // r21.x <- vBoxDelta.x; r21.z <- vBoxDelta.y; r21.w <- vBoxDelta.z
          add r23.x, -|r21.y|, r22.x
          ge r23.x, r7.y, r23.x
          add r22.x, r22.y, r22.x
          add r21.y, |r21.y|, -r22.x
          ge r21.y, r7.y, r21.y
          and r21.y, r21.y, r23.x
          dp2 r20.y, r22.zwzz, r20.yzyy
          ge r20.y, r7.y, r20.y
          and r20.y, r20.y, r21.y
          dp2 r20.z, r22.wzww, r20.zwzz
          ge r20.z, r7.y, r20.z
          and r20.y, r20.z, r20.y  // r20.y <- bInsideFrustumB

#line 339
          dp3 r20.z, r13.xyzx, r24.xyzx  // r20.z <- fDistB0
          dp3 r20.w, r13.xyzx, r29.xyzx  // r20.w <- fDistB1
          dp3 r21.y, r13.xyzx, r30.xyzx  // r21.y <- fDistB2
          dp3 r22.x, r13.xyzx, r28.xyzx  // r22.x <- fDistB3
          dp3 r22.y, r13.xyzx, r31.xyzx
          add r22.y, r31.w, r22.y  // r22.y <- fDistB4
          max r20.z, r20.w, r20.z
          max r20.w, r21.y, r22.x
          max r20.z, r20.w, r20.z
          max r20.z, r22.y, r20.z  // r20.z <- fMaxDist
          dp3 r20.w, r21.xzwx, r21.xzwx
          ge r20.zw, r7.yyyx, r20.zzzw  // r20.w <- bInsideBox; r20.z <- bInsideGate

#line 603
          or r18.w, r18.w, r20.y  // r18.w <- bTransparentInsideFrustum
          or r19.zw, r19.zzzw, r20.zzzw  // r19.w <- bTransparentInsideBox; r19.z <- bTransparentInsideGate

#line 606
          or r18.w, r18.w, r19.w  // r18.w <- bTransparentInsideFadeRegion
          ge r17.w, r3.w, r17.w
          and r17.w, r17.w, r18.y
          or r18.y, r18.w, r19.z
          and r17.w, r17.w, r18.y  // r17.w <- bVisibleTransparent

#line 618
        else
          mov r20.x, l(0)  // r20.x <- nRoomIdx0
          mov r18.z, l(0)  // r18.z <- bVisible
          mov r17.w, l(0)  // r17.w <- bVisibleTransparent
          mov r19.xy, l(0,0,0,0)  // r19.x <- nRoomIdx1; r19.y <- nObjectType
        endif

#line 76
        sync_g_t
        and r18.y, r18.z, l(1)
        store_structured g2.x, l(0), r9.y, r18.y
        sync_g_t

#line 86
        ld_structured r18.yw, l(0), r15.x, g2.xxxy
        and r18.y, r14.x, r18.y
        iadd r18.y, r18.y, r18.w
        store_structured g2.x, l(1), r9.y, r18.y
        sync_g_t
        ld_structured r18.y, l(1), r9.y, g2.xxxx
        ld_structured r18.w, l(1), r15.y, g2.xxxx
        and r18.w, r14.y, r18.w
        iadd r18.y, r18.w, r18.y
        store_structured g2.x, l(0), r9.y, r18.y
        sync_g_t
        ld_structured r18.y, l(0), r9.y, g2.xxxx
        ld_structured r18.w, l(0), r15.z, g2.xxxx
        and r18.w, r14.z, r18.w
        iadd r18.y, r18.w, r18.y
        store_structured g2.x, l(1), r9.y, r18.y
        sync_g_t
        ld_structured r18.y, l(1), r9.y, g2.xxxx
        ld_structured r18.w, l(1), r15.w, g2.xxxx
        and r18.w, r14.w, r18.w
        iadd r18.y, r18.w, r18.y
        store_structured g2.x, l(0), r9.y, r18.y
        sync_g_t
        ld_structured r18.y, l(0), r9.y, g2.xxxx
        ld_structured r18.w, l(0), r16.z, g2.xxxx
        and r18.w, r16.x, r18.w
        iadd r18.y, r18.w, r18.y
        store_structured g2.x, l(1), r9.y, r18.y
        sync_g_t
        ld_structured r18.y, l(1), r9.y, g2.xxxx
        ld_structured r18.w, l(1), r16.w, g2.xxxx
        and r18.w, r16.y, r18.w
        iadd r18.y, r18.w, r18.y
        store_structured g2.x, l(0), r9.y, r18.y
        sync_g_t

#line 90
        ld_structured r18.y, l(0), l(252), g2.xxxx  // r18.y <- nTotal
        ld_structured r18.w, l(0), r9.y, g2.xxxx
        iadd r18.w, r9.z, r18.w

#line 623
        iadd r18.w, r18.w, l(-1)  // r18.w <- nDest
        ishl r19.z, l(1), r20.x
        bfi r19.x, l(1), r19.x, l(1), r19.z  // r19.x <- nRoomMask
        ult r19.z, r18.w, l(1023)
        and r18.z, r18.z, r19.z
        if_nz r18.z
          ishl r18.z, r19.y, l(12)
          iadd r18.z, r18.z, r18.x
          store_structured g0.x, r18.w, l(0), r18.z
          or r17.x, r17.x, r19.x
        endif

#line 76
        sync_g_t
        and r18.z, r17.w, l(1)
        store_structured g2.x, l(0), r9.y, r18.z
        sync_g_t

#line 86
        ld_structured r18.zw, l(0), r15.x, g2.xxxy
        and r18.z, r14.x, r18.z
        iadd r18.z, r18.z, r18.w
        store_structured g2.x, l(1), r9.y, r18.z
        sync_g_t
        ld_structured r18.z, l(1), r9.y, g2.xxxx
        ld_structured r18.w, l(1), r15.y, g2.xxxx
        and r18.w, r14.y, r18.w
        iadd r18.z, r18.w, r18.z
        store_structured g2.x, l(0), r9.y, r18.z
        sync_g_t
        ld_structured r18.z, l(0), r9.y, g2.xxxx
        ld_structured r18.w, l(0), r15.z, g2.xxxx
        and r18.w, r14.z, r18.w
        iadd r18.z, r18.w, r18.z
        store_structured g2.x, l(1), r9.y, r18.z
        sync_g_t
        ld_structured r18.z, l(1), r9.y, g2.xxxx
        ld_structured r18.w, l(1), r15.w, g2.xxxx
        and r18.w, r14.w, r18.w
        iadd r18.z, r18.w, r18.z
        store_structured g2.x, l(0), r9.y, r18.z
        sync_g_t
        ld_structured r18.z, l(0), r9.y, g2.xxxx
        ld_structured r18.w, l(0), r16.z, g2.xxxx
        and r18.w, r16.x, r18.w
        iadd r18.z, r18.w, r18.z
        store_structured g2.x, l(1), r9.y, r18.z
        sync_g_t
        ld_structured r18.z, l(1), r9.y, g2.xxxx
        ld_structured r18.w, l(1), r16.w, g2.xxxx
        and r18.w, r16.y, r18.w
        iadd r18.z, r18.w, r18.z
        store_structured g2.x, l(0), r9.y, r18.z
        sync_g_t

#line 90
        ld_structured r18.z, l(0), l(252), g2.xxxx  // r18.z <- nTotal
        ld_structured r18.w, l(0), r9.y, g2.xxxx
        iadd r18.w, r11.y, r18.w

#line 636
        iadd r18.w, r18.w, l(-1)  // r18.w <- nDestTransparent
        ult r19.z, r18.w, l(127)
        and r17.w, r17.w, r19.z
        if_nz r17.w
          ishl r17.w, r19.y, l(12)
          iadd r17.w, r17.w, r18.x
          store_structured g1.x, r18.w, l(0), r17.w
          or r17.y, r17.y, r19.x
        endif
        iadd r9.z, r9.z, r18.y
        iadd r11.y, r11.y, r18.z

#line 648
        iadd r17.z, r17.z, l(1)
      endloop

#line 651
      umin r5.z, r9.z, l(127)  // r5.z <- nNumVisibleGates
      umin r5.w, r11.y, l(127)  // r5.w <- nNumVisibleGatesTransparent

#line 655
      ult r7.x, l(0), r5.z
      ult r5.w, l(0), r5.w
      or r5.w, r5.w, r7.x
      if_nz r5.w

#line 679
        store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r17.x
        store_structured g4.x, vThreadIDInGroupFlattened.x, l(0), r17.y
        sync_g_t
        if_nz r5.x
          iadd r5.w, vThreadIDInGroupFlattened.x, l(32)
          ld_structured r7.x, r5.w, l(0), g3.xxxx
          or r7.x, r7.x, r17.x
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r7.x
          ld_structured r5.w, r5.w, l(0), g4.xxxx
          or r5.w, r5.w, r17.y
          store_structured g4.x, vThreadIDInGroupFlattened.x, l(0), r5.w
        endif
        sync_g_t

#line 707
        ult r14.xyzw, vThreadIDInGroupFlattened.xxxx, l(16, 8, 4, 2)

#line 689
        if_nz r14.x
          ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g3.xxxx
          ld_structured r7.x, r6.x, l(0), g3.xxxx
          or r5.w, r5.w, r7.x
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r5.w
          ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g4.xxxx
          ld_structured r7.x, r6.x, l(0), g4.xxxx
          or r5.w, r5.w, r7.x
          store_structured g4.x, vThreadIDInGroupFlattened.x, l(0), r5.w
        endif
        sync_g_t
        if_nz r14.y
          ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g3.xxxx
          ld_structured r7.x, r6.y, l(0), g3.xxxx
          or r5.w, r5.w, r7.x
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r5.w
          ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g4.xxxx
          ld_structured r7.x, r6.y, l(0), g4.xxxx
          or r5.w, r5.w, r7.x
          store_structured g4.x, vThreadIDInGroupFlattened.x, l(0), r5.w
        endif

#line 700
        sync_g_t
        if_nz r14.z
          ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g3.xxxx
          ld_structured r7.x, r6.z, l(0), g3.xxxx
          or r5.w, r5.w, r7.x
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r5.w
          ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g4.xxxx
          ld_structured r7.x, r6.z, l(0), g4.xxxx
          or r5.w, r5.w, r7.x
          store_structured g4.x, vThreadIDInGroupFlattened.x, l(0), r5.w
        endif
        sync_g_t
        if_nz r14.w
          ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g3.xxxx
          ld_structured r7.x, r6.w, l(0), g3.xxxx
          or r5.w, r5.w, r7.x
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r5.w
          ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g4.xxxx
          ld_structured r7.x, r6.w, l(0), g4.xxxx
          or r5.w, r5.w, r7.x
          store_structured g4.x, vThreadIDInGroupFlattened.x, l(0), r5.w

#line 711
        endif
        sync_g_t
        ult r5.w, vThreadIDInGroupFlattened.x, l(1)
        if_nz r5.w
          ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g3.xxxx
          ld_structured r7.x, l(1), l(0), g3.xxxx
          or r5.w, r5.w, r7.x
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r5.w
          ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g4.xxxx
          ld_structured r7.x, l(1), l(0), g4.xxxx
          or r5.w, r5.w, r7.x
          store_structured g4.x, vThreadIDInGroupFlattened.x, l(0), r5.w
        endif
        sync_g_t
        ld_structured r9.x, l(0), l(0), g3.xxxx  // r9.x <- nVisibleRoomMask
        ld_structured r9.y, l(0), l(0), g4.xxxx  // r9.y <- nVisibleRoomMaskTransparent

#line 723
      else   // Prior locations: r9.x <- nNumGatePasses
        mov r9.xy, l(0,0,0,0)  // r9.x <- nVisibleRoomMask; r9.y <- nVisibleRoomMaskTransparent
      endif
    else   // Prior locations: r8.w <- _nOpaqueLinearDepth11; r5.w <- fTileBoundingSphereRadiusSquared0; r5.z <- fTileBoundingSphereRadiusSquared1; r7.x <- fTransparentTileBoundingSphereRadiusSquared1; r11.y <- fTransparencyLinearMidDepth1
      mov r11.y, l(0)  // r11.y <- nNumFineIndicesTransparent
      mov r9.xyz, l(0,0,0,0)  // r9.z <- nNumFineIndices; r9.x <- nVisibleRoomMask; r9.y <- nVisibleRoomMaskTransparent
      mov r5.z, l(0)  // r5.z <- nNumVisibleGates
    endif

#line 729
    or r14.xy, r9.xyxx, l(1, 1, 0, 0)  // r14.x <- nVisibleRoomMask; r14.y <- nVisibleRoomMaskTransparent

#line 734
    movc r5.z, r5.z, l(2), l(0)  // r5.z <- nFeatureFlags

#line 1037 "common.fx"
    div r5.w, l(1.000000, 1.000000, 1.000000, 1.000000), -cb2[24].y  // r5.w <- <RemapDepthLinear return value>

#line 738 "C:\p4\PRJ_PRO\main\assembly\shaders\win32\lighttile.fx"
    mul r5.w, r5.w, l(0.999900)
    lt r5.w, r5.w, r1.y  // r5.w <- bIsBackground

#line 755
    iadd r7.x, r0.z, r0.w

#line 78
    ishl r9.x, vThreadIDInGroupFlattened.x, l(2)

#line 821
    not r9.y, r5.w

#line 833
    add r11.x, r11.w, l(0.000000)

#line 86
    uge r15.xyzw, vThreadIDInGroupFlattened.xxxx, l(1, 2, 4, 8)
    iadd r16.xyzw, r9.xxxx, l(-4, -8, -16, -32)
    uge r17.xy, vThreadIDInGroupFlattened.xxxx, l(16, 32, 0, 0)

#line 933
    iadd r18.xyz, r9.xxxx, l(-64, -128, 8, 0)

#line 783
    mov r8.w, l(1.000000)

#line 790
    mov r19.z, l(1.000000)
    mov r10.w, l(1.000000)

#line 799
    mov r20.z, l(1.000000)

#line 802
    mov r12.w, l(1.000000)

#line 809
    mov r13.w, l(1.000000)

#line 818
    mov r21.z, l(1.000000)
    mov r22.z, l(1.000000)

#line 741
    mov r11.w, r9.z  // r11.w <- nNumFineIndices
    mov r14.w, r11.y  // r14.w <- nNumFineIndicesTransparent
    mov r17.z, r5.z  // r17.z <- nFeatureFlags
    mov r17.w, l(0)  // r17.w <- j
    loop
      uge r18.w, r17.w, r7.z
      breakc_nz r18.w
      bfi r18.w, l(26), l(6), r17.w, vThreadIDInGroupFlattened.x
      iadd r18.w, r0.w, r18.w  // r18.w <- i
      iadd r19.w, r0.y, r18.w
      ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r19.w, r19.w, l(0), t2.xxxx  // r19.w <- nObjectIdx

#line 755
      ult r18.w, r18.w, r7.x
      if_nz r18.w
        imul null, r18.w, r19.w, l(12)
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r23.xyzw, r18.w, l(0), t1.xyzw  // r23.x <- Data.x; r23.y <- Data.y; r23.z <- Data.z; r23.w <- Data.w

#line 761
        and r24.xy, r23.xyxx, l(0x00003fff, 0x00003fff, 0, 0)  // r24.x <- nTileMinX; r24.y <- nTileDeltaX
        ubfe r24.zw, l(0, 0, 14, 14), l(0, 0, 14, 14), r23.xxxy  // r24.z <- nTileMinY; r24.w <- nTileDeltaY
        f16tof32 r18.w, r23.z  // r18.w <- fTileMinZ
        ushr r23.xy, r23.xzxx, l(28, 16, 0, 0)  // r23.x <- nObjectType
        f16tof32 r20.w, r23.y  // r20.w <- fTileMaxZ

add r35.z, r18.w, -r35.y       // fTileMinZ - convergence
add r35.w, r20.w, -r35.y       // fTileMaxZ - convergence
mul r35.zw, r35.xxzw, r35.xxxx // * separation
mul r35.zw, r35.xxzw, l(0.5)   // clip -> screen
div r35.z, r35.z, r18.w        // Perspective divide
div r35.w, r35.w, r20.w        // Perspective divide
utof r36.y, cb5[0].x           //   (float)viNumTiles.x
mul r35.zw, r35.xxzw, r36.yyyy // * (float)viNumTiles.x

//mul r35.zw, r35.xxzw, r36.xxxx // IniParams debugging
//if_z vThreadIDInGroupFlattened.x
//	store_structured u4.zw, vThreadGroupID.x, l(0), r35.xxzw
//endif

round_ne r35.zw, r35.xxzw
ftoi r35.zw, r35.xxzw
if_nz r24.x
	iadd r24.x, r24.x, r35.w       // Adjust nTileMinX based on fTileMaxZ
endif
iadd r24.y, r24.y, |r35.w|     // Adjust nTileDeltaX to counter nTileMinX adjustment

//iadd r35.z, r35.w, -r35.z
//iadd r24.y, r24.y, |r35.z|     // Adjust nTileDeltaX based on difference in stereo corrections between fTileMaxZ & fTileMinZ

// Disable tile bounds (bye bye performance) -DarkStarSword:
//mov r24.x, l(0)
//mov r24.y, cb5[0].x

#line 774
        imad r23.yz, r19.wwww, l(0, 12, 12, 0), l(0, 1, 3, 0)
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r25.xyzw, r23.y, l(0), t1.xyzw  // r25.x <- vRow0.x; r25.y <- vRow0.y; r25.z <- vRow0.z; r25.w <- vRow0.w
        imad r21.w, r19.w, l(12), l(2)
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r26.xyzw, r21.w, l(0), t1.xyzw  // r26.x <- vRow1.x; r26.y <- vRow1.y; r26.z <- vRow1.z; r26.w <- vRow1.w
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r27.xyzw, r23.z, l(0), t1.xyzw  // r27.x <- vRow2.x; r27.y <- vRow2.y; r27.z <- vRow2.z; r27.w <- vRow2.w
        imad r23.yz, r19.wwww, l(0, 12, 12, 0), l(0, 4, 5, 0)
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r28.xyzw, r23.y, l(0), t1.xyzw  // r28.x <- vParams0.x; r28.y <- vParams0.y; r28.z <- vParams0.z; r28.w <- vParams0.w
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r29.xyzw, r23.z, l(0), t1.wxyz  // r29.y <- viParams1.x; r29.z <- viParams1.y; r29.w <- viParams1.z; r29.x <- viParams1.w

#line 783
        dp4 r30.x, r25.xyzw, r8.xyzw  // r30.x <- vSignedPosA.x
        dp4 r30.y, r26.xyzw, r8.xyzw  // r30.y <- vSignedPosA.y
        dp4 r30.z, r27.xyzw, r8.xyzw  // r30.z <- vSignedPosA.z
        add r31.xyz, -r28.xyzx, |r30.xyzx|
        max r31.xyz, r31.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)  // r31.x <- vDeltaA.x; r31.y <- vDeltaA.y; r31.z <- vDeltaA.z
        dp3 r21.w, r31.xyzx, r31.xyzx  // r21.w <- fDistSqA
        add r22.w, r7.w, r28.w  // r22.w <- fTotalRadiusA
        mul r22.w, r22.w, r22.w  // r22.w <- fTotalRadiusSqA
        ge r21.w, r22.w, r21.w
        dp2 r22.w, r30.xyxx, r30.xyxx
        sqrt r19.y, r22.w
        mov r19.x, r30.z
        dp3 r19.x, r29.yzwy, r19.xyzx
        lt r19.x, r19.x, r7.w
        and r19.x, r19.x, r21.w  // r19.x <- bInside
        dp4 r30.x, r25.xyzw, r10.xyzw  // r30.x <- vSignedPosB.x
        dp4 r30.y, r26.xyzw, r10.xyzw  // r30.y <- vSignedPosB.y
        dp4 r30.z, r27.xyzw, r10.xyzw  // r30.z <- vSignedPosB.z

#line 794
        add r31.xyz, -r28.xyzx, |r30.xyzx|
        max r31.xyz, r31.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)  // r31.x <- vDeltaB.x; r31.y <- vDeltaB.y; r31.z <- vDeltaB.z
        dp3 r19.y, r31.xyzx, r31.xyzx  // r19.y <- fDistSqB
        add r21.w, r9.w, r28.w  // r21.w <- fTotalRadiusB
        mul r21.w, r21.w, r21.w  // r21.w <- fTotalRadiusSqB
        ge r19.y, r21.w, r19.y
        dp2 r21.w, r30.xyxx, r30.xyxx
        sqrt r20.y, r21.w
        mov r20.x, r30.z
        dp3 r20.x, r29.yzwy, r20.xyzx
        lt r20.x, r20.x, r9.w
        and r19.y, r19.y, r20.x
        or r19.x, r19.y, r19.x

#line 802
        dp4 r30.x, r25.xyzw, r12.xyzw  // r30.x <- vTransparentSignedPosA.x
        dp4 r30.y, r26.xyzw, r12.xyzw  // r30.y <- vTransparentSignedPosA.y
        dp4 r30.z, r27.xyzw, r12.xyzw  // r30.z <- vTransparentSignedPosA.z
        add r31.xyz, -r28.xyzx, |r30.xyzx|
        max r31.xyz, r31.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)  // r31.x <- vTransparentDeltaA.x; r31.y <- vTransparentDeltaA.y; r31.z <- vTransparentDeltaA.z
        dp3 r19.y, r31.xyzx, r31.xyzx  // r19.y <- fTransparentDistSqA
        add r20.x, r11.z, r28.w  // r20.x <- fTransparentTotalRadiusA
        mul r20.x, r20.x, r20.x  // r20.x <- fTransparentTotalRadiusSqA
        dp4 r25.x, r25.xyzw, r13.xyzw  // r25.x <- vTransparentSignedPosB.x
        dp4 r25.y, r26.xyzw, r13.xyzw  // r25.y <- vTransparentSignedPosB.y
        dp4 r25.z, r27.xyzw, r13.xyzw  // r25.z <- vTransparentSignedPosB.z
        add r26.xyz, -r28.xyzx, |r25.xyzx|
        max r26.xyz, r26.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)  // r26.x <- vTransparentDeltaB.x; r26.y <- vTransparentDeltaB.y; r26.z <- vTransparentDeltaB.z
        dp3 r20.y, r26.xyzx, r26.xyzx  // r20.y <- fTransparentDistSqB

#line 813
        add r21.w, r7.y, r28.w  // r21.w <- fTransparentTotalRadiusB
        mul r21.w, r21.w, r21.w  // r21.w <- fTransparentTotalRadiusSqB

#line 818
        ge r19.y, r20.x, r19.y
        dp2 r20.x, r30.xyxx, r30.xyxx
        sqrt r21.y, r20.x
        mov r21.x, r30.z
        dp3 r20.x, r29.yzwy, r21.xyzx
        lt r20.x, r20.x, r11.z
        and r19.y, r19.y, r20.x
        ge r20.x, r21.w, r20.y
        dp2 r20.y, r25.xyxx, r25.xyxx
        sqrt r22.y, r20.y
        mov r22.x, r25.z
        dp3 r20.y, r29.yzwy, r22.xyzx
        lt r20.y, r20.y, r7.y
        and r20.x, r20.y, r20.x
        or r19.y, r19.y, r20.x  // r19.y <- bTransparentInside

#line 821
        iadd r20.xy, -r24.xzxx, vThreadGroupID.xyxx
        ult r20.xy, r20.xyxx, r24.ywyy
        and r20.x, r20.y, r20.x
        ge r20.y, r1.z, r18.w
        and r20.y, r20.y, r20.x
        ge r21.x, r20.w, r1.y
        and r20.y, r20.y, r21.x

#line 841
        and r21.xy, r14.xyxx, r23.wwww
        ine r21.xy, r21.xyxx, l(0, 0, 0, 0)

#line 821
        and r20.y, r20.y, r21.x
        and r19.x, r19.x, r20.y
        and r19.x, r9.y, r19.x  // r19.x <- bVisible

#line 833
        add r20.y, -r3.z, r18.w
        div_sat r20.y, r20.y, r11.x
        mad r20.y, r20.y, l(32.000000), l(0.500000)
        ftou r20.y, r20.y  // r20.y <- nBitIdx0
        umin r20.y, r20.y, l(31)
        add r21.x, -r3.z, r20.w
        div_sat r21.x, r21.x, r11.x
        mad r21.x, r21.x, l(32.000000), l(0.500000)
        ftou r21.x, r21.x  // r21.x <- nBitIdx1
        umin r21.x, r21.x, l(31)

#line 839
        ushr r21.w, l(-1), r20.y
        iadd r20.y, r20.y, l(31)
        iadd r20.y, -r21.x, r20.y
        ishl r20.y, r21.w, r20.y
        iadd r21.x, -r21.x, l(31)
        ushr r20.y, r20.y, r21.x  // r20.y <- nObjectBitMask
        ge r18.w, r3.w, r18.w
        and r18.w, r18.w, r20.x
        ge r20.x, r20.w, r3.z
        and r18.w, r18.w, r20.x
        and r20.x, r1.w, r20.y
        ine r20.x, r20.x, l(0)
        and r18.w, r18.w, r20.x
        and r18.w, r19.y, r18.w
        and r18.w, r21.y, r18.w  // r18.w <- bVisibleTransparent

#line 852
      else
        mov r19.x, l(0)  // r19.x <- bVisible
        mov r18.w, l(0)  // r18.w <- bVisibleTransparent
        mov r23.x, l(0)  // r23.x <- nObjectType
        mov r29.x, l(0)
      endif

#line 76
      sync_g_t
      and r19.y, r19.x, l(1)
      store_structured g2.x, l(0), r9.x, r19.y
      sync_g_t

#line 86
      ld_structured r20.xy, l(0), r16.x, g2.xyxx
      and r19.y, r15.x, r20.x
      iadd r19.y, r19.y, r20.y
      store_structured g2.x, l(1), r9.x, r19.y
      sync_g_t
      ld_structured r19.y, l(1), r9.x, g2.xxxx
      ld_structured r20.x, l(1), r16.y, g2.xxxx
      and r20.x, r15.y, r20.x
      iadd r19.y, r19.y, r20.x
      store_structured g2.x, l(0), r9.x, r19.y
      sync_g_t
      ld_structured r19.y, l(0), r9.x, g2.xxxx
      ld_structured r20.x, l(0), r16.z, g2.xxxx
      and r20.x, r15.z, r20.x
      iadd r19.y, r19.y, r20.x
      store_structured g2.x, l(1), r9.x, r19.y
      sync_g_t
      ld_structured r19.y, l(1), r9.x, g2.xxxx
      ld_structured r20.x, l(1), r16.w, g2.xxxx
      and r20.x, r15.w, r20.x
      iadd r19.y, r19.y, r20.x
      store_structured g2.x, l(0), r9.x, r19.y
      sync_g_t
      ld_structured r19.y, l(0), r9.x, g2.xxxx
      ld_structured r20.x, l(0), r18.x, g2.xxxx
      and r20.x, r17.x, r20.x
      iadd r19.y, r19.y, r20.x
      store_structured g2.x, l(1), r9.x, r19.y
      sync_g_t
      ld_structured r19.y, l(1), r9.x, g2.xxxx
      ld_structured r20.x, l(1), r18.y, g2.xxxx
      and r20.x, r17.y, r20.x
      iadd r19.y, r19.y, r20.x
      store_structured g2.x, l(0), r9.x, r19.y
      sync_g_t

#line 90
      ld_structured r19.y, l(0), l(252), g2.xxxx  // r19.y <- nTotal
      ld_structured r20.x, l(0), r9.x, g2.xxxx
      iadd r20.x, r11.w, r20.x

#line 855
      iadd r20.x, r20.x, l(-1)  // r20.x <- nDest
      ult r20.y, r20.x, l(1023)
      and r19.x, r19.x, r20.y
      if_nz r19.x
        ishl r19.x, r23.x, l(12)
        iadd r19.x, r19.x, r19.w
        store_structured g0.x, r20.x, l(0), r19.x
        or r17.z, r17.z, r29.x
      endif
      iadd r11.w, r11.w, r19.y

#line 76
      sync_g_t
      and r19.x, r18.w, l(1)
      store_structured g2.x, l(0), r9.x, r19.x
      sync_g_t

#line 86
      ld_structured r19.xy, l(0), r16.x, g2.xyxx
      and r19.x, r15.x, r19.x
      iadd r19.x, r19.x, r19.y
      store_structured g2.x, l(1), r9.x, r19.x
      sync_g_t
      ld_structured r19.x, l(1), r9.x, g2.xxxx
      ld_structured r19.y, l(1), r16.y, g2.xxxx
      and r19.y, r15.y, r19.y
      iadd r19.x, r19.y, r19.x
      store_structured g2.x, l(0), r9.x, r19.x
      sync_g_t
      ld_structured r19.x, l(0), r9.x, g2.xxxx
      ld_structured r19.y, l(0), r16.z, g2.xxxx
      and r19.y, r15.z, r19.y
      iadd r19.x, r19.y, r19.x
      store_structured g2.x, l(1), r9.x, r19.x
      sync_g_t
      ld_structured r19.x, l(1), r9.x, g2.xxxx
      ld_structured r19.y, l(1), r16.w, g2.xxxx
      and r19.y, r15.w, r19.y
      iadd r19.x, r19.y, r19.x
      store_structured g2.x, l(0), r9.x, r19.x
      sync_g_t
      ld_structured r19.x, l(0), r9.x, g2.xxxx
      ld_structured r19.y, l(0), r18.x, g2.xxxx
      and r19.y, r17.x, r19.y
      iadd r19.x, r19.y, r19.x
      store_structured g2.x, l(1), r9.x, r19.x
      sync_g_t
      ld_structured r19.x, l(1), r9.x, g2.xxxx
      ld_structured r19.y, l(1), r18.y, g2.xxxx
      and r19.y, r17.y, r19.y
      iadd r19.x, r19.y, r19.x
      store_structured g2.x, l(0), r9.x, r19.x
      sync_g_t

#line 90
      ld_structured r19.x, l(0), l(252), g2.xxxx  // r19.x <- nTotal
      ld_structured r19.y, l(0), r9.x, g2.xxxx
      iadd r19.y, r14.w, r19.y

#line 867
      iadd r19.y, r19.y, l(-1)  // r19.y <- nDestTransparent
      ult r20.x, r19.y, l(1023)
      and r18.w, r18.w, r20.x
      if_nz r18.w
        ishl r18.w, r23.x, l(12)
        iadd r18.w, r18.w, r19.w
        store_structured g1.x, r19.y, l(0), r18.w
      endif
      iadd r14.w, r14.w, r19.x
      iadd r17.w, r17.w, l(1)
    endloop

#line 878
    umin r1.w, r11.w, l(127)  // r1.w <- nNumVisibleObjects
    umin r3.z, r14.w, l(127)  // r3.z <- nNumVisibleObjectsTransparent
    and r3.w, r3.x, l(0x00020000)
    or r3.w, r3.w, r17.z  // r3.w <- nFeatureFlags
    and r5.z, r3.y, l(0x00040000)
    or r3.w, r3.w, r5.z
    and r5.z, r1.x, l(0x00080000)
    or r3.w, r3.w, r5.z

#line 279
    store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r3.w
    sync_g_t
    if_nz r5.x
      iadd r5.z, vThreadIDInGroupFlattened.x, l(32)
      ld_structured r5.z, r5.z, l(0), g11.xxxx
      or r3.w, r3.w, r5.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r3.w
    endif
    sync_g_t

#line 293
    ult r7.xyzw, vThreadIDInGroupFlattened.xxxx, l(16, 8, 4, 2)

#line 284
    if_nz r7.x
      ld_structured r3.w, vThreadIDInGroupFlattened.x, l(0), g11.xxxx
      ld_structured r5.z, r6.x, l(0), g11.xxxx
      or r3.w, r3.w, r5.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r3.w
    endif
    sync_g_t
    if_nz r7.y
      ld_structured r3.w, vThreadIDInGroupFlattened.x, l(0), g11.xxxx
      ld_structured r5.z, r6.y, l(0), g11.xxxx
      or r3.w, r3.w, r5.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r3.w
    endif
    sync_g_t
    if_nz r7.z
      ld_structured r3.w, vThreadIDInGroupFlattened.x, l(0), g11.xxxx
      ld_structured r5.z, r6.z, l(0), g11.xxxx
      or r3.w, r3.w, r5.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r3.w
    endif
    sync_g_t
    if_nz r7.w
      ld_structured r3.w, vThreadIDInGroupFlattened.x, l(0), g11.xxxx
      ld_structured r5.z, r6.w, l(0), g11.xxxx
      or r3.w, r3.w, r5.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r3.w
    endif
    sync_g_t

#line 296
    ult r3.w, vThreadIDInGroupFlattened.x, l(1)
    if_nz r3.w
      ld_structured r3.w, vThreadIDInGroupFlattened.x, l(0), g11.xxxx
      ld_structured r5.z, l(1), l(0), g11.xxxx
      or r3.w, r3.w, r5.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r3.w
    endif
    sync_g_t
    ld_structured r7.x, l(0), l(0), g11.xxxx  // r7.x <- <ReductionUintOr return value>

#line 888
    if_z vThreadIDInGroupFlattened.x

#line 898
      and r8.xyzw, r7.xxxx, l(2, 0x00020000, 0x00040000, 0x00080000)
      ine r8.yzw, r8.yyzw, l(0, 0, 0, 0)  // r8.y <- bStandard; r8.z <- bSkin; r8.w <- bHair

#line 910
      not r9.yzw, r8.zzwy

#line 914
      and r8.yzw, r8.yyzw, r9.yyww
      and r8.yzw, r9.zzzy, r8.yyzw

#line 920
      movc r10.xyzw, r8.xxxx, l(2,4,6,8), l(1,3,5,7)  // r10.w <- nPermutation
      movc r3.w, r8.w, r10.z, r10.w  // r3.w <- nPermutation
      movc r3.w, r8.z, r10.y, r3.w
      movc r3.w, r8.y, r10.x, r3.w
      movc r3.w, r5.w, l(0), r3.w

#line 924
      imul null, r5.z, r3.w, l(3)
      imm_atomic_iadd r8.x, u3, r5.z, l(1)  // r8.x <- nWriteIdx
      imad r3.w, r3.w, cb5[1].x, r8.x
      imad r5.z, vThreadGroupID.y, l(0x00010000), vThreadGroupID.x
      store_structured u2.x, r3.w, l(0), r5.z

#line 892
      mov r7.y, l(0)
      store_structured u0.xy, r0.x, l(0), r7.xyxx

#line 929
      mov r14.z, l(0)
      store_structured u1.xy, r0.x, l(0), r14.zyzz
    endif
    ult r3.w, vThreadIDInGroupFlattened.x, r1.w
    ld_structured r5.z, vThreadIDInGroupFlattened.x, l(0), g0.xxxx
    and r3.w, r3.w, r5.z
    store_structured u0.x, r0.x, r18.z, r3.w
    iadd r3.w, r9.x, l(256)
    iadd r5.z, vThreadIDInGroupFlattened.x, l(64)
    ult r1.w, r5.z, r1.w
    ld_structured r5.w, r5.z, l(0), g0.xxxx
    and r1.w, r1.w, r5.w
    iadd r3.w, r3.w, l(8)
    store_structured u0.x, r0.x, r3.w, r1.w
    ult r1.w, vThreadIDInGroupFlattened.x, r3.z
    ld_structured r5.w, vThreadIDInGroupFlattened.x, l(0), g1.xxxx
    and r1.w, r1.w, r5.w
    store_structured u1.x, r0.x, r18.z, r1.w
    ult r1.w, r5.z, r3.z
    ld_structured r3.z, r5.z, l(0), g1.xxxx
    and r1.w, r1.w, r3.z
    store_structured u1.x, r0.x, r3.w, r1.w

#line 1122
  else   // Prior locations: r3.z <- fTransparencyLinearMinDepth; r3.w <- fTransparencyLinearMaxDepth; r1.w <- nTransparencyBuckets; r5.z <- bHasTransparency

#line 382
    add r1.w, -r1.y, r1.z
    mad r1.w, r1.w, l(0.500000), r1.y  // r1.w <- fOpaqueLinearMidDepth

#line 390
    iadd r4.xyzw, -r1.wwww, r4.xyzw  // r4.x <- nOpaqueLinearDepth00; r4.y <- nOpaqueLinearDepth01; r4.z <- nOpaqueLinearDepth10; r4.w <- nOpaqueLinearDepth11

#line 395
    iadd r2.xyzw, -r1.wwww, r2.xyzw  // r2.x <- _nOpaqueLinearDepth00; r2.y <- _nOpaqueLinearDepth01; r2.z <- _nOpaqueLinearDepth10; r2.w <- _nOpaqueLinearDepth11
    umax r2.xy, r2.ywyy, r2.xzxx
    umax r2.x, r2.y, r2.x  // r2.x <- nOpaqueLinearMidDepth0
    umin r2.yz, r4.yywy, r4.xxzx
    umin r2.y, r2.z, r2.y  // r2.y <- nOpaqueLinearMidDepth1

#line 419
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r2.x
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r2.y
    sync_g_t
    if_nz r5.x
      iadd r2.z, vThreadIDInGroupFlattened.x, l(32)
      ld_structured r2.w, r2.z, l(0), g9.xxxx
      umax r2.x, r2.w, r2.x
      store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r2.x
      ld_structured r2.x, r2.z, l(0), g10.xxxx
      umin r2.x, r2.x, r2.y
      store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r2.x
    endif
    sync_g_t
    ld_structured r2.x, vThreadIDInGroupFlattened.x, l(0), g9.xxxx
    ld_structured r2.y, r6.x, l(0), g9.xxxx
    umax r2.x, r2.y, r2.x
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r2.x

#line 430
    ld_structured r2.y, vThreadIDInGroupFlattened.x, l(0), g10.xxxx
    ld_structured r2.z, r6.x, l(0), g10.xxxx
    umin r2.y, r2.z, r2.y
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r2.y
    sync_g_t
    ld_structured r2.z, r6.y, l(0), g9.xxxx
    umax r2.x, r2.z, r2.x
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r2.x
    ld_structured r2.z, r6.y, l(0), g10.xxxx
    umin r2.y, r2.z, r2.y
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r2.y
    sync_g_t
    ld_structured r2.z, r6.z, l(0), g9.xxxx
    umax r2.x, r2.z, r2.x
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r2.x
    ld_structured r2.z, r6.z, l(0), g10.xxxx
    umin r2.y, r2.z, r2.y
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r2.y
    sync_g_t

#line 441
    ld_structured r2.z, r6.w, l(0), g9.xxxx
    umax r2.x, r2.z, r2.x
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r2.x
    ld_structured r2.z, r6.w, l(0), g10.xxxx
    umin r2.y, r2.z, r2.y
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r2.y
    sync_g_t
    ld_structured r2.z, r5.y, l(0), g9.xxxx
    umax r2.x, r2.z, r2.x
    store_structured g9.x, vThreadIDInGroupFlattened.x, l(0), r2.x
    ld_structured r2.x, r5.y, l(0), g10.xxxx
    umin r2.x, r2.x, r2.y
    store_structured g10.x, vThreadIDInGroupFlattened.x, l(0), r2.x
    sync_g_t
    ld_structured r2.x, l(0), l(0), g9.xxxx
    iadd r2.x, r1.w, r2.x  // r2.x <- fOpaqueLinearMidDepth0
    ld_structured r2.y, l(0), l(0), g10.xxxx
    iadd r1.w, r1.w, r2.y  // r1.w <- fOpaqueLinearMidDepth1

#line 452
    max r2.x, r1.y, r2.x

#line 474
    ishl r2.yz, vThreadGroupID.xxyx, l(0, 4, 4, 0)
    utof r2.yz, r2.yyzy  // r2.y <- nTilePixelCoord00.x; r2.z <- nTilePixelCoord00.y
    add r2.yz, r2.yyzy, l(0.000000, 7.500000, 7.500000, 0.000000)
    mad r4.xy, r2.yzyy, cb2[29].xyxx, cb2[29].zwzz  // r4.x <- vTileCenterEye.x; r4.y <- vTileCenterEye.y

#line 478
    add r7.z, r1.y, r2.x
    mov r4.z, l(-0.500000)
    mul r7.xy, r7.zzzz, l(0.500000, 0.500000, 0.000000, 0.000000)
    mul r7.xyz, r4.xyzx, r7.xyzx  // r7.x <- vTileBoundingSphereCenter0.x; r7.y <- vTileBoundingSphereCenter0.y; r7.z <- vTileBoundingSphereCenter0.z

// Adjust tile center 0 -DarkStarSword
add r35.w, r7.z, -r35.y
mul r35.w, r35.w, r35.x
mul r35.w, r35.w, l(0.5)
div r35.w, r35.w, cb2[0].x
add r7.x, r7.x, r35.w

    mad r8.xy, |cb2[29].xyxx|, l(7.500000, 7.500000, 0.000000, 0.000000), |r4.xyxx|
    mov r8.z, l(1.000000)
    mad r2.xyz, r8.xyzx, r2.xxxx, -|r7.xyzx|  // r2.x <- vDelta0.x; r2.y <- vDelta0.y; r2.z <- vDelta0.z
    dp3 r2.x, r2.xyzx, r2.xyzx  // r2.x <- fTileBoundingSphereRadiusSquared0
    sqrt r2.y, r2.x  // r2.y <- fTileBoundingSphereRadius0
    add r9.z, r1.z, r1.w
    mul r9.xy, r9.zzzz, l(0.500000, 0.500000, 0.000000, 0.000000)
    mul r4.xyz, r4.xyzx, r9.xyzx  // r4.x <- vTileBoundingSphereCenter1.x; r4.y <- vTileBoundingSphereCenter1.y; r4.z <- vTileBoundingSphereCenter1.z

// Adjust tile center 1 -DarkStarSword
add r35.w, r4.z, -r35.y
mul r35.w, r35.w, r35.x
mul r35.w, r35.w, l(0.5)
div r35.w, r35.w, cb2[0].x
add r4.x, r4.x, r35.w

    mad r5.yzw, r8.xxyz, r1.zzzz, -|r4.xxyz|  // r5.y <- vDelta1.x; r5.z <- vDelta1.y; r5.w <- vDelta1.z
    dp3 r1.w, r5.yzwy, r5.yzwy  // r1.w <- fTileBoundingSphereRadiusSquared1
    sqrt r2.z, r1.w  // r2.z <- fTileBoundingSphereRadius1

#line 514
    iadd r2.w, r0.z, l(63)
    ushr r2.w, r2.w, l(6)  // r2.w <- nNumNonGatePasses

#line 531
    if_nz r0.w
      iadd r3.z, r0.w, l(63)
      ushr r3.z, r3.z, l(6)  // r3.z <- nNumGatePasses

#line 78
      ishl r3.w, vThreadIDInGroupFlattened.x, l(2)

#line 86
      uge r8.xyzw, vThreadIDInGroupFlattened.xxxx, l(1, 2, 4, 8)
      iadd r9.xyzw, r3.wwww, l(-4, -8, -16, -32)
      uge r5.yz, vThreadIDInGroupFlattened.xxxx, l(0, 16, 32, 0)
      iadd r10.xy, r3.wwww, l(-64, -128, 0, 0)

#line 328
      mov r7.w, l(1.000000)
      mov r4.w, l(1.000000)

#line 535
      mov r5.w, l(0)  // r5.w <- nNumFineIndices
      mov r10.zw, l(0,0,0,0)  // r10.z <- nNumFineIndicesTransparent; r10.w <- nLaneVisibleRooms
      mov r11.x, l(0)  // r11.x <- j
      loop
        uge r11.y, r11.x, r3.z
        breakc_nz r11.y
        bfi r11.y, l(26), l(6), r11.x, vThreadIDInGroupFlattened.x  // r11.y <- i

#line 540
        iadd r11.z, r0.y, r11.y
        ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r11.z, r11.z, l(0), t2.xxxx  // r11.z <- nObjectIdx

#line 553
        ult r11.y, r11.y, r0.w
        if_nz r11.y
          imul null, r11.y, r11.z, l(12)
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r12.xyzw, r11.y, l(0), t1.xyzw  // r12.x <- Data.x; r12.y <- Data.y; r12.z <- Data.z; r12.w <- Data.w

#line 560
          ubfe r11.yw, l(0, 14, 0, 14), l(0, 14, 0, 14), r12.xxxy  // r11.y <- nTileMinY; r11.w <- nTileDeltaY
          f16tof32 r12.z, r12.z  // r12.z <- fTileMinZ
          and r13.xyz, r12.wxyw, l(0x0000ffff, 0x00003fff, 0x00003fff, 0)  // r13.x <- nRoomIdx0; r13.y <- nTileMinX; r13.z <- nTileDeltaX
          ushr r12.xy, r12.wxww, l(16, 28, 0, 0)  // r12.x <- nRoomIdx1; r12.y <- nObjectType

//if_z vThreadIDInGroupFlattened.x
//	store_structured u4.z, vThreadGroupID.x, l(0), r12.z
//endif

add r35.z, r12.z, -r35.y       // fTileMinZ - convergence
mul r35.z, r35.z, r35.x        // * separation
mul r35.z, r35.z, l(0.5)       // clip -> screen
div r35.z, r35.z, r12.z        // Perspective divide
utof r36.y, cb5[0].x           //   (float)viNumTiles.x
mul r35.z, r35.z, r36.y        // * (float)viNumTiles.x

//mul r35.z, r35.z, r36.x        // IniParams debugging
//if_z vThreadIDInGroupFlattened.x
//	store_structured u4.w, vThreadGroupID.x, l(0), r35.z
//endif

round_ne r35.z, r35.z
ftoi r35.z, r35.z
if_nz r13.y
	iadd r13.y, r13.y, r35.z       // Adjust nTileMinX based on fTileMaxZ
endif
iadd r13.z, r13.z, |r35.z|     // Adjust nTileDeltaX to counter nTileMinX adjustment

// Disable tile bounds (bye bye performance) -DarkStarSword:
//mov r13.y, l(0)
//mov r13.z, cb5[0].x

#line 568
          imad r14.xy, r11.zzzz, l(12, 12, 0, 0), l(1, 3, 0, 0)
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r15.xyzw, r14.x, l(0), t1.xyzw  // r15.x <- vRow0.x; r15.y <- vRow0.y; r15.z <- vRow0.z; r15.w <- vRow0.w
          imad r12.w, r11.z, l(12), l(2)
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r16.xyzw, r12.w, l(0), t1.xyzw  // r16.x <- vRow1.x; r16.y <- vRow1.y; r16.z <- vRow1.z; r16.w <- vRow1.w
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r14.xyzw, r14.y, l(0), t1.xyzw  // r14.x <- vRow2.x; r14.y <- vRow2.y; r14.z <- vRow2.z; r14.w <- vRow2.w

#line 572
          imad r17.xyzw, r11.zzzz, l(12, 12, 12, 12), l(4, 5, 6, 7)

#line 569
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r18.xy, r17.x, l(0), t1.xyxx  // r18.x <- vHalfSize.x; r18.y <- vHalfSize.y
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r19.xyzw, r17.y, l(0), t1.xyzw  // r19.x <- vParams0.x; r19.y <- vParams0.y; r19.z <- vParams0.z; r19.w <- vParams0.w
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r20.xyzw, r17.z, l(0), t1.xyzw  // r20.x <- vParams1.x; r20.y <- vParams1.y; r20.z <- vParams1.z; r20.w <- vParams1.w
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r17.xyz, r17.w, l(0), t1.xyzx  // r17.x <- vPlane0.x; r17.y <- vPlane0.y; r17.z <- vPlane0.z

#line 576
          imad r21.xyzw, r11.zzzz, l(12, 12, 12, 12), l(8, 9, 10, 11)

#line 573
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r22.xyz, r21.x, l(0), t1.xyzx  // r22.x <- vPlane1.x; r22.y <- vPlane1.y; r22.z <- vPlane1.z
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r23.xyz, r21.y, l(0), t1.xyzx  // r23.x <- vPlane2.x; r23.y <- vPlane2.y; r23.z <- vPlane2.z
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r21.xyz, r21.z, l(0), t1.xyzx  // r21.x <- vPlane3.x; r21.y <- vPlane3.y; r21.z <- vPlane3.z
          ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r24.xyzw, r21.w, l(0), t1.xyzw  // r24.x <- vPlane4.x; r24.y <- vPlane4.y; r24.z <- vPlane4.z; r24.w <- vPlane4.w

#line 328
          dp4 r25.x, r15.xyzw, r7.xyzw  // r25.x <- vLocalPos.x; r25.x <- vLocalPos.x
          dp4 r25.y, r16.xyzw, r7.xyzw  // r25.y <- vLocalPos.y; r25.y <- vLocalPos.y
          dp4 r25.z, r14.xyzw, r7.xyzw  // r25.z <- vLocalPos.z; r25.z <- vLocalPos.z
          ge r12.w, r25.y, l(0.000000)
          movc r26.xyzw, r12.wwww, r19.xyzw, r20.xyzw  // r26.x <- vParams.x; r26.y <- vParams.y; r26.z <- vParams.z; r26.w <- vParams.w; r26.x <- vParams.x; r26.y <- vParams.y; r26.z <- vParams.z; r26.w <- vParams.w

#line 333
          mov r18.z, r26.x
          add r25.xzw, -r18.xxzy, |r25.xxyz|
          max r27.xyz, r25.xzwx, l(0.000000, 0.000000, 0.000000, 0.000000)  // r27.x <- vBoxDelta.x; r27.y <- vBoxDelta.y; r27.z <- vBoxDelta.z; r27.x <- vBoxDelta.x; r27.y <- vBoxDelta.y; r27.z <- vBoxDelta.z
          add r12.w, -|r25.y|, r26.x
          ge r12.w, r2.y, r12.w
          add r13.w, r26.y, r26.x
          add r13.w, -r13.w, |r25.y|
          ge r13.w, r2.y, r13.w
          and r12.w, r12.w, r13.w
          dp2 r13.w, r26.zwzz, r25.xzxx
          ge r13.w, r2.y, r13.w
          and r12.w, r12.w, r13.w
          dp2 r13.w, r26.wzww, r25.zwzz
          ge r13.w, r2.y, r13.w
          and r12.w, r12.w, r13.w  // r12.w <- bInsideFrustumB; r12.w <- bInsideFrustumB

#line 339
          dp3 r13.w, r7.xyzx, r17.xyzx  // r13.w <- fDistB0; r13.w <- fDistB0
          dp3 r17.w, r7.xyzx, r22.xyzx  // r17.w <- fDistB1; r17.w <- fDistB1
          dp3 r18.z, r7.xyzx, r23.xyzx  // r18.z <- fDistB2; r18.z <- fDistB2
          dp3 r21.w, r7.xyzx, r21.xyzx  // r21.w <- fDistB3; r21.w <- fDistB3
          dp3 r22.w, r7.xyzx, r24.xyzx
          add r22.w, r24.w, r22.w  // r22.w <- fDistB4; r22.w <- fDistB4
          max r13.w, r13.w, r17.w
          max r17.w, r18.z, r21.w
          max r13.w, r13.w, r17.w
          max r13.w, r22.w, r13.w  // r13.w <- fMaxDist; r13.w <- fMaxDist
          dp3 r17.w, r27.xyzx, r27.xyzx
          ge r17.w, r2.x, r17.w  // r17.w <- bInsideBox; r17.w <- bInsideBox
          ge r13.w, r2.y, r13.w  // r13.w <- bInsideGate; r13.w <- bInsideGate

#line 328
          dp4 r15.x, r15.xyzw, r4.xyzw  // r15.x <- vLocalPos.x
          dp4 r15.y, r16.xyzw, r4.xyzw  // r15.y <- vLocalPos.y
          dp4 r15.z, r14.xyzw, r4.xyzw  // r15.z <- vLocalPos.z
          ge r14.x, r15.y, l(0.000000)
          movc r14.xyzw, r14.xxxx, r19.xyzw, r20.xyzw  // r14.x <- vParams.x; r14.y <- vParams.y; r14.z <- vParams.z; r14.w <- vParams.w

#line 333
          mov r18.w, r14.x
          add r15.xzw, -r18.xxwy, |r15.xxyz|
          max r16.xyz, r15.xzwx, l(0.000000, 0.000000, 0.000000, 0.000000)  // r16.x <- vBoxDelta.x; r16.y <- vBoxDelta.y; r16.z <- vBoxDelta.z
          add r16.w, -|r15.y|, r14.x
          ge r16.w, r2.z, r16.w
          add r14.x, r14.y, r14.x
          add r14.x, -r14.x, |r15.y|
          ge r14.x, r2.z, r14.x
          and r14.x, r14.x, r16.w
          dp2 r14.y, r14.zwzz, r15.xzxx
          ge r14.y, r2.z, r14.y
          and r14.x, r14.y, r14.x
          dp2 r14.y, r14.wzww, r15.zwzz
          ge r14.y, r2.z, r14.y
          and r14.x, r14.y, r14.x  // r14.x <- bInsideFrustumB

#line 339
          dp3 r14.y, r4.xyzx, r17.xyzx  // r14.y <- fDistB0
          dp3 r14.z, r4.xyzx, r22.xyzx  // r14.z <- fDistB1
          dp3 r14.w, r4.xyzx, r23.xyzx  // r14.w <- fDistB2
          dp3 r15.x, r4.xyzx, r21.xyzx  // r15.x <- fDistB3
          dp3 r15.y, r4.xyzx, r24.xyzx
          add r15.y, r24.w, r15.y  // r15.y <- fDistB4
          max r14.y, r14.z, r14.y
          max r14.z, r14.w, r15.x
          max r14.y, r14.z, r14.y
          max r14.y, r15.y, r14.y  // r14.y <- fMaxDist
          dp3 r14.z, r16.xyzx, r16.xyzx
          ge r14.z, r1.w, r14.z  // r14.z <- bInsideBox
          ge r14.y, r2.z, r14.y  // r14.y <- bInsideGate

#line 584
          or r14.z, r14.z, r17.w  // r14.z <- bInsideBox
          or r12.w, r12.w, r14.x  // r12.w <- bInsideFrustum
          or r13.w, r13.w, r14.y  // r13.w <- bInsideGate
          or r12.w, r12.w, r14.z  // r12.w <- bInsideFadeRegion
          iadd r13.y, -r13.y, vThreadGroupID.x
          ult r13.y, r13.y, r13.z
          iadd r11.y, -r11.y, vThreadGroupID.y
          ult r11.y, r11.y, r11.w
          and r11.y, r11.y, r13.y
          ge r11.w, r1.z, r12.z
          and r11.y, r11.w, r11.y
          or r11.w, r12.w, r13.w
          and r11.y, r11.w, r11.y  // r11.y <- bVisible

#line 618
        else
          mov r13.x, l(0)  // r13.x <- nRoomIdx0
          mov r11.y, l(0)  // r11.y <- bVisible
          mov r12.xy, l(0,0,0,0)  // r12.x <- nRoomIdx1; r12.y <- nObjectType
        endif

#line 76
        sync_g_t
        and r11.w, r11.y, l(1)
        store_structured g2.x, l(0), r3.w, r11.w
        sync_g_t

#line 86
        ld_structured r12.zw, l(0), r9.x, g2.xxxy
        and r11.w, r8.x, r12.z
        iadd r11.w, r11.w, r12.w
        store_structured g2.x, l(1), r3.w, r11.w
        sync_g_t
        ld_structured r11.w, l(1), r3.w, g2.xxxx
        ld_structured r12.z, l(1), r9.y, g2.xxxx
        and r12.z, r8.y, r12.z
        iadd r11.w, r11.w, r12.z
        store_structured g2.x, l(0), r3.w, r11.w
        sync_g_t
        ld_structured r11.w, l(0), r3.w, g2.xxxx
        ld_structured r12.z, l(0), r9.z, g2.xxxx
        and r12.z, r8.z, r12.z
        iadd r11.w, r11.w, r12.z
        store_structured g2.x, l(1), r3.w, r11.w
        sync_g_t
        ld_structured r11.w, l(1), r3.w, g2.xxxx
        ld_structured r12.z, l(1), r9.w, g2.xxxx
        and r12.z, r8.w, r12.z
        iadd r11.w, r11.w, r12.z
        store_structured g2.x, l(0), r3.w, r11.w
        sync_g_t
        ld_structured r11.w, l(0), r3.w, g2.xxxx
        ld_structured r12.z, l(0), r10.x, g2.xxxx
        and r12.z, r5.y, r12.z
        iadd r11.w, r11.w, r12.z
        store_structured g2.x, l(1), r3.w, r11.w
        sync_g_t
        ld_structured r11.w, l(1), r3.w, g2.xxxx
        ld_structured r12.z, l(1), r10.y, g2.xxxx
        and r12.z, r5.z, r12.z
        iadd r11.w, r11.w, r12.z
        store_structured g2.x, l(0), r3.w, r11.w
        sync_g_t

#line 90
        ld_structured r11.w, l(0), l(252), g2.xxxx  // r11.w <- nTotal
        ld_structured r12.z, l(0), r3.w, g2.xxxx
        iadd r12.z, r5.w, r12.z

#line 623
        iadd r12.z, r12.z, l(-1)  // r12.z <- nDest

#line 627
        ult r12.w, r12.z, l(1023)
        and r11.y, r11.y, r12.w
        if_nz r11.y
          ishl r11.y, l(1), r13.x
          bfi r11.y, l(1), r12.x, l(1), r11.y  // r11.y <- nRoomMask

#line 629
          ishl r12.x, r12.y, l(12)
          iadd r11.z, r11.z, r12.x
          store_structured g0.x, r12.z, l(0), r11.z
          or r10.w, r10.w, r11.y
        endif

#line 76
        sync_g_t
        store_structured g2.x, l(0), r3.w, l(0)
        sync_g_t

#line 86
        ld_structured r11.y, l(0), r9.x, g2.xxxx
        and r11.y, r8.x, r11.y
        store_structured g2.x, l(1), r3.w, r11.y
        sync_g_t
        ld_structured r11.y, l(1), r3.w, g2.xxxx
        ld_structured r11.z, l(1), r9.y, g2.xxxx
        and r11.z, r8.y, r11.z
        iadd r11.y, r11.z, r11.y
        store_structured g2.x, l(0), r3.w, r11.y
        sync_g_t
        ld_structured r11.y, l(0), r3.w, g2.xxxx
        ld_structured r11.z, l(0), r9.z, g2.xxxx
        and r11.z, r8.z, r11.z
        iadd r11.y, r11.z, r11.y
        store_structured g2.x, l(1), r3.w, r11.y
        sync_g_t
        ld_structured r11.y, l(1), r3.w, g2.xxxx
        ld_structured r11.z, l(1), r9.w, g2.xxxx
        and r11.z, r8.w, r11.z
        iadd r11.y, r11.z, r11.y
        store_structured g2.x, l(0), r3.w, r11.y
        sync_g_t
        ld_structured r11.y, l(0), r3.w, g2.xxxx
        ld_structured r11.z, l(0), r10.x, g2.xxxx
        and r11.z, r5.y, r11.z
        iadd r11.y, r11.z, r11.y
        store_structured g2.x, l(1), r3.w, r11.y
        sync_g_t
        ld_structured r11.y, l(1), r3.w, g2.xxxx
        ld_structured r11.z, l(1), r10.y, g2.xxxx
        and r11.z, r5.z, r11.z
        iadd r11.y, r11.z, r11.y
        store_structured g2.x, l(0), r3.w, r11.y
        sync_g_t

#line 90
        ld_structured r11.y, l(0), l(252), g2.xxxx  // r11.y <- nTotal

#line 644
        iadd r5.w, r5.w, r11.w
        iadd r10.z, r10.z, r11.y

#line 648
        iadd r11.x, r11.x, l(1)
      endloop

#line 651
      umin r1.w, r5.w, l(127)  // r1.w <- nNumVisibleGates
      umin r2.x, r10.z, l(127)  // r2.x <- nNumVisibleGatesTransparent

#line 655
      ult r3.z, l(0), r1.w
      ult r2.x, l(0), r2.x
      or r2.x, r2.x, r3.z
      if_nz r2.x

#line 679
        store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r10.w
        sync_g_t
        if_nz r5.x
          iadd r2.x, vThreadIDInGroupFlattened.x, l(32)
          ld_structured r2.x, r2.x, l(0), g3.xxxx
          or r2.x, r2.x, r10.w
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r2.x
        endif
        sync_g_t

#line 707
        ult r8.xyzw, vThreadIDInGroupFlattened.xxxx, l(16, 8, 4, 2)

#line 689
        if_nz r8.x
          ld_structured r2.x, vThreadIDInGroupFlattened.x, l(0), g3.xxxx
          ld_structured r3.z, r6.x, l(0), g3.xxxx
          or r2.x, r2.x, r3.z
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r2.x
        endif
        sync_g_t
        if_nz r8.y
          ld_structured r2.x, vThreadIDInGroupFlattened.x, l(0), g3.xxxx
          ld_structured r3.z, r6.y, l(0), g3.xxxx
          or r2.x, r2.x, r3.z
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r2.x
        endif

#line 700
        sync_g_t
        if_nz r8.z
          ld_structured r2.x, vThreadIDInGroupFlattened.x, l(0), g3.xxxx
          ld_structured r3.z, r6.z, l(0), g3.xxxx
          or r2.x, r2.x, r3.z
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r2.x
        endif
        sync_g_t
        if_nz r8.w
          ld_structured r2.x, vThreadIDInGroupFlattened.x, l(0), g3.xxxx
          ld_structured r3.z, r6.w, l(0), g3.xxxx
          or r2.x, r2.x, r3.z
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r2.x

#line 711
        endif
        sync_g_t
        ult r2.x, vThreadIDInGroupFlattened.x, l(1)
        if_nz r2.x
          ld_structured r2.x, vThreadIDInGroupFlattened.x, l(0), g3.xxxx
          ld_structured r3.z, l(1), l(0), g3.xxxx
          or r2.x, r2.x, r3.z
          store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r2.x
        endif
        sync_g_t
        ld_structured r2.x, l(0), l(0), g3.xxxx  // r2.x <- nVisibleRoomMask

#line 723
      else
        mov r2.x, l(0)  // r2.x <- nVisibleRoomMask
      endif
    else   // Prior locations: r3.z <- fTransparencyLinearMinDepth; r3.w <- fTransparencyLinearMaxDepth; r4.w <- nOpaqueLinearDepth11; r2.x <- fTileBoundingSphereRadiusSquared0; r1.w <- fTileBoundingSphereRadiusSquared1; r5.y <- vDelta1.x; r5.z <- vDelta1.y; r5.w <- vDelta1.z
      mov r5.w, l(0)  // r5.w <- nNumFineIndices
      mov r1.w, l(0)  // r1.w <- nNumVisibleGates
      mov r2.x, l(0)  // r2.x <- nVisibleRoomMask
    endif

#line 728
    or r2.x, r2.x, l(1)

#line 734
    movc r1.w, r1.w, l(2), l(0)  // r1.w <- nFeatureFlags

#line 1037 "common.fx"
    div r3.z, l(1.000000, 1.000000, 1.000000, 1.000000), -cb2[24].y  // r3.z <- <RemapDepthLinear return value>

#line 738 "C:\p4\PRJ_PRO\main\assembly\shaders\win32\lighttile.fx"
    mul r3.z, r3.z, l(0.999900)
    lt r3.z, r3.z, r1.y  // r3.z <- bIsBackground

#line 755
    iadd r0.z, r0.z, r0.w

#line 78
    ishl r3.w, vThreadIDInGroupFlattened.x, l(2)

#line 821
    not r5.y, r3.z

#line 86
    uge r8.xyzw, vThreadIDInGroupFlattened.xxxx, l(1, 2, 4, 8)
    iadd r9.xyzw, r3.wwww, l(-4, -8, -16, -32)
    uge r10.xy, vThreadIDInGroupFlattened.xxxx, l(16, 32, 0, 0)

#line 933
    iadd r11.xyz, r3.wwww, l(-64, -128, 8, 0)

#line 783
    mov r7.w, l(1.000000)

#line 790
    mov r12.z, l(1.000000)
    mov r4.w, l(1.000000)

#line 799
    mov r13.z, l(1.000000)

#line 741
    mov r5.z, r5.w  // r5.z <- nNumFineIndices
    mov r10.z, r1.w  // r10.z <- nFeatureFlags
    mov r10.w, l(0)  // r10.w <- j
    loop
      uge r11.w, r10.w, r2.w
      breakc_nz r11.w
      bfi r11.w, l(26), l(6), r10.w, vThreadIDInGroupFlattened.x
      iadd r11.w, r0.w, r11.w  // r11.w <- i
      iadd r12.w, r0.y, r11.w
      ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r12.w, r12.w, l(0), t2.xxxx  // r12.w <- nObjectIdx

#line 755
      ult r11.w, r11.w, r0.z
      if_nz r11.w
        imul null, r11.w, r12.w, l(12)
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r14.xyzw, r11.w, l(0), t1.xyzw  // r14.x <- Data.x; r14.y <- Data.y; r14.z <- Data.z; r14.w <- Data.w

#line 761
        and r15.xy, r14.xyxx, l(0x00003fff, 0x00003fff, 0, 0)  // r15.x <- nTileMinX; r15.y <- nTileDeltaX
        ubfe r15.zw, l(0, 0, 14, 14), l(0, 0, 14, 14), r14.xxxy  // r15.z <- nTileMinY; r15.w <- nTileDeltaY
        f16tof32 r11.w, r14.z  // r11.w <- fTileMinZ
        ushr r14.xy, r14.xzxx, l(28, 16, 0, 0)  // r14.x <- nObjectType
        f16tof32 r13.w, r14.y  // r13.w <- fTileMaxZ

add r35.z, r11.w, -r35.y       // fTileMinZ - convergence
add r35.w, r13.w, -r35.y       // fTileMaxZ - convergence
mul r35.zw, r35.xxzw, r35.xxxx // * separation
mul r35.zw, r35.xxzw, l(0.5)   // clip -> screen
div r35.z, r35.z, r11.w        // Perspective divide
div r35.w, r35.w, r13.w        // Perspective divide
utof r36.y, cb5[0].x           //   (float)viNumTiles.x
mul r35.zw, r35.xxzw, r36.yyyy // * (float)viNumTiles.x

//mul r35.zw, r35.xxzw, r36.xxxx // IniParams debugging
//if_z vThreadIDInGroupFlattened.x
//	store_structured u4.xy, vThreadGroupID.x, l(0), r35.zwxx
//endif

round_ne r35.zw, r35.xxzw
ftoi r35.zw, r35.xxzw
if_nz r15.x
	iadd r15.x, r15.x, r35.w       // Adjust nTileMinX based on fTileMaxZ
endif
iadd r15.y, r15.y, |r35.w|     // Adjust nTileDeltaX to counter nTileMinX adjustment

//iadd r35.z, r35.w, -r35.z
//iadd r15.y, r15.y, |r35.z|     // Adjust nTileDeltaX based on difference in stereo corrections between fTileMaxZ & fTileMinZ

// Disable tile bounds (bye bye performance) -DarkStarSword:
//mov r15.x, l(0)
//mov r15.y, cb5[0].x

#line 774
        imad r14.yz, r12.wwww, l(0, 12, 12, 0), l(0, 1, 3, 0)
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r16.xyzw, r14.y, l(0), t1.xyzw  // r16.x <- vRow0.x; r16.y <- vRow0.y; r16.z <- vRow0.z; r16.w <- vRow0.w
        imad r14.y, r12.w, l(12), l(2)
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r17.xyzw, r14.y, l(0), t1.xyzw  // r17.x <- vRow1.x; r17.y <- vRow1.y; r17.z <- vRow1.z; r17.w <- vRow1.w
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r18.xyzw, r14.z, l(0), t1.xyzw  // r18.x <- vRow2.x; r18.y <- vRow2.y; r18.z <- vRow2.z; r18.w <- vRow2.w
        imad r14.yz, r12.wwww, l(0, 12, 12, 0), l(0, 4, 5, 0)
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r19.xyzw, r14.y, l(0), t1.xyzw  // r19.x <- vParams0.x; r19.y <- vParams0.y; r19.z <- vParams0.z; r19.w <- vParams0.w
        ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r20.xyzw, r14.z, l(0), t1.wxyz  // r20.y <- viParams1.x; r20.z <- viParams1.y; r20.w <- viParams1.z; r20.x <- viParams1.w

#line 783
        dp4 r21.x, r16.xyzw, r7.xyzw  // r21.x <- vSignedPosA.x
        dp4 r21.y, r17.xyzw, r7.xyzw  // r21.y <- vSignedPosA.y
        dp4 r21.z, r18.xyzw, r7.xyzw  // r21.z <- vSignedPosA.z
        add r22.xyz, -r19.xyzx, |r21.xyzx|
        max r22.xyz, r22.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)  // r22.x <- vDeltaA.x; r22.y <- vDeltaA.y; r22.z <- vDeltaA.z
        dp3 r14.y, r22.xyzx, r22.xyzx  // r14.y <- fDistSqA
        add r14.z, r2.y, r19.w  // r14.z <- fTotalRadiusA
        mul r14.z, r14.z, r14.z  // r14.z <- fTotalRadiusSqA
        ge r14.y, r14.z, r14.y
        dp2 r14.z, r21.xyxx, r21.xyxx
        sqrt r12.y, r14.z
        mov r12.x, r21.z
        dp3 r12.x, r20.yzwy, r12.xyzx
        lt r12.x, r12.x, r2.y
        and r12.x, r12.x, r14.y  // r12.x <- bInside
        dp4 r16.x, r16.xyzw, r4.xyzw  // r16.x <- vSignedPosB.x
        dp4 r16.y, r17.xyzw, r4.xyzw  // r16.y <- vSignedPosB.y
        dp4 r16.z, r18.xyzw, r4.xyzw  // r16.z <- vSignedPosB.z

#line 794
        add r17.xyz, -r19.xyzx, |r16.xyzx|
        max r17.xyz, r17.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)  // r17.x <- vDeltaB.x; r17.y <- vDeltaB.y; r17.z <- vDeltaB.z
        dp3 r12.y, r17.xyzx, r17.xyzx  // r12.y <- fDistSqB
        add r14.y, r2.z, r19.w  // r14.y <- fTotalRadiusB
        mul r14.y, r14.y, r14.y  // r14.y <- fTotalRadiusSqB
        ge r12.y, r14.y, r12.y
        dp2 r14.y, r16.xyxx, r16.xyxx
        sqrt r13.y, r14.y
        mov r13.x, r16.z
        dp3 r13.x, r20.yzwy, r13.xyzx
        lt r13.x, r13.x, r2.z
        and r12.y, r12.y, r13.x
        or r12.x, r12.y, r12.x

#line 821
        iadd r12.y, -r15.x, vThreadGroupID.x
        ult r12.y, r12.y, r15.y
        iadd r13.x, -r15.z, vThreadGroupID.y
        ult r13.x, r13.x, r15.w
        and r12.y, r12.y, r13.x
        ge r11.w, r1.z, r11.w
        and r11.w, r11.w, r12.y
        ge r12.y, r13.w, r1.y
        and r11.w, r11.w, r12.y
        and r12.y, r2.x, r14.w
        ine r12.y, r12.y, l(0)
        and r11.w, r11.w, r12.y
        and r11.w, r12.x, r11.w
        and r11.w, r5.y, r11.w  // r11.w <- bVisible

#line 852
      else
        mov r11.w, l(0)  // r11.w <- bVisible
        mov r14.x, l(0)  // r14.x <- nObjectType
        mov r20.x, l(0)
      endif

#line 76
      sync_g_t
      and r12.x, r11.w, l(1)
      store_structured g2.x, l(0), r3.w, r12.x
      sync_g_t

#line 86
      ld_structured r12.xy, l(0), r9.x, g2.xyxx
      and r12.x, r8.x, r12.x
      iadd r12.x, r12.x, r12.y
      store_structured g2.x, l(1), r3.w, r12.x
      sync_g_t
      ld_structured r12.x, l(1), r3.w, g2.xxxx
      ld_structured r12.y, l(1), r9.y, g2.xxxx
      and r12.y, r8.y, r12.y
      iadd r12.x, r12.y, r12.x
      store_structured g2.x, l(0), r3.w, r12.x
      sync_g_t
      ld_structured r12.x, l(0), r3.w, g2.xxxx
      ld_structured r12.y, l(0), r9.z, g2.xxxx
      and r12.y, r8.z, r12.y
      iadd r12.x, r12.y, r12.x
      store_structured g2.x, l(1), r3.w, r12.x
      sync_g_t
      ld_structured r12.x, l(1), r3.w, g2.xxxx
      ld_structured r12.y, l(1), r9.w, g2.xxxx
      and r12.y, r8.w, r12.y
      iadd r12.x, r12.y, r12.x
      store_structured g2.x, l(0), r3.w, r12.x
      sync_g_t
      ld_structured r12.x, l(0), r3.w, g2.xxxx
      ld_structured r12.y, l(0), r11.x, g2.xxxx
      and r12.y, r10.x, r12.y
      iadd r12.x, r12.y, r12.x
      store_structured g2.x, l(1), r3.w, r12.x
      sync_g_t
      ld_structured r12.x, l(1), r3.w, g2.xxxx
      ld_structured r12.y, l(1), r11.y, g2.xxxx
      and r12.y, r10.y, r12.y
      iadd r12.x, r12.y, r12.x
      store_structured g2.x, l(0), r3.w, r12.x
      sync_g_t

#line 90
      ld_structured r12.x, l(0), l(252), g2.xxxx  // r12.x <- nTotal
      ld_structured r12.y, l(0), r3.w, g2.xxxx
      iadd r12.y, r5.z, r12.y

#line 855
      iadd r12.y, r12.y, l(-1)  // r12.y <- nDest
      ult r13.x, r12.y, l(1023)
      and r11.w, r11.w, r13.x
      if_nz r11.w
        ishl r11.w, r14.x, l(12)
        iadd r11.w, r11.w, r12.w
        store_structured g0.x, r12.y, l(0), r11.w
        or r10.z, r10.z, r20.x
      endif
      iadd r5.z, r5.z, r12.x

#line 875
      iadd r10.w, r10.w, l(1)
    endloop

#line 878
    umin r0.y, r5.z, l(127)  // r0.y <- nNumVisibleObjects

#line 883
    and r0.zw, r3.xxxy, l(0, 0, 0x00020000, 0x00040000)
    or r0.z, r0.z, r10.z  // r0.z <- nFeatureFlags
    or r0.z, r0.w, r0.z
    and r0.w, r1.x, l(0x00080000)
    or r0.z, r0.w, r0.z

#line 279
    store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r0.z
    sync_g_t
    if_nz r5.x
      iadd r0.w, vThreadIDInGroupFlattened.x, l(32)
      ld_structured r0.w, r0.w, l(0), g11.xxxx
      or r0.z, r0.w, r0.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r0.z
    endif
    sync_g_t

#line 293
    ult r1.xyzw, vThreadIDInGroupFlattened.xxxx, l(16, 8, 4, 2)

#line 284
    if_nz r1.x
      ld_structured r0.z, vThreadIDInGroupFlattened.x, l(0), g11.xxxx
      ld_structured r0.w, r6.x, l(0), g11.xxxx
      or r0.z, r0.w, r0.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r0.z
    endif
    sync_g_t
    if_nz r1.y
      ld_structured r0.z, vThreadIDInGroupFlattened.x, l(0), g11.xxxx
      ld_structured r0.w, r6.y, l(0), g11.xxxx
      or r0.z, r0.w, r0.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r0.z
    endif
    sync_g_t
    if_nz r1.z
      ld_structured r0.z, vThreadIDInGroupFlattened.x, l(0), g11.xxxx
      ld_structured r0.w, r6.z, l(0), g11.xxxx
      or r0.z, r0.w, r0.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r0.z
    endif
    sync_g_t
    if_nz r1.w
      ld_structured r0.z, vThreadIDInGroupFlattened.x, l(0), g11.xxxx
      ld_structured r0.w, r6.w, l(0), g11.xxxx
      or r0.z, r0.w, r0.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r0.z
    endif
    sync_g_t

#line 296
    ult r0.z, vThreadIDInGroupFlattened.x, l(1)
    if_nz r0.z
      ld_structured r0.z, vThreadIDInGroupFlattened.x, l(0), g11.xxxx
      ld_structured r0.w, l(1), l(0), g11.xxxx
      or r0.z, r0.w, r0.z
      store_structured g11.x, vThreadIDInGroupFlattened.x, l(0), r0.z
    endif
    sync_g_t
    ld_structured r1.x, l(0), l(0), g11.xxxx  // r1.x <- <ReductionUintOr return value>

#line 888
    if_z vThreadIDInGroupFlattened.x

#line 898
      and r2.xyzw, r1.xxxx, l(2, 0x00020000, 0x00040000, 0x00080000)
      ine r2.yzw, r2.yyzw, l(0, 0, 0, 0)  // r2.y <- bStandard; r2.z <- bSkin; r2.w <- bHair

#line 910
      not r4.xyz, r2.zwyz

#line 914
      and r2.yzw, r2.yyzw, r4.xxzz
      and r2.yzw, r4.yyyx, r2.yyzw

#line 920
      movc r4.xyzw, r2.xxxx, l(2,4,6,8), l(1,3,5,7)  // r4.w <- nPermutation
      movc r0.z, r2.w, r4.z, r4.w  // r0.z <- nPermutation
      movc r0.z, r2.z, r4.y, r0.z
      movc r0.z, r2.y, r4.x, r0.z
      movc r0.z, r3.z, l(0), r0.z

#line 924
      imul null, r0.w, r0.z, l(3)
      imm_atomic_iadd r2.x, u3, r0.w, l(1)  // r2.x <- nWriteIdx
      imad r0.z, r0.z, cb5[1].x, r2.x
      imad r0.w, vThreadGroupID.y, l(0x00010000), vThreadGroupID.x
      store_structured u2.x, r0.z, l(0), r0.w

#line 892
      mov r1.y, l(0)
      store_structured u0.xy, r0.x, l(0), r1.xyxx

#line 929
      store_structured u1.xy, r0.x, l(0), l(0,1,0,0)
    endif
    ult r0.z, vThreadIDInGroupFlattened.x, r0.y
    ld_structured r0.w, vThreadIDInGroupFlattened.x, l(0), g0.xxxx
    and r0.z, r0.w, r0.z
    store_structured u0.x, r0.x, r11.z, r0.z
    iadd r0.z, r3.w, l(256)
    iadd r0.w, vThreadIDInGroupFlattened.x, l(64)
    ult r0.y, r0.w, r0.y
    ld_structured r0.w, r0.w, l(0), g0.xxxx
    and r0.y, r0.w, r0.y
    iadd r0.z, r0.z, l(8)
    store_structured u0.x, r0.x, r0.z, r0.y
    store_structured u1.x, r0.x, r11.z, l(0)
    store_structured u1.x, r0.x, r0.z, l(0)

#line 1126
  endif
endif

#line 1140
ret
// Approximately 1624 instruction slots used
