//! Generated by Snowball 2.1.0 - https://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>; 132] = &[
    Among("\u{0940}", -1, -1, None),
    Among("\u{0942}\u{0902}\u{0917}\u{0940}", 0, -1, None),
    Among("\u{0947}\u{0902}\u{0917}\u{0940}", 0, -1, None),
    Among("\u{090A}\u{0902}\u{0917}\u{0940}", 0, -1, None),
    Among("\u{0906}\u{090A}\u{0902}\u{0917}\u{0940}", 3, -1, None),
    Among("\u{093E}\u{090A}\u{0902}\u{0917}\u{0940}", 3, -1, None),
    Among("\u{090F}\u{0902}\u{0917}\u{0940}", 0, -1, None),
    Among("\u{0906}\u{090F}\u{0902}\u{0917}\u{0940}", 6, -1, None),
    Among("\u{093E}\u{090F}\u{0902}\u{0917}\u{0940}", 6, -1, None),
    Among("\u{0947}\u{0917}\u{0940}", 0, -1, None),
    Among("\u{094B}\u{0917}\u{0940}", 0, -1, None),
    Among("\u{090F}\u{0917}\u{0940}", 0, -1, None),
    Among("\u{0906}\u{090F}\u{0917}\u{0940}", 11, -1, None),
    Among("\u{093E}\u{090F}\u{0917}\u{0940}", 11, -1, None),
    Among("\u{0913}\u{0917}\u{0940}", 0, -1, None),
    Among("\u{0906}\u{0913}\u{0917}\u{0940}", 14, -1, None),
    Among("\u{093E}\u{0913}\u{0917}\u{0940}", 14, -1, None),
    Among("\u{0924}\u{0940}", 0, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0924}\u{0940}", 17, -1, None),
    Among("\u{0906}\u{0924}\u{0940}", 17, -1, None),
    Among("\u{093E}\u{0924}\u{0940}", 17, -1, None),
    Among("\u{0928}\u{0940}", 0, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0928}\u{0940}", 21, -1, None),
    Among("\u{0906}\u{0901}", -1, -1, None),
    Among("\u{093E}\u{0901}", -1, -1, None),
    Among("\u{0907}\u{092F}\u{093E}\u{0901}", 24, -1, None),
    Among("\u{0906}\u{0907}\u{092F}\u{093E}\u{0901}", 25, -1, None),
    Among("\u{093E}\u{0907}\u{092F}\u{093E}\u{0901}", 25, -1, None),
    Among("\u{093F}\u{092F}\u{093E}\u{0901}", 24, -1, None),
    Among("\u{0941}", -1, -1, None),
    Among("\u{0940}\u{0902}", -1, -1, None),
    Among("\u{0924}\u{0940}\u{0902}", 30, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0924}\u{0940}\u{0902}", 31, -1, None),
    Among("\u{0906}\u{0924}\u{0940}\u{0902}", 31, -1, None),
    Among("\u{093E}\u{0924}\u{0940}\u{0902}", 31, -1, None),
    Among("\u{0906}\u{0902}", -1, -1, None),
    Among("\u{0941}\u{0906}\u{0902}", 35, -1, None),
    Among("\u{0909}\u{0906}\u{0902}", 35, -1, None),
    Among("\u{0947}\u{0902}", -1, -1, None),
    Among("\u{0908}\u{0902}", -1, -1, None),
    Among("\u{0906}\u{0908}\u{0902}", 39, -1, None),
    Among("\u{093E}\u{0908}\u{0902}", 39, -1, None),
    Among("\u{094B}\u{0902}", -1, -1, None),
    Among("\u{0907}\u{092F}\u{094B}\u{0902}", 42, -1, None),
    Among("\u{0906}\u{0907}\u{092F}\u{094B}\u{0902}", 43, -1, None),
    Among("\u{093E}\u{0907}\u{092F}\u{094B}\u{0902}", 43, -1, None),
    Among("\u{093F}\u{092F}\u{094B}\u{0902}", 42, -1, None),
    Among("\u{090F}\u{0902}", -1, -1, None),
    Among("\u{0941}\u{090F}\u{0902}", 47, -1, None),
    Among("\u{0906}\u{090F}\u{0902}", 47, -1, None),
    Among("\u{0909}\u{090F}\u{0902}", 47, -1, None),
    Among("\u{093E}\u{090F}\u{0902}", 47, -1, None),
    Among("\u{0924}\u{093E}\u{090F}\u{0902}", 51, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0924}\u{093E}\u{090F}\u{0902}", 52, -1, None),
    Among("\u{0928}\u{093E}\u{090F}\u{0902}", 51, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0928}\u{093E}\u{090F}\u{0902}", 54, -1, None),
    Among("\u{0913}\u{0902}", -1, -1, None),
    Among("\u{0941}\u{0913}\u{0902}", 56, -1, None),
    Among("\u{0906}\u{0913}\u{0902}", 56, -1, None),
    Among("\u{0909}\u{0913}\u{0902}", 56, -1, None),
    Among("\u{093E}\u{0913}\u{0902}", 56, -1, None),
    Among("\u{0924}\u{093E}\u{0913}\u{0902}", 60, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0924}\u{093E}\u{0913}\u{0902}", 61, -1, None),
    Among("\u{0928}\u{093E}\u{0913}\u{0902}", 60, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0928}\u{093E}\u{0913}\u{0902}", 63, -1, None),
    Among("\u{093E}\u{0902}", -1, -1, None),
    Among("\u{0907}\u{092F}\u{093E}\u{0902}", 65, -1, None),
    Among("\u{0906}\u{0907}\u{092F}\u{093E}\u{0902}", 66, -1, None),
    Among("\u{093E}\u{0907}\u{092F}\u{093E}\u{0902}", 66, -1, None),
    Among("\u{093F}\u{092F}\u{093E}\u{0902}", 65, -1, None),
    Among("\u{0942}", -1, -1, None),
    Among("\u{0905}", -1, -1, None),
    Among("\u{0906}", -1, -1, None),
    Among("\u{0907}", -1, -1, None),
    Among("\u{0947}", -1, -1, None),
    Among("\u{0947}\u{0902}\u{0917}\u{0947}", 74, -1, None),
    Among("\u{090F}\u{0902}\u{0917}\u{0947}", 74, -1, None),
    Among("\u{0906}\u{090F}\u{0902}\u{0917}\u{0947}", 76, -1, None),
    Among("\u{093E}\u{090F}\u{0902}\u{0917}\u{0947}", 76, -1, None),
    Among("\u{094B}\u{0917}\u{0947}", 74, -1, None),
    Among("\u{0913}\u{0917}\u{0947}", 74, -1, None),
    Among("\u{0906}\u{0913}\u{0917}\u{0947}", 80, -1, None),
    Among("\u{093E}\u{0913}\u{0917}\u{0947}", 80, -1, None),
    Among("\u{0924}\u{0947}", 74, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0924}\u{0947}", 83, -1, None),
    Among("\u{0906}\u{0924}\u{0947}", 83, -1, None),
    Among("\u{093E}\u{0924}\u{0947}", 83, -1, None),
    Among("\u{0928}\u{0947}", 74, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0928}\u{0947}", 87, -1, None),
    Among("\u{0906}\u{0928}\u{0947}", 87, -1, None),
    Among("\u{093E}\u{0928}\u{0947}", 87, -1, None),
    Among("\u{0908}", -1, -1, None),
    Among("\u{0906}\u{0908}", 91, -1, None),
    Among("\u{093E}\u{0908}", 91, -1, None),
    Among("\u{0909}", -1, -1, None),
    Among("\u{090A}", -1, -1, None),
    Among("\u{094B}", -1, -1, None),
    Among("\u{094D}", -1, -1, None),
    Among("\u{090F}", -1, -1, None),
    Among("\u{0906}\u{090F}", 98, -1, None),
    Among("\u{0907}\u{090F}", 98, -1, None),
    Among("\u{0906}\u{0907}\u{090F}", 100, -1, None),
    Among("\u{093E}\u{0907}\u{090F}", 100, -1, None),
    Among("\u{093E}\u{090F}", 98, -1, None),
    Among("\u{093F}\u{090F}", 98, -1, None),
    Among("\u{0913}", -1, -1, None),
    Among("\u{0906}\u{0913}", 105, -1, None),
    Among("\u{093E}\u{0913}", 105, -1, None),
    Among("\u{0915}\u{0930}", -1, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0915}\u{0930}", 108, -1, None),
    Among("\u{0906}\u{0915}\u{0930}", 108, -1, None),
    Among("\u{093E}\u{0915}\u{0930}", 108, -1, None),
    Among("\u{093E}", -1, -1, None),
    Among("\u{0942}\u{0902}\u{0917}\u{093E}", 112, -1, None),
    Among("\u{090A}\u{0902}\u{0917}\u{093E}", 112, -1, None),
    Among("\u{0906}\u{090A}\u{0902}\u{0917}\u{093E}", 114, -1, None),
    Among("\u{093E}\u{090A}\u{0902}\u{0917}\u{093E}", 114, -1, None),
    Among("\u{0947}\u{0917}\u{093E}", 112, -1, None),
    Among("\u{090F}\u{0917}\u{093E}", 112, -1, None),
    Among("\u{0906}\u{090F}\u{0917}\u{093E}", 118, -1, None),
    Among("\u{093E}\u{090F}\u{0917}\u{093E}", 118, -1, None),
    Among("\u{0924}\u{093E}", 112, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0924}\u{093E}", 121, -1, None),
    Among("\u{0906}\u{0924}\u{093E}", 121, -1, None),
    Among("\u{093E}\u{0924}\u{093E}", 121, -1, None),
    Among("\u{0928}\u{093E}", 112, -1, Some(&r_CONSONANT)),
    Among("\u{0905}\u{0928}\u{093E}", 125, -1, None),
    Among("\u{0906}\u{0928}\u{093E}", 125, -1, None),
    Among("\u{093E}\u{0928}\u{093E}", 125, -1, None),
    Among("\u{0906}\u{092F}\u{093E}", 112, -1, None),
    Among("\u{093E}\u{092F}\u{093E}", 112, -1, None),
    Among("\u{093F}", -1, -1, None),
];

static G_consonant: &'static [u8; 10] = &[255, 255, 255, 255, 159, 0, 0, 0, 248, 7];

#[derive(Clone)]
struct Context {
    i_p: i32,
}

fn r_CONSONANT(env: &mut SnowballEnv, context: &mut Context) -> bool {
    if !env.in_grouping_b(G_consonant, 2325, 2399) {
        return false;
    }
    return true;
}

pub fn stem(env: &mut SnowballEnv) -> bool {
    let mut context = &mut Context {
        i_p: 0,
    };
    let v_1 = env.cursor;
    if env.cursor >= env.limit {
        return false;
    }
    env.next_char();
    context.i_p = env.cursor;
    env.cursor = v_1;
    env.limit_backward = env.cursor;
    env.cursor = env.limit;
    if env.cursor < context.i_p {
        return false;
    }
    let v_3 = env.limit_backward;
    env.limit_backward = context.i_p;
    env.ket = env.cursor;
    if env.find_among_b(A_0, context) == 0 {
        env.limit_backward = v_3;
        return false;
    }
    env.bra = env.cursor;
    env.limit_backward = v_3;
    if !env.slice_del() {
        return false;
    }
    env.cursor = env.limit_backward;
    return true;
}
