#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 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 ar_str_ends(el_val_t s, el_val_t suf) {
  return str_ends_with(s, suf);
  return 0;
}

el_val_t ar_str_len(el_val_t s) {
  return str_len(s);
  return 0;
}

el_val_t ar_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 ar_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 ar_slot(el_val_t person, el_val_t gender, el_val_t number) {
  if (str_eq(person, EL_STR("third"))) {
    if (str_eq(number, EL_STR("singular"))) {
      if (str_eq(gender, EL_STR("f"))) {
        return 1;
      }
      return 0;
    }
    if (str_eq(gender, EL_STR("f"))) {
      return 6;
    }
    return 5;
  }
  if (str_eq(person, EL_STR("second"))) {
    if (str_eq(number, EL_STR("singular"))) {
      if (str_eq(gender, EL_STR("f"))) {
        return 3;
      }
      return 2;
    }
    if (str_eq(gender, EL_STR("f"))) {
      return 8;
    }
    return 7;
  }
  if (str_eq(number, EL_STR("plural"))) {
    return 9;
  }
  return 4;
  return 0;
}

el_val_t ar_perfect_suffix(el_val_t slot) {
  if (slot == 0) {
    return EL_STR("");
  }
  if (slot == 1) {
    return EL_STR("\xd8\xaa");
  }
  if (slot == 2) {
    return EL_STR("\xd8\xaa\xd9\x8e");
  }
  if (slot == 3) {
    return EL_STR("\xd8\xaa\xd9\x90");
  }
  if (slot == 4) {
    return EL_STR("\xd8\xaa\xd9\x8f");
  }
  if (slot == 5) {
    return EL_STR("\xd9\x88\xd8\xa7");
  }
  if (slot == 6) {
    return EL_STR("\xd9\x86\xd9\x8e");
  }
  if (slot == 7) {
    return EL_STR("\xd8\xaa\xd9\x8f\xd9\x85\xd9\x92");
  }
  if (slot == 8) {
    return EL_STR("\xd8\xaa\xd9\x8f\xd9\x86\xd9\x8e\xd9\x91");
  }
  return EL_STR("\xd9\x86\xd9\x8e\xd8\xa7");
  return 0;
}

el_val_t ar_imperfect_prefix(el_val_t slot) {
  if (slot == 0) {
    return EL_STR("\xd9\x8a\xd9\x8e");
  }
  if (slot == 1) {
    return EL_STR("\xd8\xaa\xd9\x8e");
  }
  if (slot == 2) {
    return EL_STR("\xd8\xaa\xd9\x8e");
  }
  if (slot == 3) {
    return EL_STR("\xd8\xaa\xd9\x8e");
  }
  if (slot == 4) {
    return EL_STR("\xd8\xa3\xd9\x8e");
  }
  if (slot == 5) {
    return EL_STR("\xd9\x8a\xd9\x8e");
  }
  if (slot == 6) {
    return EL_STR("\xd9\x8a\xd9\x8e");
  }
  if (slot == 7) {
    return EL_STR("\xd8\xaa\xd9\x8e");
  }
  if (slot == 8) {
    return EL_STR("\xd8\xaa\xd9\x8e");
  }
  return EL_STR("\xd9\x86\xd9\x8e");
  return 0;
}

el_val_t ar_imperfect_suffix(el_val_t slot) {
  if (slot == 0) {
    return EL_STR("\xd9\x8f");
  }
  if (slot == 1) {
    return EL_STR("\xd9\x8f");
  }
  if (slot == 2) {
    return EL_STR("\xd9\x8f");
  }
  if (slot == 3) {
    return EL_STR("\xd9\x90\xd9\x8a\xd9\x86\xd9\x8e");
  }
  if (slot == 4) {
    return EL_STR("\xd9\x8f");
  }
  if (slot == 5) {
    return EL_STR("\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
  }
  if (slot == 6) {
    return EL_STR("\xd9\x86\xd9\x8e");
  }
  if (slot == 7) {
    return EL_STR("\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
  }
  if (slot == 8) {
    return EL_STR("\xd9\x86\xd9\x8e");
  }
  return EL_STR("\xd9\x8f");
  return 0;
}

el_val_t ar_conjugate_form1(el_val_t past_base, el_val_t present_stem, el_val_t tense, el_val_t slot) {
  if (str_eq(tense, EL_STR("past"))) {
    if (slot == 0) {
      return past_base;
    }
    el_val_t suf = ar_perfect_suffix(slot);
    el_val_t stem = ar_str_drop_last(past_base, 1);
    return el_str_concat(stem, suf);
  }
  if (str_eq(tense, EL_STR("present"))) {
    el_val_t pre = ar_imperfect_prefix(slot);
    el_val_t suf = ar_imperfect_suffix(slot);
    el_val_t mid = ar_str_drop_last(present_stem, 1);
    return el_str_concat(el_str_concat(pre, mid), suf);
  }
  if (str_eq(tense, EL_STR("future"))) {
    el_val_t pres_3ms = ar_conjugate_form1(past_base, present_stem, EL_STR("present"), 0);
    return el_str_concat(EL_STR("\xd8\xb3\xd9\x8e"), pres_3ms);
  }
  return past_base;
  return 0;
}

el_val_t ar_irregular_kaana(el_val_t slot, el_val_t tense) {
  if (str_eq(tense, EL_STR("past"))) {
    if (slot == 0) {
      return EL_STR("\xd9\x83\xd9\x8e\xd8\xa7\xd9\x86\xd9\x8e");
    }
    if (slot == 1) {
      return EL_STR("\xd9\x83\xd9\x8e\xd8\xa7\xd9\x86\xd9\x8e\xd8\xaa\xd9\x92");
    }
    if (slot == 2) {
      return EL_STR("\xd9\x83\xd9\x8f\xd9\x86\xd9\x92\xd8\xaa\xd9\x8e");
    }
    if (slot == 3) {
      return EL_STR("\xd9\x83\xd9\x8f\xd9\x86\xd9\x92\xd8\xaa\xd9\x90");
    }
    if (slot == 4) {
      return EL_STR("\xd9\x83\xd9\x8f\xd9\x86\xd9\x92\xd8\xaa\xd9\x8f");
    }
    if (slot == 5) {
      return EL_STR("\xd9\x83\xd9\x8e\xd8\xa7\xd9\x86\xd9\x8f\xd9\x88\xd8\xa7");
    }
    if (slot == 6) {
      return EL_STR("\xd9\x83\xd9\x8f\xd9\x86\xd9\x8e\xd9\x91");
    }
    if (slot == 7) {
      return EL_STR("\xd9\x83\xd9\x8f\xd9\x86\xd9\x92\xd8\xaa\xd9\x8f\xd9\x85\xd9\x92");
    }
    if (slot == 8) {
      return EL_STR("\xd9\x83\xd9\x8f\xd9\x86\xd9\x92\xd8\xaa\xd9\x8f\xd9\x86\xd9\x8e\xd9\x91");
    }
    return EL_STR("\xd9\x83\xd9\x8f\xd9\x86\xd9\x8e\xd9\x91\xd8\xa7");
  }
  if (str_eq(tense, EL_STR("present"))) {
    if (slot == 0) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd9\x83\xd9\x8f\xd9\x88\xd9\x86\xd9\x8f");
    }
    if (slot == 1) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd9\x83\xd9\x8f\xd9\x88\xd9\x86\xd9\x8f");
    }
    if (slot == 2) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd9\x83\xd9\x8f\xd9\x88\xd9\x86\xd9\x8f");
    }
    if (slot == 3) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd9\x83\xd9\x8f\xd9\x88\xd9\x86\xd9\x90\xd9\x8a\xd9\x86\xd9\x8e");
    }
    if (slot == 4) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd9\x83\xd9\x8f\xd9\x88\xd9\x86\xd9\x8f");
    }
    if (slot == 5) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd9\x83\xd9\x8f\xd9\x88\xd9\x86\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
    }
    if (slot == 6) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd9\x83\xd9\x8f\xd9\x86\xd9\x8e\xd9\x91");
    }
    if (slot == 7) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd9\x83\xd9\x8f\xd9\x88\xd9\x86\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
    }
    if (slot == 8) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd9\x83\xd9\x8f\xd9\x86\xd9\x8e\xd9\x91");
    }
    return EL_STR("\xd9\x86\xd9\x8e\xd9\x83\xd9\x8f\xd9\x88\xd9\x86\xd9\x8f");
  }
  if (str_eq(tense, EL_STR("future"))) {
    el_val_t pres = ar_irregular_kaana(slot, EL_STR("present"));
    return el_str_concat(EL_STR("\xd8\xb3\xd9\x8e"), pres);
  }
  return EL_STR("\xd9\x83\xd9\x8e\xd8\xa7\xd9\x86\xd9\x8e");
  return 0;
}

el_val_t ar_irregular_qaala(el_val_t slot, el_val_t tense) {
  if (str_eq(tense, EL_STR("past"))) {
    if (slot == 0) {
      return EL_STR("\xd9\x82\xd9\x8e\xd8\xa7\xd9\x84\xd9\x8e");
    }
    if (slot == 1) {
      return EL_STR("\xd9\x82\xd9\x8e\xd8\xa7\xd9\x84\xd9\x8e\xd8\xaa\xd9\x92");
    }
    if (slot == 2) {
      return EL_STR("\xd9\x82\xd9\x8f\xd9\x84\xd9\x92\xd8\xaa\xd9\x8e");
    }
    if (slot == 3) {
      return EL_STR("\xd9\x82\xd9\x8f\xd9\x84\xd9\x92\xd8\xaa\xd9\x90");
    }
    if (slot == 4) {
      return EL_STR("\xd9\x82\xd9\x8f\xd9\x84\xd9\x92\xd8\xaa\xd9\x8f");
    }
    if (slot == 5) {
      return EL_STR("\xd9\x82\xd9\x8e\xd8\xa7\xd9\x84\xd9\x8f\xd9\x88\xd8\xa7");
    }
    if (slot == 6) {
      return EL_STR("\xd9\x82\xd9\x8f\xd9\x84\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 7) {
      return EL_STR("\xd9\x82\xd9\x8f\xd9\x84\xd9\x92\xd8\xaa\xd9\x8f\xd9\x85\xd9\x92");
    }
    if (slot == 8) {
      return EL_STR("\xd9\x82\xd9\x8f\xd9\x84\xd9\x92\xd8\xaa\xd9\x8f\xd9\x86\xd9\x8e\xd9\x91");
    }
    return EL_STR("\xd9\x82\xd9\x8f\xd9\x84\xd9\x92\xd9\x86\xd9\x8e\xd8\xa7");
  }
  if (str_eq(tense, EL_STR("present"))) {
    if (slot == 0) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd9\x82\xd9\x8f\xd9\x88\xd9\x84\xd9\x8f");
    }
    if (slot == 1) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd9\x82\xd9\x8f\xd9\x88\xd9\x84\xd9\x8f");
    }
    if (slot == 2) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd9\x82\xd9\x8f\xd9\x88\xd9\x84\xd9\x8f");
    }
    if (slot == 3) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd9\x82\xd9\x8f\xd9\x88\xd9\x84\xd9\x90\xd9\x8a\xd9\x86\xd9\x8e");
    }
    if (slot == 4) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd9\x82\xd9\x8f\xd9\x88\xd9\x84\xd9\x8f");
    }
    if (slot == 5) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd9\x82\xd9\x8f\xd9\x88\xd9\x84\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
    }
    if (slot == 6) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd9\x82\xd9\x8f\xd9\x84\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 7) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd9\x82\xd9\x8f\xd9\x88\xd9\x84\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
    }
    if (slot == 8) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd9\x82\xd9\x8f\xd9\x84\xd9\x92\xd9\x86\xd9\x8e");
    }
    return EL_STR("\xd9\x86\xd9\x8e\xd9\x82\xd9\x8f\xd9\x88\xd9\x84\xd9\x8f");
  }
  if (str_eq(tense, EL_STR("future"))) {
    el_val_t pres = ar_irregular_qaala(slot, EL_STR("present"));
    return el_str_concat(EL_STR("\xd8\xb3\xd9\x8e"), pres);
  }
  return EL_STR("\xd9\x82\xd9\x8e\xd8\xa7\xd9\x84\xd9\x8e");
  return 0;
}

el_val_t ar_irregular_jaa(el_val_t slot, el_val_t tense) {
  if (str_eq(tense, EL_STR("past"))) {
    if (slot == 0) {
      return EL_STR("\xd8\xac\xd9\x8e\xd8\xa7\xd8\xa1\xd9\x8e");
    }
    if (slot == 1) {
      return EL_STR("\xd8\xac\xd9\x8e\xd8\xa7\xd8\xa1\xd9\x8e\xd8\xaa\xd9\x92");
    }
    if (slot == 2) {
      return EL_STR("\xd8\xac\xd9\x90\xd8\xa6\xd9\x92\xd8\xaa\xd9\x8e");
    }
    if (slot == 3) {
      return EL_STR("\xd8\xac\xd9\x90\xd8\xa6\xd9\x92\xd8\xaa\xd9\x90");
    }
    if (slot == 4) {
      return EL_STR("\xd8\xac\xd9\x90\xd8\xa6\xd9\x92\xd8\xaa\xd9\x8f");
    }
    if (slot == 5) {
      return EL_STR("\xd8\xac\xd9\x8e\xd8\xa7\xd8\xa1\xd9\x8f\xd9\x88\xd8\xa7");
    }
    if (slot == 6) {
      return EL_STR("\xd8\xac\xd9\x90\xd8\xa6\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 7) {
      return EL_STR("\xd8\xac\xd9\x90\xd8\xa6\xd9\x92\xd8\xaa\xd9\x8f\xd9\x85\xd9\x92");
    }
    if (slot == 8) {
      return EL_STR("\xd8\xac\xd9\x90\xd8\xa6\xd9\x92\xd8\xaa\xd9\x8f\xd9\x86\xd9\x8e\xd9\x91");
    }
    return EL_STR("\xd8\xac\xd9\x90\xd8\xa6\xd9\x92\xd9\x86\xd9\x8e\xd8\xa7");
  }
  if (str_eq(tense, EL_STR("present"))) {
    if (slot == 0) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd8\xac\xd9\x90\xd9\x8a\xd8\xa1\xd9\x8f");
    }
    if (slot == 1) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xac\xd9\x90\xd9\x8a\xd8\xa1\xd9\x8f");
    }
    if (slot == 2) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xac\xd9\x90\xd9\x8a\xd8\xa1\xd9\x8f");
    }
    if (slot == 3) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xac\xd9\x90\xd9\x8a\xd8\xa6\xd9\x90\xd9\x8a\xd9\x86\xd9\x8e");
    }
    if (slot == 4) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xac\xd9\x90\xd9\x8a\xd8\xa1\xd9\x8f");
    }
    if (slot == 5) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd8\xac\xd9\x90\xd9\x8a\xd8\xa6\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
    }
    if (slot == 6) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd8\xac\xd9\x90\xd8\xa6\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 7) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xac\xd9\x90\xd9\x8a\xd8\xa6\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
    }
    if (slot == 8) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xac\xd9\x90\xd8\xa6\xd9\x92\xd9\x86\xd9\x8e");
    }
    return EL_STR("\xd9\x86\xd9\x8e\xd8\xac\xd9\x90\xd9\x8a\xd8\xa1\xd9\x8f");
  }
  if (str_eq(tense, EL_STR("future"))) {
    el_val_t pres = ar_irregular_jaa(slot, EL_STR("present"));
    return el_str_concat(EL_STR("\xd8\xb3\xd9\x8e"), pres);
  }
  return EL_STR("\xd8\xac\xd9\x8e\xd8\xa7\xd8\xa1\xd9\x8e");
  return 0;
}

el_val_t ar_irregular_raaa(el_val_t slot, el_val_t tense) {
  if (str_eq(tense, EL_STR("past"))) {
    if (slot == 0) {
      return EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd9\x89");
    }
    if (slot == 1) {
      return EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd8\xaa\xd9\x92");
    }
    if (slot == 2) {
      return EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd9\x8a\xd9\x92\xd8\xaa\xd9\x8e");
    }
    if (slot == 3) {
      return EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd9\x8a\xd9\x92\xd8\xaa\xd9\x90");
    }
    if (slot == 4) {
      return EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd9\x8a\xd9\x92\xd8\xaa\xd9\x8f");
    }
    if (slot == 5) {
      return EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd9\x88\xd9\x92\xd8\xa7");
    }
    if (slot == 6) {
      return EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd9\x8a\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 7) {
      return EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd9\x8a\xd9\x92\xd8\xaa\xd9\x8f\xd9\x85\xd9\x92");
    }
    if (slot == 8) {
      return EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd9\x8a\xd9\x92\xd8\xaa\xd9\x8f\xd9\x86\xd9\x8e\xd9\x91");
    }
    return EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd9\x8a\xd9\x92\xd9\x86\xd9\x8e\xd8\xa7");
  }
  if (str_eq(tense, EL_STR("present"))) {
    if (slot == 0) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd8\xb1\xd9\x8e\xd9\x89");
    }
    if (slot == 1) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xb1\xd9\x8e\xd9\x89");
    }
    if (slot == 2) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xb1\xd9\x8e\xd9\x89");
    }
    if (slot == 3) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xb1\xd9\x8e\xd9\x8a\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 4) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd9\x89");
    }
    if (slot == 5) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd8\xb1\xd9\x8e\xd9\x88\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 6) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd8\xb1\xd9\x8e\xd9\x8a\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 7) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xb1\xd9\x8e\xd9\x88\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 8) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xb1\xd9\x8e\xd9\x8a\xd9\x92\xd9\x86\xd9\x8e");
    }
    return EL_STR("\xd9\x86\xd9\x8e\xd8\xb1\xd9\x8e\xd9\x89");
  }
  if (str_eq(tense, EL_STR("future"))) {
    el_val_t pres = ar_irregular_raaa(slot, EL_STR("present"));
    return el_str_concat(EL_STR("\xd8\xb3\xd9\x8e"), pres);
  }
  return EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd9\x89");
  return 0;
}

el_val_t ar_irregular_araada(el_val_t slot, el_val_t tense) {
  if (str_eq(tense, EL_STR("past"))) {
    if (slot == 0) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xa7\xd8\xaf\xd9\x8e");
    }
    if (slot == 1) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xa7\xd8\xaf\xd9\x8e\xd8\xaa\xd9\x92");
    }
    if (slot == 2) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xaf\xd9\x92\xd8\xaa\xd9\x8e");
    }
    if (slot == 3) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xaf\xd9\x92\xd8\xaa\xd9\x90");
    }
    if (slot == 4) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xaf\xd9\x92\xd8\xaa\xd9\x8f");
    }
    if (slot == 5) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xa7\xd8\xaf\xd9\x8f\xd9\x88\xd8\xa7");
    }
    if (slot == 6) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xaf\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 7) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xaf\xd9\x92\xd8\xaa\xd9\x8f\xd9\x85\xd9\x92");
    }
    if (slot == 8) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xaf\xd9\x92\xd8\xaa\xd9\x8f\xd9\x86\xd9\x8e\xd9\x91");
    }
    return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xaf\xd9\x92\xd9\x86\xd9\x8e\xd8\xa7");
  }
  if (str_eq(tense, EL_STR("present"))) {
    if (slot == 0) {
      return EL_STR("\xd9\x8a\xd9\x8f\xd8\xb1\xd9\x90\xd9\x8a\xd8\xaf\xd9\x8f");
    }
    if (slot == 1) {
      return EL_STR("\xd8\xaa\xd9\x8f\xd8\xb1\xd9\x90\xd9\x8a\xd8\xaf\xd9\x8f");
    }
    if (slot == 2) {
      return EL_STR("\xd8\xaa\xd9\x8f\xd8\xb1\xd9\x90\xd9\x8a\xd8\xaf\xd9\x8f");
    }
    if (slot == 3) {
      return EL_STR("\xd8\xaa\xd9\x8f\xd8\xb1\xd9\x90\xd9\x8a\xd8\xaf\xd9\x90\xd9\x8a\xd9\x86\xd9\x8e");
    }
    if (slot == 4) {
      return EL_STR("\xd8\xa3\xd9\x8f\xd8\xb1\xd9\x90\xd9\x8a\xd8\xaf\xd9\x8f");
    }
    if (slot == 5) {
      return EL_STR("\xd9\x8a\xd9\x8f\xd8\xb1\xd9\x90\xd9\x8a\xd8\xaf\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
    }
    if (slot == 6) {
      return EL_STR("\xd9\x8a\xd9\x8f\xd8\xb1\xd9\x90\xd8\xaf\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 7) {
      return EL_STR("\xd8\xaa\xd9\x8f\xd8\xb1\xd9\x90\xd9\x8a\xd8\xaf\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
    }
    if (slot == 8) {
      return EL_STR("\xd8\xaa\xd9\x8f\xd8\xb1\xd9\x90\xd8\xaf\xd9\x92\xd9\x86\xd9\x8e");
    }
    return EL_STR("\xd9\x86\xd9\x8f\xd8\xb1\xd9\x90\xd9\x8a\xd8\xaf\xd9\x8f");
  }
  if (str_eq(tense, EL_STR("future"))) {
    el_val_t pres = ar_irregular_araada(slot, EL_STR("present"));
    return el_str_concat(EL_STR("\xd8\xb3\xd9\x8e"), pres);
  }
  return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xa7\xd8\xaf\xd9\x8e");
  return 0;
}

el_val_t ar_irregular_istata(el_val_t slot, el_val_t tense) {
  if (str_eq(tense, EL_STR("past"))) {
    if (slot == 0) {
      return EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xa7\xd8\xb9\xd9\x8e");
    }
    if (slot == 1) {
      return EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xa7\xd8\xb9\xd9\x8e\xd8\xaa\xd9\x92");
    }
    if (slot == 2) {
      return EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xb9\xd9\x92\xd8\xaa\xd9\x8e");
    }
    if (slot == 3) {
      return EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xb9\xd9\x92\xd8\xaa\xd9\x90");
    }
    if (slot == 4) {
      return EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xb9\xd9\x92\xd8\xaa\xd9\x8f");
    }
    if (slot == 5) {
      return EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xa7\xd8\xb9\xd9\x8f\xd9\x88\xd8\xa7");
    }
    if (slot == 6) {
      return EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xb9\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 7) {
      return EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xb9\xd9\x92\xd8\xaa\xd9\x8f\xd9\x85\xd9\x92");
    }
    if (slot == 8) {
      return EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xb9\xd9\x92\xd8\xaa\xd9\x8f\xd9\x86\xd9\x8e\xd9\x91");
    }
    return EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xb9\xd9\x92\xd9\x86\xd9\x8e\xd8\xa7");
  }
  if (str_eq(tense, EL_STR("present"))) {
    if (slot == 0) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x90\xd9\x8a\xd8\xb9\xd9\x8f");
    }
    if (slot == 1) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x90\xd9\x8a\xd8\xb9\xd9\x8f");
    }
    if (slot == 2) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x90\xd9\x8a\xd8\xb9\xd9\x8f");
    }
    if (slot == 3) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x90\xd9\x8a\xd8\xb9\xd9\x90\xd9\x8a\xd9\x86\xd9\x8e");
    }
    if (slot == 4) {
      return EL_STR("\xd8\xa3\xd9\x8e\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x90\xd9\x8a\xd8\xb9\xd9\x8f");
    }
    if (slot == 5) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x90\xd9\x8a\xd8\xb9\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
    }
    if (slot == 6) {
      return EL_STR("\xd9\x8a\xd9\x8e\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x90\xd8\xb9\xd9\x92\xd9\x86\xd9\x8e");
    }
    if (slot == 7) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x90\xd9\x8a\xd8\xb9\xd9\x8f\xd9\x88\xd9\x86\xd9\x8e");
    }
    if (slot == 8) {
      return EL_STR("\xd8\xaa\xd9\x8e\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x90\xd8\xb9\xd9\x92\xd9\x86\xd9\x8e");
    }
    return EL_STR("\xd9\x86\xd9\x8e\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x90\xd9\x8a\xd8\xb9\xd9\x8f");
  }
  if (str_eq(tense, EL_STR("future"))) {
    el_val_t pres = ar_irregular_istata(slot, EL_STR("present"));
    return el_str_concat(EL_STR("\xd8\xb3\xd9\x8e"), pres);
  }
  return EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xa7\xd8\xb9\xd9\x8e");
  return 0;
}

el_val_t ar_irregular(el_val_t verb, el_val_t tense, el_val_t slot) {
  if (str_eq(verb, EL_STR("\xd9\x83\xd9\x8e\xd8\xa7\xd9\x86\xd9\x8e"))) {
    return ar_irregular_kaana(slot, tense);
  }
  if (str_eq(verb, EL_STR("\xd9\x82\xd9\x8e\xd8\xa7\xd9\x84\xd9\x8e"))) {
    return ar_irregular_qaala(slot, tense);
  }
  if (str_eq(verb, EL_STR("\xd8\xac\xd9\x8e\xd8\xa7\xd8\xa1\xd9\x8e"))) {
    return ar_irregular_jaa(slot, tense);
  }
  if (str_eq(verb, EL_STR("\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e\xd9\x89"))) {
    return ar_irregular_raaa(slot, tense);
  }
  if (str_eq(verb, EL_STR("\xd8\xa3\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xa7\xd8\xaf\xd9\x8e"))) {
    return ar_irregular_araada(slot, tense);
  }
  if (str_eq(verb, EL_STR("\xd8\xa7\xd9\x90\xd8\xb3\xd9\x92\xd8\xaa\xd9\x8e\xd8\xb7\xd9\x8e\xd8\xa7\xd8\xb9\xd9\x8e"))) {
    return ar_irregular_istata(slot, tense);
  }
  return EL_STR("");
  return 0;
}

el_val_t ar_present_stem(el_val_t verb) {
  if (str_eq(verb, EL_STR("\xd9\x83\xd9\x8e\xd8\xaa\xd9\x8e\xd8\xa8\xd9\x8e"))) {
    return EL_STR("\xd9\x83\xd9\x92\xd8\xaa\xd9\x8f\xd8\xa8\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xb0\xd9\x8e\xd9\x87\xd9\x8e\xd8\xa8\xd9\x8e"))) {
    return EL_STR("\xd8\xb0\xd9\x92\xd9\x87\xd9\x8e\xd8\xa8\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xa3\xd9\x8e\xd9\x83\xd9\x8e\xd9\x84\xd9\x8e"))) {
    return EL_STR("\xd8\xa3\xd9\x92\xd9\x83\xd9\x8f\xd9\x84\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xb4\xd9\x8e\xd8\xb1\xd9\x90\xd8\xa8\xd9\x8e"))) {
    return EL_STR("\xd8\xb4\xd9\x92\xd8\xb1\xd9\x8e\xd8\xa8\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xb9\xd9\x8e\xd8\xb1\xd9\x8e\xd9\x81\xd9\x8e"))) {
    return EL_STR("\xd8\xb9\xd9\x92\xd8\xb1\xd9\x90\xd9\x81\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd9\x81\xd9\x8e\xd8\xb9\xd9\x8e\xd9\x84\xd9\x8e"))) {
    return EL_STR("\xd9\x81\xd9\x92\xd8\xb9\xd9\x8e\xd9\x84\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xa3\xd9\x8e\xd8\xae\xd9\x8e\xd8\xb0\xd9\x8e"))) {
    return EL_STR("\xd8\xa3\xd9\x92\xd8\xae\xd9\x8f\xd8\xb0\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xb9\xd9\x8e\xd9\x85\xd9\x90\xd9\x84\xd9\x8e"))) {
    return EL_STR("\xd8\xb9\xd9\x92\xd9\x85\xd9\x8e\xd9\x84\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xaf\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xb3\xd9\x8e"))) {
    return EL_STR("\xd8\xaf\xd9\x92\xd8\xb1\xd9\x8f\xd8\xb3\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd9\x81\xd9\x8e\xd9\x87\xd9\x90\xd9\x85\xd9\x8e"))) {
    return EL_STR("\xd9\x81\xd9\x92\xd9\x87\xd9\x8e\xd9\x85\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xb3\xd9\x8e\xd9\x85\xd9\x90\xd8\xb9\xd9\x8e"))) {
    return EL_STR("\xd8\xb3\xd9\x92\xd9\x85\xd9\x8e\xd8\xb9\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xac\xd9\x8e\xd9\x84\xd9\x8e\xd8\xb3\xd9\x8e"))) {
    return EL_STR("\xd8\xac\xd9\x92\xd9\x84\xd9\x90\xd8\xb3\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd9\x81\xd9\x8e\xd8\xaa\xd9\x8e\xd8\xad\xd9\x8e"))) {
    return EL_STR("\xd9\x81\xd9\x92\xd8\xaa\xd9\x8e\xd8\xad\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xae\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xac\xd9\x8e"))) {
    return EL_STR("\xd8\xae\xd9\x92\xd8\xb1\xd9\x8f\xd8\xac\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xaf\xd9\x8e\xd8\xae\xd9\x8e\xd9\x84\xd9\x8e"))) {
    return EL_STR("\xd8\xaf\xd9\x92\xd8\xae\xd9\x8f\xd9\x84\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd9\x88\xd9\x8e\xd8\xac\xd9\x8e\xd8\xaf\xd9\x8e"))) {
    return EL_STR("\xd8\xac\xd9\x90\xd8\xaf\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xb5\xd9\x8e\xd9\x86\xd9\x8e\xd8\xb9\xd9\x8e"))) {
    return EL_STR("\xd8\xb5\xd9\x92\xd9\x86\xd9\x8e\xd8\xb9\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd8\xb1\xd9\x8e\xd8\xac\xd9\x8e\xd8\xb9\xd9\x8e"))) {
    return EL_STR("\xd8\xb1\xd9\x92\xd8\xac\xd9\x90\xd8\xb9\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd9\x88\xd9\x8e\xd9\x82\xd9\x8e\xd9\x81\xd9\x8e"))) {
    return EL_STR("\xd9\x82\xd9\x90\xd9\x81\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd9\x82\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8e"))) {
    return EL_STR("\xd9\x82\xd9\x92\xd8\xb1\xd9\x8e\xd8\xa3\xd9\x8f");
  }
  if (str_eq(verb, EL_STR("\xd9\x83\xd9\x8e\xd8\xb0\xd9\x8e\xd8\xa8\xd9\x8e"))) {
    return EL_STR("\xd9\x83\xd9\x92\xd8\xb0\xd9\x90\xd8\xa8\xd9\x8f");
  }
  return EL_STR("");
  return 0;
}

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 slot = ar_slot(person, gender, number);
  el_val_t irreg = ar_irregular(verb, tense, slot);
  if (!str_eq(irreg, EL_STR(""))) {
    return irreg;
  }
  el_val_t present_stem = ar_present_stem(verb);
  if (!str_eq(present_stem, EL_STR(""))) {
    return ar_conjugate_form1(verb, present_stem, tense, slot);
  }
  return verb;
  return 0;
}

el_val_t ar_is_sun_letter(el_val_t c) {
  if (str_eq(c, EL_STR("\xd8\xaa"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd8\xab"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd8\xaf"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd8\xb0"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd8\xb1"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd8\xb2"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd8\xb3"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd8\xb4"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd8\xb5"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd8\xb6"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd8\xb7"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd8\xb8"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd9\x84"))) {
    return 1;
  }
  if (str_eq(c, EL_STR("\xd9\x86"))) {
    return 1;
  }
  return 0;
  return 0;
}

el_val_t ar_definite_article(el_val_t noun) {
  el_val_t n = ar_str_len(noun);
  if (n == 0) {
    return noun;
  }
  el_val_t first = str_slice(noun, 0, 1);
  if (ar_is_sun_letter(first)) {
    el_val_t shadda = EL_STR("\xd9\x91");
    el_val_t rest = str_slice(noun, 1, n);
    return el_str_concat(el_str_concat(el_str_concat(EL_STR("\xd8\xa7\xd9\x84"), first), shadda), rest);
  }
  return el_str_concat(EL_STR("\xd8\xa7\xd9\x84"), noun);
  return 0;
}

el_val_t ar_case_ending(el_val_t kase, el_val_t definite) {
  el_val_t is_def = str_eq(definite, EL_STR("true"));
  if (str_eq(kase, EL_STR("nom"))) {
    if (is_def) {
      return EL_STR("\xd9\x8f");
    }
    return EL_STR("\xd9\x8c");
  }
  if (str_eq(kase, EL_STR("acc"))) {
    if (is_def) {
      return EL_STR("\xd9\x8e");
    }
    return EL_STR("\xd9\x8b");
  }
  if (str_eq(kase, EL_STR("gen"))) {
    if (is_def) {
      return EL_STR("\xd9\x90");
    }
    return EL_STR("\xd9\x8d");
  }
  return EL_STR("");
  return 0;
}

el_val_t ar_gender(el_val_t noun) {
  if (ar_str_ends(noun, EL_STR("\xd8\xa9"))) {
    return EL_STR("f");
  }
  if (ar_str_ends(noun, EL_STR("\xd9\x80\xd8\xa9"))) {
    return EL_STR("f");
  }
  return EL_STR("m");
  return 0;
}

el_val_t ar_masc_pl_ending(el_val_t kase) {
  if (str_eq(kase, EL_STR("nom"))) {
    return EL_STR("\xd9\x88\xd9\x86\xd9\x8e");
  }
  return EL_STR("\xd9\x8a\xd9\x86\xd9\x8e");
  return 0;
}

el_val_t ar_sound_plural(el_val_t noun, el_val_t gender) {
  if (str_eq(gender, EL_STR("f"))) {
    if (ar_str_ends(noun, EL_STR("\xd8\xa9"))) {
      el_val_t base = ar_str_drop_last(noun, 1);
      return el_str_concat(base, EL_STR("\xd8\xa7\xd8\xaa"));
    }
    return el_str_concat(noun, EL_STR("\xd8\xa7\xd8\xaa"));
  }
  return el_str_concat(noun, EL_STR("\xd9\x88\xd9\x86"));
  return 0;
}

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 g = gender;
  if (str_eq(g, EL_STR(""))) {
    g = ar_gender(noun);
  }
  el_val_t stem = noun;
  if (str_eq(number, EL_STR("plural"))) {
    if (str_eq(g, EL_STR("m"))) {
      el_val_t pl_suf = ar_masc_pl_ending(kase);
      if (str_eq(definite, EL_STR("true"))) {
        el_val_t def_stem = ar_definite_article(noun);
        return el_str_concat(def_stem, pl_suf);
      }
      return el_str_concat(noun, pl_suf);
    }
    el_val_t fem_pl = ar_sound_plural(noun, EL_STR("f"));
    el_val_t case_end = ar_case_ending(kase, definite);
    if (str_eq(definite, EL_STR("true"))) {
      return el_str_concat(ar_definite_article(fem_pl), case_end);
    }
    return el_str_concat(fem_pl, case_end);
  }
  el_val_t case_end = ar_case_ending(kase, definite);
  if (str_eq(definite, EL_STR("true"))) {
    el_val_t def_stem = ar_definite_article(noun);
    return el_str_concat(def_stem, case_end);
  }
  return el_str_concat(noun, case_end);
  return 0;
}

el_val_t ar_verb_form(el_val_t verb, el_val_t tense, el_val_t person, el_val_t number) {
  return ar_conjugate(verb, tense, person, EL_STR("m"), number);
  return 0;
}

