// 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 _color1;
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;
    vec4 _color1;
    vec2 _texCoord2;
    vec4 _t1;
};
out_vertex _ret_0;
input_dummy _IN1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 COL0;
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._color1 = COLOR;
    _ret_0._texCoord2 = _texCoord;
    _ret_0._t1 = _OUT._t1;
    gl_Position = _r0006;
    COL0 = COLOR;
    TEX0.xy = _texCoord;
    TEX1 = _OUT._t1;
    return;
    COL0 = _ret_0._color1;
    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     vec4 _color1;
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 _color1;
    vec2 _texCoord;
    vec4 _t1;
};
vec4 _ret_0;
vec3 _TMP10;
vec3 _TMP11;
vec3 _TMP12;
vec4 _TMP9;
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 _x0018;
vec2 _c0022;
vec2 _c0024;
vec2 _c0026;
vec2 _c0030;
vec2 _c0032;
vec2 _c0034;
vec2 _c0036;
vec2 _c0038;
vec2 _c0040;
float _TMP41;
float _TMP45;
float _TMP49;
float _TMP53;
float _TMP57;
float _TMP61;
float _TMP65;
float _TMP69;
float _TMP73;
float _TMP77;
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 _st;
    vec2 _g1;
    vec2 _g2;
    float _AO;
    float _BO;
    float _CO;
    vec3 _res;
    bool _fx_1;
    bool _condition_11;
    bool _condition_21;
    bool _condition_31;
    _x0018 = TEX0.xy*TextureSize;
    _fp = fract(_x0018);
    _st = vec2(float((_fp.x >= 5.00000000E-01)), float((_fp.y >= 5.00000000E-01)));
    _g1 = TEX1.xy*((_st.x + _st.y) - 1.00000000E+00) + TEX1.zw*(_st.x - _st.y);
    _g2 = TEX1.xy*(_st.y - _st.x) + TEX1.zw*((_st.x + _st.y) - 1.00000000E+00);
    _AO = 2.00000000E+00*_st.y - 1.00000000E+00;
    _BO = 2.00000000E+00*_st.x - 1.00000000E+00;
    _CO = (_st.x + _st.y) - 5.00000000E-01;
    _c0022 = TEX0.xy + _g1;
    _TMP0 = COMPAT_TEXTURE(Texture, _c0022);
    _c0024 = (TEX0.xy + _g1) - _g2;
    _TMP1 = COMPAT_TEXTURE(Texture, _c0024);
    _c0026 = TEX0.xy + _g2;
    _TMP2 = COMPAT_TEXTURE(Texture, _c0026);
    _TMP3 = COMPAT_TEXTURE(Texture, TEX0.xy);
    _c0030 = TEX0.xy - _g2;
    _TMP4 = COMPAT_TEXTURE(Texture, _c0030);
    _c0032 = (TEX0.xy - _g1) + _g2;
    _TMP5 = COMPAT_TEXTURE(Texture, _c0032);
    _c0034 = TEX0.xy - _g1;
    _TMP6 = COMPAT_TEXTURE(Texture, _c0034);
    _c0036 = (TEX0.xy - _g1) - _g2;
    _TMP7 = COMPAT_TEXTURE(Texture, _c0036);
    _c0038 = (TEX0.xy + _g1) - 2.00000000E+00*_g2;
    _TMP8 = COMPAT_TEXTURE(Texture, _c0038);
    _c0040 = (TEX0.xy - 2.00000000E+00*_g1) + _g2;
    _TMP9 = COMPAT_TEXTURE(Texture, _c0040);
    _TMP41 = dot(_TMP0.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP45 = dot(_TMP1.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP49 = dot(_TMP2.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP53 = dot(_TMP3.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP57 = dot(_TMP4.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP61 = dot(_TMP5.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP65 = dot(_TMP6.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP69 = dot(_TMP7.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP73 = dot(_TMP8.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _TMP77 = dot(_TMP9.xyz, vec3( 6.55360000E+04, 2.55000000E+02, 1.00000000E+00));
    _res = _TMP3.xyz;
    _fx_1 = _AO*_fp.y + _BO*_fp.x > _CO;
    if (_fx_1) { 
        _condition_11 = _TMP53 != _TMP65 && (_TMP65 == _TMP57 && (_TMP53 != _TMP69 && (_TMP53 != _TMP41 || _TMP53 != _TMP49 || _TMP57 != _TMP41 && _TMP57 != _TMP45 || _TMP65 != _TMP49 && _TMP65 != _TMP61) || _TMP53 == _TMP61 && (_TMP69 == _TMP65 || _TMP53 == _TMP49 || _TMP65 != _TMP49) || _TMP53 == _TMP45 && (_TMP69 == _TMP65 || _TMP53 == _TMP41 || _TMP57 != _TMP41)) || _TMP53 != _TMP57 && _TMP65 != _TMP69 && _TMP53 == _TMP61 && (_TMP57 == _TMP69 && _TMP65 != _TMP49 || _TMP53 != _TMP69 && _TMP65 == _TMP77));
        _condition_21 = _TMP53 != _TMP65 && _TMP53 != _TMP57 && _TMP57 != _TMP69 && _TMP53 == _TMP45 && (_TMP65 == _TMP69 && _TMP57 != _TMP41 || _TMP53 != _TMP69 && _TMP57 == _TMP73);
        _condition_31 = _TMP53 != _TMP65 && _TMP61 == _TMP53 && _TMP53 == _TMP45 && _TMP53 != _TMP69 && _TMP53 != _TMP57;
        if (_condition_11) { 
            _TMP10 = _TMP6.xyz;
        } else {
            if (_condition_21) { 
                _TMP11 = _TMP4.xyz;
            } else {
                if (_condition_31) { 
                    _TMP12 = (_TMP4.xyz + _TMP6.xyz)*5.00000000E-01;
                } else {
                    _TMP12 = _TMP3.xyz;
                } 
                _TMP11 = _TMP12;
            } 
            _TMP10 = _TMP11;
        } 
        _res = _TMP10;
    } 
    _ret_0 = vec4(_res.x, _res.y, _res.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
