// 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 _r0009;
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;
    _r0009 = VertexCoord.x*MVPMatrix[0];
    _r0009 = _r0009 + VertexCoord.y*MVPMatrix[1];
    _r0009 = _r0009 + VertexCoord.z*MVPMatrix[2];
    _r0009 = _r0009 + 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 = _r0009;
    _ret_0._texCoord2 = _texCoord;
    _ret_0._t1 = _OUT._t1;
    gl_Position = _r0009;
    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 _TMP29;
vec3 _TMP30;
float _TMP26;
float _TMP25;
bool _TMP24;
bool _TMP23;
bool _TMP22;
bool _TMP21;
bool _TMP20;
bool _TMP19;
bool _TMP18;
bool _TMP17;
bool _TMP16;
bool _TMP15;
bool _TMP14;
float _TMP13;
vec4 _TMP12;
vec4 _TMP11;
vec4 _TMP10;
vec4 _TMP9;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec2 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _x0044;
vec2 _val0046;
vec2 _c0048;
vec2 _c0050;
vec2 _c0052;
vec2 _c0056;
vec2 _c0058;
vec2 _c0060;
vec2 _c0062;
vec2 _c0064;
vec2 _c0066;
vec2 _c0068;
vec2 _c0070;
float _TMP71;
float _TMP75;
float _TMP79;
float _TMP83;
float _TMP87;
float _TMP91;
float _TMP95;
float _TMP99;
float _TMP103;
float _TMP107;
float _TMP111;
float _TMP115;
float _TMP123;
float _a0126;
float _TMP129;
float _a0132;
float _TMP135;
float _a0138;
float _TMP141;
float _a0144;
float _TMP147;
float _a0150;
float _TMP153;
float _a0156;
float _TMP159;
float _a0162;
float _TMP165;
float _a0168;
float _TMP171;
float _a0174;
float _TMP177;
float _a0180;
float _TMP183;
float _a0186;
float _TMP189;
float _a0192;
float _TMP193;
float _a0196;
float _TMP197;
float _a0200;
float _TMP201;
float _a0204;
float _TMP205;
float _a0208;
float _TMP211;
float _a0214;
float _TMP215;
float _a0218;
float _TMP219;
float _a0222;
float _TMP223;
float _a0226;
float _TMP227;
float _a0230;
float _TMP231;
float _a0234;
float _TMP235;
float _a0238;
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()
{
    bool _edr;
    bool _px;
    bool _interp_restriction_lv1;
    bool _nc;
    bool _fx;
    vec2 _pos;
    vec2 _dir;
    vec2 _g1;
    vec2 _g2;
    _x0044 = TEX0.xy*TextureSize;
    _TMP0 = fract(_x0044);
    _pos = _TMP0 - vec2( 5.00000000E-01, 5.00000000E-01);
    _val0046 = vec2(float((_pos.x > 0.00000000E+00)), float((_pos.y > 0.00000000E+00)));
    _dir = _val0046 - vec2(float((_pos.x < 0.00000000E+00)), float((_pos.y < 0.00000000E+00)));
    _g1 = _dir*TEX1.xy;
    _g2 = _dir*TEX1.zw;
    _c0048 = TEX0.xy + _g1;
    _TMP1 = COMPAT_TEXTURE(Texture, _c0048);
    _c0050 = (TEX0.xy + _g1) - _g2;
    _TMP2 = COMPAT_TEXTURE(Texture, _c0050);
    _c0052 = TEX0.xy + _g2;
    _TMP3 = COMPAT_TEXTURE(Texture, _c0052);
    _TMP4 = COMPAT_TEXTURE(Texture, TEX0.xy);
    _c0056 = TEX0.xy - _g2;
    _TMP5 = COMPAT_TEXTURE(Texture, _c0056);
    _c0058 = (TEX0.xy - _g1) + _g2;
    _TMP6 = COMPAT_TEXTURE(Texture, _c0058);
    _c0060 = TEX0.xy - _g1;
    _TMP7 = COMPAT_TEXTURE(Texture, _c0060);
    _c0062 = (TEX0.xy - _g1) - _g2;
    _TMP8 = COMPAT_TEXTURE(Texture, _c0062);
    _c0064 = TEX0.xy - 2.00000000E+00*_g2;
    _TMP9 = COMPAT_TEXTURE(Texture, _c0064);
    _c0066 = (TEX0.xy - _g1) - 2.00000000E+00*_g2;
    _TMP10 = COMPAT_TEXTURE(Texture, _c0066);
    _c0068 = TEX0.xy - 2.00000000E+00*_g1;
    _TMP11 = COMPAT_TEXTURE(Texture, _c0068);
    _c0070 = (TEX0.xy - 2.00000000E+00*_g1) - _g2;
    _TMP12 = COMPAT_TEXTURE(Texture, _c0070);
    _TMP71 = dot(_TMP1.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP75 = dot(_TMP2.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP79 = dot(_TMP3.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP83 = dot(_TMP4.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP87 = dot(_TMP5.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP91 = dot(_TMP6.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP95 = dot(_TMP7.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP99 = dot(_TMP8.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP103 = dot(_TMP10.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP107 = dot(_TMP12.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP111 = dot(_TMP11.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP115 = dot(_TMP9.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP13 = dot(_dir, _pos);
    _fx = _TMP13 > 5.00000000E-01;
    _a0126 = _TMP87 - _TMP71;
    _TMP123 = abs(_a0126);
    _TMP14 = _TMP123 < 1.50000000E+01;
    _a0132 = _TMP87 - _TMP75;
    _TMP129 = abs(_a0132);
    _TMP15 = _TMP129 < 1.50000000E+01;
    _a0138 = _TMP95 - _TMP79;
    _TMP135 = abs(_a0138);
    _TMP16 = _TMP135 < 1.50000000E+01;
    _a0144 = _TMP95 - _TMP91;
    _TMP141 = abs(_a0144);
    _TMP17 = _TMP141 < 1.50000000E+01;
    _a0150 = _TMP83 - _TMP99;
    _TMP147 = abs(_a0150);
    _TMP18 = _TMP147 < 1.50000000E+01;
    _a0156 = _TMP87 - _TMP115;
    _TMP153 = abs(_a0156);
    _TMP19 = _TMP153 < 1.50000000E+01;
    _a0162 = _TMP87 - _TMP103;
    _TMP159 = abs(_a0162);
    _TMP20 = _TMP159 < 1.50000000E+01;
    _a0168 = _TMP95 - _TMP111;
    _TMP165 = abs(_a0168);
    _TMP21 = _TMP165 < 1.50000000E+01;
    _a0174 = _TMP95 - _TMP107;
    _TMP171 = abs(_a0174);
    _TMP22 = _TMP171 < 1.50000000E+01;
    _a0180 = _TMP83 - _TMP91;
    _TMP177 = abs(_a0180);
    _TMP23 = _TMP177 < 1.50000000E+01;
    _a0186 = _TMP83 - _TMP75;
    _TMP183 = abs(_a0186);
    _TMP24 = _TMP183 < 1.50000000E+01;
    _interp_restriction_lv1 = _TMP83 != _TMP87 && _TMP83 != _TMP95 && (!_TMP14 && !_TMP15 || !_TMP16 && !_TMP17 || _TMP18 && (!_TMP19 && !_TMP20 || !_TMP21 && !_TMP22) || _TMP23 || _TMP24);
    _a0192 = _TMP83 - _TMP75;
    _TMP189 = abs(_a0192);
    _a0196 = _TMP83 - _TMP91;
    _TMP193 = abs(_a0196);
    _a0200 = _TMP99 - _TMP111;
    _TMP197 = abs(_a0200);
    _a0204 = _TMP99 - _TMP115;
    _TMP201 = abs(_a0204);
    _a0208 = _TMP95 - _TMP87;
    _TMP205 = abs(_a0208);
    _TMP25 = _TMP189 + _TMP193 + _TMP197 + _TMP201 + 4.00000000E+00*_TMP205;
    _a0214 = _TMP95 - _TMP79;
    _TMP211 = abs(_a0214);
    _a0218 = _TMP95 - _TMP107;
    _TMP215 = abs(_a0218);
    _a0222 = _TMP87 - _TMP103;
    _TMP219 = abs(_a0222);
    _a0226 = _TMP87 - _TMP71;
    _TMP223 = abs(_a0226);
    _a0230 = _TMP83 - _TMP99;
    _TMP227 = abs(_a0230);
    _TMP26 = _TMP211 + _TMP215 + _TMP219 + _TMP223 + 4.00000000E+00*_TMP227;
    _edr = _TMP25 < _TMP26 && _interp_restriction_lv1;
    _nc = _edr && _fx;
    _a0234 = _TMP83 - _TMP87;
    _TMP231 = abs(_a0234);
    _a0238 = _TMP83 - _TMP95;
    _TMP235 = abs(_a0238);
    _px = _TMP231 <= _TMP235;
    if (_nc) { 
        if (_px) { 
            _TMP30 = _TMP5.xyz;
        } else {
            _TMP30 = _TMP7.xyz;
        } 
        _TMP29 = _TMP30;
    } else {
        _TMP29 = _TMP4.xyz;
    } 
    _ret_0 = vec4(_TMP29.x, _TMP29.y, _TMP29.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
