//! This file was generated automatically by the Snowball to Rust compiler
//! http://snowballstem.org/

#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(unused_mut)]
use snowball::SnowballEnv;
use snowball::Among;

static A_0: &'static [Among<Context>; 9] = &[
    Among("\u{0432}\u{0448}\u{0438}\u{0441}\u{044C}", -1, 1, None),
    Among("\u{044B}\u{0432}\u{0448}\u{0438}\u{0441}\u{044C}", 0, 2, None),
    Among("\u{0438}\u{0432}\u{0448}\u{0438}\u{0441}\u{044C}", 0, 2, None),
    Among("\u{0432}", -1, 1, None),
    Among("\u{044B}\u{0432}", 3, 2, None),
    Among("\u{0438}\u{0432}", 3, 2, None),
    Among("\u{0432}\u{0448}\u{0438}", -1, 1, None),
    Among("\u{044B}\u{0432}\u{0448}\u{0438}", 6, 2, None),
    Among("\u{0438}\u{0432}\u{0448}\u{0438}", 6, 2, None),
];

static A_1: &'static [Among<Context>; 26] = &[
    Among("\u{0435}\u{043C}\u{0443}", -1, 1, None),
    Among("\u{043E}\u{043C}\u{0443}", -1, 1, None),
    Among("\u{044B}\u{0445}", -1, 1, None),
    Among("\u{0438}\u{0445}", -1, 1, None),
    Among("\u{0443}\u{044E}", -1, 1, None),
    Among("\u{044E}\u{044E}", -1, 1, None),
    Among("\u{0435}\u{044E}", -1, 1, None),
    Among("\u{043E}\u{044E}", -1, 1, None),
    Among("\u{044F}\u{044F}", -1, 1, None),
    Among("\u{0430}\u{044F}", -1, 1, None),
    Among("\u{044B}\u{0435}", -1, 1, None),
    Among("\u{0435}\u{0435}", -1, 1, None),
    Among("\u{0438}\u{0435}", -1, 1, None),
    Among("\u{043E}\u{0435}", -1, 1, None),
    Among("\u{044B}\u{043C}\u{0438}", -1, 1, None),
    Among("\u{0438}\u{043C}\u{0438}", -1, 1, None),
    Among("\u{044B}\u{0439}", -1, 1, None),
    Among("\u{0435}\u{0439}", -1, 1, None),
    Among("\u{0438}\u{0439}", -1, 1, None),
    Among("\u{043E}\u{0439}", -1, 1, None),
    Among("\u{044B}\u{043C}", -1, 1, None),
    Among("\u{0435}\u{043C}", -1, 1, None),
    Among("\u{0438}\u{043C}", -1, 1, None),
    Among("\u{043E}\u{043C}", -1, 1, None),
    Among("\u{0435}\u{0433}\u{043E}", -1, 1, None),
    Among("\u{043E}\u{0433}\u{043E}", -1, 1, None),
];

static A_2: &'static [Among<Context>; 8] = &[
    Among("\u{0432}\u{0448}", -1, 1, None),
    Among("\u{044B}\u{0432}\u{0448}", 0, 2, None),
    Among("\u{0438}\u{0432}\u{0448}", 0, 2, None),
    Among("\u{0449}", -1, 1, None),
    Among("\u{044E}\u{0449}", 3, 1, None),
    Among("\u{0443}\u{044E}\u{0449}", 4, 2, None),
    Among("\u{0435}\u{043C}", -1, 1, None),
    Among("\u{043D}\u{043D}", -1, 1, None),
];

static A_3: &'static [Among<Context>; 2] = &[
    Among("\u{0441}\u{044C}", -1, 1, None),
    Among("\u{0441}\u{044F}", -1, 1, None),
];

static A_4: &'static [Among<Context>; 46] = &[
    Among("\u{044B}\u{0442}", -1, 2, None),
    Among("\u{044E}\u{0442}", -1, 1, None),
    Among("\u{0443}\u{044E}\u{0442}", 1, 2, None),
    Among("\u{044F}\u{0442}", -1, 2, None),
    Among("\u{0435}\u{0442}", -1, 1, None),
    Among("\u{0443}\u{0435}\u{0442}", 4, 2, None),
    Among("\u{0438}\u{0442}", -1, 2, None),
    Among("\u{043D}\u{044B}", -1, 1, None),
    Among("\u{0435}\u{043D}\u{044B}", 7, 2, None),
    Among("\u{0442}\u{044C}", -1, 1, None),
    Among("\u{044B}\u{0442}\u{044C}", 9, 2, None),
    Among("\u{0438}\u{0442}\u{044C}", 9, 2, None),
    Among("\u{0435}\u{0448}\u{044C}", -1, 1, None),
    Among("\u{0438}\u{0448}\u{044C}", -1, 2, None),
    Among("\u{044E}", -1, 2, None),
    Among("\u{0443}\u{044E}", 14, 2, None),
    Among("\u{043B}\u{0430}", -1, 1, None),
    Among("\u{044B}\u{043B}\u{0430}", 16, 2, None),
    Among("\u{0438}\u{043B}\u{0430}", 16, 2, None),
    Among("\u{043D}\u{0430}", -1, 1, None),
    Among("\u{0435}\u{043D}\u{0430}", 19, 2, None),
    Among("\u{0435}\u{0442}\u{0435}", -1, 1, None),
    Among("\u{0438}\u{0442}\u{0435}", -1, 2, None),
    Among("\u{0439}\u{0442}\u{0435}", -1, 1, None),
    Among("\u{0443}\u{0439}\u{0442}\u{0435}", 23, 2, None),
    Among("\u{0435}\u{0439}\u{0442}\u{0435}", 23, 2, None),
    Among("\u{043B}\u{0438}", -1, 1, None),
    Among("\u{044B}\u{043B}\u{0438}", 26, 2, None),
    Among("\u{0438}\u{043B}\u{0438}", 26, 2, None),
    Among("\u{0439}", -1, 1, None),
    Among("\u{0443}\u{0439}", 29, 2, None),
    Among("\u{0435}\u{0439}", 29, 2, None),
    Among("\u{043B}", -1, 1, None),
    Among("\u{044B}\u{043B}", 32, 2, None),
    Among("\u{0438}\u{043B}", 32, 2, None),
    Among("\u{044B}\u{043C}", -1, 2, None),
    Among("\u{0435}\u{043C}", -1, 1, None),
    Among("\u{0438}\u{043C}", -1, 2, None),
    Among("\u{043D}", -1, 1, None),
    Among("\u{0435}\u{043D}", 38, 2, None),
    Among("\u{043B}\u{043E}", -1, 1, None),
    Among("\u{044B}\u{043B}\u{043E}", 40, 2, None),
    Among("\u{0438}\u{043B}\u{043E}", 40, 2, None),
    Among("\u{043D}\u{043E}", -1, 1, None),
    Among("\u{0435}\u{043D}\u{043E}", 43, 2, None),
    Among("\u{043D}\u{043D}\u{043E}", 43, 1, None),
];

static A_5: &'static [Among<Context>; 36] = &[
    Among("\u{0443}", -1, 1, None),
    Among("\u{044F}\u{0445}", -1, 1, None),
    Among("\u{0438}\u{044F}\u{0445}", 1, 1, None),
    Among("\u{0430}\u{0445}", -1, 1, None),
    Among("\u{044B}", -1, 1, None),
    Among("\u{044C}", -1, 1, None),
    Among("\u{044E}", -1, 1, None),
    Among("\u{044C}\u{044E}", 6, 1, None),
    Among("\u{0438}\u{044E}", 6, 1, None),
    Among("\u{044F}", -1, 1, None),
    Among("\u{044C}\u{044F}", 9, 1, None),
    Among("\u{0438}\u{044F}", 9, 1, None),
    Among("\u{0430}", -1, 1, None),
    Among("\u{0435}\u{0432}", -1, 1, None),
    Among("\u{043E}\u{0432}", -1, 1, None),
    Among("\u{0435}", -1, 1, None),
    Among("\u{044C}\u{0435}", 15, 1, None),
    Among("\u{0438}\u{0435}", 15, 1, None),
    Among("\u{0438}", -1, 1, None),
    Among("\u{0435}\u{0438}", 18, 1, None),
    Among("\u{0438}\u{0438}", 18, 1, None),
    Among("\u{044F}\u{043C}\u{0438}", 18, 1, None),
    Among("\u{0438}\u{044F}\u{043C}\u{0438}", 21, 1, None),
    Among("\u{0430}\u{043C}\u{0438}", 18, 1, None),
    Among("\u{0439}", -1, 1, None),
    Among("\u{0435}\u{0439}", 24, 1, None),
    Among("\u{0438}\u{0435}\u{0439}", 25, 1, None),
    Among("\u{0438}\u{0439}", 24, 1, None),
    Among("\u{043E}\u{0439}", 24, 1, None),
    Among("\u{044F}\u{043C}", -1, 1, None),
    Among("\u{0438}\u{044F}\u{043C}", 29, 1, None),
    Among("\u{0430}\u{043C}", -1, 1, None),
    Among("\u{0435}\u{043C}", -1, 1, None),
    Among("\u{0438}\u{0435}\u{043C}", 32, 1, None),
    Among("\u{043E}\u{043C}", -1, 1, None),
    Among("\u{043E}", -1, 1, None),
];

static A_6: &'static [Among<Context>; 2] = &[
    Among("\u{043E}\u{0441}\u{0442}", -1, 1, None),
    Among("\u{043E}\u{0441}\u{0442}\u{044C}", -1, 1, None),
];

static A_7: &'static [Among<Context>; 4] = &[
    Among("\u{0435}\u{0439}\u{0448}", -1, 1, None),
    Among("\u{044C}", -1, 3, None),
    Among("\u{0435}\u{0439}\u{0448}\u{0435}", -1, 1, None),
    Among("\u{043D}", -1, 2, None),
];

static G_v: &'static [u8; 4] = &[33, 65, 8, 232];

#[derive(Clone)]
struct Context {
    i_p2: usize,
    i_pV: usize,
}

fn r_mark_regions(env: &mut SnowballEnv, context: &mut Context) -> bool {
    // (, line 57
    context.i_pV = env.limit;
    context.i_p2 = env.limit;
    // do, line 61
    let v_1 = env.cursor;
    'lab0: loop {
        // (, line 61
        // gopast, line 62
        'golab1: loop {
            'lab2: loop {
                if !env.in_grouping(G_v, 1072, 1103) {
                    break 'lab2;
                }
                break 'golab1;
            }
            if env.cursor >= env.limit {
                break 'lab0;
            }
            env.next_char();
        }
        // setmark pV, line 62
        context.i_pV = env.cursor;
        // gopast, line 62
        'golab3: loop {
            'lab4: loop {
                if !env.out_grouping(G_v, 1072, 1103) {
                    break 'lab4;
                }
                break 'golab3;
            }
            if env.cursor >= env.limit {
                break 'lab0;
            }
            env.next_char();
        }
        // gopast, line 63
        'golab5: loop {
            'lab6: loop {
                if !env.in_grouping(G_v, 1072, 1103) {
                    break 'lab6;
                }
                break 'golab5;
            }
            if env.cursor >= env.limit {
                break 'lab0;
            }
            env.next_char();
        }
        // gopast, line 63
        'golab7: loop {
            'lab8: loop {
                if !env.out_grouping(G_v, 1072, 1103) {
                    break 'lab8;
                }
                break 'golab7;
            }
            if env.cursor >= env.limit {
                break 'lab0;
            }
            env.next_char();
        }
        // setmark p2, line 63
        context.i_p2 = env.cursor;
        break 'lab0;
    }
    env.cursor = v_1;
    return true;
}

fn r_R2(env: &mut SnowballEnv, context: &mut Context) -> bool {
    if !(context.i_p2 <= env.cursor){
        return false;
    }
    return true;
}

fn r_perfective_gerund(env: &mut SnowballEnv, context: &mut Context) -> bool {
    let mut among_var;
    // (, line 71
    // [, line 72
    env.ket = env.cursor;
    // substring, line 72
    among_var = env.find_among_b(A_0, context);
    if among_var == 0 {
        return false;
    }
    // ], line 72
    env.bra = env.cursor;
    if among_var == 0 {
        return false;
    } else if among_var == 1 {
        // (, line 76
        // or, line 76
        'lab0: loop {
            let v_1 = env.limit - env.cursor;
            'lab1: loop {
                // literal, line 76
                if !env.eq_s_b(&"\u{0430}") {
                    break 'lab1;
                }
                break 'lab0;
            }
            env.cursor = env.limit - v_1;
            // literal, line 76
            if !env.eq_s_b(&"\u{044F}") {
                return false;
            }
            break 'lab0;
        }
        // delete, line 76
        if !env.slice_del() {
            return false;
        }
    } else if among_var == 2 {
        // (, line 83
        // delete, line 83
        if !env.slice_del() {
            return false;
        }
    }
    return true;
}

fn r_adjective(env: &mut SnowballEnv, context: &mut Context) -> bool {
    let mut among_var;
    // (, line 87
    // [, line 88
    env.ket = env.cursor;
    // substring, line 88
    among_var = env.find_among_b(A_1, context);
    if among_var == 0 {
        return false;
    }
    // ], line 88
    env.bra = env.cursor;
    if among_var == 0 {
        return false;
    } else if among_var == 1 {
        // (, line 97
        // delete, line 97
        if !env.slice_del() {
            return false;
        }
    }
    return true;
}

fn r_adjectival(env: &mut SnowballEnv, context: &mut Context) -> bool {
    let mut among_var;
    // (, line 101
    // call adjective, line 102
    if !r_adjective(env, context) {
        return false;
    }
    // try, line 109
    let v_1 = env.limit - env.cursor;
    'lab0: loop {
        // (, line 109
        // [, line 110
        env.ket = env.cursor;
        // substring, line 110
        among_var = env.find_among_b(A_2, context);
        if among_var == 0 {
            env.cursor = env.limit - v_1;
            break 'lab0;
        }
        // ], line 110
        env.bra = env.cursor;
        if among_var == 0 {
            env.cursor = env.limit - v_1;
            break 'lab0;
        } else if among_var == 1 {
            // (, line 115
            // or, line 115
            'lab1: loop {
                let v_2 = env.limit - env.cursor;
                'lab2: loop {
                    // literal, line 115
                    if !env.eq_s_b(&"\u{0430}") {
                        break 'lab2;
                    }
                    break 'lab1;
                }
                env.cursor = env.limit - v_2;
                // literal, line 115
                if !env.eq_s_b(&"\u{044F}") {
                    env.cursor = env.limit - v_1;
                    break 'lab0;
                }
                break 'lab1;
            }
            // delete, line 115
            if !env.slice_del() {
                return false;
            }
        } else if among_var == 2 {
            // (, line 122
            // delete, line 122
            if !env.slice_del() {
                return false;
            }
        }
        break 'lab0;
    }
    return true;
}

fn r_reflexive(env: &mut SnowballEnv, context: &mut Context) -> bool {
    let mut among_var;
    // (, line 128
    // [, line 129
    env.ket = env.cursor;
    // substring, line 129
    among_var = env.find_among_b(A_3, context);
    if among_var == 0 {
        return false;
    }
    // ], line 129
    env.bra = env.cursor;
    if among_var == 0 {
        return false;
    } else if among_var == 1 {
        // (, line 132
        // delete, line 132
        if !env.slice_del() {
            return false;
        }
    }
    return true;
}

fn r_verb(env: &mut SnowballEnv, context: &mut Context) -> bool {
    let mut among_var;
    // (, line 136
    // [, line 137
    env.ket = env.cursor;
    // substring, line 137
    among_var = env.find_among_b(A_4, context);
    if among_var == 0 {
        return false;
    }
    // ], line 137
    env.bra = env.cursor;
    if among_var == 0 {
        return false;
    } else if among_var == 1 {
        // (, line 143
        // or, line 143
        'lab0: loop {
            let v_1 = env.limit - env.cursor;
            'lab1: loop {
                // literal, line 143
                if !env.eq_s_b(&"\u{0430}") {
                    break 'lab1;
                }
                break 'lab0;
            }
            env.cursor = env.limit - v_1;
            // literal, line 143
            if !env.eq_s_b(&"\u{044F}") {
                return false;
            }
            break 'lab0;
        }
        // delete, line 143
        if !env.slice_del() {
            return false;
        }
    } else if among_var == 2 {
        // (, line 151
        // delete, line 151
        if !env.slice_del() {
            return false;
        }
    }
    return true;
}

fn r_noun(env: &mut SnowballEnv, context: &mut Context) -> bool {
    let mut among_var;
    // (, line 159
    // [, line 160
    env.ket = env.cursor;
    // substring, line 160
    among_var = env.find_among_b(A_5, context);
    if among_var == 0 {
        return false;
    }
    // ], line 160
    env.bra = env.cursor;
    if among_var == 0 {
        return false;
    } else if among_var == 1 {
        // (, line 167
        // delete, line 167
        if !env.slice_del() {
            return false;
        }
    }
    return true;
}

fn r_derivational(env: &mut SnowballEnv, context: &mut Context) -> bool {
    let mut among_var;
    // (, line 175
    // [, line 176
    env.ket = env.cursor;
    // substring, line 176
    among_var = env.find_among_b(A_6, context);
    if among_var == 0 {
        return false;
    }
    // ], line 176
    env.bra = env.cursor;
    // call R2, line 176
    if !r_R2(env, context) {
        return false;
    }
    if among_var == 0 {
        return false;
    } else if among_var == 1 {
        // (, line 179
        // delete, line 179
        if !env.slice_del() {
            return false;
        }
    }
    return true;
}

fn r_tidy_up(env: &mut SnowballEnv, context: &mut Context) -> bool {
    let mut among_var;
    // (, line 183
    // [, line 184
    env.ket = env.cursor;
    // substring, line 184
    among_var = env.find_among_b(A_7, context);
    if among_var == 0 {
        return false;
    }
    // ], line 184
    env.bra = env.cursor;
    if among_var == 0 {
        return false;
    } else if among_var == 1 {
        // (, line 188
        // delete, line 188
        if !env.slice_del() {
            return false;
        }
        // [, line 189
        env.ket = env.cursor;
        // literal, line 189
        if !env.eq_s_b(&"\u{043D}") {
            return false;
        }
        // ], line 189
        env.bra = env.cursor;
        // literal, line 189
        if !env.eq_s_b(&"\u{043D}") {
            return false;
        }
        // delete, line 189
        if !env.slice_del() {
            return false;
        }
    } else if among_var == 2 {
        // (, line 192
        // literal, line 192
        if !env.eq_s_b(&"\u{043D}") {
            return false;
        }
        // delete, line 192
        if !env.slice_del() {
            return false;
        }
    } else if among_var == 3 {
        // (, line 194
        // delete, line 194
        if !env.slice_del() {
            return false;
        }
    }
    return true;
}

pub fn stem(env: &mut SnowballEnv) -> bool {
    let mut context = &mut Context {
        i_p2: 0,
        i_pV: 0,
    };
    // (, line 199
    // do, line 201
    let v_1 = env.cursor;
    'lab0: loop {
        // call mark_regions, line 201
        if !r_mark_regions(env, context) {
            break 'lab0;
        }
        break 'lab0;
    }
    env.cursor = v_1;
    // backwards, line 202
    env.limit_backward = env.cursor;
    env.cursor = env.limit;
    // setlimit, line 202
    let v_2 = env.limit - env.cursor;
    // tomark, line 202
    if env.cursor < context.i_pV {
        return false;
    }
    env.cursor = context.i_pV;
    let v_3 = env.limit_backward;
    env.limit_backward = env.cursor;
    env.cursor = env.limit - v_2;
    // (, line 202
    // do, line 203
    let v_4 = env.limit - env.cursor;
    'lab1: loop {
        // (, line 203
        // or, line 204
        'lab2: loop {
            let v_5 = env.limit - env.cursor;
            'lab3: loop {
                // call perfective_gerund, line 204
                if !r_perfective_gerund(env, context) {
                    break 'lab3;
                }
                break 'lab2;
            }
            env.cursor = env.limit - v_5;
            // (, line 205
            // try, line 205
            let v_6 = env.limit - env.cursor;
            'lab4: loop {
                // call reflexive, line 205
                if !r_reflexive(env, context) {
                    env.cursor = env.limit - v_6;
                    break 'lab4;
                }
                break 'lab4;
            }
            // or, line 206
            'lab5: loop {
                let v_7 = env.limit - env.cursor;
                'lab6: loop {
                    // call adjectival, line 206
                    if !r_adjectival(env, context) {
                        break 'lab6;
                    }
                    break 'lab5;
                }
                env.cursor = env.limit - v_7;
                'lab7: loop {
                    // call verb, line 206
                    if !r_verb(env, context) {
                        break 'lab7;
                    }
                    break 'lab5;
                }
                env.cursor = env.limit - v_7;
                // call noun, line 206
                if !r_noun(env, context) {
                    break 'lab1;
                }
                break 'lab5;
            }
            break 'lab2;
        }
        break 'lab1;
    }
    env.cursor = env.limit - v_4;
    // try, line 209
    let v_8 = env.limit - env.cursor;
    'lab8: loop {
        // (, line 209
        // [, line 209
        env.ket = env.cursor;
        // literal, line 209
        if !env.eq_s_b(&"\u{0438}") {
            env.cursor = env.limit - v_8;
            break 'lab8;
        }
        // ], line 209
        env.bra = env.cursor;
        // delete, line 209
        if !env.slice_del() {
            return false;
        }
        break 'lab8;
    }
    // do, line 212
    let v_9 = env.limit - env.cursor;
    'lab9: loop {
        // call derivational, line 212
        if !r_derivational(env, context) {
            break 'lab9;
        }
        break 'lab9;
    }
    env.cursor = env.limit - v_9;
    // do, line 213
    let v_10 = env.limit - env.cursor;
    'lab10: loop {
        // call tidy_up, line 213
        if !r_tidy_up(env, context) {
            break 'lab10;
        }
        break 'lab10;
    }
    env.cursor = env.limit - v_10;
    env.limit_backward = v_3;
    env.cursor = env.limit_backward;
    return true;
}
