//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.7 on Thu Nov 12 18:22:04 2015
//
//
// 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[7], immediateIndexed
dcl_constantbuffer cb12[30], immediateIndexed
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) t4
dcl_resource_structured t6, 48 
dcl_resource_structured t7, 512 
dcl_uav_typed_texture2d (float,float,float,float) u0
dcl_uav_typed_texture2d (float,float,float,float) u1
dcl_resource_texture2d (float,float,float,float) t125
dcl_input vThreadGroupID.xy
dcl_input vThreadIDInGroup.xy
//dcl_temps 24
dcl_temps 29

dcl_thread_group 8, 8, 1
ftou r0.x, cb0[2].z
imad r0.x, vThreadGroupID.y, r0.x, vThreadGroupID.x
imad r0.yz, vThreadGroupID.xxyx, l(0, 8, 8, 0), vThreadIDInGroup.xxyx
ld_structured_indexable(structured_buffer, stride=512)(mixed,mixed,mixed,mixed) r0.w, r0.x, l(0), t7.xxxx
mul r1.x, cb0[2].y, l(0.333333343)
umin r1.y, r0.w, l(127)
sincos r2.xy, r3.xy, cb12[29].yxyy
mov r4.x, l(0)
mov r5.zw, l(0,0,0,0)
mov r6.w, l(1.000000)
mov r25.w, l(1.000000)
mov r7.w, l(1.000000)
mov r8.w, l(1.000000)
mov r9.w, l(0)
mov r10.w, l(0)
mov r4.y, l(0)
loop 
  uge r1.z, r4.y, l(1)
  breakc_nz r1.z
  iadd r5.xy, r0.yzyy, r4.xyxx
  ld_indexable(texture2d)(float,float,float,float) r1.z, r5.xyww, t0.yzxw
  ge r1.w, l(0.010000), r1.z
  if_nz r1.w
    mul r6.z, r1.z, l(100.000000)
    mov r11.xyzw, cb12[24].xyzw						//Inv Projection
    mov r12.xyzw, cb12[25].xyzw
    mov r13.xyzw, cb12[26].xyzw
    mov r14.xyzw, cb12[27].xyzw
  else 
    mad r6.z, r1.z, l(1.010000), l(-0.010000)
    mov r11.xyzw, cb12[20].xyzw						//Inv Projection TRAN
    mov r12.xyzw, cb12[21].xyzw
    mov r13.xyzw, cb12[22].xyzw
    mov r14.xyzw, cb12[23].xyzw
  endif 
  utof r1.zw, r5.xxxy
  mul r15.x, r1.z, cb0[3].x
  mad r15.z, -cb0[3].y, r1.w, l(1.000000)
  mad r6.xy, r15.xzxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)

  dp4 r11.x, r11.xyzw, r6.xyzw
  dp4 r11.y, r12.xyzw, r6.xyzw
  dp4 r11.z, r13.xyzw, r6.xyzw
  dp4 r1.z, r14.xyzw, r6.xyzw
  div r6.xyz, r11.xyzx, r1.zzzz
div r25.xyz, r11.xyzx, r1.zzzz


ld_indexable(texture2d)(float,float,float,float) r28.xyzw, l(0, 0, 0, 0), t125.xyzw
add r28.w, r6.z, -r28.y
mul r28.w, r28.w, r28.x
mul r28.w, r28.w, cb12[20].x
add r6.x, r6.x, -r28.w
// add r25.x, r25.x, -r28.w

  ld_indexable(texture2d)(float,float,float,float) r1.zw, r5.xyww, t2.zwxy
  mad r1.zw, r1.zzzw, l(0.000000, 0.000000, 4.000000, 4.000000), l(0.000000, 0.000000, -2.000000, -2.000000)
  dp2 r2.z, r1.zwzz, r1.zwzz
  mad r2.zw, -r2.zzzz, l(0.000000, 0.000000, 0.250000, 0.500000), l(0.000000, 0.000000, 1.000000, 1.000000)
  sqrt r2.z, r2.z
  mul r7.xy, r1.zwzz, r2.zzzz
  mov r7.z, -r2.w
  
  dp3 r1.z, -r6.xyzx, -r6.xyzx
  rsq r1.z, r1.z
  mul r11.xyz, r1.zzzz, -r6.xyzx
  // dp3 r1.z, -r25.xyzx, -r25.xyzx
  // rsq r1.z, r1.z
  // mul r11.xyz, r1.zzzz, -r25.xyzx
  
  ld_indexable(texture2d)(float,float,float,float) r12.xyzw, r5.xyww, t4.xyzw
  mad r1.w, r12.w, l(255.000000), l(-1.000000)
  lt r1.w, |r1.w|, l(0.250000)
  movc r2.z, r1.w, l(0), r12.y

  dp4 r2.w, cb0[4].xyzw, r7.xyzw
  dp4 r3.z, cb0[5].xyzw, r7.xyzw
  dp4 r3.w, cb0[6].xyzw, r7.xyzw
   
  log r13.x, r2.w
  log r13.y, r3.z
  log r13.z, r3.w
  mul r13.xyz, r13.xyzx, l(2.200000, 2.200000, 2.200000, 0.000000)
  exp r13.xyz, r13.xyzx
  dp3 r2.w, r7.xyzx, r11.xyzx
  add r3.z, r2.w, r2.w
  mad r8.xyz, r3.zzzz, r7.xyzx, -r11.xyzx
  mov_sat r3.z, r2.w
  add r3.w, -r3.z, l(1.000000)
  add r4.z, -r12.x, l(3.000000)
  log r3.w, r3.w
  mul r4.z, r3.w, r4.z
  exp r4.z, r4.z
  mul r4.z, r4.z, l(0.250000)
  dp4 r4.w, cb0[4].xyzw, r8.xyzw
  dp4 r11.w, cb0[5].xyzw, r8.xyzw
  dp4 r8.x, cb0[6].xyzw, r8.xyzw
  log r14.x, r4.w
  log r14.y, r11.w
  log r14.z, r8.x
  mul r8.xyz, r14.xyzx, l(2.200000, 2.200000, 2.200000, 0.000000)
  exp r8.xyz, r8.xyzx
  mul r8.xyz, r4.zzzz, r8.xyzx
  mul r10.xyz, r2.zzzz, r8.xyzx
  if_nz r0.w
    add r4.z, -r12.x, l(1.000000)
    ld_indexable(texture2d)(float,float,float,float) r4.w, r5.xyzw, t1.xyzw
    mad r8.x, r12.x, l(10.000000), l(1.000000)
    exp r8.x, r8.x
    dp3 r8.y, r12.xyzx, r11.xyzx
    mul r8.z, r8.y, r8.y
    min r8.z, r8.z, l(1.000000)
    add r8.z, -r8.z, l(1.000000)
    sqrt r8.z, r8.z
    mul r3.w, r3.w, l(0.010000)
    mad r14.xyz, -r7.xyzx, r2.wwww, r11.xyzx
    mad r11.w, -r2.w, r2.w, l(1.000000)
    add r12.w, r8.x, l(2.000000)
    mul r12.w, r12.w, l(0.159154937)
    div r13.w, l(1.000000, 1.000000, 1.000000, 1.000000), r3.z
    mul r2.z, r2.z, l(3.14159274)
    exp r3.w, r3.w
    mov r15.xyz, r13.xyzx
    mov r16.xyz, r10.xyzx
    mov r14.w, l(0)
    loop 
      uge r15.w, r14.w, r1.y
      breakc_nz r15.w
      ishl r15.w, r14.w, l(2)
      iadd r15.w, r15.w, l(4)
      ld_structured_indexable(structured_buffer, stride=512)(mixed,mixed,mixed,mixed) r15.w, r0.x, r15.w, t7.xxxx
      ld_structured_indexable(structured_buffer, stride=48)(mixed,mixed,mixed,mixed) r17.xyzw, r15.w, l(0), t6.xyzw
      ld_structured_indexable(structured_buffer, stride=48)(mixed,mixed,mixed,mixed) r18.xyzw, r15.w, l(16), t6.yzwx
      ld_structured_indexable(structured_buffer, stride=48)(mixed,mixed,mixed,mixed) r19.xyz, r15.w, l(32), t6.xyzx
      add r17.yzw, -r6.xxyz, r17.yyzw	 
	  // add r17.yzw, -r25.xxyz, r17.yyzw	
      dp3 r15.w, r17.yzwy, r17.yzwy
      and r16.w, r17.x, l(8)
      if_z r16.w
        and r16.w, r17.x, l(4)
        rsq r19.w, r15.w
        mul r17.yzw, r17.yyzw, r19.wwww
        dp3 r19.w, r7.xyzx, r17.yzwy
        max r20.x, r19.w, l(0.000000)
        min r20.yzw, r20.xxxx, l(0.000000, 1.000000, 1.000000, 1.000000)
        if_nz r1.w
          dp3 r21.x, r12.xyzx, r17.yzwy
          mul r21.y, r21.x, r21.x
          min r21.y, r21.y, l(1.000000)
          add r21.y, -r21.y, l(1.000000)
          sqrt r21.y, r21.y
          mul r21.z, r2.x, r21.y
          mad r21.z, -r21.x, r3.x, -r21.z
          mad r21.w, -r21.z, r21.z, l(1.000000)
          sqrt r21.w, r21.w
          mul r21.w, r8.z, r21.w
          mad r21.z, r21.z, r8.y, r21.w
          max r21.z, r21.z, l(0.000000)
          log r21.z, r21.z
          mul r21.z, r21.z, cb12[28].w
          exp r21.z, r21.z
          mad_sat r21.z, cb12[28].z, r21.z, r20.x
          min r21.z, r4.w, r21.z
          mul r22.xyz, r18.xyzx, r21.zzzz
          and r21.z, r17.x, l(16)
          if_nz r21.z
            mul r21.y, r2.y, r21.y
            mad r21.x, -r21.x, r3.y, -r21.y
            mad r21.y, -r21.x, r21.x, l(1.000000)
            sqrt r21.y, r21.y
            mul r21.y, r8.z, r21.y
            mad r21.x, r21.x, r8.y, r21.y
            max r21.x, r21.x, l(0.000000)
            log r21.x, r21.x
            mul r21.x, r21.x, cb12[28].y
            exp r21.x, r21.x
            mul r21.x, r21.x, cb12[28].x
            mul r21.xyz, r18.xyzx, r21.xxxx
            mul r21.xyz, r20.yzwy, r21.xyzx
          else 
            mov r21.xyz, l(0,0,0,0)
          endif 
        else 
          and r23.xy, r17.xxxx, l(2, 16, 0, 0)
          movc r17.x, r23.x, l(0), r4.z
          ne r21.w, r17.x, l(0.000000)
          if_nz r21.w
            mad r23.xzw, -r7.xxyz, r19.wwww, r17.yyzw
            dp3 r21.w, r14.xyzx, r23.xzwx
            mul r22.w, r17.x, r17.x
            mad r23.xz, r17.xxxx, r17.xxxx, l(0.570000, 0.000000, 0.090000, 0.000000)
            div r23.xz, r22.wwww, r23.xxzx
            mul r17.x, r23.z, l(0.450000)
            mad r22.w, -r23.x, l(0.500000), l(1.000000)
            mad r23.x, -r19.w, r19.w, l(1.000000)
            mul_sat r23.x, r11.w, r23.x
            sqrt r23.x, r23.x
            max r19.w, r2.w, r19.w
            div r19.w, r23.x, r19.w
            max r21.w, r21.w, l(0.000000)
            mul r17.x, r17.x, r21.w
            mad r17.x, r17.x, r19.w, r22.w
            mul r23.xzw, r17.xxxx, r20.xxxx
          else 
            mov r23.xzw, r20.yyzw
          endif 
          mul r22.xyz, r18.xyzx, r23.xzwx
          if_nz r23.y
            mad r20.xyz, -r6.xyzx, r1.zzzz, r17.yzwy
			// mad r20.xyz, -r25.xyzx, r1.zzzz, r17.yzwy
            dp3 r17.x, r20.xyzx, r20.xyzx
            rsq r17.x, r17.x
            mul r20.xyz, r17.xxxx, r20.xyzx
            dp3_sat r17.x, r11.xyzx, r20.xyzx
            dp3_sat r19.w, r20.xyzx, r7.xyzx
            log r20.x, r19.w
            mul r20.x, r8.x, r20.x
            exp r20.x, r20.x
            mul r20.x, r12.w, r20.x
            max r20.y, r17.x, l(1.192092896E-007)
            min r20.z, r3.z, r20.w
            add r19.w, r19.w, r19.w
            mul r21.w, r19.w, r20.z
            ge r21.w, r20.y, r21.w
            eq r20.z, r3.z, r20.z
            div r22.w, r20.w, r3.z
            movc r20.z, r20.z, l(1.000000), r22.w
            mul r19.w, r19.w, r20.z
            div r19.w, r19.w, r20.y
            movc r19.w, r21.w, r19.w, r13.w
            add r17.x, -r17.x, l(1.000000)
            mul r20.y, r17.x, r17.x
            mul r20.y, r20.y, r20.y
            mul r20.z, r17.x, r20.y
            mad r17.x, -r17.x, r20.y, l(1.000000)
            mad r17.x, r17.x, l(0.200000), r20.z
            min r17.x, r17.x, l(1.000000)
            mul r17.x, r19.w, r17.x
            mul r17.x, r20.x, r17.x
            mul r17.x, r17.x, l(0.250000)
            min r17.x, r17.x, l(15.000000)
            mul r17.x, r2.z, r17.x
            mul r20.xyz, r17.xxxx, r18.xyzx
            mul r21.xyz, r20.wwww, r20.xyzx
          else 
            mov r21.xyz, l(0,0,0,0)
          endif 
        endif 
        if_z r16.w
          dp3_sat r16.w, r11.xyzx, -r17.yzwy
          mul r16.w, r3.w, r16.w
          mul r16.w, r20.w, r16.w
          mul r16.w, r4.z, r16.w
          mad r18.xyz, r18.xyzx, r16.wwww, r22.xyzx
        else 
          mov r18.xyz, r22.xyzx
        endif 
      else 
        mov r21.xyz, l(0,0,0,0)
      endif 
      sqrt r15.w, r15.w
      div_sat r15.w, r15.w, r18.w
      log r15.w, r15.w
      mul r15.w, r15.w, r19.z
      exp r15.w, r15.w
      mad_sat r15.w, r19.y, r15.w, r19.x
      add r15.w, -r15.w, l(1.000000)
      log r15.w, r15.w
      mul r15.w, r15.w, l(2.200000)
      exp r15.w, r15.w
      mad r15.xyz, r18.xyzx, r15.wwww, r15.xyzx
      mad r16.xyz, r21.xyzx, r15.wwww, r16.xyzx
      iadd r14.w, r14.w, l(1)
    endloop 
    mov r13.xyz, r15.xyzx
    mov r10.xyz, r16.xyzx
  endif 
  mul r9.xyz, r1.xxxx, r13.xyzx
  store_uav_typed u0.xyzw, r5.xyyy, r9.xyzw
  store_uav_typed u1.xyzw, r5.xyyy, r10.xyzw
  iadd r4.y, r4.y, l(1)
endloop 
ret 
// Approximately 0 instruction slots used
