// GLSL shader autogenerated by cg2glsl.py.
#if defined(VERTEX)

#if __VERSION__ >= 130
#define COMPAT_VARYING out
#define COMPAT_ATTRIBUTE in
#define COMPAT_TEXTURE texture
#else
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING     vec4 _t1;
COMPAT_VARYING     vec2 _texCoord2;
COMPAT_VARYING     vec4 _position1;
COMPAT_VARYING     float _frame_rotation;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
struct out_vertex {
    vec4 _position1;
    vec2 _texCoord2;
    vec4 _t1;
};
out_vertex _ret_0;
input_dummy _IN1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
 
uniform mat4 MVPMatrix;
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    out_vertex _OUT;
    vec2 _ps;
    vec2 _texCoord;
    _r0006 = VertexCoord.x*MVPMatrix[0];
    _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
    _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
    _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
    _ps = vec2(1.00000000E+00/TextureSize.x, 1.00000000E+00/TextureSize.y);
    _texCoord = TexCoord.xy + vec2( 1.00000001E-07, 1.00000001E-07);
    _OUT._t1.xy = vec2(0.00000000E+00, -_ps.y);
    _OUT._t1.zw = vec2(-_ps.x, 0.00000000E+00);
    _ret_0._position1 = _r0006;
    _ret_0._texCoord2 = _texCoord;
    _ret_0._t1 = _OUT._t1;
    gl_Position = _r0006;
    TEX0.xy = _texCoord;
    TEX1 = _OUT._t1;
    return;
    TEX0.xy = _ret_0._texCoord2;
    TEX1 = _ret_0._t1;
} 
#elif defined(FRAGMENT)

#if __VERSION__ >= 130
#define COMPAT_VARYING in
#define COMPAT_TEXTURE texture
out vec4 FragColor;
#else
#define COMPAT_VARYING varying
#define FragColor gl_FragColor
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING     vec4 _t1;
COMPAT_VARYING     vec2 _texCoord;
COMPAT_VARYING     float _frame_rotation;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
struct out_vertex {
    vec2 _texCoord;
    vec4 _t1;
};
vec4 _ret_0;
vec3 _TMP25;
vec3 _TMP33;
vec3 _TMP37;
vec3 _TMP38;
vec3 _TMP39;
vec3 _TMP34;
vec3 _TMP35;
vec3 _TMP36;
vec3 _TMP26;
vec3 _TMP30;
vec3 _TMP31;
vec3 _TMP32;
vec3 _TMP27;
vec3 _TMP28;
vec3 _TMP29;
vec4 _TMP23;
vec4 _TMP21;
vec4 _TMP20;
vec4 _TMP18;
vec4 _TMP16;
vec4 _TMP15;
vec4 _TMP14;
vec4 _TMP13;
vec4 _TMP12;
vec4 _TMP11;
vec4 _TMP10;
vec4 _TMP9;
float _TMP7;
float _TMP6;
float _TMP5;
float _TMP4;
float _TMP3;
float _TMP2;
float _TMP1;
float _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _x0045;
vec2 _c0065;
vec2 _c0067;
vec2 _c0069;
vec2 _c0073;
vec2 _c0075;
vec2 _c0077;
vec2 _c0079;
vec2 _c0083;
vec2 _c0087;
vec2 _c0089;
vec2 _c0093;
float _TMP100;
float _TMP104;
float _TMP108;
float _TMP112;
float _TMP116;
float _TMP120;
float _TMP124;
float _TMP128;
float _TMP136;
float _TMP144;
float _TMP148;
float _TMP156;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec2 _fp;
    vec2 _g1;
    vec2 _g2;
    vec3 _E11;
    vec3 _E14;
    vec3 _E15;
    _x0045 = TEX0.xy*TextureSize;
    _fp = fract(_x0045);
    _TMP0 = float((_fp.x >= 5.00000000E-01));
    _TMP1 = float((_fp.y >= 5.00000000E-01));
    _TMP2 = float((_fp.x >= 5.00000000E-01));
    _TMP3 = float((_fp.y >= 5.00000000E-01));
    _g1 = TEX1.xy*((_TMP0 + _TMP1) - 1.00000000E+00) + TEX1.zw*(_TMP2 - _TMP3);
    _TMP4 = float((_fp.y >= 5.00000000E-01));
    _TMP5 = float((_fp.x >= 5.00000000E-01));
    _TMP6 = float((_fp.x >= 5.00000000E-01));
    _TMP7 = float((_fp.y >= 5.00000000E-01));
    _g2 = TEX1.xy*(_TMP4 - _TMP5) + TEX1.zw*((_TMP6 + _TMP7) - 1.00000000E+00);
    _c0065 = TEX0.xy + _g1;
    _TMP9 = COMPAT_TEXTURE(Texture, _c0065);
    _c0067 = (TEX0.xy + _g1) - _g2;
    _TMP10 = COMPAT_TEXTURE(Texture, _c0067);
    _c0069 = TEX0.xy + _g2;
    _TMP11 = COMPAT_TEXTURE(Texture, _c0069);
    _TMP12 = COMPAT_TEXTURE(Texture, TEX0.xy);
    _c0073 = TEX0.xy - _g2;
    _TMP13 = COMPAT_TEXTURE(Texture, _c0073);
    _c0075 = (TEX0.xy - _g1) + _g2;
    _TMP14 = COMPAT_TEXTURE(Texture, _c0075);
    _c0077 = TEX0.xy - _g1;
    _TMP15 = COMPAT_TEXTURE(Texture, _c0077);
    _c0079 = (TEX0.xy - _g1) - _g2;
    _TMP16 = COMPAT_TEXTURE(Texture, _c0079);
    _c0083 = (TEX0.xy + 2.00000000E+00*_g1) - _g2;
    _TMP18 = COMPAT_TEXTURE(Texture, _c0083);
    _c0087 = (TEX0.xy - _g1) + 2.00000000E+00*_g2;
    _TMP20 = COMPAT_TEXTURE(Texture, _c0087);
    _c0089 = (TEX0.xy + _g1) - 2.00000000E+00*_g2;
    _TMP21 = COMPAT_TEXTURE(Texture, _c0089);
    _c0093 = (TEX0.xy - 2.00000000E+00*_g1) + _g2;
    _TMP23 = COMPAT_TEXTURE(Texture, _c0093);
    _E11 = _TMP12.xyz;
    _E14 = _TMP12.xyz;
    _E15 = _TMP12.xyz;
    _TMP100 = dot(_TMP9.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP104 = dot(_TMP10.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP108 = dot(_TMP11.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP112 = dot(_TMP12.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP116 = dot(_TMP13.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP120 = dot(_TMP14.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP124 = dot(_TMP15.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP128 = dot(_TMP16.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP136 = dot(_TMP18.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP144 = dot(_TMP20.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP148 = dot(_TMP21.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP156 = dot(_TMP23.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    if (_TMP112 != _TMP124 && (_TMP124 == _TMP116 && (_TMP112 != _TMP128 && (_TMP112 != _TMP100 || _TMP112 != _TMP108 || _TMP100 == _TMP136 && _TMP108 == _TMP144 || _TMP116 != _TMP100 && _TMP116 != _TMP104 || _TMP124 != _TMP108 && _TMP124 != _TMP120) || _TMP112 == _TMP120 && (_TMP128 == _TMP124 || _TMP112 == _TMP108 || _TMP124 != _TMP108) || _TMP112 == _TMP104 && (_TMP128 == _TMP124 || _TMP112 == _TMP100 || _TMP116 != _TMP100)) || _TMP112 != _TMP116 && _TMP112 == _TMP104 && (_TMP116 != _TMP128 && (_TMP124 == _TMP128 && _TMP116 != _TMP100 || _TMP112 != _TMP128 && _TMP116 == _TMP148) || _TMP112 != _TMP128 && _TMP112 == _TMP120))) { 
        _E11 = (_TMP12.xyz + _TMP13.xyz)*5.00000000E-01;
        _E14 = (_TMP12.xyz + _TMP15.xyz)*5.00000000E-01;
        _E15 = _TMP13.xyz;
    } else {
        if (_TMP112 != _TMP124 && _TMP112 != _TMP116 && _TMP124 != _TMP128 && _TMP112 == _TMP120 && (_TMP116 == _TMP128 && _TMP124 != _TMP108 || _TMP112 != _TMP128 && _TMP124 == _TMP156)) { 
            _E11 = (_TMP12.xyz + _TMP15.xyz)*5.00000000E-01;
            _E14 = _E11;
            _E15 = _TMP15.xyz;
        } 
    } 
    if (_fp.x < 5.00000000E-01) { 
        if (_fp.x < 2.50000000E-01) { 
            if (_fp.y < 2.50000000E-01) { 
                _TMP27 = _E15;
            } else {
                if (_fp.y < 5.00000000E-01) { 
                    _TMP28 = _E11;
                } else {
                    if (_fp.y < 7.50000000E-01) { 
                        _TMP29 = _E14;
                    } else {
                        _TMP29 = _E15;
                    } 
                    _TMP28 = _TMP29;
                } 
                _TMP27 = _TMP28;
            } 
            _TMP26 = _TMP27;
        } else {
            if (_fp.y < 2.50000000E-01) { 
                _TMP30 = _E14;
            } else {
                if (_fp.y < 5.00000000E-01) { 
                    _TMP31 = _TMP12.xyz;
                } else {
                    if (_fp.y < 7.50000000E-01) { 
                        _TMP32 = _TMP12.xyz;
                    } else {
                        _TMP32 = _E11;
                    } 
                    _TMP31 = _TMP32;
                } 
                _TMP30 = _TMP31;
            } 
            _TMP26 = _TMP30;
        } 
        _TMP25 = _TMP26;
    } else {
        if (_fp.x < 7.50000000E-01) { 
            if (_fp.y < 2.50000000E-01) { 
                _TMP34 = _E11;
            } else {
                if (_fp.y < 5.00000000E-01) { 
                    _TMP35 = _TMP12.xyz;
                } else {
                    if (_fp.y < 7.50000000E-01) { 
                        _TMP36 = _TMP12.xyz;
                    } else {
                        _TMP36 = _E14;
                    } 
                    _TMP35 = _TMP36;
                } 
                _TMP34 = _TMP35;
            } 
            _TMP33 = _TMP34;
        } else {
            if (_fp.y < 2.50000000E-01) { 
                _TMP37 = _E15;
            } else {
                if (_fp.y < 5.00000000E-01) { 
                    _TMP38 = _E14;
                } else {
                    if (_fp.y < 7.50000000E-01) { 
                        _TMP39 = _E11;
                    } else {
                        _TMP39 = _E15;
                    } 
                    _TMP38 = _TMP39;
                } 
                _TMP37 = _TMP38;
            } 
            _TMP33 = _TMP37;
        } 
        _TMP25 = _TMP33;
    } 
    _ret_0 = vec4(_TMP25.x, _TMP25.y, _TMP25.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
