// 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     float _frame_rotation;
COMPAT_VARYING     vec4 _color1;
struct output_dummy {
    vec4 _color1;
};
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
vec4 _oPosition1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 COL0;
COMPAT_VARYING vec4 TEX0;
 
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()
{
    vec4 _oColor;
    vec2 _otexCoord;
    _r0006 = VertexCoord.x*MVPMatrix[0];
    _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
    _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
    _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
    _oPosition1 = _r0006;
    _oColor = COLOR;
    _otexCoord = TexCoord.xy;
    gl_Position = _r0006;
    COL0 = COLOR;
    TEX0.xy = TexCoord.xy;
} 
#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     float _frame_rotation;
COMPAT_VARYING     vec4 _color1;
struct output_dummy {
    vec4 _color1;
};
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
vec3 _TMP13;
vec3 _TMP15;
vec3 _TMP14;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _c0023;
vec2 _c0025;
vec2 _c0027;
vec2 _c0029;
vec2 _c0033;
vec2 _c0035;
vec2 _c0037;
vec2 _c0039;
float _TMP48;
float _TMP52;
float _TMP56;
float _TMP60;
float _TMP64;
float _TMP68;
float _TMP72;
float _TMP76;
float _TMP80;
COMPAT_VARYING vec4 TEX0;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec2 _ps;
    vec2 _dx;
    vec2 _dy;
    vec2 _pixcoord;
    vec2 _fp;
    vec2 _d11;
    vec3 _E0;
    vec3 _E1;
    vec3 _E2;
    vec3 _E3;
    output_dummy _OUT;
    _ps = vec2(9.99899983E-01/TextureSize.x, 9.99899983E-01/TextureSize.y);
    _dx = vec2(_ps.x, 0.00000000E+00);
    _dy = vec2(0.00000000E+00, _ps.y);
    _pixcoord = TEX0.xy/_ps;
    _fp = fract(_pixcoord);
    _d11 = TEX0.xy - _fp*_ps;
    _c0023 = (_d11 - _dx) - _dy;
    _TMP0 = COMPAT_TEXTURE(Texture, _c0023);
    _c0025 = _d11 - _dy;
    _TMP1 = COMPAT_TEXTURE(Texture, _c0025);
    _c0027 = (_d11 + _dx) - _dy;
    _TMP2 = COMPAT_TEXTURE(Texture, _c0027);
    _c0029 = _d11 - _dx;
    _TMP3 = COMPAT_TEXTURE(Texture, _c0029);
    _TMP4 = COMPAT_TEXTURE(Texture, _d11);
    _c0033 = _d11 + _dx;
    _TMP5 = COMPAT_TEXTURE(Texture, _c0033);
    _c0035 = (_d11 - _dx) + _dy;
    _TMP6 = COMPAT_TEXTURE(Texture, _c0035);
    _c0037 = _d11 + _dy;
    _TMP7 = COMPAT_TEXTURE(Texture, _c0037);
    _c0039 = _d11 + _dx + _dy;
    _TMP8 = COMPAT_TEXTURE(Texture, _c0039);
    _E0 = _TMP4.xyz;
    _E1 = _TMP4.xyz;
    _E2 = _TMP4.xyz;
    _E3 = _TMP4.xyz;
    _TMP48 = dot(_TMP0.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP52 = dot(_TMP1.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP56 = dot(_TMP2.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP60 = dot(_TMP3.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP64 = dot(_TMP4.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP68 = dot(_TMP5.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP72 = dot(_TMP6.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP76 = dot(_TMP7.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP80 = dot(_TMP8.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    if (_TMP64 != _TMP76 && _TMP76 == _TMP68 && (_TMP64 != _TMP80 && (_TMP64 != _TMP52 || _TMP64 != _TMP60 || _TMP68 != _TMP52 && _TMP68 != _TMP56 || _TMP76 != _TMP60 && _TMP76 != _TMP72) || _TMP64 == _TMP72 && (_TMP80 == _TMP76 || _TMP64 == _TMP60 || _TMP76 != _TMP60) || _TMP64 == _TMP56 && (_TMP80 == _TMP76 || _TMP64 == _TMP52 || _TMP68 != _TMP52))) { 
        if (_TMP64 == _TMP56 && _TMP64 == _TMP60 && _TMP76 == _TMP72) { 
            _E3 = _TMP4.xyz + 7.50000000E-01*(_TMP7.xyz - _TMP4.xyz);
            _E2 = (_TMP4.xyz + _TMP7.xyz) - _E3;
        } else {
            if (_TMP64 == _TMP72 && _TMP64 == _TMP52 && _TMP68 == _TMP56) { 
                _E3 = _TMP4.xyz + 7.50000000E-01*(_TMP5.xyz - _TMP4.xyz);
                _E1 = (_TMP4.xyz + _TMP5.xyz) - _E3;
            } else {
                _E3 = _TMP4.xyz + 5.00000000E-01*(_TMP5.xyz - _TMP4.xyz);
            } 
        } 
    } else {
        if (_TMP64 != _TMP76 && _TMP64 != _TMP80 && _TMP64 != _TMP68 && _TMP64 == _TMP72 && _TMP64 == _TMP56) { 
            _E3 = _TMP4.xyz + 5.00000000E-01*(_TMP5.xyz - _TMP4.xyz);
        } 
    } 
    if (_TMP64 != _TMP68 && _TMP68 == _TMP52 && (_TMP64 != _TMP56 && (_TMP64 != _TMP60 || _TMP64 != _TMP76 || _TMP52 != _TMP60 && _TMP52 != _TMP48 || _TMP68 != _TMP76 && _TMP68 != _TMP80) || _TMP64 == _TMP80 && (_TMP56 == _TMP68 || _TMP64 == _TMP76 || _TMP68 != _TMP76) || _TMP64 == _TMP48 && (_TMP56 == _TMP68 || _TMP64 == _TMP60 || _TMP52 != _TMP60))) { 
        if (_TMP64 == _TMP48 && _TMP64 == _TMP76 && _TMP68 == _TMP80) { 
            _E1 = _E1 + 7.50000000E-01*(_TMP5.xyz - _E1);
            _E3 = (_E3 + _TMP5.xyz) - _E1;
        } else {
            if (_TMP64 == _TMP80 && _TMP64 == _TMP60 && _TMP52 == _TMP48) { 
                _E1 = _E1 + 7.50000000E-01*(_TMP1.xyz - _E1);
                _E0 = (_TMP4.xyz + _TMP1.xyz) - _E1;
            } else {
                _E1 = _E1 + 5.00000000E-01*(_TMP1.xyz - _E1);
            } 
        } 
    } else {
        if (_TMP64 != _TMP68 && _TMP64 != _TMP56 && _TMP64 != _TMP52 && _TMP64 == _TMP80 && _TMP64 == _TMP48) { 
            _E1 = _E1 + 5.00000000E-01*(_TMP1.xyz - _E1);
        } 
    } 
    if (_TMP64 != _TMP52 && _TMP52 == _TMP60 && (_TMP64 != _TMP48 && (_TMP64 != _TMP76 || _TMP64 != _TMP68 || _TMP60 != _TMP76 && _TMP60 != _TMP72 || _TMP52 != _TMP68 && _TMP52 != _TMP56) || _TMP64 == _TMP56 && (_TMP48 == _TMP52 || _TMP64 == _TMP68 || _TMP52 != _TMP68) || _TMP64 == _TMP72 && (_TMP48 == _TMP52 || _TMP64 == _TMP76 || _TMP60 != _TMP76))) { 
        if (_TMP64 == _TMP72 && _TMP64 == _TMP68 && _TMP52 == _TMP56) { 
            _E0 = _E0 + 7.50000000E-01*(_TMP1.xyz - _E0);
            _E1 = (_E1 + _TMP1.xyz) - _E0;
        } else {
            if (_TMP64 == _TMP56 && _TMP64 == _TMP76 && _TMP60 == _TMP72) { 
                _E0 = _E0 + 7.50000000E-01*(_TMP3.xyz - _E0);
                _E2 = (_E2 + _TMP3.xyz) - _E0;
            } else {
                _E0 = _E0 + 5.00000000E-01*(_TMP3.xyz - _E0);
            } 
        } 
    } else {
        if (_TMP64 != _TMP52 && _TMP64 != _TMP48 && _TMP64 != _TMP60 && _TMP64 == _TMP56 && _TMP64 == _TMP72) { 
            _E0 = _E0 + 5.00000000E-01*(_TMP3.xyz - _E0);
        } 
    } 
    if (_TMP64 != _TMP60 && _TMP60 == _TMP76 && (_TMP64 != _TMP72 && (_TMP64 != _TMP68 || _TMP64 != _TMP52 || _TMP76 != _TMP68 && _TMP76 != _TMP80 || _TMP60 != _TMP52 && _TMP60 != _TMP48) || _TMP64 == _TMP48 && (_TMP72 == _TMP60 || _TMP64 == _TMP52 || _TMP60 != _TMP52) || _TMP64 == _TMP80 && (_TMP72 == _TMP60 || _TMP64 == _TMP68 || _TMP76 != _TMP68))) { 
        if (_TMP64 == _TMP80 && _TMP64 == _TMP52 && _TMP60 == _TMP48) { 
            _E2 = _E2 + 7.50000000E-01*(_TMP3.xyz - _E2);
            _E0 = (_E0 + _TMP3.xyz) - _E2;
        } else {
            if (_TMP64 == _TMP48 && _TMP64 == _TMP68 && _TMP76 == _TMP80) { 
                _E2 = _E2 + 7.50000000E-01*(_TMP7.xyz - _E2);
                _E3 = (_E3 + _TMP7.xyz) - _E2;
            } else {
                _E2 = _E2 + 5.00000000E-01*(_TMP7.xyz - _E2);
            } 
        } 
    } else {
        if (_TMP64 != _TMP60 && _TMP64 != _TMP72 && _TMP64 != _TMP76 && _TMP64 == _TMP48 && _TMP64 == _TMP80) { 
            _E2 = _E2 + 5.00000000E-01*(_TMP7.xyz - _E2);
        } 
    } 
    if (_fp.x < 5.00000000E-01) { 
        if (_fp.y < 5.00000000E-01) { 
            _TMP14 = _E0;
        } else {
            _TMP14 = _E2;
        } 
        _TMP13 = _TMP14;
    } else {
        if (_fp.y < 5.00000000E-01) { 
            _TMP15 = _E1;
        } else {
            _TMP15 = _E3;
        } 
        _TMP13 = _TMP15;
    } 
    _OUT._color1 = vec4(_TMP13.x, _TMP13.y, _TMP13.z, 1.00000000E+00);
    FragColor = _OUT._color1;
    return;
} 
#endif
