#include <stdint.h>
#include <stdlib.h>
#include "el_runtime.h"

el_val_t str_ends(el_val_t s, el_val_t suf);
el_val_t str_last_char(el_val_t s);
el_val_t str_last2(el_val_t s);
el_val_t str_last3(el_val_t s);
el_val_t str_drop_last(el_val_t s, el_val_t n);
el_val_t is_vowel(el_val_t c);
el_val_t morph_apply_suffix(el_val_t base, el_val_t suffix);
el_val_t en_irregular_plural(el_val_t word);
el_val_t en_irregular_singular(el_val_t word);
el_val_t en_irregular_verb(el_val_t base);
el_val_t en_verb_3sg(el_val_t base);
el_val_t en_should_double_final(el_val_t base);
el_val_t en_verb_past(el_val_t base);
el_val_t en_verb_gerund(el_val_t base);
el_val_t en_pluralize_regular(el_val_t singular);
el_val_t en_verb_form(el_val_t base, el_val_t tense, el_val_t person, el_val_t number);
el_val_t agree_determiner(el_val_t det, el_val_t noun);
el_val_t morph_pluralize(el_val_t noun, el_val_t profile);
el_val_t morph_map_canonical(el_val_t verb, el_val_t code);
el_val_t morph_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number, el_val_t profile);
el_val_t morph_inflect(el_val_t word, el_val_t features, el_val_t profile);
el_val_t pluralize(el_val_t singular);
el_val_t singularize(el_val_t plural);
el_val_t verb_form(el_val_t base, el_val_t tense, el_val_t person, el_val_t number);
el_val_t irregular_plural(el_val_t word);
el_val_t irregular_singular(el_val_t word);
el_val_t ru_gender(el_val_t noun);
el_val_t ru_stem_type(el_val_t noun, el_val_t gender);
el_val_t ru_noun_case(el_val_t noun, el_val_t gender, el_val_t gram_case, el_val_t number);
el_val_t ru_decline_regular(el_val_t noun, el_val_t gender, el_val_t stype, el_val_t gram_case, el_val_t number);
el_val_t ru_decline_masc(el_val_t noun, el_val_t stype, el_val_t gram_case, el_val_t number);
el_val_t ru_decline_fem(el_val_t noun, el_val_t stype, el_val_t gram_case, el_val_t number);
el_val_t ru_decline_neut(el_val_t noun, el_val_t stype, el_val_t gram_case, el_val_t number);
el_val_t ru_past_agree(el_val_t verb_stem, el_val_t gender, el_val_t number);
el_val_t ru_conjugate_1st(el_val_t stem, el_val_t tense, el_val_t person, el_val_t number);
el_val_t ru_conjugate_2nd(el_val_t stem, el_val_t tense, el_val_t person, el_val_t number);
el_val_t ru_irregular(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number);
el_val_t ru_past_stem(el_val_t verb);
el_val_t ru_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number, el_val_t gender);

el_val_t ru_gender(el_val_t noun) {
  el_val_t n = str_len(noun);
  if (n == 0) {
    return EL_STR("m");
  }
  el_val_t last = str_slice(noun, (n - 1), n);
  if (str_eq(last, EL_STR("\xd0\xbe"))) {
    return EL_STR("n");
  }
  if (str_eq(last, EL_STR("\xd0\xb5"))) {
    return EL_STR("n");
  }
  if (str_eq(last, EL_STR("\xd1\x91"))) {
    return EL_STR("n");
  }
  if (str_eq(last, EL_STR("\xd0\xb0"))) {
    return EL_STR("f");
  }
  if (str_eq(last, EL_STR("\xd1\x8f"))) {
    return EL_STR("f");
  }
  if (str_eq(last, EL_STR("\xd1\x8c"))) {
    return EL_STR("f");
  }
  return EL_STR("m");
  return 0;
}

el_val_t ru_stem_type(el_val_t noun, el_val_t gender) {
  el_val_t n = str_len(noun);
  if (n == 0) {
    return EL_STR("hard");
  }
  el_val_t last = str_slice(noun, (n - 1), n);
  if (str_eq(last, EL_STR("\xd1\x8c"))) {
    return EL_STR("soft");
  }
  if (str_eq(last, EL_STR("\xd0\xb9"))) {
    return EL_STR("soft");
  }
  if (str_eq(last, EL_STR("\xd1\x8f"))) {
    return EL_STR("soft");
  }
  if (str_eq(last, EL_STR("\xd0\xb5"))) {
    return EL_STR("soft");
  }
  if (str_eq(last, EL_STR("\xd0\xb6"))) {
    return EL_STR("sibilant");
  }
  if (str_eq(last, EL_STR("\xd1\x88"))) {
    return EL_STR("sibilant");
  }
  if (str_eq(last, EL_STR("\xd1\x87"))) {
    return EL_STR("sibilant");
  }
  if (str_eq(last, EL_STR("\xd1\x89"))) {
    return EL_STR("sibilant");
  }
  return EL_STR("hard");
  return 0;
}

el_val_t ru_noun_case(el_val_t noun, el_val_t gender, el_val_t gram_case, el_val_t number) {
  if (str_eq(noun, EL_STR("\xd1\x87\xd0\xb5\xd0\xbb\xd0\xbe\xd0\xb2\xd0\xb5\xd0\xba"))) {
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return EL_STR("\xd1\x87\xd0\xb5\xd0\xbb\xd0\xbe\xd0\xb2\xd0\xb5\xd0\xba");
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return EL_STR("\xd1\x87\xd0\xb5\xd0\xbb\xd0\xbe\xd0\xb2\xd0\xb5\xd0\xba\xd0\xb0");
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return EL_STR("\xd1\x87\xd0\xb5\xd0\xbb\xd0\xbe\xd0\xb2\xd0\xb5\xd0\xba\xd0\xb0");
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return EL_STR("\xd1\x87\xd0\xb5\xd0\xbb\xd0\xbe\xd0\xb2\xd0\xb5\xd0\xba\xd1\x83");
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return EL_STR("\xd1\x87\xd0\xb5\xd0\xbb\xd0\xbe\xd0\xb2\xd0\xb5\xd0\xba\xd0\xbe\xd0\xbc");
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return EL_STR("\xd1\x87\xd0\xb5\xd0\xbb\xd0\xbe\xd0\xb2\xd0\xb5\xd0\xba\xd0\xb5");
      }
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return EL_STR("\xd0\xbb\xd1\x8e\xd0\xb4\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return EL_STR("\xd0\xbb\xd1\x8e\xd0\xb4\xd0\xb5\xd0\xb9");
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return EL_STR("\xd0\xbb\xd1\x8e\xd0\xb4\xd0\xb5\xd0\xb9");
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return EL_STR("\xd0\xbb\xd1\x8e\xd0\xb4\xd1\x8f\xd0\xbc");
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return EL_STR("\xd0\xbb\xd1\x8e\xd0\xb4\xd1\x8c\xd0\xbc\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return EL_STR("\xd0\xbb\xd1\x8e\xd0\xb4\xd1\x8f\xd1\x85");
    }
    return EL_STR("\xd0\xbb\xd1\x8e\xd0\xb4\xd0\xb8");
  }
  if (str_eq(noun, EL_STR("\xd1\x80\xd0\xb5\xd0\xb1\xd1\x91\xd0\xbd\xd0\xbe\xd0\xba"))) {
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return EL_STR("\xd1\x80\xd0\xb5\xd0\xb1\xd1\x91\xd0\xbd\xd0\xbe\xd0\xba");
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return EL_STR("\xd1\x80\xd0\xb5\xd0\xb1\xd1\x91\xd0\xbd\xd0\xba\xd0\xb0");
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return EL_STR("\xd1\x80\xd0\xb5\xd0\xb1\xd1\x91\xd0\xbd\xd0\xba\xd0\xb0");
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return EL_STR("\xd1\x80\xd0\xb5\xd0\xb1\xd1\x91\xd0\xbd\xd0\xba\xd1\x83");
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return EL_STR("\xd1\x80\xd0\xb5\xd0\xb1\xd1\x91\xd0\xbd\xd0\xba\xd0\xbe\xd0\xbc");
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return EL_STR("\xd1\x80\xd0\xb5\xd0\xb1\xd1\x91\xd0\xbd\xd0\xba\xd0\xb5");
      }
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return EL_STR("\xd0\xb4\xd0\xb5\xd1\x82\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return EL_STR("\xd0\xb4\xd0\xb5\xd1\x82\xd0\xb5\xd0\xb9");
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return EL_STR("\xd0\xb4\xd0\xb5\xd1\x82\xd0\xb5\xd0\xb9");
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return EL_STR("\xd0\xb4\xd0\xb5\xd1\x82\xd1\x8f\xd0\xbc");
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return EL_STR("\xd0\xb4\xd0\xb5\xd1\x82\xd1\x8c\xd0\xbc\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return EL_STR("\xd0\xb4\xd0\xb5\xd1\x82\xd1\x8f\xd1\x85");
    }
    return EL_STR("\xd0\xb4\xd0\xb5\xd1\x82\xd0\xb8");
  }
  if (str_eq(noun, EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd1\x8f"))) {
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd1\x8f");
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd1\x8f");
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb8");
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb8");
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb5\xd0\xbc");
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb8");
      }
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0");
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0");
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd1\x91\xd0\xbd");
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0\xd0\xbc");
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0\xd0\xbc\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0\xd1\x85");
    }
    return EL_STR("\xd0\xb2\xd1\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0");
  }
  if (str_eq(noun, EL_STR("\xd0\xb8\xd0\xbc\xd1\x8f"))) {
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return EL_STR("\xd0\xb8\xd0\xbc\xd1\x8f");
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return EL_STR("\xd0\xb8\xd0\xbc\xd1\x8f");
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb8");
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb8");
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb5\xd0\xbc");
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb8");
      }
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0");
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0");
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return EL_STR("\xd0\xb8\xd0\xbc\xd1\x91\xd0\xbd");
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0\xd0\xbc");
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0\xd0\xbc\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0\xd1\x85");
    }
    return EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb0");
  }
  if (str_eq(noun, EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd1\x8c"))) {
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd1\x8c");
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd1\x8c");
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd0\xb8");
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd0\xb8");
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd1\x91\xd0\xbc");
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd0\xb8");
      }
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd0\xb5\xd0\xb9");
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd1\x8f\xd0\xbc");
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd1\x8f\xd0\xbc\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd1\x8f\xd1\x85");
    }
    return EL_STR("\xd0\xbf\xd1\x83\xd1\x82\xd0\xb8");
  }
  if (str_eq(noun, EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd1\x8c"))) {
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd1\x8c");
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd1\x8c");
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd0\xb8");
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd0\xb8");
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd1\x8c\xd1\x8e");
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd0\xb8");
      }
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd0\xb5\xd0\xb9");
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd0\xb5\xd0\xb9");
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd1\x8f\xd0\xbc");
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd1\x8f\xd0\xbc\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd1\x8f\xd1\x85");
    }
    return EL_STR("\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd0\xb8");
  }
  if (str_eq(noun, EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd1\x8c"))) {
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd1\x8c");
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd1\x8c");
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd0\xb8");
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd0\xb8");
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd1\x8c\xd1\x8e");
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd0\xb8");
      }
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd0\xb5\xd0\xb9");
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd0\xb5\xd0\xb9");
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd1\x8f\xd0\xbc");
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd1\x8f\xd0\xbc\xd0\xb8");
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd1\x8f\xd1\x85");
    }
    return EL_STR("\xd0\xb4\xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd0\xb8");
  }
  el_val_t stype = ru_stem_type(noun, gender);
  return ru_decline_regular(noun, gender, stype, gram_case, number);
  return 0;
}

el_val_t ru_decline_regular(el_val_t noun, el_val_t gender, el_val_t stype, el_val_t gram_case, el_val_t number) {
  if (str_eq(gender, EL_STR("m"))) {
    return ru_decline_masc(noun, stype, gram_case, number);
  }
  if (str_eq(gender, EL_STR("f"))) {
    return ru_decline_fem(noun, stype, gram_case, number);
  }
  return ru_decline_neut(noun, stype, gram_case, number);
  return 0;
}

el_val_t ru_decline_masc(el_val_t noun, el_val_t stype, el_val_t gram_case, el_val_t number) {
  el_val_t n = str_len(noun);
  if (str_eq(stype, EL_STR("soft"))) {
    el_val_t last = str_slice(noun, (n - 1), n);
    if (str_eq(last, EL_STR("\xd0\xb9"))) {
      el_val_t stem = str_drop_last(noun, 1);
      if (str_eq(number, EL_STR("sg"))) {
        if (str_eq(gram_case, EL_STR("nom"))) {
          return noun;
        }
        if (str_eq(gram_case, EL_STR("acc"))) {
          return noun;
        }
        if (str_eq(gram_case, EL_STR("gen"))) {
          return el_str_concat(stem, EL_STR("\xd1\x8f"));
        }
        if (str_eq(gram_case, EL_STR("dat"))) {
          return el_str_concat(stem, EL_STR("\xd1\x8e"));
        }
        if (str_eq(gram_case, EL_STR("ins"))) {
          return el_str_concat(stem, EL_STR("\xd0\xb5\xd0\xbc"));
        }
        if (str_eq(gram_case, EL_STR("pre"))) {
          return el_str_concat(stem, EL_STR("\xd0\xb5"));
        }
        return noun;
      }
      if (str_eq(gram_case, EL_STR("nom"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8"));
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8"));
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb5\xd0\xb2"));
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return el_str_concat(stem, EL_STR("\xd1\x8f\xd0\xbc"));
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return el_str_concat(stem, EL_STR("\xd1\x8f\xd0\xbc\xd0\xb8"));
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return el_str_concat(stem, EL_STR("\xd1\x8f\xd1\x85"));
      }
      return el_str_concat(stem, EL_STR("\xd0\xb8"));
    }
    if (str_eq(last, EL_STR("\xd1\x8c"))) {
      el_val_t stem = str_drop_last(noun, 1);
      if (str_eq(number, EL_STR("sg"))) {
        if (str_eq(gram_case, EL_STR("nom"))) {
          return noun;
        }
        if (str_eq(gram_case, EL_STR("acc"))) {
          return noun;
        }
        if (str_eq(gram_case, EL_STR("gen"))) {
          return el_str_concat(stem, EL_STR("\xd1\x8f"));
        }
        if (str_eq(gram_case, EL_STR("dat"))) {
          return el_str_concat(stem, EL_STR("\xd1\x8e"));
        }
        if (str_eq(gram_case, EL_STR("ins"))) {
          return el_str_concat(stem, EL_STR("\xd1\x91\xd0\xbc"));
        }
        if (str_eq(gram_case, EL_STR("pre"))) {
          return el_str_concat(stem, EL_STR("\xd0\xb5"));
        }
        return noun;
      }
      if (str_eq(gram_case, EL_STR("nom"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8"));
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8"));
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb5\xd0\xb9"));
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return el_str_concat(stem, EL_STR("\xd1\x8f\xd0\xbc"));
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return el_str_concat(stem, EL_STR("\xd1\x8f\xd0\xbc\xd0\xb8"));
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return el_str_concat(stem, EL_STR("\xd1\x8f\xd1\x85"));
      }
      return el_str_concat(stem, EL_STR("\xd0\xb8"));
    }
  }
  el_val_t stem = noun;
  if (str_eq(number, EL_STR("sg"))) {
    if (str_eq(gram_case, EL_STR("nom"))) {
      return stem;
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return stem;
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb0"));
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return el_str_concat(stem, EL_STR("\xd1\x83"));
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return el_str_concat(stem, EL_STR("\xd0\xbe\xd0\xbc"));
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb5"));
    }
    return stem;
  }
  if (str_eq(gram_case, EL_STR("nom"))) {
    return el_str_concat(stem, EL_STR("\xd1\x8b"));
  }
  if (str_eq(gram_case, EL_STR("acc"))) {
    return el_str_concat(stem, EL_STR("\xd1\x8b"));
  }
  if (str_eq(gram_case, EL_STR("gen"))) {
    return el_str_concat(stem, EL_STR("\xd0\xbe\xd0\xb2"));
  }
  if (str_eq(gram_case, EL_STR("dat"))) {
    return el_str_concat(stem, EL_STR("\xd0\xb0\xd0\xbc"));
  }
  if (str_eq(gram_case, EL_STR("ins"))) {
    return el_str_concat(stem, EL_STR("\xd0\xb0\xd0\xbc\xd0\xb8"));
  }
  if (str_eq(gram_case, EL_STR("pre"))) {
    return el_str_concat(stem, EL_STR("\xd0\xb0\xd1\x85"));
  }
  return el_str_concat(stem, EL_STR("\xd1\x8b"));
  return 0;
}

el_val_t ru_decline_fem(el_val_t noun, el_val_t stype, el_val_t gram_case, el_val_t number) {
  el_val_t n = str_len(noun);
  el_val_t last = str_slice(noun, (n - 1), n);
  if (str_eq(last, EL_STR("\xd1\x8c"))) {
    el_val_t stem = str_drop_last(noun, 1);
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return noun;
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return noun;
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8"));
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8"));
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return el_str_concat(stem, EL_STR("\xd1\x8c\xd1\x8e"));
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8"));
      }
      return noun;
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8"));
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8"));
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb5\xd0\xb9"));
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8f\xd0\xbc"));
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8f\xd0\xbc\xd0\xb8"));
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8f\xd1\x85"));
    }
    return el_str_concat(stem, EL_STR("\xd0\xb8"));
  }
  if (str_eq(last, EL_STR("\xd1\x8f"))) {
    el_val_t stem = str_drop_last(noun, 1);
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return noun;
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return el_str_concat(stem, EL_STR("\xd1\x8e"));
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8"));
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb5"));
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb5\xd0\xb9"));
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb5"));
      }
      return noun;
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8"));
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8"));
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb5\xd0\xb9"));
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8f\xd0\xbc"));
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8f\xd0\xbc\xd0\xb8"));
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8f\xd1\x85"));
    }
    return el_str_concat(stem, EL_STR("\xd0\xb8"));
  }
  if (str_eq(last, EL_STR("\xd0\xb0"))) {
    el_val_t stem = str_drop_last(noun, 1);
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return noun;
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return el_str_concat(stem, EL_STR("\xd1\x83"));
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return el_str_concat(stem, EL_STR("\xd1\x8b"));
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb5"));
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return el_str_concat(stem, EL_STR("\xd0\xbe\xd0\xb9"));
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb5"));
      }
      return noun;
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8b"));
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8b"));
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return stem;
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb0\xd0\xbc"));
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb0\xd0\xbc\xd0\xb8"));
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb0\xd1\x85"));
    }
    return el_str_concat(stem, EL_STR("\xd1\x8b"));
  }
  return noun;
  return 0;
}

el_val_t ru_decline_neut(el_val_t noun, el_val_t stype, el_val_t gram_case, el_val_t number) {
  el_val_t n = str_len(noun);
  el_val_t last = str_slice(noun, (n - 1), n);
  if (str_ends_with(noun, EL_STR("\xd0\xb8\xd0\xb5"))) {
    el_val_t stem = str_drop_last(noun, 2);
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return noun;
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return noun;
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8\xd1\x8f"));
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8\xd1\x8e"));
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8\xd0\xb5\xd0\xbc"));
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8\xd0\xb8"));
      }
      return noun;
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8\xd1\x8f"));
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8\xd1\x8f"));
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8\xd0\xb9"));
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8\xd1\x8f\xd0\xbc"));
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8\xd1\x8f\xd0\xbc\xd0\xb8"));
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8\xd1\x8f\xd1\x85"));
    }
    return el_str_concat(stem, EL_STR("\xd0\xb8\xd1\x8f"));
  }
  if (str_eq(last, EL_STR("\xd0\xb5"))) {
    el_val_t stem = str_drop_last(noun, 1);
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return noun;
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return noun;
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return el_str_concat(stem, EL_STR("\xd1\x8f"));
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return el_str_concat(stem, EL_STR("\xd1\x8e"));
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb5\xd0\xbc"));
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return noun;
      }
      return noun;
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8f"));
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8f"));
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb5\xd0\xb9"));
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8f\xd0\xbc"));
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8f\xd0\xbc\xd0\xb8"));
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return el_str_concat(stem, EL_STR("\xd1\x8f\xd1\x85"));
    }
    return el_str_concat(stem, EL_STR("\xd1\x8f"));
  }
  if (str_eq(last, EL_STR("\xd0\xbe"))) {
    el_val_t stem = str_drop_last(noun, 1);
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(gram_case, EL_STR("nom"))) {
        return noun;
      }
      if (str_eq(gram_case, EL_STR("acc"))) {
        return noun;
      }
      if (str_eq(gram_case, EL_STR("gen"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb0"));
      }
      if (str_eq(gram_case, EL_STR("dat"))) {
        return el_str_concat(stem, EL_STR("\xd1\x83"));
      }
      if (str_eq(gram_case, EL_STR("ins"))) {
        return el_str_concat(stem, EL_STR("\xd0\xbe\xd0\xbc"));
      }
      if (str_eq(gram_case, EL_STR("pre"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb5"));
      }
      return noun;
    }
    if (str_eq(gram_case, EL_STR("nom"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb0"));
    }
    if (str_eq(gram_case, EL_STR("acc"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb0"));
    }
    if (str_eq(gram_case, EL_STR("gen"))) {
      return stem;
    }
    if (str_eq(gram_case, EL_STR("dat"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb0\xd0\xbc"));
    }
    if (str_eq(gram_case, EL_STR("ins"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb0\xd0\xbc\xd0\xb8"));
    }
    if (str_eq(gram_case, EL_STR("pre"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb0\xd1\x85"));
    }
    return el_str_concat(stem, EL_STR("\xd0\xb0"));
  }
  return noun;
  return 0;
}

el_val_t ru_past_agree(el_val_t verb_stem, el_val_t gender, el_val_t number) {
  if (str_eq(number, EL_STR("pl"))) {
    return el_str_concat(verb_stem, EL_STR("\xd0\xb8"));
  }
  if (str_eq(gender, EL_STR("f"))) {
    return el_str_concat(verb_stem, EL_STR("\xd0\xb0"));
  }
  if (str_eq(gender, EL_STR("n"))) {
    return el_str_concat(verb_stem, EL_STR("\xd0\xbe"));
  }
  return verb_stem;
  return 0;
}

el_val_t ru_conjugate_1st(el_val_t stem, el_val_t tense, el_val_t person, el_val_t number) {
  if (str_eq(tense, EL_STR("present"))) {
    el_val_t n = str_len(stem);
    el_val_t last = str_slice(stem, (n - 1), n);
    el_val_t vowels = 0;
    vowels = (((((((((str_eq(last, EL_STR("\xd0\xb0")) || str_eq(last, EL_STR("\xd0\xb5"))) || str_eq(last, EL_STR("\xd0\xb8"))) || str_eq(last, EL_STR("\xd0\xbe"))) || str_eq(last, EL_STR("\xd1\x83"))) || str_eq(last, EL_STR("\xd1\x8e"))) || str_eq(last, EL_STR("\xd1\x8f"))) || str_eq(last, EL_STR("\xd1\x8d"))) || str_eq(last, EL_STR("\xd1\x91"))) || str_eq(last, EL_STR("\xd1\x8b")));
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(person, EL_STR("1"))) {
        if (vowels) {
          return el_str_concat(stem, EL_STR("\xd1\x8e"));
        }
        return el_str_concat(stem, EL_STR("\xd1\x83"));
      }
      if (str_eq(person, EL_STR("2"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb5\xd1\x88\xd1\x8c"));
      }
      return el_str_concat(stem, EL_STR("\xd0\xb5\xd1\x82"));
    }
    if (str_eq(person, EL_STR("1"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb5\xd0\xbc"));
    }
    if (str_eq(person, EL_STR("2"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb5\xd1\x82\xd0\xb5"));
    }
    if (vowels) {
      return el_str_concat(stem, EL_STR("\xd1\x8e\xd1\x82"));
    }
    return el_str_concat(stem, EL_STR("\xd1\x83\xd1\x82"));
  }
  return stem;
  return 0;
}

el_val_t ru_conjugate_2nd(el_val_t stem, el_val_t tense, el_val_t person, el_val_t number) {
  if (str_eq(tense, EL_STR("present"))) {
    el_val_t n = str_len(stem);
    el_val_t last = str_slice(stem, (n - 1), n);
    el_val_t after_vowel = (((((((((str_eq(last, EL_STR("\xd0\xb0")) || str_eq(last, EL_STR("\xd0\xb5"))) || str_eq(last, EL_STR("\xd0\xb8"))) || str_eq(last, EL_STR("\xd0\xbe"))) || str_eq(last, EL_STR("\xd1\x83"))) || str_eq(last, EL_STR("\xd1\x8e"))) || str_eq(last, EL_STR("\xd1\x8f"))) || str_eq(last, EL_STR("\xd1\x8d"))) || str_eq(last, EL_STR("\xd1\x91"))) || str_eq(last, EL_STR("\xd1\x8b")));
    if (str_eq(number, EL_STR("sg"))) {
      if (str_eq(person, EL_STR("1"))) {
        if (after_vowel) {
          return el_str_concat(stem, EL_STR("\xd1\x8e"));
        }
        return el_str_concat(stem, EL_STR("\xd1\x83"));
      }
      if (str_eq(person, EL_STR("2"))) {
        return el_str_concat(stem, EL_STR("\xd0\xb8\xd1\x88\xd1\x8c"));
      }
      return el_str_concat(stem, EL_STR("\xd0\xb8\xd1\x82"));
    }
    if (str_eq(person, EL_STR("1"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8\xd0\xbc"));
    }
    if (str_eq(person, EL_STR("2"))) {
      return el_str_concat(stem, EL_STR("\xd0\xb8\xd1\x82\xd0\xb5"));
    }
    if (after_vowel) {
      return el_str_concat(stem, EL_STR("\xd1\x8f\xd1\x82"));
    }
    return el_str_concat(stem, EL_STR("\xd0\xb0\xd1\x82"));
  }
  return stem;
  return 0;
}

el_val_t ru_irregular(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number) {
  if (str_eq(verb, EL_STR("\xd0\xb1\xd1\x8b\xd1\x82\xd1\x8c"))) {
    if (str_eq(tense, EL_STR("present"))) {
      return EL_STR("\xd0\xb5\xd1\x81\xd1\x82\xd1\x8c");
    }
    if (str_eq(tense, EL_STR("future"))) {
      if (str_eq(number, EL_STR("sg"))) {
        if (str_eq(person, EL_STR("1"))) {
          return EL_STR("\xd0\xb1\xd1\x83\xd0\xb4\xd1\x83");
        }
        if (str_eq(person, EL_STR("2"))) {
          return EL_STR("\xd0\xb1\xd1\x83\xd0\xb4\xd0\xb5\xd1\x88\xd1\x8c");
        }
        return EL_STR("\xd0\xb1\xd1\x83\xd0\xb4\xd0\xb5\xd1\x82");
      }
      if (str_eq(person, EL_STR("1"))) {
        return EL_STR("\xd0\xb1\xd1\x83\xd0\xb4\xd0\xb5\xd0\xbc");
      }
      if (str_eq(person, EL_STR("2"))) {
        return EL_STR("\xd0\xb1\xd1\x83\xd0\xb4\xd0\xb5\xd1\x82\xd0\xb5");
      }
      return EL_STR("\xd0\xb1\xd1\x83\xd0\xb4\xd1\x83\xd1\x82");
    }
    return EL_STR("");
  }
  if (str_eq(verb, EL_STR("\xd0\xb8\xd0\xb4\xd1\x82\xd0\xb8"))) {
    if (str_eq(tense, EL_STR("present"))) {
      if (str_eq(number, EL_STR("sg"))) {
        if (str_eq(person, EL_STR("1"))) {
          return EL_STR("\xd0\xb8\xd0\xb4\xd1\x83");
        }
        if (str_eq(person, EL_STR("2"))) {
          return EL_STR("\xd0\xb8\xd0\xb4\xd1\x91\xd1\x88\xd1\x8c");
        }
        return EL_STR("\xd0\xb8\xd0\xb4\xd1\x91\xd1\x82");
      }
      if (str_eq(person, EL_STR("1"))) {
        return EL_STR("\xd0\xb8\xd0\xb4\xd1\x91\xd0\xbc");
      }
      if (str_eq(person, EL_STR("2"))) {
        return EL_STR("\xd0\xb8\xd0\xb4\xd1\x91\xd1\x82\xd0\xb5");
      }
      return EL_STR("\xd0\xb8\xd0\xb4\xd1\x83\xd1\x82");
    }
    return EL_STR("");
  }
  if (str_eq(verb, EL_STR("\xd0\xb5\xd1\x85\xd0\xb0\xd1\x82\xd1\x8c"))) {
    if (str_eq(tense, EL_STR("present"))) {
      if (str_eq(number, EL_STR("sg"))) {
        if (str_eq(person, EL_STR("1"))) {
          return EL_STR("\xd0\xb5\xd0\xb4\xd1\x83");
        }
        if (str_eq(person, EL_STR("2"))) {
          return EL_STR("\xd0\xb5\xd0\xb4\xd0\xb5\xd1\x88\xd1\x8c");
        }
        return EL_STR("\xd0\xb5\xd0\xb4\xd0\xb5\xd1\x82");
      }
      if (str_eq(person, EL_STR("1"))) {
        return EL_STR("\xd0\xb5\xd0\xb4\xd0\xb5\xd0\xbc");
      }
      if (str_eq(person, EL_STR("2"))) {
        return EL_STR("\xd0\xb5\xd0\xb4\xd0\xb5\xd1\x82\xd0\xb5");
      }
      return EL_STR("\xd0\xb5\xd0\xb4\xd1\x83\xd1\x82");
    }
    return EL_STR("");
  }
  if (str_eq(verb, EL_STR("\xd0\xb3\xd0\xbe\xd0\xb2\xd0\xbe\xd1\x80\xd0\xb8\xd1\x82\xd1\x8c"))) {
    if (str_eq(tense, EL_STR("present"))) {
      return ru_conjugate_2nd(EL_STR("\xd0\xb3\xd0\xbe\xd0\xb2\xd0\xbe\xd1\x80"), EL_STR("present"), person, number);
    }
    return EL_STR("");
  }
  if (str_eq(verb, EL_STR("\xd0\xb7\xd0\xbd\xd0\xb0\xd1\x82\xd1\x8c"))) {
    if (str_eq(tense, EL_STR("present"))) {
      return ru_conjugate_1st(EL_STR("\xd0\xb7\xd0\xbd\xd0\xb0"), EL_STR("present"), person, number);
    }
    return EL_STR("");
  }
  if (str_eq(verb, EL_STR("\xd0\xb2\xd0\xb8\xd0\xb4\xd0\xb5\xd1\x82\xd1\x8c"))) {
    if (str_eq(tense, EL_STR("present"))) {
      if (str_eq(number, EL_STR("sg"))) {
        if (str_eq(person, EL_STR("1"))) {
          return EL_STR("\xd0\xb2\xd0\xb8\xd0\xb6\xd1\x83");
        }
        if (str_eq(person, EL_STR("2"))) {
          return EL_STR("\xd0\xb2\xd0\xb8\xd0\xb4\xd0\xb8\xd1\x88\xd1\x8c");
        }
        return EL_STR("\xd0\xb2\xd0\xb8\xd0\xb4\xd0\xb8\xd1\x82");
      }
      if (str_eq(person, EL_STR("1"))) {
        return EL_STR("\xd0\xb2\xd0\xb8\xd0\xb4\xd0\xb8\xd0\xbc");
      }
      if (str_eq(person, EL_STR("2"))) {
        return EL_STR("\xd0\xb2\xd0\xb8\xd0\xb4\xd0\xb8\xd1\x82\xd0\xb5");
      }
      return EL_STR("\xd0\xb2\xd0\xb8\xd0\xb4\xd1\x8f\xd1\x82");
    }
    return EL_STR("");
  }
  if (str_eq(verb, EL_STR("\xd0\xb4\xd0\xb5\xd0\xbb\xd0\xb0\xd1\x82\xd1\x8c"))) {
    if (str_eq(tense, EL_STR("present"))) {
      return ru_conjugate_1st(EL_STR("\xd0\xb4\xd0\xb5\xd0\xbb\xd0\xb0"), EL_STR("present"), person, number);
    }
    return EL_STR("");
  }
  if (str_eq(verb, EL_STR("\xd1\x85\xd0\xbe\xd1\x82\xd0\xb5\xd1\x82\xd1\x8c"))) {
    if (str_eq(tense, EL_STR("present"))) {
      if (str_eq(number, EL_STR("sg"))) {
        if (str_eq(person, EL_STR("1"))) {
          return EL_STR("\xd1\x85\xd0\xbe\xd1\x87\xd1\x83");
        }
        if (str_eq(person, EL_STR("2"))) {
          return EL_STR("\xd1\x85\xd0\xbe\xd1\x87\xd0\xb5\xd1\x88\xd1\x8c");
        }
        return EL_STR("\xd1\x85\xd0\xbe\xd1\x87\xd0\xb5\xd1\x82");
      }
      if (str_eq(person, EL_STR("1"))) {
        return EL_STR("\xd1\x85\xd0\xbe\xd1\x82\xd0\xb8\xd0\xbc");
      }
      if (str_eq(person, EL_STR("2"))) {
        return EL_STR("\xd1\x85\xd0\xbe\xd1\x82\xd0\xb8\xd1\x82\xd0\xb5");
      }
      return EL_STR("\xd1\x85\xd0\xbe\xd1\x82\xd1\x8f\xd1\x82");
    }
    return EL_STR("");
  }
  if (str_eq(verb, EL_STR("\xd0\xbc\xd0\xbe\xd1\x87\xd1\x8c"))) {
    if (str_eq(tense, EL_STR("present"))) {
      if (str_eq(number, EL_STR("sg"))) {
        if (str_eq(person, EL_STR("1"))) {
          return EL_STR("\xd0\xbc\xd0\xbe\xd0\xb3\xd1\x83");
        }
        if (str_eq(person, EL_STR("2"))) {
          return EL_STR("\xd0\xbc\xd0\xbe\xd0\xb6\xd0\xb5\xd1\x88\xd1\x8c");
        }
        return EL_STR("\xd0\xbc\xd0\xbe\xd0\xb6\xd0\xb5\xd1\x82");
      }
      if (str_eq(person, EL_STR("1"))) {
        return EL_STR("\xd0\xbc\xd0\xbe\xd0\xb6\xd0\xb5\xd0\xbc");
      }
      if (str_eq(person, EL_STR("2"))) {
        return EL_STR("\xd0\xbc\xd0\xbe\xd0\xb6\xd0\xb5\xd1\x82\xd0\xb5");
      }
      return EL_STR("\xd0\xbc\xd0\xbe\xd0\xb3\xd1\x83\xd1\x82");
    }
    return EL_STR("");
  }
  if (str_eq(verb, EL_STR("\xd1\x81\xd0\xba\xd0\xb0\xd0\xb7\xd0\xb0\xd1\x82\xd1\x8c"))) {
    if (str_eq(tense, EL_STR("present"))) {
      if (str_eq(number, EL_STR("sg"))) {
        if (str_eq(person, EL_STR("1"))) {
          return EL_STR("\xd1\x81\xd0\xba\xd0\xb0\xd0\xb6\xd1\x83");
        }
        if (str_eq(person, EL_STR("2"))) {
          return EL_STR("\xd1\x81\xd0\xba\xd0\xb0\xd0\xb6\xd0\xb5\xd1\x88\xd1\x8c");
        }
        return EL_STR("\xd1\x81\xd0\xba\xd0\xb0\xd0\xb6\xd0\xb5\xd1\x82");
      }
      if (str_eq(person, EL_STR("1"))) {
        return EL_STR("\xd1\x81\xd0\xba\xd0\xb0\xd0\xb6\xd0\xb5\xd0\xbc");
      }
      if (str_eq(person, EL_STR("2"))) {
        return EL_STR("\xd1\x81\xd0\xba\xd0\xb0\xd0\xb6\xd0\xb5\xd1\x82\xd0\xb5");
      }
      return EL_STR("\xd1\x81\xd0\xba\xd0\xb0\xd0\xb6\xd1\x83\xd1\x82");
    }
    return EL_STR("");
  }
  return EL_STR("");
  return 0;
}

el_val_t ru_past_stem(el_val_t verb) {
  if (str_eq(verb, EL_STR("\xd1\x87\xd0\xb8\xd1\x82\xd0\xb0\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd1\x87\xd0\xb8\xd1\x82\xd0\xb0");
  }
  if (str_eq(verb, EL_STR("\xd0\xb7\xd0\xbd\xd0\xb0\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd0\xb7\xd0\xbd\xd0\xb0");
  }
  if (str_eq(verb, EL_STR("\xd0\xb4\xd0\xb5\xd0\xbb\xd0\xb0\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd0\xb4\xd0\xb5\xd0\xbb\xd0\xb0");
  }
  if (str_eq(verb, EL_STR("\xd1\x81\xd0\xba\xd0\xb0\xd0\xb7\xd0\xb0\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd1\x81\xd0\xba\xd0\xb0\xd0\xb7\xd0\xb0");
  }
  if (str_eq(verb, EL_STR("\xd0\xb4\xd1\x83\xd0\xbc\xd0\xb0\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd0\xb4\xd1\x83\xd0\xbc\xd0\xb0");
  }
  if (str_eq(verb, EL_STR("\xd1\x80\xd0\xb0\xd0\xb1\xd0\xbe\xd1\x82\xd0\xb0\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd1\x80\xd0\xb0\xd0\xb1\xd0\xbe\xd1\x82\xd0\xb0");
  }
  if (str_eq(verb, EL_STR("\xd0\xbf\xd0\xb8\xd1\x81\xd0\xb0\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd0\xbf\xd0\xb8\xd1\x81\xd0\xb0");
  }
  if (str_eq(verb, EL_STR("\xd1\x81\xd0\xbb\xd1\x83\xd1\x88\xd0\xb0\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd1\x81\xd0\xbb\xd1\x83\xd1\x88\xd0\xb0");
  }
  if (str_eq(verb, EL_STR("\xd0\xbe\xd1\x82\xd0\xb2\xd0\xb5\xd1\x87\xd0\xb0\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd0\xbe\xd1\x82\xd0\xb2\xd0\xb5\xd1\x87\xd0\xb0");
  }
  if (str_eq(verb, EL_STR("\xd0\xb3\xd0\xbe\xd0\xb2\xd0\xbe\xd1\x80\xd0\xb8\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd0\xb3\xd0\xbe\xd0\xb2\xd0\xbe\xd1\x80\xd0\xb8");
  }
  if (str_eq(verb, EL_STR("\xd0\xb2\xd0\xb8\xd0\xb4\xd0\xb5\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd0\xb2\xd0\xb8\xd0\xb4\xd0\xb5");
  }
  if (str_eq(verb, EL_STR("\xd1\x81\xd0\xbc\xd0\xbe\xd1\x82\xd1\x80\xd0\xb5\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd1\x81\xd0\xbc\xd0\xbe\xd1\x82\xd1\x80\xd0\xb5");
  }
  if (str_eq(verb, EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd0\xb8\xd0\xbc\xd0\xb5");
  }
  if (str_eq(verb, EL_STR("\xd1\x85\xd0\xbe\xd1\x82\xd0\xb5\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd1\x85\xd0\xbe\xd1\x82\xd0\xb5");
  }
  if (str_eq(verb, EL_STR("\xd0\xb1\xd1\x8b\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd0\xb1\xd1\x8b");
  }
  if (str_eq(verb, EL_STR("\xd0\xb8\xd0\xb4\xd1\x82\xd0\xb8"))) {
    return EL_STR("\xd1\x88\xd1\x91");
  }
  if (str_eq(verb, EL_STR("\xd0\xb5\xd1\x85\xd0\xb0\xd1\x82\xd1\x8c"))) {
    return EL_STR("\xd0\xb5\xd1\x85\xd0\xb0");
  }
  if (str_eq(verb, EL_STR("\xd0\xbc\xd0\xbe\xd1\x87\xd1\x8c"))) {
    return EL_STR("\xd0\xbc\xd0\xbe");
  }
  if (str_eq(verb, EL_STR("\xd0\xbd\xd0\xb5\xd1\x81\xd1\x82\xd0\xb8"))) {
    return EL_STR("\xd0\xbd\xd1\x91");
  }
  if (str_eq(verb, EL_STR("\xd0\xb2\xd0\xb5\xd1\x81\xd1\x82\xd0\xb8"))) {
    return EL_STR("\xd0\xb2\xd1\x91");
  }
  el_val_t n = str_len(verb);
  if (n > 2) {
    el_val_t last2 = str_slice(verb, (n - 2), n);
    if (str_eq(last2, EL_STR("\xd1\x82\xd1\x8c"))) {
      return str_drop_last(verb, 2);
    }
  }
  return verb;
  return 0;
}

el_val_t ru_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number, el_val_t gender) {
  if (str_eq(verb, EL_STR("byt"))) {
    if (str_eq(tense, EL_STR("present"))) {
      return EL_STR("");
    }
    if (str_eq(tense, EL_STR("future"))) {
      return EL_STR("budet");
    }
    return EL_STR("byl");
  }
  if (str_eq(tense, EL_STR("past"))) {
    if (str_eq(verb, EL_STR("\xd0\xb8\xd0\xb4\xd1\x82\xd0\xb8"))) {
      if (str_eq(number, EL_STR("pl"))) {
        return EL_STR("\xd1\x88\xd0\xbb\xd0\xb8");
      }
      if (str_eq(gender, EL_STR("f"))) {
        return EL_STR("\xd1\x88\xd0\xbb\xd0\xb0");
      }
      if (str_eq(gender, EL_STR("n"))) {
        return EL_STR("\xd1\x88\xd0\xbb\xd0\xbe");
      }
      return EL_STR("\xd1\x88\xd1\x91\xd0\xbb");
    }
    if (str_eq(verb, EL_STR("\xd0\xbc\xd0\xbe\xd1\x87\xd1\x8c"))) {
      if (str_eq(number, EL_STR("pl"))) {
        return EL_STR("\xd0\xbc\xd0\xbe\xd0\xb3\xd0\xbb\xd0\xb8");
      }
      if (str_eq(gender, EL_STR("f"))) {
        return EL_STR("\xd0\xbc\xd0\xbe\xd0\xb3\xd0\xbb\xd0\xb0");
      }
      if (str_eq(gender, EL_STR("n"))) {
        return EL_STR("\xd0\xbc\xd0\xbe\xd0\xb3\xd0\xbb\xd0\xbe");
      }
      return EL_STR("\xd0\xbc\xd0\xbe\xd0\xb3");
    }
    if (str_eq(verb, EL_STR("\xd0\xbd\xd0\xb5\xd1\x81\xd1\x82\xd0\xb8"))) {
      if (str_eq(number, EL_STR("pl"))) {
        return EL_STR("\xd0\xbd\xd0\xb5\xd1\x81\xd0\xbb\xd0\xb8");
      }
      if (str_eq(gender, EL_STR("f"))) {
        return EL_STR("\xd0\xbd\xd0\xb5\xd1\x81\xd0\xbb\xd0\xb0");
      }
      if (str_eq(gender, EL_STR("n"))) {
        return EL_STR("\xd0\xbd\xd0\xb5\xd1\x81\xd0\xbb\xd0\xbe");
      }
      return EL_STR("\xd0\xbd\xd1\x91\xd1\x81");
    }
    if (str_eq(verb, EL_STR("\xd0\xb2\xd0\xb5\xd1\x81\xd1\x82\xd0\xb8"))) {
      if (str_eq(number, EL_STR("pl"))) {
        return EL_STR("\xd0\xb2\xd0\xb5\xd0\xbb\xd0\xb8");
      }
      if (str_eq(gender, EL_STR("f"))) {
        return EL_STR("\xd0\xb2\xd0\xb5\xd0\xbb\xd0\xb0");
      }
      if (str_eq(gender, EL_STR("n"))) {
        return EL_STR("\xd0\xb2\xd0\xb5\xd0\xbb\xd0\xbe");
      }
      return EL_STR("\xd0\xb2\xd1\x91\xd0\xbb");
    }
    el_val_t ps = ru_past_stem(verb);
    return ru_past_agree(ps, gender, number);
  }
  if (str_eq(tense, EL_STR("future"))) {
    el_val_t aux = ru_irregular(EL_STR("\xd0\xb1\xd1\x8b\xd1\x82\xd1\x8c"), EL_STR("future"), person, number);
    return el_str_concat(el_str_concat(aux, EL_STR(" ")), verb);
  }
  el_val_t irr = ru_irregular(verb, tense, person, number);
  if (!str_eq(irr, EL_STR(""))) {
    return irr;
  }
  el_val_t n = str_len(verb);
  if (n > 4) {
    el_val_t last4 = str_slice(verb, (n - 4), n);
    if (str_eq(last4, EL_STR("\xd0\xb8\xd1\x82\xd1\x8c "))) {
    }
  }
  if (str_ends_with(verb, EL_STR("\xd0\xb8\xd1\x82\xd1\x8c"))) {
    el_val_t stem = str_drop_last(verb, 3);
    return ru_conjugate_2nd(stem, EL_STR("present"), person, number);
  }
  if (str_ends_with(verb, EL_STR("\xd0\xb5\xd1\x82\xd1\x8c"))) {
    el_val_t stem = str_drop_last(verb, 3);
    return ru_conjugate_2nd(stem, EL_STR("present"), person, number);
  }
  if (str_ends_with(verb, EL_STR("\xd0\xb0\xd1\x82\xd1\x8c"))) {
    el_val_t stem = str_drop_last(verb, 2);
    return ru_conjugate_1st(stem, EL_STR("present"), person, number);
  }
  if (str_ends_with(verb, EL_STR("\xd1\x8f\xd1\x82\xd1\x8c"))) {
    el_val_t stem = str_drop_last(verb, 2);
    return ru_conjugate_1st(stem, EL_STR("present"), person, number);
  }
  if (str_ends_with(verb, EL_STR("\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x82\xd1\x8c"))) {
    el_val_t stem = el_str_concat(str_drop_last(verb, 5), EL_STR("\xd1\x83"));
    return ru_conjugate_1st(stem, EL_STR("present"), person, number);
  }
  if (str_ends_with(verb, EL_STR("\xd0\xbd\xd1\x83\xd1\x82\xd1\x8c"))) {
    el_val_t stem = el_str_concat(str_drop_last(verb, 4), EL_STR("\xd0\xbd"));
    return ru_conjugate_1st(stem, EL_STR("present"), person, number);
  }
  return verb;
  return 0;
}

