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

el_val_t lang_profile(el_val_t code, el_val_t word_order, el_val_t morph_type, el_val_t has_case, el_val_t has_gender, el_val_t script_dir, el_val_t agreement, el_val_t null_subject);
el_val_t lang_get(el_val_t profile, el_val_t key);
el_val_t lang_profile_en(void);
el_val_t lang_profile_ja(void);
el_val_t lang_profile_ar(void);
el_val_t lang_profile_zh(void);
el_val_t lang_profile_de(void);
el_val_t lang_profile_es(void);
el_val_t lang_profile_fi(void);
el_val_t lang_profile_sw(void);
el_val_t lang_profile_hi(void);
el_val_t lang_profile_ru(void);
el_val_t lang_profile_fr(void);
el_val_t lang_profile_la(void);
el_val_t lang_profile_he(void);
el_val_t lang_profile_sa(void);
el_val_t lang_profile_got(void);
el_val_t lang_profile_non(void);
el_val_t lang_profile_enm(void);
el_val_t lang_profile_pi(void);
el_val_t lang_profile_grc(void);
el_val_t lang_profile_ang(void);
el_val_t lang_profile_fro(void);
el_val_t lang_profile_goh(void);
el_val_t lang_profile_sga(void);
el_val_t lang_profile_txb(void);
el_val_t lang_profile_peo(void);
el_val_t lang_profile_akk(void);
el_val_t lang_profile_uga(void);
el_val_t lang_profile_egy(void);
el_val_t lang_profile_sux(void);
el_val_t lang_profile_gez(void);
el_val_t lang_profile_cop(void);
el_val_t lang_from_code(el_val_t code);
el_val_t lang_default(void);
el_val_t lang_is_isolating(el_val_t profile);
el_val_t lang_is_agglutinative(el_val_t profile);
el_val_t lang_is_fusional(el_val_t profile);
el_val_t lang_is_polysynthetic(el_val_t profile);
el_val_t lang_is_rtl(el_val_t profile);
el_val_t lang_has_null_subject(el_val_t profile);
el_val_t lang_has_case(el_val_t profile);
el_val_t lang_has_gender(el_val_t profile);
el_val_t lang_word_order(el_val_t profile);
el_val_t lang_code(el_val_t profile);
el_val_t es_str_ends(el_val_t s, el_val_t suf);
el_val_t es_str_drop_last(el_val_t s, el_val_t n);
el_val_t es_str_last_char(el_val_t s);
el_val_t es_str_last2(el_val_t s);
el_val_t es_str_last3(el_val_t s);
el_val_t es_verb_class(el_val_t base);
el_val_t es_stem(el_val_t base);
el_val_t es_slot(el_val_t person, el_val_t number);
el_val_t es_irregular_present(el_val_t verb, el_val_t person, el_val_t number);
el_val_t es_irregular_preterite(el_val_t verb, el_val_t person, el_val_t number);
el_val_t es_irregular_imperfect(el_val_t verb, el_val_t person, el_val_t number);
el_val_t es_regular_present(el_val_t stem, el_val_t vclass, el_val_t slot);
el_val_t es_regular_preterite(el_val_t stem, el_val_t vclass, el_val_t slot);
el_val_t es_regular_future(el_val_t base, el_val_t slot);
el_val_t es_irregular_future_stem(el_val_t verb);
el_val_t es_regular_imperfect(el_val_t stem, el_val_t vclass, el_val_t slot);
el_val_t es_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number);
el_val_t es_gender(el_val_t noun);
el_val_t es_invariant_plural(el_val_t noun);
el_val_t es_pluralize(el_val_t noun);
el_val_t es_starts_with_stressed_a(el_val_t noun);
el_val_t es_agree_article(el_val_t noun, el_val_t definite, el_val_t number);
el_val_t fr_str_ends(el_val_t s, el_val_t suf);
el_val_t fr_str_drop_last(el_val_t s, el_val_t n);
el_val_t fr_str_last_char(el_val_t s);
el_val_t fr_str_last2(el_val_t s);
el_val_t fr_is_vowel_start(el_val_t s);
el_val_t fr_is_known_irregular(el_val_t verb);
el_val_t fr_verb_group(el_val_t base);
el_val_t fr_stem(el_val_t base);
el_val_t fr_slot(el_val_t person, el_val_t number);
el_val_t fr_irregular_present(el_val_t verb, el_val_t person, el_val_t number);
el_val_t fr_regular_present(el_val_t stem, el_val_t vgroup, el_val_t slot);
el_val_t fr_future_stem(el_val_t base, el_val_t vgroup);
el_val_t fr_regular_future(el_val_t fstem, el_val_t slot);
el_val_t fr_irregular_future_stem(el_val_t verb);
el_val_t fr_imperfect_stem(el_val_t base, el_val_t vgroup);
el_val_t fr_regular_imperfect(el_val_t istem, el_val_t slot);
el_val_t fr_uses_etre(el_val_t verb);
el_val_t fr_past_participle(el_val_t verb);
el_val_t fr_avoir_present(el_val_t slot);
el_val_t fr_etre_present(el_val_t slot);
el_val_t fr_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number);
el_val_t fr_gender(el_val_t noun);
el_val_t fr_invariant_plural(el_val_t noun);
el_val_t fr_pluralize(el_val_t noun);
el_val_t fr_agree_article(el_val_t noun, el_val_t definite, el_val_t number);
el_val_t fr_subject_starts_vowel(el_val_t subject);
el_val_t fr_verb_ends_vowel(el_val_t verb_form);
el_val_t fr_question_inversion(el_val_t subject, el_val_t verb_form);
el_val_t de_article_def(el_val_t gender, el_val_t gram_case, el_val_t number);
el_val_t de_article_indef(el_val_t gender, el_val_t gram_case, el_val_t number);
el_val_t de_article(el_val_t gender, el_val_t gram_case, el_val_t number, el_val_t definite);
el_val_t de_adj_ending(el_val_t gender, el_val_t gram_case, el_val_t number, el_val_t article_type);
el_val_t de_noun_plural(el_val_t noun, el_val_t gender);
el_val_t de_case_ending(el_val_t noun, el_val_t gender, el_val_t gram_case, el_val_t number);
el_val_t de_conjugate_weak(el_val_t stem, el_val_t tense, el_val_t person, el_val_t number);
el_val_t de_irregular_present(el_val_t verb, el_val_t person, el_val_t number);
el_val_t de_strong_past_stem(el_val_t verb);
el_val_t de_norm_number(el_val_t number);
el_val_t de_norm_person(el_val_t person);
el_val_t de_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number);
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 fi_harmony(el_val_t word);
el_val_t fi_suffix(el_val_t base, el_val_t harmony);
el_val_t fi_noun_case(el_val_t stem, el_val_t gram_case, el_val_t number, el_val_t harmony);
el_val_t fi_str_last_char(el_val_t s);
el_val_t fi_apply_case(el_val_t noun, el_val_t gram_case, el_val_t number);
el_val_t fi_verb_stem(el_val_t dict_form);
el_val_t fi_irregular_verb(el_val_t dict_form);
el_val_t fi_present_ending(el_val_t stem, el_val_t person, el_val_t number, el_val_t harmony);
el_val_t fi_past_stem(el_val_t stem);
el_val_t fi_past_ending(el_val_t stem, el_val_t person, el_val_t number, el_val_t harmony);
el_val_t fi_neg_aux(el_val_t person, el_val_t number);
el_val_t fi_negative(el_val_t verb, el_val_t person, el_val_t number);
el_val_t fi_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number);
el_val_t fi_question_suffix(el_val_t harmony);
el_val_t fi_make_question(el_val_t verb_form, el_val_t harmony);
el_val_t fi_full_paradigm(el_val_t noun);
el_val_t ar_str_ends(el_val_t s, el_val_t suf);
el_val_t ar_str_len(el_val_t s);
el_val_t ar_str_drop_last(el_val_t s, el_val_t n);
el_val_t ar_str_last_char(el_val_t s);
el_val_t ar_slot(el_val_t person, el_val_t gender, el_val_t number);
el_val_t ar_perfect_suffix(el_val_t slot);
el_val_t ar_imperfect_prefix(el_val_t slot);
el_val_t ar_imperfect_suffix(el_val_t slot);
el_val_t ar_conjugate_form1(el_val_t past_base, el_val_t present_stem, el_val_t tense, el_val_t slot);
el_val_t ar_irregular_kaana(el_val_t slot, el_val_t tense);
el_val_t ar_irregular_qaala(el_val_t slot, el_val_t tense);
el_val_t ar_irregular_jaa(el_val_t slot, el_val_t tense);
el_val_t ar_irregular_raaa(el_val_t slot, el_val_t tense);
el_val_t ar_irregular_araada(el_val_t slot, el_val_t tense);
el_val_t ar_irregular_istata(el_val_t slot, el_val_t tense);
el_val_t ar_irregular(el_val_t verb, el_val_t tense, el_val_t slot);
el_val_t ar_present_stem(el_val_t verb);
el_val_t ar_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t gender, el_val_t number);
el_val_t ar_is_sun_letter(el_val_t c);
el_val_t ar_definite_article(el_val_t noun);
el_val_t ar_case_ending(el_val_t kase, el_val_t definite);
el_val_t ar_gender(el_val_t noun);
el_val_t ar_masc_pl_ending(el_val_t kase);
el_val_t ar_sound_plural(el_val_t noun, el_val_t gender);
el_val_t ar_noun_form(el_val_t noun, el_val_t gender, el_val_t kase, el_val_t number, el_val_t definite);
el_val_t ar_verb_form(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number);
el_val_t hi_str_ends(el_val_t s, el_val_t suf);
el_val_t hi_str_drop_last(el_val_t s, el_val_t n);
el_val_t hi_str_last_char(el_val_t s);
el_val_t hi_gender(el_val_t noun);
el_val_t hi_masc_aa_stem(el_val_t noun);
el_val_t hi_noun_direct_m(el_val_t noun, el_val_t number);
el_val_t hi_noun_oblique_m(el_val_t noun, el_val_t number);
el_val_t hi_noun_direct_f(el_val_t noun, el_val_t number);
el_val_t hi_noun_oblique_f(el_val_t noun, el_val_t number);
el_val_t hi_noun_direct(el_val_t noun, el_val_t gender, el_val_t number);
el_val_t hi_noun_oblique(el_val_t noun, el_val_t gender, el_val_t number);
el_val_t hi_postposition(el_val_t gram_case);
el_val_t hi_agree_genitive(el_val_t possessed_gender, el_val_t possessed_number);
el_val_t hi_verb_stem(el_val_t infinitive);
el_val_t hi_verb_stem_clean(el_val_t infinitive);
el_val_t hi_present_aspect(el_val_t gender, el_val_t number);
el_val_t hi_aux_present(el_val_t person, el_val_t number);
el_val_t hi_past_suffix(el_val_t gender, el_val_t number);
el_val_t hi_past_irregular(el_val_t stem, el_val_t gender, el_val_t number);
el_val_t hi_future_suffix(el_val_t person, el_val_t number, el_val_t gender);
el_val_t hi_tense_suffix(el_val_t tense, el_val_t gender, el_val_t number);
el_val_t hi_hona_present(el_val_t person, el_val_t number);
el_val_t hi_hona_past(el_val_t gender, el_val_t number);
el_val_t hi_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t gender, el_val_t number);
el_val_t hi_noun_with_post(el_val_t noun, el_val_t gender, el_val_t number, el_val_t gram_case);
el_val_t hi_genitive_phrase(el_val_t possessor, el_val_t possessor_gender, el_val_t possessor_number, el_val_t possessed, el_val_t possessed_gender, el_val_t possessed_number);
el_val_t sw_str_ends(el_val_t s, el_val_t suf);
el_val_t sw_str_drop_last(el_val_t s, el_val_t n);
el_val_t sw_str_first_char(el_val_t s);
el_val_t sw_str_first2(el_val_t s);
el_val_t sw_str_first3(el_val_t s);
el_val_t sw_str_last_char(el_val_t s);
el_val_t sw_is_class1_noun(el_val_t noun);
el_val_t sw_noun_class(el_val_t noun);
el_val_t sw_subj_prefix(el_val_t person, el_val_t number, el_val_t noun_class);
el_val_t sw_obj_prefix(el_val_t person, el_val_t number, el_val_t noun_class);
el_val_t sw_tense_marker(el_val_t tense);
el_val_t sw_verb_final(el_val_t tense, el_val_t negative);
el_val_t sw_neg_subj_prefix(el_val_t person, el_val_t number, el_val_t noun_class);
el_val_t sw_verb_stem(el_val_t infinitive);
el_val_t sw_conjugate(el_val_t verb_stem, el_val_t person, el_val_t number, el_val_t noun_class, el_val_t tense);
el_val_t sw_negative(el_val_t verb_stem, el_val_t person, el_val_t number, el_val_t noun_class, el_val_t tense);
el_val_t sw_noun_plural(el_val_t noun);
el_val_t sw_adj_prefix(el_val_t noun_class, el_val_t number);
el_val_t sw_agree_adj(el_val_t adj_stem, el_val_t noun_class, el_val_t number);
el_val_t sw_demonstrative(el_val_t noun_class, el_val_t number, el_val_t proximity);
el_val_t sw_copula_present(el_val_t person, el_val_t number, el_val_t use_case);
el_val_t sw_copula_neg_present(el_val_t person, el_val_t number);
el_val_t la_str_ends(el_val_t s, el_val_t suf);
el_val_t la_str_drop_last(el_val_t s, el_val_t n);
el_val_t la_str_last_char(el_val_t s);
el_val_t la_str_last2(el_val_t s);
el_val_t la_str_last3(el_val_t s);
el_val_t la_slot(el_val_t person, el_val_t number);
el_val_t la_verb_class(el_val_t verb);
el_val_t la_stem(el_val_t verb, el_val_t vclass);
el_val_t la_perfect_stem(el_val_t verb, el_val_t vclass);
el_val_t la_perfect_ending(el_val_t slot);
el_val_t la_present_ending(el_val_t vclass, el_val_t slot);
el_val_t la_present_form(el_val_t stem, el_val_t vclass, el_val_t slot);
el_val_t la_future_ending_12(el_val_t slot);
el_val_t la_future_ending_34(el_val_t slot);
el_val_t la_future_form(el_val_t stem, el_val_t vclass, el_val_t slot);
el_val_t la_esse_present(el_val_t slot);
el_val_t la_esse_past(el_val_t slot);
el_val_t la_esse_future(el_val_t slot);
el_val_t la_ire_present(el_val_t slot);
el_val_t la_ire_past(el_val_t slot);
el_val_t la_ire_future(el_val_t slot);
el_val_t la_velle_present(el_val_t slot);
el_val_t la_velle_past(el_val_t slot);
el_val_t la_velle_future(el_val_t slot);
el_val_t la_posse_present(el_val_t slot);
el_val_t la_posse_past(el_val_t slot);
el_val_t la_posse_future(el_val_t slot);
el_val_t la_irregular_perfect_stem(el_val_t verb);
el_val_t la_map_canonical(el_val_t verb);
el_val_t la_conjugate(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number);
el_val_t la_declension(el_val_t noun);
el_val_t la_decline_1(el_val_t stem, el_val_t gram_case, el_val_t number);
el_val_t la_decline_2m(el_val_t stem, el_val_t gram_case, el_val_t number);
el_val_t la_decline_2n(el_val_t stem, el_val_t gram_case, el_val_t number);
el_val_t la_decline_3(el_val_t noun, el_val_t gram_case, el_val_t number);
el_val_t la_decline_4(el_val_t stem, el_val_t gram_case, el_val_t number);
el_val_t la_decline_5(el_val_t stem, el_val_t gram_case, el_val_t number);
el_val_t la_decline_2er(el_val_t noun, el_val_t gram_case, el_val_t number);
el_val_t la_decline(el_val_t noun, el_val_t gram_case, el_val_t number);
el_val_t la_noun_phrase(el_val_t noun, el_val_t gram_case, el_val_t number, el_val_t definite);
el_val_t ja_verb_group(el_val_t dict_form);
el_val_t ja_ichidan_stem(el_val_t dict_form);
el_val_t ja_godan_stem_change(el_val_t dict_form, el_val_t row);
el_val_t ja_conjugate(el_val_t dict_form, el_val_t form);
el_val_t ja_particle(el_val_t gram_case);
el_val_t ja_noun_phrase(el_val_t noun, el_val_t gram_case);
el_val_t ja_question_particle(void);
el_val_t ja_make_question(el_val_t sentence);
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 str_ends(el_val_t s, el_val_t suf) {
  return str_ends_with(s, suf);
  return 0;
}

el_val_t str_last_char(el_val_t s) {
  el_val_t n = str_len(s);
  if (n == 0) {
    return EL_STR("");
  }
  return str_slice(s, (n - 1), n);
  return 0;
}

el_val_t str_last2(el_val_t s) {
  el_val_t n = str_len(s);
  if (n < 2) {
    return s;
  }
  return str_slice(s, (n - 2), n);
  return 0;
}

el_val_t str_last3(el_val_t s) {
  el_val_t n = str_len(s);
  if (n < 3) {
    return s;
  }
  return str_slice(s, (n - 3), n);
  return 0;
}

el_val_t str_drop_last(el_val_t s, el_val_t n) {
  el_val_t len = str_len(s);
  if (n >= len) {
    return EL_STR("");
  }
  return str_slice(s, 0, (len - n));
  return 0;
}

el_val_t is_vowel(el_val_t c) {
  if (str_eq(c, EL_STR("a"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("e"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("i"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("o"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("u"))) {
    return 1;
  }
  return 0;
  return 0;
}

el_val_t morph_apply_suffix(el_val_t base, el_val_t suffix) {
  if (str_eq(suffix, EL_STR(""))) {
    return base;
  }
  el_val_t suf_start = str_slice(suffix, 0, 1);
  el_val_t suf_starts_vowel = is_vowel(suf_start);
  if (suf_starts_vowel) {
    if (str_ends(base, EL_STR("e"))) {
      if (!str_ends(base, EL_STR("ee"))) {
        return el_str_concat(str_drop_last(base, 1), suffix);
      }
    }
  }
  if (suf_starts_vowel) {
    el_val_t n = str_len(base);
    if (n >= 3) {
      el_val_t c3 = str_slice(base, (n - 3), (n - 2));
      el_val_t c2 = str_slice(base, (n - 2), (n - 1));
      el_val_t c1 = str_slice(base, (n - 1), n);
      if (!is_vowel(c3)) {
        if (is_vowel(c2)) {
          if (!is_vowel(c1)) {
            if (!str_eq(c1, EL_STR("w"))) {
              if (!str_eq(c1, EL_STR("x"))) {
                if (!str_eq(c1, EL_STR("y"))) {
                  return el_str_concat(el_str_concat(base, c1), suffix);
                }
              }
            }
          }
        }
      }
    }
  }
  return el_str_concat(base, suffix);
  return 0;
}

el_val_t en_irregular_plural(el_val_t word) {
  if (str_eq(word, EL_STR("child"))) {
    return EL_STR("children");
  }
  if (str_eq(word, EL_STR("man"))) {
    return EL_STR("men");
  }
  if (str_eq(word, EL_STR("woman"))) {
    return EL_STR("women");
  }
  if (str_eq(word, EL_STR("tooth"))) {
    return EL_STR("teeth");
  }
  if (str_eq(word, EL_STR("foot"))) {
    return EL_STR("feet");
  }
  if (str_eq(word, EL_STR("goose"))) {
    return EL_STR("geese");
  }
  if (str_eq(word, EL_STR("mouse"))) {
    return EL_STR("mice");
  }
  if (str_eq(word, EL_STR("louse"))) {
    return EL_STR("lice");
  }
  if (str_eq(word, EL_STR("ox"))) {
    return EL_STR("oxen");
  }
  if (str_eq(word, EL_STR("person"))) {
    return EL_STR("people");
  }
  if (str_eq(word, EL_STR("leaf"))) {
    return EL_STR("leaves");
  }
  if (str_eq(word, EL_STR("loaf"))) {
    return EL_STR("loaves");
  }
  if (str_eq(word, EL_STR("wolf"))) {
    return EL_STR("wolves");
  }
  if (str_eq(word, EL_STR("life"))) {
    return EL_STR("lives");
  }
  if (str_eq(word, EL_STR("knife"))) {
    return EL_STR("knives");
  }
  if (str_eq(word, EL_STR("wife"))) {
    return EL_STR("wives");
  }
  if (str_eq(word, EL_STR("half"))) {
    return EL_STR("halves");
  }
  if (str_eq(word, EL_STR("self"))) {
    return EL_STR("selves");
  }
  if (str_eq(word, EL_STR("elf"))) {
    return EL_STR("elves");
  }
  if (str_eq(word, EL_STR("shelf"))) {
    return EL_STR("shelves");
  }
  if (str_eq(word, EL_STR("fish"))) {
    return EL_STR("fish");
  }
  if (str_eq(word, EL_STR("sheep"))) {
    return EL_STR("sheep");
  }
  if (str_eq(word, EL_STR("deer"))) {
    return EL_STR("deer");
  }
  if (str_eq(word, EL_STR("moose"))) {
    return EL_STR("moose");
  }
  if (str_eq(word, EL_STR("series"))) {
    return EL_STR("series");
  }
  if (str_eq(word, EL_STR("species"))) {
    return EL_STR("species");
  }
  return EL_STR("");
  return 0;
}

el_val_t en_irregular_singular(el_val_t word) {
  if (str_eq(word, EL_STR("children"))) {
    return EL_STR("child");
  }
  if (str_eq(word, EL_STR("men"))) {
    return EL_STR("man");
  }
  if (str_eq(word, EL_STR("women"))) {
    return EL_STR("woman");
  }
  if (str_eq(word, EL_STR("teeth"))) {
    return EL_STR("tooth");
  }
  if (str_eq(word, EL_STR("feet"))) {
    return EL_STR("foot");
  }
  if (str_eq(word, EL_STR("geese"))) {
    return EL_STR("goose");
  }
  if (str_eq(word, EL_STR("mice"))) {
    return EL_STR("mouse");
  }
  if (str_eq(word, EL_STR("lice"))) {
    return EL_STR("louse");
  }
  if (str_eq(word, EL_STR("oxen"))) {
    return EL_STR("ox");
  }
  if (str_eq(word, EL_STR("people"))) {
    return EL_STR("person");
  }
  if (str_eq(word, EL_STR("leaves"))) {
    return EL_STR("leaf");
  }
  if (str_eq(word, EL_STR("wolves"))) {
    return EL_STR("wolf");
  }
  if (str_eq(word, EL_STR("lives"))) {
    return EL_STR("life");
  }
  if (str_eq(word, EL_STR("knives"))) {
    return EL_STR("knife");
  }
  if (str_eq(word, EL_STR("wives"))) {
    return EL_STR("wife");
  }
  if (str_eq(word, EL_STR("halves"))) {
    return EL_STR("half");
  }
  if (str_eq(word, EL_STR("selves"))) {
    return EL_STR("self");
  }
  if (str_eq(word, EL_STR("elves"))) {
    return EL_STR("elf");
  }
  if (str_eq(word, EL_STR("shelves"))) {
    return EL_STR("shelf");
  }
  if (str_eq(word, EL_STR("fish"))) {
    return EL_STR("fish");
  }
  if (str_eq(word, EL_STR("sheep"))) {
    return EL_STR("sheep");
  }
  if (str_eq(word, EL_STR("deer"))) {
    return EL_STR("deer");
  }
  if (str_eq(word, EL_STR("moose"))) {
    return EL_STR("moose");
  }
  if (str_eq(word, EL_STR("series"))) {
    return EL_STR("series");
  }
  if (str_eq(word, EL_STR("species"))) {
    return EL_STR("species");
  }
  return EL_STR("");
  return 0;
}

el_val_t en_irregular_verb(el_val_t base) {
  el_val_t empty = el_list_empty();
  if (str_eq(base, EL_STR("be"))) {
    el_val_t r = el_list_new(5, EL_STR("be"), EL_STR("is"), EL_STR("was"), EL_STR("been"), EL_STR("being"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("have"))) {
    el_val_t r = el_list_new(5, EL_STR("have"), EL_STR("has"), EL_STR("had"), EL_STR("had"), EL_STR("having"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("do"))) {
    el_val_t r = el_list_new(5, EL_STR("do"), EL_STR("does"), EL_STR("did"), EL_STR("done"), EL_STR("doing"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("go"))) {
    el_val_t r = el_list_new(5, EL_STR("go"), EL_STR("goes"), EL_STR("went"), EL_STR("gone"), EL_STR("going"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("say"))) {
    el_val_t r = el_list_new(5, EL_STR("say"), EL_STR("says"), EL_STR("said"), EL_STR("said"), EL_STR("saying"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("make"))) {
    el_val_t r = el_list_new(5, EL_STR("make"), EL_STR("makes"), EL_STR("made"), EL_STR("made"), EL_STR("making"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("know"))) {
    el_val_t r = el_list_new(5, EL_STR("know"), EL_STR("knows"), EL_STR("knew"), EL_STR("known"), EL_STR("knowing"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("take"))) {
    el_val_t r = el_list_new(5, EL_STR("take"), EL_STR("takes"), EL_STR("took"), EL_STR("taken"), EL_STR("taking"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("see"))) {
    el_val_t r = el_list_new(5, EL_STR("see"), EL_STR("sees"), EL_STR("saw"), EL_STR("seen"), EL_STR("seeing"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("come"))) {
    el_val_t r = el_list_new(5, EL_STR("come"), EL_STR("comes"), EL_STR("came"), EL_STR("come"), EL_STR("coming"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("think"))) {
    el_val_t r = el_list_new(5, EL_STR("think"), EL_STR("thinks"), EL_STR("thought"), EL_STR("thought"), EL_STR("thinking"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("get"))) {
    el_val_t r = el_list_new(5, EL_STR("get"), EL_STR("gets"), EL_STR("got"), EL_STR("gotten"), EL_STR("getting"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("give"))) {
    el_val_t r = el_list_new(5, EL_STR("give"), EL_STR("gives"), EL_STR("gave"), EL_STR("given"), EL_STR("giving"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("find"))) {
    el_val_t r = el_list_new(5, EL_STR("find"), EL_STR("finds"), EL_STR("found"), EL_STR("found"), EL_STR("finding"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("tell"))) {
    el_val_t r = el_list_new(5, EL_STR("tell"), EL_STR("tells"), EL_STR("told"), EL_STR("told"), EL_STR("telling"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("become"))) {
    el_val_t r = el_list_new(5, EL_STR("become"), EL_STR("becomes"), EL_STR("became"), EL_STR("become"), EL_STR("becoming"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("leave"))) {
    el_val_t r = el_list_new(5, EL_STR("leave"), EL_STR("leaves"), EL_STR("left"), EL_STR("left"), EL_STR("leaving"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("feel"))) {
    el_val_t r = el_list_new(5, EL_STR("feel"), EL_STR("feels"), EL_STR("felt"), EL_STR("felt"), EL_STR("feeling"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("put"))) {
    el_val_t r = el_list_new(5, EL_STR("put"), EL_STR("puts"), EL_STR("put"), EL_STR("put"), EL_STR("putting"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("bring"))) {
    el_val_t r = el_list_new(5, EL_STR("bring"), EL_STR("brings"), EL_STR("brought"), EL_STR("brought"), EL_STR("bringing"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("begin"))) {
    el_val_t r = el_list_new(5, EL_STR("begin"), EL_STR("begins"), EL_STR("began"), EL_STR("begun"), EL_STR("beginning"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("keep"))) {
    el_val_t r = el_list_new(5, EL_STR("keep"), EL_STR("keeps"), EL_STR("kept"), EL_STR("kept"), EL_STR("keeping"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("hold"))) {
    el_val_t r = el_list_new(5, EL_STR("hold"), EL_STR("holds"), EL_STR("held"), EL_STR("held"), EL_STR("holding"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("write"))) {
    el_val_t r = el_list_new(5, EL_STR("write"), EL_STR("writes"), EL_STR("wrote"), EL_STR("written"), EL_STR("writing"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("stand"))) {
    el_val_t r = el_list_new(5, EL_STR("stand"), EL_STR("stands"), EL_STR("stood"), EL_STR("stood"), EL_STR("standing"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("hear"))) {
    el_val_t r = el_list_new(5, EL_STR("hear"), EL_STR("hears"), EL_STR("heard"), EL_STR("heard"), EL_STR("hearing"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("let"))) {
    el_val_t r = el_list_new(5, EL_STR("let"), EL_STR("lets"), EL_STR("let"), EL_STR("let"), EL_STR("letting"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("run"))) {
    el_val_t r = el_list_new(5, EL_STR("run"), EL_STR("runs"), EL_STR("ran"), EL_STR("run"), EL_STR("running"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("meet"))) {
    el_val_t r = el_list_new(5, EL_STR("meet"), EL_STR("meets"), EL_STR("met"), EL_STR("met"), EL_STR("meeting"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("sit"))) {
    el_val_t r = el_list_new(5, EL_STR("sit"), EL_STR("sits"), EL_STR("sat"), EL_STR("sat"), EL_STR("sitting"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("send"))) {
    el_val_t r = el_list_new(5, EL_STR("send"), EL_STR("sends"), EL_STR("sent"), EL_STR("sent"), EL_STR("sending"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("speak"))) {
    el_val_t r = el_list_new(5, EL_STR("speak"), EL_STR("speaks"), EL_STR("spoke"), EL_STR("spoken"), EL_STR("speaking"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("buy"))) {
    el_val_t r = el_list_new(5, EL_STR("buy"), EL_STR("buys"), EL_STR("bought"), EL_STR("bought"), EL_STR("buying"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("pay"))) {
    el_val_t r = el_list_new(5, EL_STR("pay"), EL_STR("pays"), EL_STR("paid"), EL_STR("paid"), EL_STR("paying"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("read"))) {
    el_val_t r = el_list_new(5, EL_STR("read"), EL_STR("reads"), EL_STR("read"), EL_STR("read"), EL_STR("reading"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("win"))) {
    el_val_t r = el_list_new(5, EL_STR("win"), EL_STR("wins"), EL_STR("won"), EL_STR("won"), EL_STR("winning"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("eat"))) {
    el_val_t r = el_list_new(5, EL_STR("eat"), EL_STR("eats"), EL_STR("ate"), EL_STR("eaten"), EL_STR("eating"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("fall"))) {
    el_val_t r = el_list_new(5, EL_STR("fall"), EL_STR("falls"), EL_STR("fell"), EL_STR("fallen"), EL_STR("falling"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("sleep"))) {
    el_val_t r = el_list_new(5, EL_STR("sleep"), EL_STR("sleeps"), EL_STR("slept"), EL_STR("slept"), EL_STR("sleeping"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("drive"))) {
    el_val_t r = el_list_new(5, EL_STR("drive"), EL_STR("drives"), EL_STR("drove"), EL_STR("driven"), EL_STR("driving"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("build"))) {
    el_val_t r = el_list_new(5, EL_STR("build"), EL_STR("builds"), EL_STR("built"), EL_STR("built"), EL_STR("building"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("cut"))) {
    el_val_t r = el_list_new(5, EL_STR("cut"), EL_STR("cuts"), EL_STR("cut"), EL_STR("cut"), EL_STR("cutting"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("set"))) {
    el_val_t r = el_list_new(5, EL_STR("set"), EL_STR("sets"), EL_STR("set"), EL_STR("set"), EL_STR("setting"));
    EL_NULL;
    return r;
  }
  if (str_eq(base, EL_STR("hit"))) {
    el_val_t r = el_list_new(5, EL_STR("hit"), EL_STR("hits"), EL_STR("hit"), EL_STR("hit"), EL_STR("hitting"));
    EL_NULL;
    return r;
  }
  return empty;
  return 0;
}

el_val_t en_verb_3sg(el_val_t base) {
  if (str_ends(base, EL_STR("s"))) {
    return el_str_concat(base, EL_STR("es"));
  }
  if (str_ends(base, EL_STR("x"))) {
    return el_str_concat(base, EL_STR("es"));
  }
  if (str_ends(base, EL_STR("z"))) {
    return el_str_concat(base, EL_STR("es"));
  }
  if (str_ends(base, EL_STR("ch"))) {
    return el_str_concat(base, EL_STR("es"));
  }
  if (str_ends(base, EL_STR("sh"))) {
    return el_str_concat(base, EL_STR("es"));
  }
  el_val_t last = str_last_char(base);
  if (str_eq(last, EL_STR("y"))) {
    el_val_t prev = str_drop_last(base, 1);
    el_val_t prev_last = str_last_char(prev);
    if (!is_vowel(prev_last)) {
      return el_str_concat(prev, EL_STR("ies"));
    }
  }
  return el_str_concat(base, EL_STR("s"));
  return 0;
}

el_val_t en_should_double_final(el_val_t base) {
  el_val_t n = str_len(base);
  if (n < 3) {
    return 0;
  }
  el_val_t c3 = str_slice(base, (n - 3), (n - 2));
  el_val_t c2 = str_slice(base, (n - 2), (n - 1));
  el_val_t c1 = str_slice(base, (n - 1), n);
  if (!is_vowel(c3)) {
    if (is_vowel(c2)) {
      if (!is_vowel(c1)) {
        if (!str_eq(c1, EL_STR("w"))) {
          if (!str_eq(c1, EL_STR("x"))) {
            if (!str_eq(c1, EL_STR("y"))) {
              return 1;
            }
          }
        }
      }
    }
  }
  return 0;
  return 0;
}

el_val_t en_verb_past(el_val_t base) {
  if (str_ends(base, EL_STR("e"))) {
    return el_str_concat(base, EL_STR("d"));
  }
  el_val_t last = str_last_char(base);
  if (str_eq(last, EL_STR("y"))) {
    el_val_t prev = str_drop_last(base, 1);
    el_val_t prev_last = str_last_char(prev);
    if (!is_vowel(prev_last)) {
      return el_str_concat(prev, EL_STR("ied"));
    }
  }
  if (en_should_double_final(base)) {
    return el_str_concat(el_str_concat(base, last), EL_STR("ed"));
  }
  return el_str_concat(base, EL_STR("ed"));
  return 0;
}

el_val_t en_verb_gerund(el_val_t base) {
  if (str_ends(base, EL_STR("ie"))) {
    return el_str_concat(str_drop_last(base, 2), EL_STR("ying"));
  }
  if (str_ends(base, EL_STR("e"))) {
    if (!str_ends(base, EL_STR("ee"))) {
      return el_str_concat(str_drop_last(base, 1), EL_STR("ing"));
    }
  }
  el_val_t last = str_last_char(base);
  if (en_should_double_final(base)) {
    return el_str_concat(el_str_concat(base, last), EL_STR("ing"));
  }
  return el_str_concat(base, EL_STR("ing"));
  return 0;
}

el_val_t en_pluralize_regular(el_val_t singular) {
  if (str_ends(singular, EL_STR("s"))) {
    return el_str_concat(singular, EL_STR("es"));
  }
  if (str_ends(singular, EL_STR("x"))) {
    return el_str_concat(singular, EL_STR("es"));
  }
  if (str_ends(singular, EL_STR("z"))) {
    return el_str_concat(singular, EL_STR("es"));
  }
  if (str_ends(singular, EL_STR("ch"))) {
    return el_str_concat(singular, EL_STR("es"));
  }
  if (str_ends(singular, EL_STR("sh"))) {
    return el_str_concat(singular, EL_STR("es"));
  }
  el_val_t last = str_last_char(singular);
  if (str_eq(last, EL_STR("y"))) {
    el_val_t prev = str_drop_last(singular, 1);
    el_val_t prev_last = str_last_char(prev);
    if (!is_vowel(prev_last)) {
      return el_str_concat(prev, EL_STR("ies"));
    }
  }
  if (str_ends(singular, EL_STR("fe"))) {
    return el_str_concat(str_drop_last(singular, 2), EL_STR("ves"));
  }
  return el_str_concat(singular, EL_STR("s"));
  return 0;
}

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 irreg = en_irregular_verb(base);
  el_val_t is_irreg = 0;
  if (native_list_len(irreg) > 0) {
    is_irreg = 1;
  }
  if (str_eq(base, EL_STR("be"))) {
    if (str_eq(tense, EL_STR("present"))) {
      if (str_eq(number, EL_STR("plural"))) {
        return EL_STR("are");
      }
      if (str_eq(person, EL_STR("first"))) {
        return EL_STR("am");
      }
      if (str_eq(person, EL_STR("second"))) {
        return EL_STR("are");
      }
      return EL_STR("is");
    }
    if (str_eq(tense, EL_STR("past"))) {
      if (str_eq(number, EL_STR("plural"))) {
        return EL_STR("were");
      }
      if (str_eq(person, EL_STR("second"))) {
        return EL_STR("were");
      }
      return EL_STR("was");
    }
    if (str_eq(tense, EL_STR("future"))) {
      return EL_STR("will be");
    }
    if (str_eq(tense, EL_STR("perfect"))) {
      return EL_STR("been");
    }
    if (str_eq(tense, EL_STR("progressive"))) {
      return EL_STR("being");
    }
    return EL_STR("be");
  }
  if (str_eq(tense, EL_STR("present"))) {
    if (str_eq(person, EL_STR("third"))) {
      if (str_eq(number, EL_STR("singular"))) {
        if (is_irreg) {
          return native_list_get(irreg, 1);
        }
        return en_verb_3sg(base);
      }
    }
    return base;
  }
  if (str_eq(tense, EL_STR("past"))) {
    if (is_irreg) {
      return native_list_get(irreg, 2);
    }
    return en_verb_past(base);
  }
  if (str_eq(tense, EL_STR("future"))) {
    return el_str_concat(EL_STR("will "), base);
  }
  if (str_eq(tense, EL_STR("perfect"))) {
    if (is_irreg) {
      return native_list_get(irreg, 3);
    }
    return en_verb_past(base);
  }
  if (str_eq(tense, EL_STR("progressive"))) {
    if (is_irreg) {
      return native_list_get(irreg, 4);
    }
    return en_verb_gerund(base);
  }
  return base;
  return 0;
}

el_val_t agree_determiner(el_val_t det, el_val_t noun) {
  if (str_eq(det, EL_STR("a"))) {
    el_val_t first = str_slice(noun, 0, 1);
    el_val_t fl = str_to_lower(first);
    if (is_vowel(fl)) {
      return EL_STR("an");
    }
    return EL_STR("a");
  }
  return det;
  return 0;
}

el_val_t morph_pluralize(el_val_t noun, el_val_t profile) {
  el_val_t mtype = lang_get(profile, EL_STR("morph_type"));
  el_val_t code = lang_get(profile, EL_STR("code"));
  if (str_eq(code, EL_STR("es"))) {
    return es_pluralize(noun);
  }
  if (str_eq(code, EL_STR("fr"))) {
    return fr_pluralize(noun);
  }
  if (str_eq(code, EL_STR("de"))) {
    return de_noun_plural(noun, EL_STR("unknown"));
  }
  if (str_eq(code, EL_STR("ru"))) {
    return ru_noun_case(noun, EL_STR("m"), EL_STR("nom"), EL_STR("pl"));
  }
  if (str_eq(code, EL_STR("ja"))) {
    return noun;
  }
  if (str_eq(code, EL_STR("fi"))) {
    return fi_apply_case(noun, EL_STR("nom"), EL_STR("pl"));
  }
  if (str_eq(code, EL_STR("ar"))) {
    return ar_sound_plural(noun, EL_STR("m"));
  }
  if (str_eq(code, EL_STR("hi"))) {
    return hi_noun_direct(noun, hi_gender(noun), EL_STR("pl"));
  }
  if (str_eq(code, EL_STR("sw"))) {
    return sw_noun_plural(noun);
  }
  if (str_eq(mtype, EL_STR("isolating"))) {
    return noun;
  }
  if (str_eq(mtype, EL_STR("agglutinative"))) {
    return noun;
  }
  if (str_eq(mtype, EL_STR("fusional"))) {
    if (str_eq(code, EL_STR("en"))) {
      el_val_t irreg = en_irregular_plural(noun);
      if (!str_eq(irreg, EL_STR(""))) {
        return irreg;
      }
      return en_pluralize_regular(noun);
    }
    return noun;
  }
  return noun;
  return 0;
}

el_val_t morph_map_canonical(el_val_t verb, el_val_t code) {
  if (str_eq(verb, EL_STR("be"))) {
    if (str_eq(code, EL_STR("es"))) {
      return EL_STR("ser");
    }
    if (str_eq(code, EL_STR("fr"))) {
      return EL_STR("etre");
    }
    if (str_eq(code, EL_STR("de"))) {
      return EL_STR("sein");
    }
    if (str_eq(code, EL_STR("fi"))) {
      return EL_STR("olla");
    }
    if (str_eq(code, EL_STR("ru"))) {
      return EL_STR("byt");
    }
    if (str_eq(code, EL_STR("sw"))) {
      return EL_STR("kuwa");
    }
  }
  return verb;
  return 0;
}

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 mtype = lang_get(profile, EL_STR("morph_type"));
  el_val_t code = lang_get(profile, EL_STR("code"));
  verb = morph_map_canonical(verb, code);
  if (str_eq(code, EL_STR("es"))) {
    return es_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("fr"))) {
    return fr_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("de"))) {
    return de_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("ru"))) {
    return ru_conjugate(verb, tense, person, number, EL_STR("unknown"));
  }
  if (str_eq(code, EL_STR("ja"))) {
    return ja_conjugate(verb, EL_STR("present"));
  }
  if (str_eq(code, EL_STR("fi"))) {
    return fi_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("ar"))) {
    return ar_conjugate(verb, tense, person, EL_STR("m"), number);
  }
  if (str_eq(code, EL_STR("hi"))) {
    return hi_conjugate(verb, tense, person, EL_STR("m"), number);
  }
  if (str_eq(code, EL_STR("sw"))) {
    return sw_conjugate(verb, person, number, EL_STR("1"), tense);
  }
  if (str_eq(code, EL_STR("la"))) {
    return la_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("he"))) {
    return he_conjugate(verb, tense, person, EL_STR("m"), number);
  }
  if (str_eq(code, EL_STR("grc"))) {
    return grc_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("ang"))) {
    return ang_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("sa"))) {
    return sa_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("got"))) {
    return got_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("non"))) {
    return non_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("enm"))) {
    return enm_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("pi"))) {
    return pi_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("fro"))) {
    return fro_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("goh"))) {
    return goh_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("sga"))) {
    return sga_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("txb"))) {
    return txb_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("peo"))) {
    return peo_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("akk"))) {
    return akk_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("uga"))) {
    return uga_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("egy"))) {
    return egy_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("sux"))) {
    return sux_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("gez"))) {
    return gez_conjugate(verb, tense, person, number);
  }
  if (str_eq(code, EL_STR("cop"))) {
    return cop_conjugate(verb, tense, person, number);
  }
  if (str_eq(mtype, EL_STR("isolating"))) {
    return verb;
  }
  if (str_eq(mtype, EL_STR("agglutinative"))) {
    return verb;
  }
  if (str_eq(mtype, EL_STR("fusional"))) {
    if (str_eq(code, EL_STR("en"))) {
      return en_verb_form(verb, tense, person, number);
    }
    return verb;
  }
  return verb;
  return 0;
}

el_val_t morph_inflect(el_val_t word, el_val_t features, el_val_t profile) {
  el_val_t n = str_len(features);
  if (n == 0) {
    return word;
  }
  el_val_t i = 0;
  el_val_t running = 1;
  while (running) {
    if (i >= n) {
      running = 0;
    } else {
      el_val_t c = str_slice(features, i, (i + 1));
      if (str_eq(c, EL_STR(";"))) {
        running = 0;
      } else {
        i = (i + 1);
      }
    }
  }
  el_val_t first_feat = str_slice(features, 0, i);
  if (str_eq(first_feat, EL_STR("plural"))) {
    return morph_pluralize(word, profile);
  }
  if (i < n) {
    el_val_t rest = str_slice(features, (i + 1), n);
    el_val_t j = 0;
    el_val_t rn = str_len(rest);
    el_val_t running2 = 1;
    while (running2) {
      if (j >= rn) {
        running2 = 0;
      } else {
        el_val_t c = str_slice(rest, j, (j + 1));
        if (str_eq(c, EL_STR(";"))) {
          running2 = 0;
        } else {
          j = (j + 1);
        }
      }
    }
    el_val_t person = str_slice(rest, 0, j);
    el_val_t number = EL_STR("");
    if (j < rn) {
      number = str_slice(rest, (j + 1), rn);
    }
    return morph_conjugate(word, first_feat, person, number, profile);
  }
  return morph_conjugate(word, first_feat, EL_STR("third"), EL_STR("singular"), profile);
  return 0;
}

el_val_t pluralize(el_val_t singular) {
  return morph_pluralize(singular, lang_default());
  return 0;
}

el_val_t singularize(el_val_t plural) {
  el_val_t irreg = en_irregular_singular(plural);
  if (!str_eq(irreg, EL_STR(""))) {
    return irreg;
  }
  if (str_ends(plural, EL_STR("ies"))) {
    return el_str_concat(str_drop_last(plural, 3), EL_STR("y"));
  }
  if (str_ends(plural, EL_STR("ves"))) {
    el_val_t stem = str_drop_last(plural, 3);
    el_val_t last_stem = str_last_char(stem);
    if (str_eq(last_stem, EL_STR("i"))) {
      return el_str_concat(stem, EL_STR("fe"));
    }
    return el_str_concat(stem, EL_STR("f"));
  }
  if (str_ends(plural, EL_STR("ches"))) {
    return str_drop_last(plural, 2);
  }
  if (str_ends(plural, EL_STR("shes"))) {
    return str_drop_last(plural, 2);
  }
  if (str_ends(plural, EL_STR("xes"))) {
    return str_drop_last(plural, 2);
  }
  if (str_ends(plural, EL_STR("zes"))) {
    return str_drop_last(plural, 2);
  }
  if (str_ends(plural, EL_STR("ses"))) {
    return str_drop_last(plural, 2);
  }
  if (str_ends(plural, EL_STR("s"))) {
    return str_drop_last(plural, 1);
  }
  return plural;
  return 0;
}

el_val_t verb_form(el_val_t base, el_val_t tense, el_val_t person, el_val_t number) {
  return morph_conjugate(base, tense, person, number, lang_default());
  return 0;
}

el_val_t irregular_plural(el_val_t word) {
  return en_irregular_plural(word);
  return 0;
}

el_val_t irregular_singular(el_val_t word) {
  return en_irregular_singular(word);
  return 0;
}

