//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.08.299.0000
//
//   vsa shaderdump19/SM3001.pso /Fcshaderdump19/SM3001.pso.dis
//
//
// Parameters:
//
float4 AmbientColor : register(c0);
sampler2D BaseMap : register(s0);
float3 EyePosition : register(c1);
float4 LightData[20] : register(c9);
float3 MatAlpha : register(c3);
sampler2D NormalMap : register(s1);
float4 ToggleADTS : register(c5);
float4 ToggleNumLights : register(c6);




//
// Registers:
//
//   Name            Reg   Size
//   --------------- ----- ----
//   AmbientColor    const_0       1
//   EyePosition     const_1       1
//   MatAlpha        const_3       1
//   ToggleADTS      const_5       1
//   ToggleNumLights const_6       1
//   LightData[0]       const_9         1
//   LightData[1]       const_10         1
//   LightData[2]       const_11         1
//   LightData[3]       const_12         1
//   LightData[4]       const_13         1
//   LightData[5]       const_14         1
//   LightData[6]       const_15         1
//   LightData[7]       const_16         1
//   LightData[8]       const_17        1
//   LightData[9]       const_18        1
//   LightData[10]       const_19        1
//   LightData[11]       const_20        1
//   LightData[12]       const_21        1
//   LightData[13]       const_22        1
//   LightData[14]       const_23        1
//   LightData[15]       const_24        1
//   LightData[16]       const_25       1
//   LightData[17]       const_26       1
//   LightData[18]       const_27       1
//   LightData[19]       const_28       1
//   BaseMap         texture_0       1
//   NormalMap       texture_1       1
//


// Structures:

struct VS_OUTPUT {
    float2 texcoord_0 : TEXCOORD0;
			
    float3 color_0 : COLOR0; 
    
    
    float3 texcoord_3 : TEXCOORD3_centroid;
    float3 texcoord_4 : TEXCOORD4_centroid;
    float3 texcoord_5 : TEXCOORD5_centroid;
			
    float3 texcoord_6 : TEXCOORD6_centroid;
			
    float4 texcoord_7 : TEXCOORD7_centroid;

  
			
};

struct PS_OUTPUT {
    float4 color_0 : COLOR0;
};

// Code:


PS_OUTPUT main(VS_OUTPUT IN) {
    PS_OUTPUT OUT;

#define	expand(v)		(((v) - 0.5) / 0.5)
#define	compress(v)		(((v) * 0.5) + 0.5)
#define	shade(n, l)		max(dot(n, l), 0)
#define	shades(n, l)		saturate(dot(n, l))
#define	weight(v)		dot(v, 1)
#define	sqr(v)			((v) * (v))

    const float4 const_2 = {-0.5, 0, 1, 10};
    const int4 const_29 = {2, -10, -11, -12};
    const int4 const_30 = {2, -16, -17, -18};
    const int4 const_31 = {2, -18, -19, 0};
    const int4 const_32 = {2, -2, -3, -4};
    const int4 const_33 = {2, -4, -5, -6};
    const int4 const_34 = {2, -12, -13, -14};
    const int4 const_35 = {2, -14, -15, -16};
    const int4 const_4 = {-1, -2, 0, 2};
    const int4 const_7 = {2, -6, -7, -8};
    const int4 const_8 = {2, -8, -9, -10};

    float3 eye282;
    float3 l103;
    float3 l108;
    float3 l113;
    float3 l118;
    float3 l123;
    float3 l128;
    float3 l133;
    float3 l144;
    float3 l31;
    float3 l34;
    float1 l590;
    float3 l93;
    float3 l98;
    float3 m151;
    float3 m157;
    float3 m165;
    float3 m172;
    float3 m179;
    float3 m186;
    float3 m193;
    float3 m200;
    float3 m207;
    float3 m213;
    float1 q1;
    float3 q11;
    float1 q12;
    float3 q14;
    float1 q15;
    float3 q17;
    float1 q18;
    float3 q20;
    float1 q21;
    float3 q23;
    float1 q24;
    float3 q26;
    float1 q27;
    float3 q29;
    float3 q3;
    float1 q30;
    float3 q39;
    float3 q44;
    float3 q49;
    float3 q5;
    float3 q54;
    float3 q59;
    float1 q6;
    float3 q64;
    float3 q69;
    float3 q74;
    float3 q79;
    float3 q8;
    float3 q88;
    float1 q9;
    float4 r0;
    float4 r1;
    float3 r10;
    float4 r2;
    float4 r3;
    float4 r4;
    float4 r5;
    float3 r6;
    float3 r7;
    float3 r8;
    float3 r9;
    float3 r11;


#define	TanSpaceProj	float3x3(r9.xyz, r8.xyz, r7.xyz)

    r0.xyzw = tex2D(NormalMap, IN.texcoord_0.xy);
    
    r0.xyz = r0.xyz - 0.5;
    
    r0.xyz = 2 * r0.xyz;
    
    r7.xyz = normalize(IN.texcoord_5.xyz);
    
    r1.xyz = EyePosition.xyz - IN.texcoord_6.xyz;
    
    r4.xyz = normalize(r0.xyz);
    
    r0.z = dot(r7.xyz, r1.xyz);
    
    r9.xyz = normalize(IN.texcoord_3.xyz);
    
    r8.xyz = normalize(IN.texcoord_4.xyz);
    
    r0.x = dot(r9.xyz, r1.xyz);
    
    r0.y = dot(r8.xyz, r1.xyz);
    
    r3.yzw = const_2.yzw;
    r1.w = (ToggleNumLights.x <= 0.0 ? r3.y : r3.z);
    r6.xyz = normalize(r0.xyz);
    
    if (0 != r1.w) {
        r0.x = dot(r9.xyz, LightData[1].xyz);
        
        r0.y = dot(r8.xyz, LightData[1].xyz);
        
        r0.z = dot(r7.xyz, LightData[1].xyz);
        
        r2.xyz = r6.xyz + r0.xyz;
        
        r1.xyz = normalize(r2.xyz);
        
        r1.z = saturate(dot(r1.xyz, r4.xyz));
        
        r1.w = dot(r4.xyz, r0.xyz);
        
        r0.z = pow(abs(r1.z), ToggleNumLights.z);
        
        r0.y = max(r1.w, 0);
        
        r2.w = 1;
        r2.xyz = r0.y * LightData[0].xyz;
        
        r0.xyz = r0.z * LightData[0].xyz;
        
    }
    else {
        r2.yzw = 0;
        r2.xyz = r2.wyz;
        
        r0.xyz = r2.w;
        
        
    }//endif

    r3.w = r3.w - ToggleNumLights.x;
    
    r1.x = min(ToggleNumLights.y, r3.w);
    
    r1.w = (r1.x >= 0.0 ? 0 : 1);
    r1.y = frac(r1.x);
    
    r1.z = (r1.y <= 0.0 ? 0 : 1);
    r1.y = r1.x - r1.y;
    
    r3.x = (r1.w * r1.z) + r1.y;
    r1.w = (r3.x <= 0.0 ? 0 : 1);
    if (0 != r1.w) {
        r5.x = 2 * r2.w;
        r5.yz = r5.x + const_4.xy;
        r1.xyz = r5.x + const_4.zxy;
        r10.xyz = (r1.xyz >= 0.0 ? r1.xyz : -r5.xyz);
        r1.xyzw = (r10.x <= 0.0 ? LightData[1].xyzw : r3.y);
        r1.xyzw = (r10.y <= 0.0 ? LightData[2].xyzw : r1.xyzw);
        r1.xyzw = (r10.z <= 0.0 ? LightData[3].xyzw : r1.xyzw);
        r11.xyz = (r10.x <= 0.0 ? LightData[0].xyz : r3.y);
        
        r5.xyz = r1.xyz - IN.texcoord_6.xyz;
        r1.xyz = (r10.y <= 0.0 ? LightData[1].xyz : r11.xyz);
        
        r11.x = dot(r9.xyz, r5.xyz);
        r11.y = dot(r8.xyz, r5.xyz);
        r11.z = dot(r7.xyz, r5.xyz);
        r1.xyz = (r10.z <= 0.0 ? LightData[2].xyz : r1.xyz);
        
        r10.xyz = normalize(r11.xyz);
        
        r3.w = dot(r5.xyz, r5.xyz);	// normalize + length
        r11.xyz = r6.xyz + r10.xyz;
        
        r3.w = 1.0 / sqrt(r3.w);
        r5.xyz = normalize(r11.xyz);
        
        r4.w = 1.0 / r3.w;
        r5.w = saturate(dot(r5.xyz, r4.xyz));
        
        r1.w = 1.0 / r1.w;
        
        r3.w = pow(abs(r5.w), ToggleNumLights.z);
        
        r1.w = saturate(r4.w * r1.w);
        r5.xyz = r1.xyz * r3.w;
        
        r3.w = 1.0 - (r1.w * r1.w);
        
        r1.w = dot(r4.xyz, r10.xyz);
        
        r0.xyz = (r3.w * r5.xyz) + r0.xyz;
        
        r3.w = r3.w * r1.w;
        
        r1.w = max(r3.w, 0);
        
        r3.w = r2.w + 1;
        r2.xyz = (r1.w * r1.xyz) + r2.xyz;
        
    }
    else {
        r3.w = r2.w;
    } //endif

    if (1 < r3.x) {
        r10.xyz = (2 * r3.w) + const_32.yzw;
        r1.xyzw = (r10.x == 0.0 ? LightData[3].xyzw : r3.y);
        r1.xyzw = (r10.y == 0.0 ? LightData[4].xyzw : r1.xyzw);
        r1.xyzw = (r10.z == 0.0 ? LightData[5].xyzw : r1.xyzw);
        r11.xyz = (r10.x == 0.0 ? LightData[2].xyz : r3.y);
        
        r5.xyz = r1.xyz - IN.texcoord_6.xyz;
        r1.xyz = (r10.y == 0.0 ? LightData[3].xyz : r11.xyz);
        
        r11.x = dot(r9.xyz, r5.xyz);
        r11.y = dot(r8.xyz, r5.xyz);
        r11.z = dot(r7.xyz, r5.xyz);
        r1.xyz = (r10.z == 0.0 ? LightData[4].xyz : r1.xyz);
        
        r10.xyz = normalize(r11.xyz);
        
        r2.w = dot(r5.xyz, r5.xyz);	// normalize + length
        r11.xyz = r6.xyz + r10.xyz;
        
        r2.w = 1.0 / sqrt(r2.w);
        r5.xyz = normalize(r11.xyz);
        
        r4.w = 1.0 / r2.w;
        r5.w = saturate(dot(r5.xyz, r4.xyz));
        
        r1.w = 1.0 / r1.w;
        
        r2.w = pow(abs(r5.w), ToggleNumLights.z);
        
        r1.w = saturate(r4.w * r1.w);
        r5.xyz = r1.xyz * r2.w;
        
        r2.w = 1.0 - (r1.w * r1.w);
        
        r1.w = dot(r4.xyz, r10.xyz);
        
        r0.xyz = (r2.w * r5.xyz) + r0.xyz;
        
        r2.w = r2.w * r1.w;
        
        r1.w = max(r2.w, 0);
        
        r3.w = r3.w + 1;
        r2.xyz = (r1.w * r1.xyz) + r2.xyz;
        
    }//endif

    if (2 < r3.x) {
        r10.xyz = (2 * r3.w) + const_33.yzw;
        r1.xyzw = (r10.x == 0.0 ? LightData[5].xyzw : r3.y);
        r1.xyzw = (r10.y == 0.0 ? LightData[6].xyzw : r1.xyzw);
        r1.xyzw = (r10.z == 0.0 ? LightData[7].xyzw : r1.xyzw);
        r11.xyz = (r10.x == 0.0 ? LightData[4].xyz : r3.y);
        
        r5.xyz = r1.xyz - IN.texcoord_6.xyz;
        r1.xyz = (r10.y == 0.0 ? LightData[5].xyz : r11.xyz);
        
        r11.x = dot(r9.xyz, r5.xyz);
        r11.y = dot(r8.xyz, r5.xyz);
        r11.z = dot(r7.xyz, r5.xyz);
        r1.xyz = (r10.z == 0.0 ? LightData[6].xyz : r1.xyz);
        
        r10.xyz = normalize(r11.xyz);
        
        r2.w = dot(r5.xyz, r5.xyz);	// normalize + length
        r11.xyz = r6.xyz + r10.xyz;
        
        r2.w = 1.0 / sqrt(r2.w);
        r5.xyz = normalize(r11.xyz);
        
        r4.w = 1.0 / r2.w;
        r5.w = saturate(dot(r5.xyz, r4.xyz));
        
        r1.w = 1.0 / r1.w;
        
        r2.w = pow(abs(r5.w), ToggleNumLights.z);
        
        r1.w = saturate(r4.w * r1.w);
        r5.xyz = r1.xyz * r2.w;
        
        r2.w = 1.0 - (r1.w * r1.w);
        
        r1.w = dot(r4.xyz, r10.xyz);
        
        r0.xyz = (r2.w * r5.xyz) + r0.xyz;
        
        r2.w = r2.w * r1.w;
        
        r1.w = max(r2.w, 0);
        
        r3.w = r3.w + 1;
        r2.xyz = (r1.w * r1.xyz) + r2.xyz;
        
    }//endif

    if (3 < r3.x) {
        r10.xyz = (2 * r3.w) + const_7.yzw;
        r1.xyzw = (r10.x == 0.0 ? LightData[7].xyzw : r3.y);
        r1.xyzw = (r10.y == 0.0 ? LightData[8].xyzw : r1.xyzw);
        r1.xyzw = (r10.z == 0.0 ? LightData[9].xyzw : r1.xyzw);
        r11.xyz = (r10.x == 0.0 ? LightData[6].xyz : r3.y);
        
        r5.xyz = r1.xyz - IN.texcoord_6.xyz;
        r1.xyz = (r10.y == 0.0 ? LightData[7].xyz : r11.xyz);
        
        r11.x = dot(r9.xyz, r5.xyz);
        r11.y = dot(r8.xyz, r5.xyz);
        r11.z = dot(r7.xyz, r5.xyz);
        r1.xyz = (r10.z == 0.0 ? LightData[8].xyz : r1.xyz);
        
        r10.xyz = normalize(r11.xyz);
        
        r2.w = dot(r5.xyz, r5.xyz);	// normalize + length
        r11.xyz = r6.xyz + r10.xyz;
        
        r2.w = 1.0 / sqrt(r2.w);
        r5.xyz = normalize(r11.xyz);
        
        r4.w = 1.0 / r2.w;
        r5.w = saturate(dot(r5.xyz, r4.xyz));
        
        r1.w = 1.0 / r1.w;
        
        r2.w = pow(abs(r5.w), ToggleNumLights.z);
        
        r1.w = saturate(r4.w * r1.w);
        r5.xyz = r1.xyz * r2.w;
        
        r2.w = 1.0 - (r1.w * r1.w);
        
        r1.w = dot(r4.xyz, r10.xyz);
        
        r0.xyz = (r2.w * r5.xyz) + r0.xyz;
        
        r2.w = r2.w * r1.w;
        
        r1.w = max(r2.w, 0);
        
        r3.w = r3.w + 1;
        r2.xyz = (r1.w * r1.xyz) + r2.xyz;
        
    }//endif

    if (4 < r3.x) {
        r10.xyz = (2 * r3.w) + const_8.yzw;
        r1.xyzw = (r10.x == 0.0 ? LightData[9].xyzw : r3.y);
        r1.xyzw = (r10.y == 0.0 ? LightData[10].xyzw : r1.xyzw);
        r1.xyzw = (r10.z == 0.0 ? LightData[11].xyzw : r1.xyzw);
        r11.xyz = (r10.x == 0.0 ? LightData[8].xyz : r3.y);
        
        r5.xyz = r1.xyz - IN.texcoord_6.xyz;
        r1.xyz = (r10.y == 0.0 ? LightData[9].xyz : r11.xyz);
        
        r11.x = dot(r9.xyz, r5.xyz);
        r11.y = dot(r8.xyz, r5.xyz);
        r11.z = dot(r7.xyz, r5.xyz);
        r1.xyz = (r10.z == 0.0 ? LightData[10].xyz : r1.xyz);
        
        r10.xyz = normalize(r11.xyz);
        
        r2.w = dot(r5.xyz, r5.xyz);	// normalize + length
        r11.xyz = r6.xyz + r10.xyz;
        
        r2.w = 1.0 / sqrt(r2.w);
        r5.xyz = normalize(r11.xyz);
        
        r4.w = 1.0 / r2.w;
        r5.w = saturate(dot(r5.xyz, r4.xyz));
        
        r1.w = 1.0 / r1.w;
        
        r2.w = pow(abs(r5.w), ToggleNumLights.z);
        
        r1.w = saturate(r4.w * r1.w);
        r5.xyz = r1.xyz * r2.w;
        
        r2.w = 1.0 - (r1.w * r1.w);
        
        r1.w = dot(r4.xyz, r10.xyz);
        
        r0.xyz = (r2.w * r5.xyz) + r0.xyz;
        
        r2.w = r2.w * r1.w;
        
        r1.w = max(r2.w, 0);
        
        r3.w = r3.w + 1;
        r2.xyz = (r1.w * r1.xyz) + r2.xyz;
        
    }//endif

    if (5 < r3.x) {
        r10.xyz = (2 * r3.w) + const_29.yzw;
        r1.xyzw = (r10.x == 0.0 ? LightData[11].xyzw : r3.y);
        r1.xyzw = (r10.y == 0.0 ? LightData[12].xyzw : r1.xyzw);
        r1.xyzw = (r10.z == 0.0 ? LightData[13].xyzw : r1.xyzw);
        r11.xyz = (r10.x == 0.0 ? LightData[10].xyz : r3.y);
        
        r5.xyz = r1.xyz - IN.texcoord_6.xyz;
        r1.xyz = (r10.y == 0.0 ? LightData[11].xyz : r11.xyz);
        
        r11.x = dot(r9.xyz, r5.xyz);
        r11.y = dot(r8.xyz, r5.xyz);
        r11.z = dot(r7.xyz, r5.xyz);
        r1.xyz = (r10.z == 0.0 ? LightData[12].xyz : r1.xyz);
        
        r10.xyz = normalize(r11.xyz);
        
        r2.w = dot(r5.xyz, r5.xyz);	// normalize + length
        r11.xyz = r6.xyz + r10.xyz;
        
        r2.w = 1.0 / sqrt(r2.w);
        r5.xyz = normalize(r11.xyz);
        
        r4.w = 1.0 / r2.w;
        r5.w = saturate(dot(r5.xyz, r4.xyz));
        
        r1.w = 1.0 / r1.w;
        
        r2.w = pow(abs(r5.w), ToggleNumLights.z);
        
        r1.w = saturate(r4.w * r1.w);
        r5.xyz = r1.xyz * r2.w;
        
        r2.w = 1.0 - (r1.w * r1.w);
        
        r1.w = dot(r4.xyz, r10.xyz);
        
        r0.xyz = (r2.w * r5.xyz) + r0.xyz;
        
        r2.w = r2.w * r1.w;
        
        r1.w = max(r2.w, 0);
        
        r3.w = r3.w + 1;
        r2.xyz = (r1.w * r1.xyz) + r2.xyz;
        
    }//endif

    if (6 < r3.x) {
        r10.xyz = (2 * r3.w) + const_34.yzw;
        r1.xyzw = (r10.x == 0.0 ? LightData[13].xyzw : r3.y);
        r1.xyzw = (r10.y == 0.0 ? LightData[14].xyzw : r1.xyzw);
        r1.xyzw = (r10.z == 0.0 ? LightData[15].xyzw : r1.xyzw);
        r11.xyz = (r10.x == 0.0 ? LightData[12].xyz : r3.y);
        
        r5.xyz = r1.xyz - IN.texcoord_6.xyz;
        r1.xyz = (r10.y == 0.0 ? LightData[13].xyz : r11.xyz);
        
        r11.x = dot(r9.xyz, r5.xyz);
        r11.y = dot(r8.xyz, r5.xyz);
        r11.z = dot(r7.xyz, r5.xyz);
        r1.xyz = (r10.z == 0.0 ? LightData[14].xyz : r1.xyz);
        
        r10.xyz = normalize(r11.xyz);
        
        r2.w = dot(r5.xyz, r5.xyz);	// normalize + length
        r11.xyz = r6.xyz + r10.xyz;
        
        r2.w = 1.0 / sqrt(r2.w);
        r5.xyz = normalize(r11.xyz);
        
        r4.w = 1.0 / r2.w;
        r5.w = saturate(dot(r5.xyz, r4.xyz));
        
        r1.w = 1.0 / r1.w;
        
        r2.w = pow(abs(r5.w), ToggleNumLights.z);
        
        r1.w = saturate(r4.w * r1.w);
        r5.xyz = r1.xyz * r2.w;
        
        r2.w = 1.0 - (r1.w * r1.w);
        
        r1.w = dot(r4.xyz, r10.xyz);
        
        r0.xyz = (r2.w * r5.xyz) + r0.xyz;
        
        r2.w = r2.w * r1.w;
        
        r1.w = max(r2.w, 0);
        
        r3.w = r3.w + 1;
        r2.xyz = (r1.w * r1.xyz) + r2.xyz;
        
    }//endif

    if (7 < r3.x) {
        r10.xyz = (2 * r3.w) + const_35.yzw;
        r1.xyzw = (r10.x == 0.0 ? LightData[15].xyzw : r3.y);
        r1.xyzw = (r10.y == 0.0 ? LightData[16].xyzw : r1.xyzw);
        r1.xyzw = (r10.z == 0.0 ? LightData[17].xyzw : r1.xyzw);
        r11.xyz = (r10.x == 0.0 ? LightData[14].xyz : r3.y);
        
        r5.xyz = r1.xyz - IN.texcoord_6.xyz;
        r1.xyz = (r10.y == 0.0 ? LightData[15].xyz : r11.xyz);
        
        r11.x = dot(r9.xyz, r5.xyz);
        r11.y = dot(r8.xyz, r5.xyz);
        r11.z = dot(r7.xyz, r5.xyz);
        r1.xyz = (r10.z == 0.0 ? LightData[16].xyz : r1.xyz);
        
        r10.xyz = normalize(r11.xyz);
        
        r2.w = dot(r5.xyz, r5.xyz);	// normalize + length
        r11.xyz = r6.xyz + r10.xyz;
        
        r2.w = 1.0 / sqrt(r2.w);
        r5.xyz = normalize(r11.xyz);
        
        r4.w = 1.0 / r2.w;
        r5.w = saturate(dot(r5.xyz, r4.xyz));
        
        r1.w = 1.0 / r1.w;
        
        r2.w = pow(abs(r5.w), ToggleNumLights.z);
        
        r1.w = saturate(r4.w * r1.w);
        r5.xyz = r1.xyz * r2.w;
        
        r2.w = 1.0 - (r1.w * r1.w);
        
        r1.w = dot(r4.xyz, r10.xyz);
        
        r0.xyz = (r2.w * r5.xyz) + r0.xyz;
        
        r2.w = r2.w * r1.w;
        
        r1.w = max(r2.w, 0);
        
        r3.w = r3.w + 1;
        r2.xyz = (r1.w * r1.xyz) + r2.xyz;
        
    }//endif

    if (8 < r3.x) {
        r10.xyz = (2 * r3.w) + const_30.yzw;
        r1.xyzw = (r10.x == 0.0 ? LightData[17].xyzw : r3.y);
        r1.xyzw = (r10.y == 0.0 ? LightData[18].xyzw : r1.xyzw);
        r1.xyzw = (r10.z == 0.0 ? LightData[19].xyzw : r1.xyzw);
        r11.xyz = (r10.x == 0.0 ? LightData[16].xyz : r3.y);
        
        r5.xyz = r1.xyz - IN.texcoord_6.xyz;
        r1.xyz = (r10.y == 0.0 ? LightData[17].xyz : r11.xyz);
        
        r11.x = dot(r9.xyz, r5.xyz);
        r11.y = dot(r8.xyz, r5.xyz);
        r11.z = dot(r7.xyz, r5.xyz);
        r1.xyz = (r10.z == 0.0 ? LightData[18].xyz : r1.xyz);
        
        r10.xyz = normalize(r11.xyz);
        
        r2.w = dot(r5.xyz, r5.xyz);	// normalize + length
        r11.xyz = r6.xyz + r10.xyz;
        
        r2.w = 1.0 / sqrt(r2.w);
        r5.xyz = normalize(r11.xyz);
        
        r4.w = 1.0 / r2.w;
        r5.w = saturate(dot(r5.xyz, r4.xyz));
        
        r1.w = 1.0 / r1.w;
        
        r2.w = pow(abs(r5.w), ToggleNumLights.z);
        
        r1.w = saturate(r4.w * r1.w);
        r5.xyz = r1.xyz * r2.w;
        
        r2.w = 1.0 - (r1.w * r1.w);
        
        r1.w = dot(r4.xyz, r10.xyz);
        
        r0.xyz = (r2.w * r5.xyz) + r0.xyz;
        
        r2.w = r2.w * r1.w;
        
        r1.w = max(r2.w, 0);
        
        r3.w = r3.w + 1;
        r2.xyz = (r1.w * r1.xyz) + r2.xyz;
        
    }//endif

    if (9 < r3.x) {
        r5.xyz = LightData[19].xyz - IN.texcoord_6.xyz;
        r1.x = dot(r9.xyz, r5.xyz);
        r1.y = dot(r8.xyz, r5.xyz);
        r1.z = dot(r7.xyz, r5.xyz);
        r1.w = dot(r5.xyz, r5.xyz);	// normalize + length
        r5.xyz = normalize(r1.xyz);
        
        r6.xyz = r6.xyz + r5.xyz;
        
        r1.w = 1.0 / sqrt(r1.w);
        r1.w = 1.0 / r1.w;
        r2.w = 1.0 / LightData[19].w;
        r1.xyz = normalize(r6.xyz);
        
        r1.w = saturate(r1.w * r2.w);
        r3.x = saturate(dot(r1.xyz, r4.xyz));
        
        r2.w = 1.0 - (r1.w * r1.w);
        
        r1.w = pow(abs(r3.x), ToggleNumLights.z);
        
        r6.xy = (2 * r3.w) + const_31.yz;
        r1.xyz = (r6.x == 0.0 ? LightData[18].xyz : r3.y);
        
        r3.w = dot(r4.xyz, r5.xyz);
        
        r1.xyz = (r6.y == 0.0 ? LightData[19].xyz : r1.xyz);
        
        r3.w = r2.w * r3.w;
        
        r4.xyz = r1.w * r1.xyz;
        
        r1.w = max(r3.w, 0);
        
        r0.xyz = (r2.w * r4.xyz) + r0.xyz;
        
        r2.xyz = (r1.w * r1.xyz) + r2.xyz;
        
    }///endif



    r1.z = r3.z - ToggleADTS.x;
    
    r1.w = ToggleADTS.x;
    
    r1.xyz = (r1.w * AmbientColor.rgb) + r1.z;
    
    r1.xyz = r2.xyz + r1.xyz;
    
    r2.xyz = r0.w * r0.xyz;
    
    r0.xyzw = tex2D(BaseMap, IN.texcoord_0.xy);
    
    r0.xyz = r0.xyz * IN.color_0.rgb;
    
    r1.xyz = (r0.xyz * r1.xyz) + r2.xyz;
    
    r0.xyz = IN.texcoord_7.xyz - r1.xyz;
    
    OUT.color_0.rgb = (IN.texcoord_7.w * r0.xyz) + r1.xyz;
    
    OUT.color_0.a = r0.w * MatAlpha.x;
    
    return OUT;
};

// approximately 435 instruction slots used (2 texture, 433 arithmetic)
