// ---- Created with 3Dmigoto v1.2.35 on Tue Apr 26 22:30:35 2016

cbuffer cbInstanceData : register(b4)
{

  struct
  {
    float4x3 mWorld;
    float4 atlasUvScaleOffset;
    float4 userClipPlane;
    uint4 matricesData;
    uint envData;
    bool dynamicLightDisable;
    uint2 envPad;
    float4 mulCol;
    float4 aSh[3];
    float4 ShLightMask;
    float4 vDominantRotateParam;
    float4 parallaxCorrectedCubemapOrigin_envMapInterpRatio;
    float4 parallaxCorrectedCubemapAabbMin_envMapColorScale0;
    float4 parallaxCorrectedCubemapAabbMax_envMapColorScale1;
    float ditherFadeAlpha;
  } VC_InstanceData[2] : packoffset(c0);

}

SamplerState SS_GIMap_s : register(s5);
Texture2D<float4> g_DOLTexture2 : register(t27);


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


void main( 
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD2,
  float4 v3 : TEXCOORD4,
  float4 v4 : COLOR1,
  float4 v5 : TEXCOORD6,
  float2 v6 : TEXCOORD7,
  uint v7 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = g_DOLTexture2.Sample(SS_GIMap_s, v6.xy).xyz;
  r0.xyzw = float4(-0.5,-0.5,-0.5,-0.5) + r0.yzzx;
  r0.xyzw = r0.xyzw + r0.xyzw;
  r1.x = dot(r0.xzw, r0.xzw);
  r1.x = rsqrt(r1.x);
  r0.xyzw = r1.xxxx * r0.xyzw;
  r1.x = round(v1.w);
  r1.x = (uint)r1.x;
  r1.x = (int)r1.x * 17;
  r1.yz = -VC_InstanceData[r1.x].vDominantRotateParam.xy * r0.xx;
  r1.z = r0.w * VC_InstanceData[r1.x].vDominantRotateParam.x + -r1.z;
  r1.y = r0.w * -VC_InstanceData[r1.x].vDominantRotateParam.y + -r1.y;
  r1.y = r0.z * VC_InstanceData[r1.x].vDominantRotateParam.w + r1.y;
  r1.z = -r0.z * -VC_InstanceData[r1.x].vDominantRotateParam.z + r1.z;
  r1.w = VC_InstanceData[r1.x].vDominantRotateParam.x * r1.z;
  r2.x = -VC_InstanceData[r1.x].vDominantRotateParam.z * r0.x;
  r2.x = r0.w * VC_InstanceData[r1.x].vDominantRotateParam.w + r2.x;
  r0.y = -r0.y * -VC_InstanceData[r1.x].vDominantRotateParam.y + r2.x;
  r1.w = VC_InstanceData[r1.x].vDominantRotateParam.w * r0.y + r1.w;
  r1.w = VC_InstanceData[r1.x].vDominantRotateParam.y * r1.y + r1.w;
  r2.xy = VC_InstanceData[r1.x].vDominantRotateParam.xw * r1.yy;
  r0.x = dot(r0.wx, VC_InstanceData[r1.x].vDominantRotateParam.zw);
  r0.x = r0.z * -VC_InstanceData[r1.x].vDominantRotateParam.x + r0.x;
  r3.x = -VC_InstanceData[r1.x].vDominantRotateParam.z * r0.x + r1.w;
  r0.z = VC_InstanceData[r1.x].vDominantRotateParam.w * r0.x + -r2.x;
  r0.x = VC_InstanceData[r1.x].vDominantRotateParam.x * r0.x + r2.y;
  r0.x = -VC_InstanceData[r1.x].vDominantRotateParam.y * r0.y + r0.x;
  r3.z = VC_InstanceData[r1.x].vDominantRotateParam.z * r1.z + r0.x;
  r0.x = VC_InstanceData[r1.x].vDominantRotateParam.y * r1.z + r0.z;
  r3.y = VC_InstanceData[r1.x].vDominantRotateParam.z * r0.y + r0.x;
  o0.xyz = r3.xyz * float3(0.5,0.5,0.5) + float3(0.500488758,0.500488758,0.500488758);
  o0.w = 0;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer cbInstanceData
// {
//
//   struct PerInstanceData
//   {
//       
//       float4x3 mWorld;               // Offset:    0
//       float4 atlasUvScaleOffset;     // Offset:   48
//       float4 userClipPlane;          // Offset:   64
//       uint4 matricesData;            // Offset:   80
//       uint envData;                  // Offset:   96
//       bool dynamicLightDisable;      // Offset:  100
//       uint2 envPad;                  // Offset:  104
//       float4 mulCol;                 // Offset:  112
//       float4 aSh[3];                 // Offset:  128
//       float4 ShLightMask;            // Offset:  176
//       float4 vDominantRotateParam;   // Offset:  192
//       float4 parallaxCorrectedCubemapOrigin_envMapInterpRatio;// Offset:  208
//       float4 parallaxCorrectedCubemapAabbMin_envMapColorScale0;// Offset:  224
//       float4 parallaxCorrectedCubemapAabbMax_envMapColorScale1;// Offset:  240
//       float ditherFadeAlpha;         // Offset:  256
//
//   } VC_InstanceData[2];              // Offset:    0 Size:   532
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SS_GIMap                          sampler      NA          NA    5        1
// g_DOLTexture2                     texture  float4          2d   27        1
// cbInstanceData                    cbuffer      NA          NA    4        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float       
// TEXCOORD                 0   xyzw        1     NONE   float      w
// TEXCOORD                 2   xyzw        2     NONE   float       
// TEXCOORD                 4   xyzw        3     NONE   float       
// COLOR                    1   xyzw        4     NONE   float       
// TEXCOORD                 6   xyzw        5     NONE   float       
// TEXCOORD                 7   xy          6     NONE   float   xy  
// SV_IsFrontFace           0   x           7    FFACE    uint       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb4[34], dynamicIndexed
dcl_sampler s5, mode_default
dcl_resource_texture2d (float,float,float,float) t27
dcl_input_ps linear v1.w
dcl_input_ps linear v6.xy
dcl_output o0.xyzw
dcl_temps 4
sample_indexable(texture2d)(float,float,float,float) r0.xyz, v6.xyxx, t27.xyzw, s5
add r0.xyzw, r0.yzzx, l(-0.500000, -0.500000, -0.500000, -0.500000)
add r0.xyzw, r0.xyzw, r0.xyzw
dp3 r1.x, r0.xzwx, r0.xzwx
rsq r1.x, r1.x
mul r0.xyzw, r0.xyzw, r1.xxxx
round_ne r1.x, v1.w
ftou r1.x, r1.x
imul null, r1.x, r1.x, l(17)
mul r1.yz, r0.xxxx, -cb4[r1.x + 12].xxyx
mad r1.z, r0.w, cb4[r1.x + 12].x, -r1.z
mad r1.y, r0.w, -cb4[r1.x + 12].y, -r1.y
mad r1.y, r0.z, cb4[r1.x + 12].w, r1.y
mad r1.z, -r0.z, -cb4[r1.x + 12].z, r1.z
mul r1.w, r1.z, cb4[r1.x + 12].x
mul r2.x, r0.x, -cb4[r1.x + 12].z
mad r2.x, r0.w, cb4[r1.x + 12].w, r2.x
mad r0.y, -r0.y, -cb4[r1.x + 12].y, r2.x
mad r1.w, cb4[r1.x + 12].w, r0.y, r1.w
mad r1.w, cb4[r1.x + 12].y, r1.y, r1.w
mul r2.xy, r1.yyyy, cb4[r1.x + 12].xwxx
dp2 r0.x, r0.wxww, cb4[r1.x + 12].zwzz
mad r0.x, r0.z, -cb4[r1.x + 12].x, r0.x
mad r3.x, -cb4[r1.x + 12].z, r0.x, r1.w
mad r0.z, cb4[r1.x + 12].w, r0.x, -r2.x
mad r0.x, cb4[r1.x + 12].x, r0.x, r2.y
mad r0.x, -cb4[r1.x + 12].y, r0.y, r0.x
mad r3.z, cb4[r1.x + 12].z, r1.z, r0.x
mad r0.x, cb4[r1.x + 12].y, r1.z, r0.z
mad r3.y, cb4[r1.x + 12].z, r0.y, r0.x
mad o0.xyz, r3.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), l(0.500489, 0.500489, 0.500489, 0.000000)
mov o0.w, l(0)
ret 
// Approximately 33 instruction slots used

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