//Ambient occlusion CS.
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sun May 23 23:40:50 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[20], dynamicIndexed
dcl_constantbuffer cb1[53], immediateIndexed
dcl_constantbuffer cb2[13], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (uint,uint,uint,uint) t2
dcl_uav_typed_texture2d (uint,uint,uint,uint) u0
dcl_input vThreadID.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

mov r0.xy, vThreadID.xyxx
mov r0.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r1.x, r0.xyww, t1.xyzw

mov r10.x, r1.x

ld_indexable(texture2d)(uint,uint,uint,uint) r0.x, r0.xyzw, t2.xyzw
and r0.y, cb2[12].y, l(1)
ubfe r0.z, l(1), l(1), cb2[12].y
bfi r2.x, l(31), l(1), vThreadID.x, cb2[12].y
xor r0.y, r0.z, r0.y
imad r2.y, vThreadID.y, l(2), r0.y
mov r2.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.y, r2.xyzw, t0.yxzw
lt r0.z, r0.y, cb0[19].x
movc r0.y, r0.z, r0.y, r1.x
mul r1.z, r0.y, r0.y
itof r0.zw, vThreadID.xxxy
mad r0.zw, r0.zzzw, cb0[18].zzzw, l(0.000000, 0.000000, -0.500000, -0.500000)
mul r0.zw, r0.zzzw, l(0.000000, 0.000000, 2.000000, -2.000000)

//mad r0.z, -r25.x, l(1.0), r0.z

//mul r25.w, r10.x, r25.y
//mul r25.w, r25.w, l(0.005)
//mad r0.z, r25.x, r25.w, r0.z

//mad r0.z, r25.x, r1.z, r0.z

mul r2.xyzw, r0.wwww, cb1[33].xyzw
mad r2.xyzw, r0.zzzz, cb1[32].xyzw, r2.xyzw
mad r2.xyzw, r1.zzzz, cb1[34].xyzw, r2.xyzw
add r2.xyzw, r2.xyzw, cb1[35].xyzw
div r2.xyz, r2.xyzx, r2.wwww
imul null, r3.xy, vThreadID.xyxx, l(0x0000aaab, 0x0000aaab, 0, 0)
ushr r3.xy, r3.xyxx, l(17, 17, 0, 0)
imad r3.xy, r3.xyxx, l(-3, -3, 0, 0), vThreadID.xyxx
imad r1.w, r3.y, l(3), r3.x
ishl r2.w, r1.w, l(3)
itof r1.w, r1.w
add r1.w, r1.w, l(0.500000)
mul r3.xyzw, r2.yyyy, cb1[1].xyzw
mad r3.xyzw, r2.xxxx, cb1[0].xyzw, r3.xyzw
mad r3.xyzw, r2.zzzz, cb1[2].xyzw, r3.xyzw
add r3.xyzw, r3.xyzw, cb1[3].xyzw

//mad r3.x, r25.x, r3.w, r3.x

div r3.xyz, r3.xyzx, r3.wwww
mad r1.xy, r0.zwzz, cb1[52].xyxx, cb1[52].wzww
mad r0.z, r1.w, l(0.111111112), l(0.500000)
mul r4.xy, cb1[52].xyxx, l(16.000000, 16.000000, 0.000000, 0.000000)
mov r4.z, l(16.000000)
mov r5.w, l(1.000000)
mov r6.xy, l(0,0,0,0)
mov r0.w, r0.x
loop
  breakc_z r0.w
  firstbit_lo r1.w, r0.w
  ishl r3.w, l(1), r1.w
  xor r0.w, r0.w, r3.w
  iadd r3.w, r2.w, r1.w
  and r4.w, r3.w, l(3)
  ishr r3.w, r3.w, l(2)
  ineg r6.z, r4.w
  ult r7.xyz, r4.wwww, l(1, 2, 3, 0)
  and r8.y, r6.z, r7.y
  iadd r4.w, r4.w, l(-3)
  movc r8.z, r7.y, l(0), r4.w
  ieq r8.w, r7.z, l(0)
  mov r8.x, r7.x
  and r7.xyzw, r8.xyzw, cb0[r3.w + 0].xyzw
  or r6.zw, r7.yyyw, r7.xxxz
  or r3.w, r6.w, r6.z
  and r4.w, r3.w, l(1023)
  iadd r4.w, r4.w, l(-511)
  itof r7.x, r4.w
  ubfe r6.zw, l(0, 0, 10, 10), l(0, 0, 10, 20), r3.wwww
  iadd r6.zw, r6.zzzw, l(0, 0, -511, -511)
  itof r7.yz, r6.zzwz
  dp3 r3.w, r7.xyzx, r7.xyzx
  rsq r3.w, r3.w
  mad r7.xyz, r7.xyzx, r3.wwww, r2.xyzx
  mul r8.xyzw, r7.yyyy, cb1[1].xyzw
  mad r8.xyzw, r7.xxxx, cb1[0].xyzw, r8.xyzw
  mad r7.xyzw, r7.zzzz, cb1[2].xyzw, r8.xyzw
  add r7.xyzw, r7.xyzw, cb1[3].xyzw
  div r7.xyz, r7.xyzx, r7.wwww
  add r7.xyz, -r3.xyzx, r7.xyzx
  mul r6.zw, |r7.xxxy|, cb2[2].xxxy
  max r3.w, r6.w, r6.z
  div r3.w, l(1.000000, 1.000000, 1.000000, 1.000000), r3.w
  mul r7.xyz, r3.wwww, r7.xyzx
  mul r7.xyz, r4.xyzx, r7.xyzx
  mad r5.xyz, r7.xyzx, r0.zzzz, r1.xyzx
  div r3.w, l(1.000000, 1.000000, 1.000000, 1.000000), r5.z
  mul r7.z, r3.w, r7.z
  mul r7.x, r7.x, cb0[18].x
  sample_l_indexable(texture2d)(float,float,float,float) r4.w, r5.xyxx, t1.yzwx, s0, l(0.000000)
  mul r4.w, r4.w, r4.w
  mad r4.w, r4.w, r3.w, l(-1.000000)
  mad_sat r6.zw, r4.wwww, l(0.000000, 0.000000, 32.000000, -256.000000), l(0.000000, 0.000000, -1.000000, 1.000000)
  add r4.w, r6.w, r6.z
  min r4.w, r4.w, l(1.000000)
  mad r5.xyz, r7.xyzx, cb0[18].yyyy, r5.xywx
  sample_l_indexable(texture2d)(float,float,float,float) r6.z, r5.xyxx, t1.yzxw, s0, l(0.000000)
  mul r6.z, r6.z, r6.z
  mad r6.z, r6.z, r3.w, -r5.z
  mad_sat r6.zw, r6.zzzz, l(0.000000, 0.000000, 32.000000, -256.000000), l(0.000000, 0.000000, -1.000000, 1.000000)
  add r6.z, r6.w, r6.z
  add r6.z, r6.z, l(0.062500)
  min r6.z, r6.z, l(1.000000)
  mul r4.w, r4.w, r6.z
  mad r5.xyz, r7.xyzx, cb0[18].yyyy, r5.xyzx
  sample_l_indexable(texture2d)(float,float,float,float) r6.z, r5.xyxx, t1.yzxw, s0, l(0.000000)
  mul r6.z, r6.z, r6.z
  mad r6.z, r6.z, r3.w, -r5.z
  mad_sat r6.zw, r6.zzzz, l(0.000000, 0.000000, 32.000000, -256.000000), l(0.000000, 0.000000, -1.000000, 1.000000)
  add r6.z, r6.w, r6.z
  add r6.z, r6.z, l(0.125000)
  min r6.z, r6.z, l(1.000000)
  mul r4.w, r4.w, r6.z
  mad r5.xyz, r7.xyzx, cb0[18].yyyy, r5.xyzx
  sample_l_indexable(texture2d)(float,float,float,float) r6.z, r5.xyxx, t1.yzxw, s0, l(0.000000)
  mul r6.z, r6.z, r6.z
  mad r6.z, r6.z, r3.w, -r5.z
  mad_sat r6.zw, r6.zzzz, l(0.000000, 0.000000, 32.000000, -256.000000), l(0.000000, 0.000000, -1.000000, 1.000000)
  add r6.z, r6.w, r6.z
  add r6.z, r6.z, l(0.187500)
  min r6.z, r6.z, l(1.000000)
  mul r4.w, r4.w, r6.z
  mad r5.xyz, r7.xyzx, cb0[18].yyyy, r5.xyzx
  sample_l_indexable(texture2d)(float,float,float,float) r6.z, r5.xyxx, t1.yzxw, s0, l(0.000000)
  mul r6.z, r6.z, r6.z
  mad r6.z, r6.z, r3.w, -r5.z
  mad_sat r6.zw, r6.zzzz, l(0.000000, 0.000000, 32.000000, -256.000000), l(0.000000, 0.000000, -1.000000, 1.000000)
  add r6.z, r6.w, r6.z
  add r6.z, r6.z, l(0.250000)
  min r6.z, r6.z, l(1.000000)
  mul r4.w, r4.w, r6.z
  mad r5.xyz, r7.xyzx, cb0[18].yyyy, r5.xyzx
  sample_l_indexable(texture2d)(float,float,float,float) r6.z, r5.xyxx, t1.yzxw, s0, l(0.000000)
  mul r6.z, r6.z, r6.z
  mad r6.z, r6.z, r3.w, -r5.z
  mad_sat r6.zw, r6.zzzz, l(0.000000, 0.000000, 32.000000, -256.000000), l(0.000000, 0.000000, -1.000000, 1.000000)
  add r6.z, r6.w, r6.z
  add r6.z, r6.z, l(0.312500)
  min r6.z, r6.z, l(1.000000)
  mul r4.w, r4.w, r6.z
  mad r5.xyz, r7.xyzx, cb0[18].yyyy, r5.xyzx
  sample_l_indexable(texture2d)(float,float,float,float) r6.z, r5.xyxx, t1.yzxw, s0, l(0.000000)
  mul r6.z, r6.z, r6.z
  mad r6.z, r6.z, r3.w, -r5.z
  mad_sat r6.zw, r6.zzzz, l(0.000000, 0.000000, 32.000000, -256.000000), l(0.000000, 0.000000, -1.000000, 1.000000)
  add r6.z, r6.w, r6.z
  add r6.z, r6.z, l(0.375000)
  min r6.z, r6.z, l(1.000000)
  mul r4.w, r4.w, r6.z
  mad r5.xyz, r7.xyzx, cb0[18].yyyy, r5.xyzx
  sample_l_indexable(texture2d)(float,float,float,float) r5.x, r5.xyxx, t1.xyzw, s0, l(0.000000)
  mul r5.x, r5.x, r5.x
  mad r3.w, r5.x, r3.w, -r5.z
  mad_sat r5.xy, r3.wwww, l(32.000000, -256.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000)
  add r3.w, r5.y, r5.x
  add r3.w, r3.w, l(0.437500)
  min r3.w, r3.w, l(1.000000)
  mul r3.w, r3.w, r4.w
  mad r3.w, r3.w, l(63.000000), l(0.500000)
  ftou r3.w, r3.w
  imul null, r4.w, r1.w, l(6)
  uge r5.x, r1.w, l(4)
  imad r1.w, r1.w, l(6), l(-24)
  ishl r1.w, r3.w, r1.w
  and r1.w, r1.w, r5.x
  or r6.y, r1.w, r6.y
  ishl r1.w, r3.w, r4.w
  movc r1.w, r5.x, l(0), r1.w
  or r6.x, r1.w, r6.x
endloop
f32tof16 r0.x, |r0.y|
ishl r0.y, r0.x, l(24)
ushr r0.x, r0.x, l(8)
ishl r0.x, r0.x, l(24)
or r1.xyzw, r0.yxyy, r6.xyxx
store_uav_typed u0.xyzw, vThreadID.xyyy, r1.xyzw
ret
// Approximately 0 instruction slots used
