//Sun position CS.
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sat May 29 10:44:07 2021
//
//
// 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 cb0[11], immediateIndexed
dcl_constantbuffer cb1[54], immediateIndexed
dcl_constantbuffer cb2[142], immediateIndexed
dcl_constantbuffer cb3[4], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texturecube (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t6
dcl_uav_typed_texture2d (float,float,float,float) u0
dcl_uav_typed_texture2d (float,float,float,float) u1
dcl_input vThreadIDInGroup.xy
dcl_temps 40
dcl_resource_texture2d (float,float,float,float) t125
dcl_thread_group 8, 8, 1

ld_indexable(texture2d)(float,float,float,float) r25.xyzw, l(0, 0, 0, 0), t125.xyzw

max r0.x, |cb0[0].y|, |cb0[0].x|
max r0.x, r0.x, l(1.000000)
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
mul r0.xy, r0.xxxx, cb0[0].xyxx

mad r0.x, r25.x, l(1.0), r0.x

mad r0.xy, r0.xyxx, cb1[52].xyxx, cb1[52].wzww
mad r0.xy, r0.xyxx, cb3[3].xyxx, l(-6.000000, -6.000000, 0.000000, 0.000000)
ftoi r0.xy, r0.xyxx
ishl r0.zw, vThreadIDInGroup.xxxy, l(0, 0, 1, 1)
iadd r0.xy, r0.xyxx, r0.zwzz
add r0.zw, cb3[2].xxxy, l(0.000000, 0.000000, -2.000000, -2.000000)
ftoi r0.zw, r0.zzzw
imax r0.xy, r0.xyxx, l(0, 0, 0, 0)
imin r0.xy, r0.zwzz, r0.xyxx
mov r0.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r1.x, r0.xyzw, t0.xyzw
iadd r2.xyzw, r0.xyxy, l(0, 1, 1, 0)
mov r3.xy, r2.zwzz
mov r3.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r1.y, r3.xyzw, t0.yxzw
mov r2.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r1.z, r2.xyzw, t0.yzxw
iadd r0.xy, r0.xyxx, l(1, 1, 0, 0)
mov r0.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r1.w, r0.xyzw, t0.yzwx
mad r0.xyzw, -r1.xyzw, r1.xyzw, cb0[0].zzzz
add r1.x, cb0[0].z, l(0.010000)
div r0.xyzw, r0.xyzw, r1.xxxx
mad_sat r0.xyzw, r0.xyzw, cb0[2].wwww, l(1.000000, 1.000000, 1.000000, 1.000000)
dp4 r0.x, r0.xyzw, l(0.250000, 0.250000, 0.250000, 0.250000)
ishl r1.xy, cb0[3].yxyy, l(3, 3, 0, 0)
mov r1.z, l(0)
iadd r2.xy, vThreadIDInGroup.xyxx, r1.xzxx
mov r2.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r3.xyzw, r2.xyww, t1.xyzw
ld_indexable(texture2d)(float,float,float,float) r2.xyzw, r2.xyzw, t2.xyzw
and r0.y, cb0[6].z, l(1)
if_nz r0.y
  dp3 r0.y, cb0[1].xyzx, cb0[1].xyzx
  sqrt r0.y, r0.y
  add r0.y, r0.y, -cb0[5].w
  max r0.y, r0.y, l(0.000000)
  mad r0.y, r0.y, r0.y, l(1.000000)
  div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
  mul r0.yzw, r0.yyyy, cb0[2].xxyz
  itof r1.xw, vThreadIDInGroup.xxxy
  add r1.xw, r1.xxxw, l(-3.500000, 0.000000, 0.000000, -3.500000)
  mul r4.xyz, r1.xxxx, cb1[50].xyzx
  mad r4.xyz, r4.xyzx, l(-4.000000, -4.000000, -4.000000, 0.000000), cb0[1].xyzx
  mul r5.xyz, r1.wwww, cb1[49].xyzx
  mad r4.xyz, r5.xyzx, l(-4.000000, -4.000000, -4.000000, 0.000000), r4.xyzx
  and r1.x, cb0[6].z, l(2)
  if_nz r1.x
    dp3 r1.x, r4.xyzx, r4.xyzx
    rsq r1.x, r1.x
    mul r5.xyz, r1.xxxx, r4.xyzx
    dp3 r1.x, r5.xyzx, cb0[5].xyzx
    add r1.w, r1.x, -cb0[6].x
    mul_sat r1.w, r1.w, cb0[6].y
    mul r1.w, r1.w, r1.w
    mul r0.x, r0.x, r1.w
    and r5.xy, cb0[6].zzzz, l(4, 8, 0, 0)
    if_nz r5.x
      add r1.w, -|r1.x|, l(1.000000)
      sqrt r1.w, r1.w
      mad r4.w, |r1.x|, l(-0.0187292993), l(0.074261)
      mad r4.w, r4.w, |r1.x|, l(-0.212114394)
      mad r4.w, r4.w, |r1.x|, l(1.57072878)
      mul r5.x, r1.w, r4.w
      mad r5.x, r5.x, l(-2.000000), l(3.14159274)
      lt r1.x, r1.x, -r1.x
      and r1.x, r1.x, r5.x
      mad r1.x, r4.w, r1.w, r1.x
      add r1.x, -r1.x, l(1.57079637)
      mad r6.x, r1.x, l(0.318309873), l(0.500000)
      mov r6.y, l(0)
      sample_l_indexable(texture2d)(float,float,float,float) r1.x, r6.xyxx, t3.xyzw, s0, l(0.000000)
      mul r0.x, r0.x, r1.x
    endif
    if_nz r5.y
      add r5.xyz, -r4.xyzx, cb1[53].xyzx
      mul r6.xyz, r5.yyyy, cb0[8].xywx
      mad r5.xyw, r5.xxxx, cb0[7].xyxw, r6.xyxz
      mad r5.xyz, r5.zzzz, cb0[9].xywx, r5.xywx
      add r5.xyz, r5.xyzx, cb0[10].xywx
      div r1.xw, r5.xxxy, r5.zzzz
      mad r1.xw, r1.xxxw, l(0.500000, 0.000000, 0.000000, 0.500000), l(0.500000, 0.000000, 0.000000, 0.500000)
      sample_l_indexable(texture2d)(float,float,float,float) r5.xyz, r1.xwxx, t4.xyzw, s1, l(1.000000)
      mul r0.yzw, r0.yyzw, r5.xxyz
    endif
  else
    and r1.x, cb0[6].z, l(8)
    if_nz r1.x
      add r4.xyz, -r4.xyzx, cb1[53].xyzx
      mul r5.xyz, r4.yyyy, cb0[8].xyzx
      mad r4.xyw, r4.xxxx, cb0[7].xyxz, r5.xyxz
      mad r4.xyz, r4.zzzz, cb0[9].xyzx, r4.xywx
      add r4.xyz, r4.xyzx, cb0[10].xyzx
      sample_l_indexable(texturecube)(float,float,float,float) r4.xyz, r4.xyzx, t5.xyzw, s1, l(1.000000)
      mul r0.yzw, r0.yyzw, r4.xxyz
    endif
  endif
else
  mul r1.xw, cb1[53].xxxy, cb2[138].yyyy
  mad r4.x, cb1[53].z, cb2[138].y, -cb2[138].z
  mad r1.xw, -cb2[141].zzzw, r4.xxxx, r1.xxxw
  dp2 r4.x, cb2[141].xyxx, r1.xwxx
  mul r4.zw, cb2[141].yyyx, l(0.000000, 0.000000, -1.000000, 1.000000)
  dp2 r4.y, r4.zwzz, r1.xwxx
  mul r5.x, cb2[138].y, cb2[140].w
  mul r5.y, cb2[138].y, cb2[139].w
  add r1.xw, r4.xxxy, -r5.xxxy
  add r4.xy, |r1.xwxx|, l(1.000000, 1.000000, 0.000000, 0.000000)
  div r1.xw, r1.xxxw, r4.xxxy
  mad r1.xw, r1.xxxw, l(0.500000, 0.000000, 0.000000, 0.500000), l(0.500000, 0.000000, 0.000000, 0.500000)
  sample_l_indexable(texture2d)(float,float,float,float) r1.x, r1.xwxx, t6.xyzw, s0, l(0.000000)
  mul r1.x, r1.x, r1.x
  mad r1.x, r1.x, l(4.000000), l(0.025000)
  min r1.x, r1.x, l(1.000000)
  mad r1.x, r1.x, l(1.250000), l(-0.250000)
  max r1.x, r1.x, l(0.000000)
  mul r0.x, r0.x, r1.x
  mov r0.yzw, cb0[2].xxyz
endif
dp3 r1.x, r0.yzwy, l(0.300000, 0.590000, 0.110000, 0.000000)
mul r1.w, r0.x, r1.x
mad_sat r1.w, r1.w, cb2[43].x, -cb0[3].w
mul r4.w, r0.x, r1.w
div r0.x, cb2[43].x, cb0[4].x
mul r1.w, r0.x, r1.x
exp r1.w, -r1.w
add r1.w, -r1.w, l(1.000000)
div r0.x, r1.w, r0.x
div_sat r0.x, r0.x, r1.x
mul r0.xyz, r0.xxxx, r0.yzwy
mov r0.w, l(1.000000)
mul r0.xyzw, r4.wwww, r0.xyzw
iadd r1.xyzw, vThreadIDInGroup.xyyy, r1.yzzz
store_uav_typed u1.xyzw, r1.xwww, r0.xyzw
mov r4.xyz, r0.xyzx
mul r0.xyzw, r4.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
mad r0.xyzw, r2.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000), r0.xyzw
add r2.xyzw, -r0.xyzw, r3.xyzw
mad r0.xyzw, cb0[4].yyyy, r2.xyzw, r0.xyzw
mul r0.xyzw, r0.xyzw, cb0[3].zzzz
store_uav_typed u0.xyzw, r1.xyzw, r0.xyzw
ret
// Approximately 0 instruction slots used

///////////////////////////////// HLSL Code /////////////////////////////////
// // ---- Created with 3Dmigoto v1.3.16 on Sat May 29 10:44:07 2021
// Texture2D<float4> t6 : register(t6);
//
// TextureCube<float4> t5 : register(t5);
//
// Texture2D<float4> t4 : register(t4);
//
// Texture2D<float4> t3 : register(t3);
//
// Texture2D<float4> t2 : register(t2);
//
// Texture2D<float4> t1 : register(t1);
//
// Texture2D<float4> t0 : register(t0);
//
// SamplerState s1_s : register(s1);
//
// SamplerState s0_s : register(s0);
//
// cbuffer cb3 : register(b3)
// {
//   float4 cb3[4];
// }
//
// cbuffer cb2 : register(b2)
// {
//   float4 cb2[142];
// }
//
// cbuffer cb1 : register(b1)
// {
//   float4 cb1[54];
// }
//
// cbuffer cb0 : register(b0)
// {
//   float4 cb0[11];
// }
//
//
//
//
// // 3Dmigoto declarations
// #define cmp -
// Texture1D<float4> IniParams : register(t120);
// Texture2D<float4> StereoParams : register(t125);
//
//
// void main)
// {
// // Needs manual fix for instruction:
// // unknown dcl_: dcl_uav_typed_texture2d (float,float,float,float) u0
// // Needs manual fix for instruction:
// // unknown dcl_: dcl_uav_typed_texture2d (float,float,float,float) u1
//   float4 r0,r1,r2,r3,r4,r5,r6;
//   uint4 bitmask, uiDest;
//   float4 fDest;
//
// // Needs manual fix for instruction:
// // unknown dcl_: dcl_thread_group 8, 8, 1
//   r0.x = max(abs(cb0[0].x), abs(cb0[0].y));
//   r0.x = max(1, r0.x);
//   r0.x = 1 / r0.x;
//   r0.xy = cb0[0].xy * r0.xx;
//   r0.xy = r0.xy * cb1[52].xy + cb1[52].wz;
//   r0.xy = r0.xy * cb3[3].xy + float2(-6,-6);
//   r0.xy = (int2)r0.xy;
//   r0.zw = (uint2)vThreadIDInGroup.xy << int2(1,1);
//   r0.xy = (int2)r0.xy + (int2)r0.zw;
//   r0.zw = float2(-2,-2) + cb3[2].xy;
//   r0.zw = (int2)r0.zw;
//   r0.xy = max(int2(0,0), (int2)r0.xy);
//   r0.xy = min((int2)r0.xy, (int2)r0.zw);
//   r0.zw = float2(0,0);
//   r1.x = t0.Load(r0.xyz).x;
//   r2.xyzw = (int4)r0.xyxy + int4(0,1,1,0);
//   r3.xy = r2.zw;
//   r3.zw = float2(0,0);
//   r1.y = t0.Load(r3.xyz).x;
//   r2.zw = float2(0,0);
//   r1.z = t0.Load(r2.xyz).x;
//   r0.xy = (int2)r0.xy + int2(1,1);
//   r0.zw = float2(0,0);
//   r1.w = t0.Load(r0.xyz).x;
//   r0.xyzw = -r1.xyzw * r1.xyzw + cb0[0].zzzz;
//   r1.x = 0.00999999978 + cb0[0].z;
//   r0.xyzw = r0.xyzw / r1.xxxx;
//   r0.xyzw = saturate(r0.xyzw * cb0[2].wwww + float4(1,1,1,1));
//   r0.x = dot(r0.xyzw, float4(0.25,0.25,0.25,0.25));
//   r1.xy = asuint(cb0[3].yx) << int2(3,3);
//   r1.z = 0;
//   r2.xy = (int2)vThreadIDInGroup.xy + (int2)r1.xz;
//   r2.zw = float2(0,0);
//   r3.xyzw = t1.Load(r2.xyw).xyzw;
//   r2.xyzw = t2.Load(r2.xyz).xyzw;
//   r0.y = asint(cb0[6].z) & 1;
//   if (r0.y != 0) {
//     r0.y = dot(cb0[1].xyz, cb0[1].xyz);
//     r0.y = sqrt(r0.y);
//     r0.y = -cb0[5].w + r0.y;
//     r0.y = max(0, r0.y);
//     r0.y = r0.y * r0.y + 1;
//     r0.y = 1 / r0.y;
//     r0.yzw = cb0[2].xyz * r0.yyy;
//     r1.xw = (int2)vThreadIDInGroup.xy;
//     r1.xw = float2(-3.5,-3.5) + r1.xw;
//     r4.xyz = cb1[50].xyz * r1.xxx;
//     r4.xyz = r4.xyz * float3(-4,-4,-4) + cb0[1].xyz;
//     r5.xyz = cb1[49].xyz * r1.www;
//     r4.xyz = r5.xyz * float3(-4,-4,-4) + r4.xyz;
//     r1.x = asint(cb0[6].z) & 2;
//     if (r1.x != 0) {
//       r1.x = dot(r4.xyz, r4.xyz);
//       r1.x = rsqrt(r1.x);
//       r5.xyz = r4.xyz * r1.xxx;
//       r1.x = dot(r5.xyz, cb0[5].xyz);
//       r1.w = -cb0[6].x + r1.x;
//       r1.w = saturate(cb0[6].y * r1.w);
//       r1.w = r1.w * r1.w;
//       r0.x = r1.w * r0.x;
//       r5.xy = asint(cb0[6].zz) & int2(4,8);
//       if (r5.x != 0) {
//         r1.w = 1 + -abs(r1.x);
//         r1.w = sqrt(r1.w);
//         r4.w = abs(r1.x) * -0.0187292993 + 0.0742610022;
//         r4.w = r4.w * abs(r1.x) + -0.212114394;
//         r4.w = r4.w * abs(r1.x) + 1.57072878;
//         r5.x = r4.w * r1.w;
//         r5.x = r5.x * -2 + 3.14159274;
//         r1.x = cmp(r1.x < -r1.x);
//         r1.x = r1.x ? r5.x : 0;
//         r1.x = r4.w * r1.w + r1.x;
//         r1.x = 1.57079637 + -r1.x;
//         r6.x = r1.x * 0.318309873 + 0.5;
//         r6.y = 0;
//         r1.x = t3.SampleLevel(s0_s, r6.xy, 0).x;
//         r0.x = r1.x * r0.x;
//       }
//       if (r5.y != 0) {
//         r5.xyz = cb1[53].xyz + -r4.xyz;
//         r6.xyz = cb0[8].xyw * r5.yyy;
//         r5.xyw = r5.xxx * cb0[7].xyw + r6.xyz;
//         r5.xyz = r5.zzz * cb0[9].xyw + r5.xyw;
//         r5.xyz = cb0[10].xyw + r5.xyz;
//         r1.xw = r5.xy / r5.zz;
//         r1.xw = r1.xw * float2(0.5,0.5) + float2(0.5,0.5);
//         r5.xyz = t4.SampleLevel(s1_s, r1.xw, 1).xyz;
//         r0.yzw = r5.xyz * r0.yzw;
//       }
//     } else {
//       r1.x = asint(cb0[6].z) & 8;
//       if (r1.x != 0) {
//         r4.xyz = cb1[53].xyz + -r4.xyz;
//         r5.xyz = cb0[8].xyz * r4.yyy;
//         r4.xyw = r4.xxx * cb0[7].xyz + r5.xyz;
//         r4.xyz = r4.zzz * cb0[9].xyz + r4.xyw;
//         r4.xyz = cb0[10].xyz + r4.xyz;
//         r4.xyz = t5.SampleLevel(s1_s, r4.xyz, 1).xyz;
//         r0.yzw = r4.xyz * r0.yzw;
//       }
//     }
//   } else {
//     r1.xw = cb2[138].yy * cb1[53].xy;
//     r4.x = cb1[53].z * cb2[138].y + -cb2[138].z;
//     r1.xw = -cb2[141].zw * r4.xx + r1.xw;
//     r4.x = dot(cb2[141].xy, r1.xw);
//     r4.zw = float2(-1,1) * cb2[141].yx;
//     r4.y = dot(r4.zw, r1.xw);
//     r5.x = cb2[140].w * cb2[138].y;
//     r5.y = cb2[139].w * cb2[138].y;
//     r1.xw = -r5.xy + r4.xy;
//     r4.xy = float2(1,1) + abs(r1.xw);
//     r1.xw = r1.xw / r4.xy;
//     r1.xw = r1.xw * float2(0.5,0.5) + float2(0.5,0.5);
//     r1.x = t6.SampleLevel(s0_s, r1.xw, 0).x;
//     r1.x = r1.x * r1.x;
//     r1.x = r1.x * 4 + 0.0250000004;
//     r1.x = min(1, r1.x);
//     r1.x = r1.x * 1.25 + -0.25;
//     r1.x = max(0, r1.x);
//     r0.x = r1.x * r0.x;
//     r0.yzw = cb0[2].xyz;
//   }
//   r1.x = dot(r0.yzw, float3(0.300000012,0.589999974,0.109999999));
//   r1.w = r1.x * r0.x;
//   r1.w = saturate(r1.w * cb2[43].x + -cb0[3].w);
//   r4.w = r1.w * r0.x;
//   r0.x = cb2[43].x / cb0[4].x;
//   r1.w = r1.x * r0.x;
//   r1.w = exp2(-r1.w);
//   r1.w = 1 + -r1.w;
//   r0.x = r1.w / r0.x;
//   r0.x = saturate(r0.x / r1.x);
//   r0.xyz = r0.yzw * r0.xxx;
//   r0.w = 1;
//   r0.xyzw = r0.xyzw * r4.wwww;
//   r1.xyzw = (int4)vThreadIDInGroup.xyyy + (int4)r1.yzzz;
// // No code for instruction (needs manual fix):
// store_uav_typed u1.xyzw, r1.xwww, r0.xyzw
//   r4.xyz = r0.xyz;
//   r0.xyzw = float4(0.5,0.5,0.5,0.5) * r4.xyzw;
//   r0.xyzw = r2.xyzw * float4(0.5,0.5,0.5,0.5) + r0.xyzw;
//   r2.xyzw = r3.xyzw + -r0.xyzw;
//   r0.xyzw = cb0[4].yyyy * r2.xyzw + r0.xyzw;
//   r0.xyzw = cb0[3].zzzz * r0.xyzw;
// // No code for instruction (needs manual fix):
// store_uav_typed u0.xyzw, r1.xyzw, r0.xyzw
//   return;
// }
//////////////////////////////// HLSL Errors ////////////////////////////////
// F:\SteamLibrary\steamapps\common\Days Gone\BendGame\Binaries\Win64\ShaderFixes\4495d444c2c6567f-cs_replace.txt(49,10): error X3000: syntax error: unexpected token ')'
/////////////////////////////////////////////////////////////////////////////
