img_writer_emit_start (struct MonoImageWriter * acfg)
{
  int D.25861;

  D.25861 = acfg->use_bin_writer;
  if (D.25861 != 0) goto <D.25862>; else goto <D.25863>;
  <D.25862>:
  bin_writer_emit_start (acfg);
  goto <D.25864>;
  <D.25863>:
  asm_writer_emit_start (acfg);
  <D.25864>:
}


bin_writer_emit_start (struct MonoImageWriter * acfg)
{
  struct GHashTable * D.25865;

  D.25865 = monoeg_g_hash_table_new (monoeg_g_str_hash, monoeg_g_str_equal);
  acfg->labels = D.25865;
}


asm_writer_emit_start (struct MonoImageWriter * acfg)
{

}


img_writer_emit_section_change (struct MonoImageWriter * acfg, const char * section_name, int subsection_index)
{
  int D.25866;

  D.25866 = acfg->use_bin_writer;
  if (D.25866 != 0) goto <D.25867>; else goto <D.25868>;
  <D.25867>:
  bin_writer_emit_section_change (acfg, section_name, subsection_index);
  goto <D.25869>;
  <D.25868>:
  asm_writer_emit_section_change (acfg, section_name, subsection_index);
  <D.25869>:
  acfg->current_section = section_name;
  acfg->current_subsection = subsection_index;
}


bin_writer_emit_section_change (struct MonoImageWriter * acfg, const char * section_name, int subsection_index)
{
  struct BinSection * D.25870;
  int D.25873;
  int D.25151;
  char * D.25876;
  int D.25879;
  int D.25160;
  char * D.25882;
  gchar * D.25887;
  struct BinSection * D.25888;
  struct BinSection * section;

  D.25870 = acfg->cur_section;
  if (D.25870 != 0B) goto <D.25871>; else goto <D.25872>;
  <D.25871>:
  D.25870 = acfg->cur_section;
  D.25873 = D.25870->subsection;
  if (D.25873 == subsection_index) goto <D.25874>; else goto <D.25875>;
  <D.25874>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.25870 = acfg->cur_section;
    D.25876 = D.25870->name;
    D.25151 = __builtin_strcmp (D.25876, section_name);
  }
  if (D.25151 == 0) goto <D.25877>; else goto <D.25878>;
  <D.25877>:
  return;
  <D.25878>:
  <D.25875>:
  <D.25872>:
  section = acfg->sections;
  goto <D.25162>;
  <D.25161>:
  D.25879 = section->subsection;
  if (D.25879 == subsection_index) goto <D.25880>; else goto <D.25881>;
  <D.25880>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.25882 = section->name;
    D.25160 = __builtin_strcmp (D.25882, section_name);
  }
  if (D.25160 == 0) goto <D.25883>; else goto <D.25884>;
  <D.25883>:
  acfg->cur_section = section;
  return;
  <D.25884>:
  <D.25881>:
  section = section->next;
  <D.25162>:
  if (section != 0B) goto <D.25161>; else goto <D.25163>;
  <D.25163>:
  if (section == 0B) goto <D.25885>; else goto <D.25886>;
  <D.25885>:
  section = monoeg_malloc0 (56);
  D.25887 = monoeg_strdup (section_name);
  section->name = D.25887;
  section->subsection = subsection_index;
  D.25888 = acfg->sections;
  section->next = D.25888;
  acfg->sections = section;
  acfg->cur_section = section;
  <D.25886>:
}


monoeg_strdup (const gchar * str)
{
  gchar * D.25892;

  if (str != 0B) goto <D.25890>; else goto <D.25891>;
  <D.25890>:
  D.25892 = __strdup (str);
  return D.25892;
  <D.25891>:
  D.25892 = 0B;
  return D.25892;
}


asm_writer_emit_section_change (struct MonoImageWriter * acfg, const char * section_name, int subsection_index)
{
  int D.25636;
  int iftmp.0;
  int D.25635;
  const char[6] * D.25900;
  unsigned char D.25901;
  int D.25902;
  unsigned char D.25903;
  int D.25904;
  _Bool D.25905;
  _Bool D.25906;
  _Bool D.25907;
  const unsigned char * D.25910;
  unsigned char D.25911;
  int D.25912;
  const unsigned char * D.25913;
  unsigned char D.25914;
  int D.25915;
  _Bool D.25916;
  _Bool D.25917;
  const unsigned char * D.25920;
  unsigned char D.25921;
  int D.25922;
  const unsigned char * D.25923;
  unsigned char D.25924;
  int D.25925;
  _Bool D.25926;
  _Bool D.25927;
  const unsigned char * D.25930;
  unsigned char D.25931;
  int D.25932;
  const unsigned char * D.25933;
  unsigned char D.25934;
  int D.25935;
  int D.25645;
  int iftmp.1;
  int D.25644;
  const char[6] * D.25941;
  unsigned char D.25942;
  int D.25943;
  unsigned char D.25944;
  int D.25945;
  _Bool D.25946;
  _Bool D.25947;
  _Bool D.25948;
  const unsigned char * D.25951;
  unsigned char D.25952;
  int D.25953;
  const unsigned char * D.25954;
  unsigned char D.25955;
  int D.25956;
  _Bool D.25957;
  _Bool D.25958;
  const unsigned char * D.25961;
  unsigned char D.25962;
  int D.25963;
  const unsigned char * D.25964;
  unsigned char D.25965;
  int D.25966;
  _Bool D.25967;
  _Bool D.25968;
  const unsigned char * D.25971;
  unsigned char D.25972;
  int D.25973;
  const unsigned char * D.25974;
  unsigned char D.25975;
  int D.25976;
  struct FILE * D.25978;

  asm_writer_emit_unset_mode (acfg);
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 5;
    if (__s2_len <= 3) goto <D.25898>; else goto <D.25899>;
    <D.25898>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = section_name;
      D.25900 = ".text";
      D.25901 = MEM[(const unsigned char *)D.25900];
      D.25902 = (int) D.25901;
      D.25903 = *__s2;
      D.25904 = (int) D.25903;
      __result = D.25902 - D.25904;
      {
        D.25905 = __s2_len != 0;
        D.25906 = __result == 0;
        D.25907 = D.25905 & D.25906;
        if (D.25907 != 0) goto <D.25908>; else goto <D.25909>;
        <D.25908>:
        D.25910 = &MEM[(void *)".text" + 1B];
        D.25911 = *D.25910;
        D.25912 = (int) D.25911;
        D.25913 = __s2 + 1;
        D.25914 = *D.25913;
        D.25915 = (int) D.25914;
        __result = D.25912 - D.25915;
        D.25916 = __s2_len > 1;
        D.25906 = __result == 0;
        D.25917 = D.25916 & D.25906;
        if (D.25917 != 0) goto <D.25918>; else goto <D.25919>;
        <D.25918>:
        D.25920 = &MEM[(void *)".text" + 2B];
        D.25921 = *D.25920;
        D.25922 = (int) D.25921;
        D.25923 = __s2 + 2;
        D.25924 = *D.25923;
        D.25925 = (int) D.25924;
        __result = D.25922 - D.25925;
        D.25926 = __s2_len > 2;
        D.25906 = __result == 0;
        D.25927 = D.25926 & D.25906;
        if (D.25927 != 0) goto <D.25928>; else goto <D.25929>;
        <D.25928>:
        D.25930 = &MEM[(void *)".text" + 3B];
        D.25931 = *D.25930;
        D.25932 = (int) D.25931;
        D.25933 = __s2 + 3;
        D.25934 = *D.25933;
        D.25935 = (int) D.25934;
        __result = D.25932 - D.25935;
        <D.25929>:
        <D.25919>:
        <D.25909>:
      }
      D.25635 = __result;
    }
    iftmp.0 = -D.25635;
    goto <D.25936>;
    <D.25899>:
    iftmp.0 = __builtin_strcmp (section_name, ".text");
    <D.25936>:
    D.25636 = iftmp.0;
  }
  if (D.25636 == 0) goto <D.25894>; else goto <D.25937>;
  <D.25937>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 5;
    if (__s2_len <= 3) goto <D.25939>; else goto <D.25940>;
    <D.25939>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = section_name;
      D.25941 = ".data";
      D.25942 = MEM[(const unsigned char *)D.25941];
      D.25943 = (int) D.25942;
      D.25944 = *__s2;
      D.25945 = (int) D.25944;
      __result = D.25943 - D.25945;
      {
        D.25946 = __s2_len != 0;
        D.25947 = __result == 0;
        D.25948 = D.25946 & D.25947;
        if (D.25948 != 0) goto <D.25949>; else goto <D.25950>;
        <D.25949>:
        D.25951 = &MEM[(void *)".data" + 1B];
        D.25952 = *D.25951;
        D.25953 = (int) D.25952;
        D.25954 = __s2 + 1;
        D.25955 = *D.25954;
        D.25956 = (int) D.25955;
        __result = D.25953 - D.25956;
        D.25957 = __s2_len > 1;
        D.25947 = __result == 0;
        D.25958 = D.25957 & D.25947;
        if (D.25958 != 0) goto <D.25959>; else goto <D.25960>;
        <D.25959>:
        D.25961 = &MEM[(void *)".data" + 2B];
        D.25962 = *D.25961;
        D.25963 = (int) D.25962;
        D.25964 = __s2 + 2;
        D.25965 = *D.25964;
        D.25966 = (int) D.25965;
        __result = D.25963 - D.25966;
        D.25967 = __s2_len > 2;
        D.25947 = __result == 0;
        D.25968 = D.25967 & D.25947;
        if (D.25968 != 0) goto <D.25969>; else goto <D.25970>;
        <D.25969>:
        D.25971 = &MEM[(void *)".data" + 3B];
        D.25972 = *D.25971;
        D.25973 = (int) D.25972;
        D.25974 = __s2 + 3;
        D.25975 = *D.25974;
        D.25976 = (int) D.25975;
        __result = D.25973 - D.25976;
        <D.25970>:
        <D.25960>:
        <D.25950>:
      }
      D.25644 = __result;
    }
    iftmp.1 = -D.25644;
    goto <D.25977>;
    <D.25940>:
    iftmp.1 = __builtin_strcmp (section_name, ".data");
    <D.25977>:
    D.25645 = iftmp.1;
  }
  if (D.25645 == 0) goto <D.25894>; else goto <D.25895>;
  <D.25894>:
  D.25978 = acfg->fp;
  fprintf (D.25978, "%s %d\n", section_name, subsection_index);
  goto <D.25896>;
  <D.25895>:
  D.25978 = acfg->fp;
  fprintf (D.25978, ".section \"%s\"\n", section_name);
  D.25978 = acfg->fp;
  fprintf (D.25978, ".subsection %d\n", subsection_index);
  <D.25896>:
}


asm_writer_emit_unset_mode (struct MonoImageWriter * acfg)
{
  int D.25979;
  struct FILE * D.25982;

  D.25979 = acfg->mode;
  if (D.25979 == 0) goto <D.25980>; else goto <D.25981>;
  <D.25980>:
  return;
  <D.25981>:
  D.25982 = acfg->fp;
  fprintf (D.25982, "\n");
  acfg->mode = 0;
}


fprintf (struct FILE * restrict __stream, const char * restrict __fmt)
{
  int D.25984;

  D.25984 = __fprintf_chk (__stream, 1, __fmt, __builtin_va_arg_pack ());
  return D.25984;
}


img_writer_emit_push_section (struct MonoImageWriter * acfg, const char * section_name, int subsection)
{
  int D.25986;
  _Bool D.25987;
  long int D.25988;
  long int D.25989;
  const char * D.25992;
  int D.25993;
  int D.25994;

  D.25986 = acfg->stack_pos;
  D.25987 = D.25986 > 14;
  D.25988 = (long int) D.25987;
  D.25989 = __builtin_expect (D.25988, 0);
  if (D.25989 != 0) goto <D.25990>; else goto <D.25991>;
  <D.25990>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 2018, "acfg->stack_pos < 16 - 1");
  <D.25991>:
  D.25986 = acfg->stack_pos;
  D.25992 = acfg->current_section;
  acfg->section_stack[D.25986] = D.25992;
  D.25986 = acfg->stack_pos;
  D.25993 = acfg->current_subsection;
  acfg->subsection_stack[D.25986] = D.25993;
  D.25986 = acfg->stack_pos;
  D.25994 = D.25986 + 1;
  acfg->stack_pos = D.25994;
  img_writer_emit_section_change (acfg, section_name, subsection);
}


img_writer_emit_pop_section (struct MonoImageWriter * acfg)
{
  int D.25995;
  _Bool D.25996;
  long int D.25997;
  long int D.25998;
  int D.26001;
  const char * D.26002;
  int D.26003;

  D.25995 = acfg->stack_pos;
  D.25996 = D.25995 <= 0;
  D.25997 = (long int) D.25996;
  D.25998 = __builtin_expect (D.25997, 0);
  if (D.25998 != 0) goto <D.25999>; else goto <D.26000>;
  <D.25999>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 2029, "acfg->stack_pos > 0");
  <D.26000>:
  D.25995 = acfg->stack_pos;
  D.26001 = D.25995 + -1;
  acfg->stack_pos = D.26001;
  D.25995 = acfg->stack_pos;
  D.26002 = acfg->section_stack[D.25995];
  D.25995 = acfg->stack_pos;
  D.26003 = acfg->subsection_stack[D.25995];
  img_writer_emit_section_change (acfg, D.26002, D.26003);
}


img_writer_set_section_addr (struct MonoImageWriter * acfg, guint64 addr)
{
  int D.26004;

  D.26004 = acfg->use_bin_writer;
  if (D.26004 == 0) goto <D.26005>; else goto <D.26006>;
  <D.26005>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "image-writer.c", 2039);
  <D.26006>:
  bin_writer_set_section_addr (acfg, addr);
}


bin_writer_set_section_addr (struct MonoImageWriter * acfg, guint64 addr)
{
  struct BinSection * D.26007;

  D.26007 = acfg->cur_section;
  D.26007->addr = addr;
  D.26007 = acfg->cur_section;
  D.26007->has_addr = 1;
}


img_writer_emit_global (struct MonoImageWriter * acfg, const char * name, gboolean func)
{
  int D.26008;

  D.26008 = acfg->use_bin_writer;
  if (D.26008 != 0) goto <D.26009>; else goto <D.26010>;
  <D.26009>:
  bin_writer_emit_global (acfg, name, func);
  goto <D.26011>;
  <D.26010>:
  asm_writer_emit_global (acfg, name, func);
  <D.26011>:
}


bin_writer_emit_global (struct MonoImageWriter * acfg, const char * name, gboolean func)
{
  bin_writer_emit_symbol_inner (acfg, name, 0B, 1, func);
}


bin_writer_emit_symbol_inner (struct MonoImageWriter * acfg, const char * name, const char * end_label, gboolean is_global, gboolean func)
{
  gchar * D.26012;
  gchar * D.26015;
  struct BinSection * D.26016;
  struct BinSection * D.26017;
  int D.26018;
  struct BinSymbol * D.26019;
  struct BinSymbol * symbol;

  symbol = monoeg_malloc0 (28);
  D.26012 = monoeg_strdup (name);
  symbol->name = D.26012;
  if (end_label != 0B) goto <D.26013>; else goto <D.26014>;
  <D.26013>:
  D.26015 = monoeg_strdup (end_label);
  symbol->end_label = D.26015;
  <D.26014>:
  symbol->is_function = func;
  symbol->is_global = is_global;
  D.26016 = acfg->cur_section;
  symbol->section = D.26016;
  D.26017 = symbol->section;
  D.26018 = D.26017->cur_offset;
  symbol->offset = D.26018;
  D.26019 = acfg->symbols;
  symbol->next = D.26019;
  acfg->symbols = symbol;
}


asm_writer_emit_global (struct MonoImageWriter * acfg, const char * name, gboolean func)
{
  struct FILE * D.26020;

  asm_writer_emit_unset_mode (acfg);
  D.26020 = acfg->fp;
  fprintf (D.26020, "\t.globl %s\n", name);
  asm_writer_emit_symbol_type (acfg, name, func);
}


asm_writer_emit_symbol_type (struct MonoImageWriter * acfg, const char * name, gboolean func)
{
  struct FILE * D.26024;
  const char * stype;

  if (func != 0) goto <D.26021>; else goto <D.26022>;
  <D.26021>:
  stype = "function";
  goto <D.26023>;
  <D.26022>:
  stype = "object";
  <D.26023>:
  asm_writer_emit_unset_mode (acfg);
  D.26024 = acfg->fp;
  fprintf (D.26024, "\t.type %s,#%s\n", name, stype);
}


img_writer_emit_local_symbol (struct MonoImageWriter * acfg, const char * name, const char * end_label, gboolean func)
{
  int D.26025;

  D.26025 = acfg->use_bin_writer;
  if (D.26025 != 0) goto <D.26026>; else goto <D.26027>;
  <D.26026>:
  bin_writer_emit_local_symbol (acfg, name, end_label, func);
  goto <D.26028>;
  <D.26027>:
  asm_writer_emit_local_symbol (acfg, name, end_label, func);
  <D.26028>:
}


bin_writer_emit_local_symbol (struct MonoImageWriter * acfg, const char * name, const char * end_label, gboolean func)
{
  bin_writer_emit_symbol_inner (acfg, name, end_label, 0, func);
}


asm_writer_emit_local_symbol (struct MonoImageWriter * acfg, const char * name, const char * end_label, gboolean func)
{
  struct FILE * D.26029;

  asm_writer_emit_unset_mode (acfg);
  D.26029 = acfg->fp;
  fprintf (D.26029, "\t.local %s\n", name);
  asm_writer_emit_symbol_type (acfg, name, func);
}


img_writer_emit_symbol_size (struct MonoImageWriter * acfg, const char * name, const char * end_label)
{
  int D.26030;

  D.26030 = acfg->use_bin_writer;
  if (D.26030 == 0) goto <D.26031>; else goto <D.26032>;
  <D.26031>:
  asm_writer_emit_symbol_size (acfg, name, end_label);
  <D.26032>:
}


asm_writer_emit_symbol_size (struct MonoImageWriter * acfg, const char * name, const char * end_label)
{
  struct FILE * D.26033;

  asm_writer_emit_unset_mode (acfg);
  D.26033 = acfg->fp;
  fprintf (D.26033, "\t.size %s,%s-%s\n", name, end_label, name);
}


img_writer_emit_label (struct MonoImageWriter * acfg, const char * name)
{
  int D.26034;

  D.26034 = acfg->use_bin_writer;
  if (D.26034 != 0) goto <D.26035>; else goto <D.26036>;
  <D.26035>:
  bin_writer_emit_label (acfg, name);
  goto <D.26037>;
  <D.26036>:
  asm_writer_emit_label (acfg, name);
  <D.26037>:
}


bin_writer_emit_label (struct MonoImageWriter * acfg, const char * name)
{
  gchar * D.26038;
  struct BinSection * D.26039;
  int D.26040;
  struct GHashTable * D.26041;
  char * D.26042;
  struct BinLabel * label;

  label = monoeg_malloc0 (12);
  D.26038 = monoeg_strdup (name);
  label->name = D.26038;
  D.26039 = acfg->cur_section;
  label->section = D.26039;
  D.26039 = acfg->cur_section;
  D.26040 = D.26039->cur_offset;
  label->offset = D.26040;
  D.26041 = acfg->labels;
  D.26042 = label->name;
  monoeg_g_hash_table_insert_replace (D.26041, D.26042, label, 0);
}


asm_writer_emit_label (struct MonoImageWriter * acfg, const char * name)
{
  struct FILE * D.26043;
  const char * D.26044;

  asm_writer_emit_unset_mode (acfg);
  D.26043 = acfg->fp;
  D.26044 = get_label (name);
  fprintf (D.26043, "%s:\n", D.26044);
}


get_label (const char * s)
{
  const char * D.26045;

  D.26045 = s;
  return D.26045;
}


img_writer_emit_bytes (struct MonoImageWriter * acfg, const guint8 * buf, int size)
{
  int D.26047;

  D.26047 = acfg->use_bin_writer;
  if (D.26047 != 0) goto <D.26048>; else goto <D.26049>;
  <D.26048>:
  bin_writer_emit_bytes (acfg, buf, size);
  goto <D.26050>;
  <D.26049>:
  asm_writer_emit_bytes (acfg, buf, size);
  <D.26050>:
}


bin_writer_emit_bytes (struct MonoImageWriter * acfg, const guint8 * buf, int size)
{
  struct BinSection * D.26051;
  guint8 * D.26052;
  int D.26053;
  sizetype D.26054;
  guint8 * D.26055;
  unsigned int size.2;
  int D.26057;

  D.26051 = acfg->cur_section;
  bin_writer_emit_ensure_buffer (D.26051, size);
  D.26051 = acfg->cur_section;
  D.26052 = D.26051->data;
  D.26051 = acfg->cur_section;
  D.26053 = D.26051->cur_offset;
  D.26054 = (sizetype) D.26053;
  D.26055 = D.26052 + D.26054;
  size.2 = (unsigned int) size;
  memcpy (D.26055, buf, size.2);
  D.26051 = acfg->cur_section;
  D.26051 = acfg->cur_section;
  D.26053 = D.26051->cur_offset;
  D.26057 = D.26053 + size;
  D.26051->cur_offset = D.26057;
}


bin_writer_emit_ensure_buffer (struct BinSection * section, int size)
{
  int D.26058;
  int D.26059;
  int iftmp.3;
  unsigned int new_size.4;
  guint8 * D.26067;
  unsigned int D.26068;
  int new_offset;

  D.26058 = section->cur_offset;
  new_offset = D.26058 + size;
  D.26059 = section->data_len;
  if (D.26059 <= new_offset) goto <D.26060>; else goto <D.26061>;
  <D.26060>:
  {
    int new_size;
    guint8 * data;

    D.26059 = section->data_len;
    if (D.26059 != 0) goto <D.26063>; else goto <D.26064>;
    <D.26063>:
    D.26059 = section->data_len;
    iftmp.3 = D.26059 * 2;
    goto <D.26065>;
    <D.26064>:
    iftmp.3 = 256;
    <D.26065>:
    new_size = iftmp.3;
    goto <D.25200>;
    <D.25199>:
    new_size = new_size * 2;
    <D.25200>:
    if (new_size <= new_offset) goto <D.25199>; else goto <D.25201>;
    <D.25201>:
    new_size.4 = (unsigned int) new_size;
    data = monoeg_malloc0 (new_size.4);
    D.26067 = section->data;
    D.26059 = section->data_len;
    D.26068 = (unsigned int) D.26059;
    memcpy (data, D.26067, D.26068);
    D.26067 = section->data;
    monoeg_g_free (D.26067);
    section->data = data;
    section->data_len = new_size;
  }
  <D.26061>:
}


memcpy (void * restrict __dest, const void * restrict __src, size_t __len)
{
  void * D.26069;
  unsigned int D.26070;

  D.26070 = __builtin_object_size (__dest, 0);
  D.26069 = __builtin___memcpy_chk (__dest, __src, __len, D.26070);
  return D.26069;
}


asm_writer_emit_bytes (struct MonoImageWriter * acfg, const guint8 * buf, int size)
{
  int D.26072;
  char * byte_to_str.5;
  void * byte_to_str.6;
  int D.26079;
  sizetype D.26080;
  char * D.26081;
  int D.26082;
  unsigned int D.26083;
  unsigned int D.26084;
  struct FILE * D.26087;
  sizetype i.7;
  const guint8 * D.26089;
  unsigned char D.26090;
  int D.26091;
  int D.26093;
  sizetype D.26094;
  char * D.26095;
  int D.26096;
  int i;

  D.26072 = acfg->mode;
  if (D.26072 != 1) goto <D.26073>; else goto <D.26074>;
  <D.26073>:
  acfg->mode = 1;
  acfg->col_count = 0;
  <D.26074>:
  byte_to_str.5 = byte_to_str;
  if (byte_to_str.5 == 0B) goto <D.26076>; else goto <D.26077>;
  <D.26076>:
  byte_to_str.6 = monoeg_malloc0 (2048);
  byte_to_str = byte_to_str.6;
  i = 0;
  goto <D.25702>;
  <D.25701>:
  byte_to_str.5 = byte_to_str;
  D.26079 = i * 8;
  D.26080 = (sizetype) D.26079;
  D.26081 = byte_to_str.5 + D.26080;
  sprintf (D.26081, ",%d", i);
  i = i + 1;
  <D.25702>:
  if (i <= 255) goto <D.25701>; else goto <D.25703>;
  <D.25703>:
  <D.26077>:
  i = 0;
  goto <D.25705>;
  <D.25704>:
  D.26082 = acfg->col_count;
  D.26083 = (unsigned int) D.26082;
  D.26084 = D.26083 & 31;
  if (D.26084 == 0) goto <D.26085>; else goto <D.26086>;
  <D.26085>:
  D.26087 = acfg->fp;
  i.7 = (sizetype) i;
  D.26089 = buf + i.7;
  D.26090 = *D.26089;
  D.26091 = (int) D.26090;
  fprintf (D.26087, "\n\t.byte %d", D.26091);
  goto <D.26092>;
  <D.26086>:
  byte_to_str.5 = byte_to_str;
  i.7 = (sizetype) i;
  D.26089 = buf + i.7;
  D.26090 = *D.26089;
  D.26091 = (int) D.26090;
  D.26093 = D.26091 * 8;
  D.26094 = (sizetype) D.26093;
  D.26095 = byte_to_str.5 + D.26094;
  D.26087 = acfg->fp;
  fputs (D.26095, D.26087);
  <D.26092>:
  i = i + 1;
  D.26082 = acfg->col_count;
  D.26096 = D.26082 + 1;
  acfg->col_count = D.26096;
  <D.25705>:
  if (i < size) goto <D.25704>; else goto <D.25706>;
  <D.25706>:
}


sprintf (char * restrict __s, const char * restrict __fmt)
{
  int D.26097;
  unsigned int D.26098;

  D.26098 = __builtin_object_size (__s, 1);
  D.26097 = __builtin___sprintf_chk (__s, 1, D.26098, __fmt, __builtin_va_arg_pack ());
  return D.26097;
}


img_writer_emit_string (struct MonoImageWriter * acfg, const char * value)
{
  int D.26100;

  D.26100 = acfg->use_bin_writer;
  if (D.26100 != 0) goto <D.26101>; else goto <D.26102>;
  <D.26101>:
  bin_writer_emit_string (acfg, value);
  goto <D.26103>;
  <D.26102>:
  asm_writer_emit_string (acfg, value);
  <D.26103>:
}


bin_writer_emit_string (struct MonoImageWriter * acfg, const char * value)
{
  unsigned int D.26104;
  unsigned int D.26105;
  int size;

  D.26104 = strlen (value);
  D.26105 = D.26104 + 1;
  size = (int) D.26105;
  bin_writer_emit_bytes (acfg, value, size);
}


asm_writer_emit_string (struct MonoImageWriter * acfg, const char * value)
{
  struct FILE * D.26106;

  asm_writer_emit_unset_mode (acfg);
  D.26106 = acfg->fp;
  fprintf (D.26106, "\t%s \"%s\"\n", ".string", value);
}


img_writer_emit_line (struct MonoImageWriter * acfg)
{
  int D.26107;

  D.26107 = acfg->use_bin_writer;
  if (D.26107 != 0) goto <D.26108>; else goto <D.26109>;
  <D.26108>:
  bin_writer_emit_line (acfg);
  goto <D.26110>;
  <D.26109>:
  asm_writer_emit_line (acfg);
  <D.26110>:
}


bin_writer_emit_line (struct MonoImageWriter * acfg)
{

}


asm_writer_emit_line (struct MonoImageWriter * acfg)
{
  struct FILE * D.26111;

  asm_writer_emit_unset_mode (acfg);
  D.26111 = acfg->fp;
  fprintf (D.26111, "\n");
}


img_writer_emit_alignment (struct MonoImageWriter * acfg, int size)
{
  int D.26112;

  D.26112 = acfg->use_bin_writer;
  if (D.26112 != 0) goto <D.26113>; else goto <D.26114>;
  <D.26113>:
  bin_writer_emit_alignment (acfg, size);
  goto <D.26115>;
  <D.26114>:
  asm_writer_emit_alignment (acfg, size);
  <D.26115>:
}


bin_writer_emit_alignment (struct MonoImageWriter * acfg, int size)
{
  struct BinSection * D.26116;
  int D.26117;
  int D.26118;
  int D.26119;
  int D.26122;
  int offset;
  int add;

  D.26116 = acfg->cur_section;
  offset = D.26116->cur_offset;
  D.26117 = size + -1;
  offset = D.26117 + offset;
  D.26118 = -size;
  offset = D.26118 & offset;
  D.26116 = acfg->cur_section;
  D.26119 = D.26116->cur_offset;
  add = offset - D.26119;
  if (add != 0) goto <D.26120>; else goto <D.26121>;
  <D.26120>:
  D.26116 = acfg->cur_section;
  bin_writer_emit_ensure_buffer (D.26116, add);
  D.26116 = acfg->cur_section;
  D.26116 = acfg->cur_section;
  D.26119 = D.26116->cur_offset;
  D.26122 = D.26119 + add;
  D.26116->cur_offset = D.26122;
  <D.26121>:
}


asm_writer_emit_alignment (struct MonoImageWriter * acfg, int size)
{
  struct FILE * D.26123;
  int D.26124;

  asm_writer_emit_unset_mode (acfg);
  D.26123 = acfg->fp;
  D.26124 = ilog2 (size);
  fprintf (D.26123, "\t.align %d\n", D.26124);
}


ilog2 (int value)
{
  int D.26125;
  int D.26126;
  int count;

  count = -1;
  goto <D.25096>;
  <D.25095>:
  count = count + 4;
  value = value >> 4;
  <D.25096>:
  D.26125 = value & -16;
  if (D.26125 != 0) goto <D.25095>; else goto <D.25097>;
  <D.25097>:
  goto <D.25099>;
  <D.25098>:
  count = count + 1;
  value = value >> 1;
  <D.25099>:
  if (value != 0) goto <D.25098>; else goto <D.25100>;
  <D.25100>:
  D.26126 = count;
  return D.26126;
}


img_writer_emit_pointer_unaligned (struct MonoImageWriter * acfg, const char * target)
{
  int D.26128;

  D.26128 = acfg->use_bin_writer;
  if (D.26128 != 0) goto <D.26129>; else goto <D.26130>;
  <D.26129>:
  bin_writer_emit_pointer_unaligned (acfg, target);
  goto <D.26131>;
  <D.26130>:
  asm_writer_emit_pointer_unaligned (acfg, target);
  <D.26131>:
}


bin_writer_emit_pointer_unaligned (struct MonoImageWriter * acfg, const char * target)
{
  struct BinSection * D.26134;
  int D.26135;
  unsigned int D.26136;
  unsigned int D.26137;
  int D.26138;
  gchar * D.26139;
  struct BinReloc * D.26140;
  int D.25234;
  int iftmp.8;
  int D.25233;
  struct BinSection * D.26144;
  const char[6] * D.26145;
  unsigned char D.26146;
  int D.26147;
  unsigned char D.26148;
  int D.26149;
  _Bool D.26150;
  _Bool D.26151;
  _Bool D.26152;
  const unsigned char * D.26155;
  unsigned char D.26156;
  int D.26157;
  const unsigned char * D.26158;
  unsigned char D.26159;
  int D.26160;
  _Bool D.26161;
  _Bool D.26162;
  const unsigned char * D.26165;
  unsigned char D.26166;
  int D.26167;
  const unsigned char * D.26168;
  unsigned char D.26169;
  int D.26170;
  _Bool D.26171;
  _Bool D.26172;
  const unsigned char * D.26175;
  unsigned char D.26176;
  int D.26177;
  const unsigned char * D.26178;
  unsigned char D.26179;
  int D.26180;
  char * D.26182;
  int D.26185;
  int D.26186;
  struct BinReloc * reloc;

  if (target == 0B) goto <D.26132>; else goto <D.26133>;
  <D.26132>:
  D.26134 = acfg->cur_section;
  D.26134 = acfg->cur_section;
  D.26135 = D.26134->cur_offset;
  D.26136 = (unsigned int) D.26135;
  D.26137 = D.26136 + 4;
  D.26138 = (int) D.26137;
  D.26134->cur_offset = D.26138;
  return;
  <D.26133>:
  reloc = monoeg_malloc0 (36);
  D.26139 = monoeg_strdup (target);
  reloc->val1 = D.26139;
  D.26134 = acfg->cur_section;
  reloc->section = D.26134;
  D.26134 = acfg->cur_section;
  D.26135 = D.26134->cur_offset;
  reloc->section_offset = D.26135;
  D.26140 = acfg->relocations;
  reloc->next = D.26140;
  acfg->relocations = reloc;
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 5;
    if (__s2_len <= 3) goto <D.26142>; else goto <D.26143>;
    <D.26142>:
    {
      const unsigned char * __s2;
      int __result;

      D.26144 = reloc->section;
      __s2 = D.26144->name;
      D.26145 = ".data";
      D.26146 = MEM[(const unsigned char *)D.26145];
      D.26147 = (int) D.26146;
      D.26148 = *__s2;
      D.26149 = (int) D.26148;
      __result = D.26147 - D.26149;
      {
        D.26150 = __s2_len != 0;
        D.26151 = __result == 0;
        D.26152 = D.26150 & D.26151;
        if (D.26152 != 0) goto <D.26153>; else goto <D.26154>;
        <D.26153>:
        D.26155 = &MEM[(void *)".data" + 1B];
        D.26156 = *D.26155;
        D.26157 = (int) D.26156;
        D.26158 = __s2 + 1;
        D.26159 = *D.26158;
        D.26160 = (int) D.26159;
        __result = D.26157 - D.26160;
        D.26161 = __s2_len > 1;
        D.26151 = __result == 0;
        D.26162 = D.26161 & D.26151;
        if (D.26162 != 0) goto <D.26163>; else goto <D.26164>;
        <D.26163>:
        D.26165 = &MEM[(void *)".data" + 2B];
        D.26166 = *D.26165;
        D.26167 = (int) D.26166;
        D.26168 = __s2 + 2;
        D.26169 = *D.26168;
        D.26170 = (int) D.26169;
        __result = D.26167 - D.26170;
        D.26171 = __s2_len > 2;
        D.26151 = __result == 0;
        D.26172 = D.26171 & D.26151;
        if (D.26172 != 0) goto <D.26173>; else goto <D.26174>;
        <D.26173>:
        D.26175 = &MEM[(void *)".data" + 3B];
        D.26176 = *D.26175;
        D.26177 = (int) D.26176;
        D.26178 = __s2 + 3;
        D.26179 = *D.26178;
        D.26180 = (int) D.26179;
        __result = D.26177 - D.26180;
        <D.26174>:
        <D.26164>:
        <D.26154>:
      }
      D.25233 = __result;
    }
    iftmp.8 = -D.25233;
    goto <D.26181>;
    <D.26143>:
    D.26144 = reloc->section;
    D.26182 = D.26144->name;
    iftmp.8 = __builtin_strcmp (D.26182, ".data");
    <D.26181>:
    D.25234 = iftmp.8;
  }
  if (D.25234 == 0) goto <D.26183>; else goto <D.26184>;
  <D.26183>:
  D.26185 = acfg->num_relocs;
  D.26186 = D.26185 + 1;
  acfg->num_relocs = D.26186;
  <D.26184>:
  D.26134 = acfg->cur_section;
  D.26134 = acfg->cur_section;
  D.26135 = D.26134->cur_offset;
  D.26136 = (unsigned int) D.26135;
  D.26137 = D.26136 + 4;
  D.26138 = (int) D.26137;
  D.26134->cur_offset = D.26138;
}


asm_writer_emit_pointer_unaligned (struct MonoImageWriter * acfg, const char * target)
{
  struct FILE * D.26188;
  const char * iftmp.9;

  asm_writer_emit_unset_mode (acfg);
  D.26188 = acfg->fp;
  if (target != 0B) goto <D.26190>; else goto <D.26191>;
  <D.26190>:
  iftmp.9 = target;
  goto <D.26192>;
  <D.26191>:
  iftmp.9 = "0";
  <D.26192>:
  fprintf (D.26188, "\t%s %s\n", ".long", iftmp.9);
}


img_writer_emit_pointer (struct MonoImageWriter * acfg, const char * target)
{
  int D.26193;

  D.26193 = acfg->use_bin_writer;
  if (D.26193 != 0) goto <D.26194>; else goto <D.26195>;
  <D.26194>:
  bin_writer_emit_pointer (acfg, target);
  goto <D.26196>;
  <D.26195>:
  asm_writer_emit_pointer (acfg, target);
  <D.26196>:
}


bin_writer_emit_pointer (struct MonoImageWriter * acfg, const char * target)
{
  bin_writer_emit_alignment (acfg, 4);
  bin_writer_emit_pointer_unaligned (acfg, target);
}


asm_writer_emit_pointer (struct MonoImageWriter * acfg, const char * target)
{
  asm_writer_emit_unset_mode (acfg);
  asm_writer_emit_alignment (acfg, 4);
  asm_writer_emit_pointer_unaligned (acfg, target);
}


img_writer_emit_int16 (struct MonoImageWriter * acfg, int value)
{
  int D.26197;

  D.26197 = acfg->use_bin_writer;
  if (D.26197 != 0) goto <D.26198>; else goto <D.26199>;
  <D.26198>:
  bin_writer_emit_int16 (acfg, value);
  goto <D.26200>;
  <D.26199>:
  asm_writer_emit_int16 (acfg, value);
  <D.26200>:
}


bin_writer_emit_int16 (struct MonoImageWriter * acfg, int value)
{
  struct BinSection * D.26201;
  guint8 * D.26202;
  int D.26203;
  sizetype D.26204;
  int D.26205;
  unsigned char D.26206;
  guint8 * D.26207;
  int D.26208;
  unsigned char D.26209;
  guint8 * data;

  D.26201 = acfg->cur_section;
  bin_writer_emit_ensure_buffer (D.26201, 2);
  D.26201 = acfg->cur_section;
  D.26202 = D.26201->data;
  D.26201 = acfg->cur_section;
  D.26203 = D.26201->cur_offset;
  D.26204 = (sizetype) D.26203;
  data = D.26202 + D.26204;
  D.26201 = acfg->cur_section;
  D.26201 = acfg->cur_section;
  D.26203 = D.26201->cur_offset;
  D.26205 = D.26203 + 2;
  D.26201->cur_offset = D.26205;
  D.26206 = (unsigned char) value;
  *data = D.26206;
  D.26207 = data + 1;
  D.26208 = value >> 8;
  D.26209 = (unsigned char) D.26208;
  *D.26207 = D.26209;
}


asm_writer_emit_int16 (struct MonoImageWriter * acfg, int value)
{
  int D.26210;
  int D.26213;
  int D.26214;
  int D.26215;
  unsigned int D.26216;
  unsigned int D.26217;
  struct FILE * D.26220;

  D.26210 = acfg->mode;
  if (D.26210 != 2) goto <D.26211>; else goto <D.26212>;
  <D.26211>:
  acfg->mode = 2;
  acfg->col_count = 0;
  <D.26212>:
  D.26213 = acfg->col_count;
  D.26214 = D.26213;
  D.26215 = D.26214 + 1;
  acfg->col_count = D.26215;
  D.26216 = (unsigned int) D.26214;
  D.26217 = D.26216 & 7;
  if (D.26217 == 0) goto <D.26218>; else goto <D.26219>;
  <D.26218>:
  D.26220 = acfg->fp;
  fprintf (D.26220, "\n\t%s ", ".hword");
  goto <D.26221>;
  <D.26219>:
  D.26220 = acfg->fp;
  fprintf (D.26220, ", ");
  <D.26221>:
  D.26220 = acfg->fp;
  fprintf (D.26220, "%d", value);
}


img_writer_emit_int32 (struct MonoImageWriter * acfg, int value)
{
  int D.26222;

  D.26222 = acfg->use_bin_writer;
  if (D.26222 != 0) goto <D.26223>; else goto <D.26224>;
  <D.26223>:
  bin_writer_emit_int32 (acfg, value);
  goto <D.26225>;
  <D.26224>:
  asm_writer_emit_int32 (acfg, value);
  <D.26225>:
}


bin_writer_emit_int32 (struct MonoImageWriter * acfg, int value)
{
  struct BinSection * D.26226;
  guint8 * D.26227;
  int D.26228;
  sizetype D.26229;
  int D.26230;
  unsigned char D.26231;
  guint8 * D.26232;
  int D.26233;
  unsigned char D.26234;
  guint8 * D.26235;
  int D.26236;
  unsigned char D.26237;
  guint8 * D.26238;
  int D.26239;
  unsigned char D.26240;
  guint8 * data;

  D.26226 = acfg->cur_section;
  bin_writer_emit_ensure_buffer (D.26226, 4);
  D.26226 = acfg->cur_section;
  D.26227 = D.26226->data;
  D.26226 = acfg->cur_section;
  D.26228 = D.26226->cur_offset;
  D.26229 = (sizetype) D.26228;
  data = D.26227 + D.26229;
  D.26226 = acfg->cur_section;
  D.26226 = acfg->cur_section;
  D.26228 = D.26226->cur_offset;
  D.26230 = D.26228 + 4;
  D.26226->cur_offset = D.26230;
  D.26231 = (unsigned char) value;
  *data = D.26231;
  D.26232 = data + 1;
  D.26233 = value >> 8;
  D.26234 = (unsigned char) D.26233;
  *D.26232 = D.26234;
  D.26235 = data + 2;
  D.26236 = value >> 16;
  D.26237 = (unsigned char) D.26236;
  *D.26235 = D.26237;
  D.26238 = data + 3;
  D.26239 = value >> 24;
  D.26240 = (unsigned char) D.26239;
  *D.26238 = D.26240;
}


asm_writer_emit_int32 (struct MonoImageWriter * acfg, int value)
{
  int D.26241;
  int D.26244;
  int D.26245;
  int D.26246;
  unsigned int D.26247;
  unsigned int D.26248;
  struct FILE * D.26251;

  D.26241 = acfg->mode;
  if (D.26241 != 3) goto <D.26242>; else goto <D.26243>;
  <D.26242>:
  acfg->mode = 3;
  acfg->col_count = 0;
  <D.26243>:
  D.26244 = acfg->col_count;
  D.26245 = D.26244;
  D.26246 = D.26245 + 1;
  acfg->col_count = D.26246;
  D.26247 = (unsigned int) D.26245;
  D.26248 = D.26247 & 7;
  if (D.26248 == 0) goto <D.26249>; else goto <D.26250>;
  <D.26249>:
  D.26251 = acfg->fp;
  fprintf (D.26251, "\n\t%s ", ".long");
  goto <D.26252>;
  <D.26250>:
  D.26251 = acfg->fp;
  fprintf (D.26251, ",");
  <D.26252>:
  D.26251 = acfg->fp;
  fprintf (D.26251, "%d", value);
}


img_writer_emit_symbol_diff (struct MonoImageWriter * acfg, const char * end, const char * start, int offset)
{
  int D.26253;

  D.26253 = acfg->use_bin_writer;
  if (D.26253 != 0) goto <D.26254>; else goto <D.26255>;
  <D.26254>:
  bin_writer_emit_symbol_diff (acfg, end, start, offset);
  goto <D.26256>;
  <D.26255>:
  asm_writer_emit_symbol_diff (acfg, end, start, offset);
  <D.26256>:
}


bin_writer_emit_symbol_diff (struct MonoImageWriter * acfg, const char * end, const char * start, int offset)
{
  struct BinSection * D.26257;
  int D.26258;
  int D.26259;

  create_reloc (acfg, end, start, offset);
  D.26257 = acfg->cur_section;
  D.26257 = acfg->cur_section;
  D.26258 = D.26257->cur_offset;
  D.26259 = D.26258 + 4;
  D.26257->cur_offset = D.26259;
}


create_reloc (struct MonoImageWriter * acfg, const char * end, const char * start, int offset)
{
  struct MonoMemPool * D.26260;
  char * D.26261;
  int D.25264;
  int iftmp.10;
  int D.25263;
  const char[2] * D.26265;
  unsigned char D.26266;
  int D.26267;
  unsigned char D.26268;
  int D.26269;
  _Bool D.26270;
  _Bool D.26271;
  _Bool D.26272;
  const unsigned char * D.26275;
  unsigned char D.26276;
  int D.26277;
  const unsigned char * D.26278;
  unsigned char D.26279;
  int D.26280;
  _Bool D.26281;
  _Bool D.26282;
  const unsigned char * D.26285;
  unsigned char D.26286;
  int D.26287;
  const unsigned char * D.26288;
  unsigned char D.26289;
  int D.26290;
  _Bool D.26291;
  _Bool D.26292;
  const unsigned char * D.26295;
  unsigned char D.26296;
  int D.26297;
  const unsigned char * D.26298;
  unsigned char D.26299;
  int D.26300;
  struct BinSection * D.26304;
  int D.26305;
  char * D.26307;
  struct BinReloc * D.26308;
  struct BinReloc * D.26309;
  struct BinReloc * reloc;

  D.26260 = acfg->mempool;
  reloc = mono_mempool_alloc0 (D.26260, 36);
  D.26260 = acfg->mempool;
  D.26261 = mono_mempool_strdup (D.26260, end);
  reloc->val1 = D.26261;
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 1;
    if (__s2_len <= 3) goto <D.26263>; else goto <D.26264>;
    <D.26263>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = start;
      D.26265 = ".";
      D.26266 = MEM[(const unsigned char *)D.26265];
      D.26267 = (int) D.26266;
      D.26268 = *__s2;
      D.26269 = (int) D.26268;
      __result = D.26267 - D.26269;
      {
        D.26270 = __s2_len != 0;
        D.26271 = __result == 0;
        D.26272 = D.26270 & D.26271;
        if (D.26272 != 0) goto <D.26273>; else goto <D.26274>;
        <D.26273>:
        D.26275 = &MEM[(void *)"." + 1B];
        D.26276 = *D.26275;
        D.26277 = (int) D.26276;
        D.26278 = __s2 + 1;
        D.26279 = *D.26278;
        D.26280 = (int) D.26279;
        __result = D.26277 - D.26280;
        D.26281 = __s2_len > 1;
        D.26271 = __result == 0;
        D.26282 = D.26281 & D.26271;
        if (D.26282 != 0) goto <D.26283>; else goto <D.26284>;
        <D.26283>:
        D.26285 = &MEM[(void *)"." + 2B];
        D.26286 = *D.26285;
        D.26287 = (int) D.26286;
        D.26288 = __s2 + 2;
        D.26289 = *D.26288;
        D.26290 = (int) D.26289;
        __result = D.26287 - D.26290;
        D.26291 = __s2_len > 2;
        D.26271 = __result == 0;
        D.26292 = D.26291 & D.26271;
        if (D.26292 != 0) goto <D.26293>; else goto <D.26294>;
        <D.26293>:
        D.26295 = &MEM[(void *)"." + 3B];
        D.26296 = *D.26295;
        D.26297 = (int) D.26296;
        D.26298 = __s2 + 3;
        D.26299 = *D.26298;
        D.26300 = (int) D.26299;
        __result = D.26297 - D.26300;
        <D.26294>:
        <D.26284>:
        <D.26274>:
      }
      D.25263 = __result;
    }
    iftmp.10 = -D.25263;
    goto <D.26301>;
    <D.26264>:
    iftmp.10 = __builtin_strcmp (start, ".");
    <D.26301>:
    D.25264 = iftmp.10;
  }
  if (D.25264 == 0) goto <D.26302>; else goto <D.26303>;
  <D.26302>:
  D.26304 = acfg->cur_section;
  reloc->val2_section = D.26304;
  D.26304 = acfg->cur_section;
  D.26305 = D.26304->cur_offset;
  reloc->val2_offset = D.26305;
  goto <D.26306>;
  <D.26303>:
  D.26260 = acfg->mempool;
  D.26307 = mono_mempool_strdup (D.26260, start);
  reloc->val2 = D.26307;
  <D.26306>:
  reloc->offset = offset;
  D.26304 = acfg->cur_section;
  reloc->section = D.26304;
  D.26304 = acfg->cur_section;
  D.26305 = D.26304->cur_offset;
  reloc->section_offset = D.26305;
  D.26308 = acfg->relocations;
  reloc->next = D.26308;
  acfg->relocations = reloc;
  D.26309 = reloc;
  return D.26309;
}


asm_writer_emit_symbol_diff (struct MonoImageWriter * acfg, const char * end, const char * start, int offset)
{
  int D.26311;
  int D.25729;
  int iftmp.11;
  int D.25728;
  const char[2] * D.26319;
  unsigned char D.26320;
  int D.26321;
  unsigned char D.26322;
  int D.26323;
  _Bool D.26324;
  _Bool D.26325;
  _Bool D.26326;
  const unsigned char * D.26329;
  unsigned char D.26330;
  int D.26331;
  const unsigned char * D.26332;
  unsigned char D.26333;
  int D.26334;
  _Bool D.26335;
  _Bool D.26336;
  const unsigned char * D.26339;
  unsigned char D.26340;
  int D.26341;
  const unsigned char * D.26342;
  unsigned char D.26343;
  int D.26344;
  _Bool D.26345;
  _Bool D.26346;
  const unsigned char * D.26349;
  unsigned char D.26350;
  int D.26351;
  const unsigned char * D.26352;
  unsigned char D.26353;
  int D.26354;
  int D.26358;
  int D.26359;
  struct FILE * D.26360;
  int D.26361;
  int D.26362;
  int D.26363;
  unsigned int D.26364;
  unsigned int D.26365;

  D.26311 = acfg->mode;
  if (D.26311 != 3) goto <D.26312>; else goto <D.26313>;
  <D.26312>:
  acfg->mode = 3;
  acfg->col_count = 0;
  <D.26313>:
  start = get_label (start);
  end = get_label (end);
  if (offset == 0) goto <D.26314>; else goto <D.26315>;
  <D.26314>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 1;
    if (__s2_len <= 3) goto <D.26317>; else goto <D.26318>;
    <D.26317>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = start;
      D.26319 = ".";
      D.26320 = MEM[(const unsigned char *)D.26319];
      D.26321 = (int) D.26320;
      D.26322 = *__s2;
      D.26323 = (int) D.26322;
      __result = D.26321 - D.26323;
      {
        D.26324 = __s2_len != 0;
        D.26325 = __result == 0;
        D.26326 = D.26324 & D.26325;
        if (D.26326 != 0) goto <D.26327>; else goto <D.26328>;
        <D.26327>:
        D.26329 = &MEM[(void *)"." + 1B];
        D.26330 = *D.26329;
        D.26331 = (int) D.26330;
        D.26332 = __s2 + 1;
        D.26333 = *D.26332;
        D.26334 = (int) D.26333;
        __result = D.26331 - D.26334;
        D.26335 = __s2_len > 1;
        D.26325 = __result == 0;
        D.26336 = D.26335 & D.26325;
        if (D.26336 != 0) goto <D.26337>; else goto <D.26338>;
        <D.26337>:
        D.26339 = &MEM[(void *)"." + 2B];
        D.26340 = *D.26339;
        D.26341 = (int) D.26340;
        D.26342 = __s2 + 2;
        D.26343 = *D.26342;
        D.26344 = (int) D.26343;
        __result = D.26341 - D.26344;
        D.26345 = __s2_len > 2;
        D.26325 = __result == 0;
        D.26346 = D.26345 & D.26325;
        if (D.26346 != 0) goto <D.26347>; else goto <D.26348>;
        <D.26347>:
        D.26349 = &MEM[(void *)"." + 3B];
        D.26350 = *D.26349;
        D.26351 = (int) D.26350;
        D.26352 = __s2 + 3;
        D.26353 = *D.26352;
        D.26354 = (int) D.26353;
        __result = D.26351 - D.26354;
        <D.26348>:
        <D.26338>:
        <D.26328>:
      }
      D.25728 = __result;
    }
    iftmp.11 = -D.25728;
    goto <D.26355>;
    <D.26318>:
    iftmp.11 = __builtin_strcmp (start, ".");
    <D.26355>:
    D.25729 = iftmp.11;
  }
  if (D.25729 != 0) goto <D.26356>; else goto <D.26357>;
  <D.26356>:
  {
    char symbol[128];

    try
      {
        D.26358 = acfg->label_gen;
        sprintf (&symbol, "%sDIFF_SYM%d", ".L", D.26358);
        D.26358 = acfg->label_gen;
        D.26359 = D.26358 + 1;
        acfg->label_gen = D.26359;
        D.26360 = acfg->fp;
        fprintf (D.26360, "\n%s=%s - %s", &symbol, end, start);
        D.26360 = acfg->fp;
        fprintf (D.26360, "\n\t%s ", ".long");
        D.26360 = acfg->fp;
        fprintf (D.26360, "%s", &symbol);
        return;
      }
    finally
      {
        symbol = {CLOBBER};
      }
  }
  <D.26357>:
  <D.26315>:
  D.26361 = acfg->col_count;
  D.26362 = D.26361;
  D.26363 = D.26362 + 1;
  acfg->col_count = D.26363;
  D.26364 = (unsigned int) D.26362;
  D.26365 = D.26364 & 7;
  if (D.26365 == 0) goto <D.26366>; else goto <D.26367>;
  <D.26366>:
  D.26360 = acfg->fp;
  fprintf (D.26360, "\n\t%s ", ".long");
  goto <D.26368>;
  <D.26367>:
  D.26360 = acfg->fp;
  fprintf (D.26360, ",");
  <D.26368>:
  if (offset > 0) goto <D.26369>; else goto <D.26370>;
  <D.26369>:
  D.26360 = acfg->fp;
  fprintf (D.26360, "%s - %s + %d", end, start, offset);
  goto <D.26371>;
  <D.26370>:
  if (offset < 0) goto <D.26372>; else goto <D.26373>;
  <D.26372>:
  D.26360 = acfg->fp;
  fprintf (D.26360, "%s - %s %d", end, start, offset);
  goto <D.26374>;
  <D.26373>:
  D.26360 = acfg->fp;
  fprintf (D.26360, "%s - %s", end, start);
  <D.26374>:
  <D.26371>:
}


img_writer_emit_zero_bytes (struct MonoImageWriter * acfg, int num)
{
  int D.26377;

  D.26377 = acfg->use_bin_writer;
  if (D.26377 != 0) goto <D.26378>; else goto <D.26379>;
  <D.26378>:
  bin_writer_emit_zero_bytes (acfg, num);
  goto <D.26380>;
  <D.26379>:
  asm_writer_emit_zero_bytes (acfg, num);
  <D.26380>:
}


bin_writer_emit_zero_bytes (struct MonoImageWriter * acfg, int num)
{
  struct BinSection * D.26381;
  int D.26382;
  int D.26383;

  D.26381 = acfg->cur_section;
  bin_writer_emit_ensure_buffer (D.26381, num);
  D.26381 = acfg->cur_section;
  D.26381 = acfg->cur_section;
  D.26382 = D.26381->cur_offset;
  D.26383 = D.26382 + num;
  D.26381->cur_offset = D.26383;
}


asm_writer_emit_zero_bytes (struct MonoImageWriter * acfg, int num)
{
  struct FILE * D.26384;

  asm_writer_emit_unset_mode (acfg);
  D.26384 = acfg->fp;
  fprintf (D.26384, "\t%s %d\n", ".skip", num);
}


img_writer_emit_writeout (struct MonoImageWriter * acfg)
{
  int D.26385;
  int D.26388;

  D.26385 = acfg->use_bin_writer;
  if (D.26385 != 0) goto <D.26386>; else goto <D.26387>;
  <D.26386>:
  D.26388 = bin_writer_emit_writeout (acfg);
  return D.26388;
  <D.26387>:
  D.26388 = asm_writer_emit_writeout (acfg);
  return D.26388;
}


bin_writer_emit_writeout (struct MonoImageWriter * acfg)
{
  const char * D.26390;
  int D.26391;
  unsigned int D.26392;
  int D.26393;
  unsigned int D.26394;
  int D.26395;
  unsigned int D.26396;
  int D.26397;
  unsigned int D.26398;
  int D.26399;
  unsigned int D.26400;
  int D.25594;
  char * D.26401;
  const char * D.26402;
  struct BinSection * D.26405;
  int D.26406;
  int num_local_syms.12;
  unsigned int file_offset.13;
  unsigned int D.26409;
  int D.26410;
  int D.26411;
  int * D.26412;
  int D.26413;
  int D.26414;
  unsigned int D.26415;
  unsigned int D.26416;
  int size.14;
  int size.15;
  unsigned int size.16;
  unsigned int D.26420;
  unsigned int D.26421;
  unsigned int D.26422;
  int size.17;
  unsigned int D.26424;
  struct GString * D.26425;
  unsigned int D.26426;
  int size.18;
  unsigned int D.26428;
  int D.26429;
  unsigned int D.26430;
  unsigned int D.26431;
  int size.19;
  unsigned int D.26433;
  unsigned int D.26434;
  unsigned int file_offset.20;
  unsigned int D.26436;
  unsigned int D.26437;
  unsigned int D.26438;
  unsigned int D.26439;
  unsigned int D.26440;
  struct BinSection * D.26441;
  int D.26444;
  long long unsigned int D.26447;
  unsigned int D.26448;
  unsigned int D.26449;
  unsigned int D.26450;
  int size.21;
  unsigned int D.26452;
  unsigned int D.26453;
  unsigned int D.26454;
  unsigned int D.26455;
  unsigned int D.26456;
  unsigned int virt_offset.22;
  struct BinSection * D.26458;
  int size.23;
  unsigned int D.26462;
  unsigned int D.26463;
  unsigned int D.26464;
  unsigned int D.26465;
  unsigned int D.26466;
  unsigned int D.26467;
  unsigned int D.26468;
  unsigned int D.26469;
  unsigned int D.26470;
  unsigned int D.26471;
  unsigned int virt_offset.24;
  unsigned int D.26473;
  unsigned int D.26474;
  unsigned int D.26475;
  unsigned int D.26476;
  unsigned int D.26477;
  unsigned int D.26478;
  unsigned int D.26479;
  unsigned int D.26480;
  unsigned int D.26481;
  unsigned int D.26482;
  unsigned int D.26483;
  struct BinSection * D.26484;
  int size.25;
  unsigned int D.26488;
  unsigned int D.26489;
  unsigned int D.26490;
  unsigned int D.26491;
  unsigned int D.26492;
  unsigned int D.26493;
  unsigned int D.26494;
  unsigned int D.26495;
  struct BinSection * D.26496;
  int size.26;
  unsigned int D.26500;
  unsigned int D.26501;
  unsigned int D.26502;
  unsigned int D.26503;
  unsigned int D.26504;
  struct BinSection * D.26505;
  int size.27;
  struct BinSection * D.26510;
  int size.28;
  struct BinSection * D.26515;
  int size.29;
  struct BinSection * D.26520;
  int size.30;
  struct BinSection * D.26525;
  int size.31;
  unsigned int D.26530;
  unsigned int D.26531;
  unsigned int D.26532;
  unsigned int D.26533;
  unsigned int D.26534;
  struct GString * D.26535;
  unsigned int D.26536;
  int size.32;
  unsigned int D.26538;
  unsigned int D.26539;
  unsigned int D.26540;
  unsigned int D.26541;
  unsigned int D.26542;
  int num_local_syms.33;
  unsigned int num_local_syms.34;
  unsigned int D.26545;
  int size.35;
  unsigned int D.26547;
  unsigned int D.26548;
  unsigned int D.26549;
  unsigned int D.26550;
  unsigned int D.26551;
  struct GString * D.26552;
  unsigned int D.26553;
  int size.36;
  unsigned int D.26557;
  unsigned int D.26558;
  _Bool D.26559;
  long int D.26560;
  long int D.26561;
  unsigned int D.26564;
  unsigned int D.26565;
  unsigned int D.26566;
  unsigned int D.26567;
  unsigned int D.26568;
  unsigned int D.26569;
  unsigned int D.26570;
  unsigned int D.26571;
  unsigned int D.26572;
  unsigned int D.26573;
  unsigned int D.26574;
  unsigned int D.26575;
  unsigned int D.26576;
  unsigned int D.26577;
  unsigned int D.26578;
  unsigned int D.26579;
  unsigned int D.26580;
  unsigned int D.26581;
  struct BinSection * D.26582;
  unsigned int D.26585;
  int D.26586;
  unsigned int D.26587;
  int D.26588;
  struct FILE * D.26589;
  unsigned int file_offset.37;
  unsigned int D.26593;
  int D.26594;
  int D.26595;
  unsigned int D.26596;
  void * D.26597;
  int D.26598;
  int D.26599;
  unsigned int D.26600;
  unsigned int D.26601;
  char * D.26602;
  int D.26603;
  unsigned int D.26604;
  int D.26605;
  unsigned int D.26606;
  int D.26609;
  guint8 * D.26610;
  unsigned int size.38;
  unsigned int D.26614;
  int D.26615;
  guint8 * D.26616;
  unsigned int size.39;
  int D.26618;
  int size.40;
  unsigned int D.26620;
  int D.26621;
  struct BinSection * D.26622;
  unsigned int D.26625;
  int D.26626;
  guint8 * D.26627;
  int D.26628;
  unsigned int D.26629;
  unsigned int i.41;
  unsigned int D.26631;
  int D.26632;
  char * D.26633;
  unsigned int D.26634;
  int D.26635;
  unsigned int D.26636;
  int D.26637;
  char * D.26638;
  int D.26641;
  struct FILE * file;
  struct ElfHeader header;
  struct ElfProgHeader progh[4];
  struct ElfSectHeader secth[20];
  struct ElfReloc * relocs;
  struct ElfStrTable str_table;
  struct ElfStrTable sh_str_table;
  struct ElfStrTable dyn_str_table;
  struct BinSection * all_sections[32];
  struct BinSection * sections[20];
  struct ElfSymbol * dynsym;
  struct ElfSymbol * symtab;
  struct ElfDynamic dynamic[14];
  int * hash;
  int i;
  int num_sections;
  int file_offset;
  int virt_offset;
  int size;
  int num_symtab;
  int num_local_syms;

  try
    {
      str_table.data = 0B;
      str_table.hash = 0B;
      sh_str_table.data = 0B;
      sh_str_table.hash = 0B;
      dyn_str_table.data = 0B;
      dyn_str_table.hash = 0B;
      file = acfg->fp;
      memset (&secth, 0, 800);
      memset (&dynamic, 0, 112);
      memset (&header, 0, 52);
      i = 1;
      goto <D.25582>;
      <D.25581>:
      D.26390 = section_info[i].name;
      D.26391 = str_table_add (&sh_str_table, D.26390);
      D.26392 = (unsigned int) D.26391;
      secth[i].sh_name = D.26392;
      D.26393 = section_info[i].type;
      D.26394 = (unsigned int) D.26393;
      secth[i].sh_type = D.26394;
      D.26395 = section_info[i].align;
      D.26396 = (unsigned int) D.26395;
      secth[i].sh_addralign = D.26396;
      D.26397 = section_info[i].flags;
      D.26398 = (unsigned int) D.26397;
      secth[i].sh_flags = D.26398;
      D.26399 = section_info[i].esize;
      D.26400 = (unsigned int) D.26399;
      secth[i].sh_entsize = D.26400;
      i = i + 1;
      <D.25582>:
      if (i <= 19) goto <D.25581>; else goto <D.25583>;
      <D.25583>:
      secth[2].sh_info = 4;
      secth[18].sh_info = 20;
      secth[1].sh_link = 2;
      secth[2].sh_link = 3;
      secth[4].sh_link = 2;
      secth[5].sh_link = 2;
      secth[8].sh_link = 3;
      secth[18].sh_link = 19;
      num_sections = collect_sections (acfg, &secth, &all_sections, 16);
      hash = build_hash (acfg, num_sections, &dyn_str_table);
      num_symtab = MEM[(int *)hash + 4B];
      memset (&sections, 0, 80);
      i = 0;
      goto <D.25599>;
      <D.25598>:
      {
        struct BinSection * sect;
        int j;

        sect = all_sections[i];
        j = 0;
        goto <D.25597>;
        <D.25596>:
        {
          size_t __s1_len;
          size_t __s2_len;

          D.26401 = sect->name;
          D.26402 = section_info[j].name;
          D.25594 = __builtin_strcmp (D.26401, D.26402);
        }
        if (D.25594 == 0) goto <D.26403>; else goto <D.26404>;
        <D.26403>:
        sect->shidx = j;
        goto <D.25595>;
        <D.26404>:
        j = j + 1;
        <D.25597>:
        if (j <= 19) goto <D.25596>; else goto <D.25595>;
        <D.25595>:
        D.26405 = all_sections[i];
        D.26406 = D.26405->shidx;
        sections[D.26406] = sect;
      }
      i = i + 1;
      <D.25599>:
      if (i < num_sections) goto <D.25598>; else goto <D.25600>;
      <D.25600>:
      dynsym = collect_syms (acfg, hash, &dyn_str_table, 0B, 0B);
      num_local_syms.12 = MEM[(int *)hash + 4B];
      num_local_syms = num_local_syms.12;
      symtab = collect_syms (acfg, 0B, &str_table, &secth, &num_local_syms);
      virt_offset = 180;
      file_offset = virt_offset;
      file_offset.13 = (unsigned int) file_offset;
      secth[1].sh_offset = file_offset.13;
      D.26409 = secth[1].sh_offset;
      secth[1].sh_addr = D.26409;
      D.26410 = *hash;
      D.26411 = D.26410 + 2;
      D.26412 = hash + 4;
      D.26413 = *D.26412;
      D.26414 = D.26411 + D.26413;
      D.26415 = (unsigned int) D.26414;
      D.26416 = D.26415 * 4;
      size.14 = (int) D.26416;
      size = size.14;
      size.15 = size;
      file_offset = file_offset + size.15;
      virt_offset = file_offset;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[1].sh_size = size.16;
      file_offset.13 = (unsigned int) file_offset;
      secth[2].sh_offset = file_offset.13;
      D.26420 = secth[2].sh_offset;
      secth[2].sh_addr = D.26420;
      D.26412 = hash + 4;
      D.26413 = *D.26412;
      D.26421 = (unsigned int) D.26413;
      D.26422 = D.26421 * 16;
      size.17 = (int) D.26422;
      size = size.17;
      size.15 = size;
      file_offset = file_offset + size.15;
      virt_offset = file_offset;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[2].sh_size = size.16;
      file_offset.13 = (unsigned int) file_offset;
      secth[3].sh_offset = file_offset.13;
      D.26424 = secth[3].sh_offset;
      secth[3].sh_addr = D.26424;
      D.26425 = dyn_str_table.data;
      D.26426 = D.26425->len;
      size.18 = (int) D.26426;
      size = size.18;
      size.15 = size;
      file_offset = file_offset + size.15;
      virt_offset = file_offset;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[3].sh_size = size.16;
      file_offset = file_offset + 3;
      file_offset = file_offset & -4;
      file_offset.13 = (unsigned int) file_offset;
      secth[4].sh_offset = file_offset.13;
      D.26428 = secth[4].sh_offset;
      secth[4].sh_addr = D.26428;
      D.26429 = acfg->num_relocs;
      D.26430 = (unsigned int) D.26429;
      D.26431 = D.26430 * 8;
      size.19 = (int) D.26431;
      size = size.19;
      size.15 = size;
      file_offset = file_offset + size.15;
      virt_offset = file_offset;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[4].sh_size = size.16;
      file_offset.13 = (unsigned int) file_offset;
      secth[5].sh_offset = file_offset.13;
      D.26433 = secth[5].sh_offset;
      secth[5].sh_addr = D.26433;
      size = 0;
      size.15 = size;
      file_offset = file_offset + size.15;
      virt_offset = file_offset;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[5].sh_size = size.16;
      D.26434 = secth[6].sh_addralign;
      file_offset.20 = (unsigned int) file_offset;
      D.26436 = D.26434 + file_offset.20;
      D.26437 = D.26436 + 4294967295;
      D.26434 = secth[6].sh_addralign;
      D.26438 = -D.26434;
      D.26439 = D.26437 & D.26438;
      file_offset = (int) D.26439;
      virt_offset = file_offset;
      file_offset.13 = (unsigned int) file_offset;
      secth[6].sh_offset = file_offset.13;
      D.26440 = secth[6].sh_offset;
      secth[6].sh_addr = D.26440;
      D.26441 = sections[6];
      if (D.26441 != 0B) goto <D.26442>; else goto <D.26443>;
      <D.26442>:
      D.26441 = sections[6];
      D.26444 = D.26441->has_addr;
      if (D.26444 != 0) goto <D.26445>; else goto <D.26446>;
      <D.26445>:
      D.26441 = sections[6];
      D.26447 = D.26441->addr;
      D.26448 = (unsigned int) D.26447;
      secth[6].sh_addr = D.26448;
      D.26449 = secth[6].sh_flags;
      D.26450 = D.26449 & 4294967293;
      secth[6].sh_flags = D.26450;
      <D.26446>:
      D.26441 = sections[6];
      size.21 = D.26441->cur_offset;
      size = size.21;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[6].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      <D.26443>:
      D.26452 = secth[7].sh_addralign;
      file_offset.20 = (unsigned int) file_offset;
      D.26453 = D.26452 + file_offset.20;
      D.26454 = D.26453 + 4294967295;
      D.26452 = secth[7].sh_addralign;
      D.26455 = -D.26452;
      D.26456 = D.26454 & D.26455;
      file_offset = (int) D.26456;
      virt_offset = file_offset;
      virt_offset.22 = (unsigned int) virt_offset;
      secth[7].sh_addr = virt_offset.22;
      file_offset.13 = (unsigned int) file_offset;
      secth[7].sh_offset = file_offset.13;
      D.26458 = sections[7];
      if (D.26458 != 0B) goto <D.26459>; else goto <D.26460>;
      <D.26459>:
      D.26458 = sections[7];
      size.23 = D.26458->cur_offset;
      size = size.23;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[7].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      size.15 = size;
      virt_offset = virt_offset + size.15;
      <D.26460>:
      D.26462 = secth[8].sh_addralign;
      file_offset.20 = (unsigned int) file_offset;
      D.26463 = D.26462 + file_offset.20;
      D.26464 = D.26463 + 4294967295;
      D.26462 = secth[8].sh_addralign;
      D.26465 = -D.26462;
      D.26466 = D.26464 & D.26465;
      file_offset = (int) D.26466;
      virt_offset = file_offset;
      virt_offset = virt_offset + 4096;
      virt_offset.22 = (unsigned int) virt_offset;
      secth[8].sh_addr = virt_offset.22;
      file_offset.13 = (unsigned int) file_offset;
      secth[8].sh_offset = file_offset.13;
      size = 112;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[8].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      size.15 = size;
      virt_offset = virt_offset + size.15;
      D.26467 = secth[9].sh_addralign;
      file_offset.20 = (unsigned int) file_offset;
      D.26468 = D.26467 + file_offset.20;
      D.26469 = D.26468 + 4294967295;
      D.26467 = secth[9].sh_addralign;
      D.26470 = -D.26467;
      D.26471 = D.26469 & D.26470;
      file_offset = (int) D.26471;
      D.26467 = secth[9].sh_addralign;
      virt_offset.24 = (unsigned int) virt_offset;
      D.26473 = D.26467 + virt_offset.24;
      D.26474 = D.26473 + 4294967295;
      D.26467 = secth[9].sh_addralign;
      D.26470 = -D.26467;
      D.26475 = D.26474 & D.26470;
      virt_offset = (int) D.26475;
      virt_offset.22 = (unsigned int) virt_offset;
      secth[9].sh_addr = virt_offset.22;
      file_offset.13 = (unsigned int) file_offset;
      secth[9].sh_offset = file_offset.13;
      size = 12;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[9].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      size.15 = size;
      virt_offset = virt_offset + size.15;
      D.26476 = secth[10].sh_addralign;
      file_offset.20 = (unsigned int) file_offset;
      D.26477 = D.26476 + file_offset.20;
      D.26478 = D.26477 + 4294967295;
      D.26476 = secth[10].sh_addralign;
      D.26479 = -D.26476;
      D.26480 = D.26478 & D.26479;
      file_offset = (int) D.26480;
      D.26476 = secth[10].sh_addralign;
      virt_offset.24 = (unsigned int) virt_offset;
      D.26481 = D.26476 + virt_offset.24;
      D.26482 = D.26481 + 4294967295;
      D.26476 = secth[10].sh_addralign;
      D.26479 = -D.26476;
      D.26483 = D.26482 & D.26479;
      virt_offset = (int) D.26483;
      virt_offset.22 = (unsigned int) virt_offset;
      secth[10].sh_addr = virt_offset.22;
      file_offset.13 = (unsigned int) file_offset;
      secth[10].sh_offset = file_offset.13;
      D.26484 = sections[10];
      if (D.26484 != 0B) goto <D.26485>; else goto <D.26486>;
      <D.26485>:
      D.26484 = sections[10];
      size.25 = D.26484->cur_offset;
      size = size.25;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[10].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      size.15 = size;
      virt_offset = virt_offset + size.15;
      <D.26486>:
      D.26488 = secth[11].sh_addralign;
      file_offset.20 = (unsigned int) file_offset;
      D.26489 = D.26488 + file_offset.20;
      D.26490 = D.26489 + 4294967295;
      D.26488 = secth[11].sh_addralign;
      D.26491 = -D.26488;
      D.26492 = D.26490 & D.26491;
      file_offset = (int) D.26492;
      D.26488 = secth[11].sh_addralign;
      virt_offset.24 = (unsigned int) virt_offset;
      D.26493 = D.26488 + virt_offset.24;
      D.26494 = D.26493 + 4294967295;
      D.26488 = secth[11].sh_addralign;
      D.26491 = -D.26488;
      D.26495 = D.26494 & D.26491;
      virt_offset = (int) D.26495;
      virt_offset.22 = (unsigned int) virt_offset;
      secth[11].sh_addr = virt_offset.22;
      file_offset.13 = (unsigned int) file_offset;
      secth[11].sh_offset = file_offset.13;
      D.26496 = sections[11];
      if (D.26496 != 0B) goto <D.26497>; else goto <D.26498>;
      <D.26497>:
      D.26496 = sections[11];
      size.26 = D.26496->cur_offset;
      size = size.26;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[11].sh_size = size.16;
      <D.26498>:
      D.26500 = secth[12].sh_addralign;
      file_offset.20 = (unsigned int) file_offset;
      D.26501 = D.26500 + file_offset.20;
      D.26502 = D.26501 + 4294967295;
      D.26500 = secth[12].sh_addralign;
      D.26503 = -D.26500;
      D.26504 = D.26502 & D.26503;
      file_offset = (int) D.26504;
      file_offset.13 = (unsigned int) file_offset;
      secth[12].sh_offset = file_offset.13;
      D.26505 = sections[12];
      if (D.26505 != 0B) goto <D.26506>; else goto <D.26507>;
      <D.26506>:
      D.26505 = sections[12];
      size.27 = D.26505->cur_offset;
      size = size.27;
      goto <D.26509>;
      <D.26507>:
      size = 0;
      <D.26509>:
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[12].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      file_offset.13 = (unsigned int) file_offset;
      secth[13].sh_offset = file_offset.13;
      D.26510 = sections[13];
      if (D.26510 != 0B) goto <D.26511>; else goto <D.26512>;
      <D.26511>:
      D.26510 = sections[13];
      size.28 = D.26510->cur_offset;
      size = size.28;
      goto <D.26514>;
      <D.26512>:
      size = 0;
      <D.26514>:
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[13].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      file_offset.13 = (unsigned int) file_offset;
      secth[14].sh_offset = file_offset.13;
      D.26515 = sections[14];
      if (D.26515 != 0B) goto <D.26516>; else goto <D.26517>;
      <D.26516>:
      D.26515 = sections[14];
      size.29 = D.26515->cur_offset;
      size = size.29;
      goto <D.26519>;
      <D.26517>:
      size = 0;
      <D.26519>:
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[14].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      file_offset.13 = (unsigned int) file_offset;
      secth[15].sh_offset = file_offset.13;
      D.26520 = sections[15];
      if (D.26520 != 0B) goto <D.26521>; else goto <D.26522>;
      <D.26521>:
      D.26520 = sections[15];
      size.30 = D.26520->cur_offset;
      size = size.30;
      goto <D.26524>;
      <D.26522>:
      size = 0;
      <D.26524>:
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[15].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      file_offset.13 = (unsigned int) file_offset;
      secth[16].sh_offset = file_offset.13;
      D.26525 = sections[16];
      if (D.26525 != 0B) goto <D.26526>; else goto <D.26527>;
      <D.26526>:
      D.26525 = sections[16];
      size.31 = D.26525->cur_offset;
      size = size.31;
      goto <D.26529>;
      <D.26527>:
      size = 0;
      <D.26529>:
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[16].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      D.26530 = secth[17].sh_addralign;
      file_offset.20 = (unsigned int) file_offset;
      D.26531 = D.26530 + file_offset.20;
      D.26532 = D.26531 + 4294967295;
      D.26530 = secth[17].sh_addralign;
      D.26533 = -D.26530;
      D.26534 = D.26532 & D.26533;
      file_offset = (int) D.26534;
      file_offset.13 = (unsigned int) file_offset;
      secth[17].sh_offset = file_offset.13;
      D.26535 = sh_str_table.data;
      D.26536 = D.26535->len;
      size.32 = (int) D.26536;
      size = size.32;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[17].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      D.26538 = secth[18].sh_addralign;
      file_offset.20 = (unsigned int) file_offset;
      D.26539 = D.26538 + file_offset.20;
      D.26540 = D.26539 + 4294967295;
      D.26538 = secth[18].sh_addralign;
      D.26541 = -D.26538;
      D.26542 = D.26540 & D.26541;
      file_offset = (int) D.26542;
      file_offset.13 = (unsigned int) file_offset;
      secth[18].sh_offset = file_offset.13;
      num_local_syms.33 = num_local_syms;
      num_local_syms.34 = (unsigned int) num_local_syms.33;
      D.26545 = num_local_syms.34 * 16;
      size.35 = (int) D.26545;
      size = size.35;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[18].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      D.26547 = secth[19].sh_addralign;
      file_offset.20 = (unsigned int) file_offset;
      D.26548 = D.26547 + file_offset.20;
      D.26549 = D.26548 + 4294967295;
      D.26547 = secth[19].sh_addralign;
      D.26550 = -D.26547;
      D.26551 = D.26549 & D.26550;
      file_offset = (int) D.26551;
      file_offset.13 = (unsigned int) file_offset;
      secth[19].sh_offset = file_offset.13;
      D.26552 = str_table.data;
      D.26553 = D.26552->len;
      size.36 = (int) D.26553;
      size = size.36;
      size.15 = size;
      size.16 = (unsigned int) size.15;
      secth[19].sh_size = size.16;
      size.15 = size;
      file_offset = file_offset + size.15;
      i = 1;
      goto <D.25602>;
      <D.25601>:
      D.26399 = section_info[i].esize;
      if (D.26399 != 0) goto <D.26555>; else goto <D.26556>;
      <D.26555>:
      D.26557 = secth[i].sh_size;
      D.26399 = section_info[i].esize;
      D.26400 = (unsigned int) D.26399;
      D.26558 = D.26557 % D.26400;
      D.26559 = D.26558 != 0;
      D.26560 = (long int) D.26559;
      D.26561 = __builtin_expect (D.26560, 0);
      if (D.26561 != 0) goto <D.26562>; else goto <D.26563>;
      <D.26562>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 1489, "secth [i].sh_size % section_info [i].esize == 0");
      <D.26563>:
      <D.26556>:
      i = i + 1;
      <D.25602>:
      if (i <= 19) goto <D.25601>; else goto <D.25603>;
      <D.25603>:
      file_offset = file_offset + 3;
      file_offset = file_offset & -4;
      header.e_ident[0] = 127;
      header.e_ident[1] = 69;
      header.e_ident[2] = 76;
      header.e_ident[3] = 70;
      header.e_ident[4] = 1;
      header.e_ident[5] = 1;
      header.e_ident[6] = 1;
      header.e_ident[7] = 0;
      header.e_ident[8] = 0;
      i = 9;
      goto <D.25605>;
      <D.25604>:
      header.e_ident[i] = 0;
      i = i + 1;
      <D.25605>:
      if (i <= 15) goto <D.25604>; else goto <D.25606>;
      <D.25606>:
      header.e_type = 3;
      header.e_machine = 40;
      header.e_version = 1;
      header.e_phoff = 52;
      header.e_ehsize = 52;
      header.e_phentsize = 32;
      header.e_phnum = 4;
      D.26564 = secth[6].sh_addr;
      header.e_entry = D.26564;
      header.e_shstrndx = 17;
      header.e_shentsize = 40;
      header.e_shnum = 20;
      file_offset.13 = (unsigned int) file_offset;
      header.e_shoff = file_offset.13;
      i = 0;
      dynamic[i].d_tag = 4;
      D.26409 = secth[1].sh_offset;
      dynamic[i].d_un.d_val = D.26409;
      i = i + 1;
      dynamic[i].d_tag = 5;
      D.26424 = secth[3].sh_offset;
      dynamic[i].d_un.d_val = D.26424;
      i = i + 1;
      dynamic[i].d_tag = 6;
      D.26420 = secth[2].sh_offset;
      dynamic[i].d_un.d_val = D.26420;
      i = i + 1;
      dynamic[i].d_tag = 10;
      D.26425 = dyn_str_table.data;
      D.26426 = D.26425->len;
      dynamic[i].d_un.d_val = D.26426;
      i = i + 1;
      dynamic[i].d_tag = 11;
      dynamic[i].d_un.d_val = 16;
      i = i + 1;
      dynamic[i].d_tag = 17;
      D.26428 = secth[4].sh_offset;
      dynamic[i].d_un.d_val = D.26428;
      i = i + 1;
      dynamic[i].d_tag = 18;
      D.26565 = secth[4].sh_size;
      dynamic[i].d_un.d_val = D.26565;
      i = i + 1;
      dynamic[i].d_tag = 19;
      dynamic[i].d_un.d_val = 8;
      i = i + 1;
      dynamic[i].d_tag = 1879048186;
      D.26429 = acfg->num_relocs;
      D.26566 = (unsigned int) D.26429;
      dynamic[i].d_un.d_val = D.26566;
      i = i + 1;
      memset (&progh, 0, 128);
      progh[0].p_type = 1;
      D.26567 = secth[8].sh_offset;
      progh[0].p_memsz = D.26567;
      D.26568 = progh[0].p_memsz;
      progh[0].p_filesz = D.26568;
      progh[0].p_align = 4096;
      progh[0].p_flags = 5;
      progh[1].p_type = 1;
      D.26567 = secth[8].sh_offset;
      progh[1].p_offset = D.26567;
      D.26569 = secth[8].sh_addr;
      progh[1].p_paddr = D.26569;
      D.26570 = progh[1].p_paddr;
      progh[1].p_vaddr = D.26570;
      D.26571 = secth[11].sh_offset;
      D.26567 = secth[8].sh_offset;
      D.26572 = D.26571 - D.26567;
      progh[1].p_filesz = D.26572;
      D.26573 = secth[11].sh_addr;
      D.26574 = secth[11].sh_size;
      D.26575 = D.26573 + D.26574;
      D.26569 = secth[8].sh_addr;
      D.26576 = D.26575 - D.26569;
      progh[1].p_memsz = D.26576;
      progh[1].p_align = 4096;
      progh[1].p_flags = 6;
      progh[2].p_type = 2;
      D.26567 = secth[8].sh_offset;
      progh[2].p_offset = D.26567;
      D.26569 = secth[8].sh_addr;
      progh[2].p_paddr = D.26569;
      D.26577 = progh[2].p_paddr;
      progh[2].p_vaddr = D.26577;
      D.26578 = secth[8].sh_size;
      progh[2].p_memsz = D.26578;
      D.26579 = progh[2].p_memsz;
      progh[2].p_filesz = D.26579;
      progh[2].p_align = 4;
      progh[2].p_flags = 6;
      progh[3].p_type = 1685382481;
      D.26567 = secth[8].sh_offset;
      progh[3].p_offset = D.26567;
      D.26569 = secth[8].sh_addr;
      progh[3].p_paddr = D.26569;
      D.26580 = progh[3].p_paddr;
      progh[3].p_vaddr = D.26580;
      D.26578 = secth[8].sh_size;
      progh[3].p_memsz = D.26578;
      D.26581 = progh[3].p_memsz;
      progh[3].p_filesz = D.26581;
      progh[3].p_align = 4;
      progh[3].p_flags = 6;
      i = 0;
      goto <D.25608>;
      <D.25607>:
      D.26582 = sections[i];
      if (D.26582 != 0B) goto <D.26583>; else goto <D.26584>;
      <D.26583>:
      D.26582 = sections[i];
      D.26585 = secth[i].sh_offset;
      D.26586 = (int) D.26585;
      D.26582->file_offset = D.26586;
      D.26582 = sections[i];
      D.26587 = secth[i].sh_addr;
      D.26588 = (int) D.26587;
      D.26582->virt_offset = D.26588;
      <D.26584>:
      i = i + 1;
      <D.25608>:
      if (i <= 19) goto <D.25607>; else goto <D.25609>;
      <D.25609>:
      reloc_symbols (acfg, dynsym, &secth, &dyn_str_table, 1);
      reloc_symbols (acfg, symtab, &secth, &str_table, 0);
      relocs = resolve_relocations (acfg);
      D.26589 = acfg->fp;
      if (D.26589 == 0B) goto <D.26590>; else goto <D.26591>;
      <D.26590>:
      file_offset.37 = (unsigned int) file_offset;
      D.26593 = file_offset.37 + 800;
      D.26594 = (int) D.26593;
      acfg->out_buf_size = D.26594;
      D.26595 = acfg->out_buf_size;
      D.26596 = (unsigned int) D.26595;
      D.26597 = monoeg_malloc (D.26596);
      acfg->out_buf = D.26597;
      <D.26591>:
      bin_writer_fwrite (acfg, &header, 52, 1);
      bin_writer_fwrite (acfg, &progh, 128, 1);
      D.26410 = *hash;
      D.26412 = hash + 4;
      D.26413 = *D.26412;
      D.26598 = D.26410 + D.26413;
      D.26599 = D.26598 + 2;
      D.26600 = (unsigned int) D.26599;
      D.26601 = D.26600 * 4;
      bin_writer_fwrite (acfg, hash, D.26601, 1);
      D.26412 = hash + 4;
      D.26413 = *D.26412;
      D.26421 = (unsigned int) D.26413;
      D.26422 = D.26421 * 16;
      bin_writer_fwrite (acfg, dynsym, D.26422, 1);
      D.26425 = dyn_str_table.data;
      D.26602 = D.26425->str;
      D.26425 = dyn_str_table.data;
      D.26426 = D.26425->len;
      bin_writer_fwrite (acfg, D.26602, D.26426, 1);
      D.26428 = secth[4].sh_offset;
      D.26603 = (int) D.26428;
      bin_writer_fseek (acfg, D.26603);
      D.26429 = acfg->num_relocs;
      D.26604 = (unsigned int) D.26429;
      bin_writer_fwrite (acfg, relocs, 8, D.26604);
      D.26433 = secth[5].sh_offset;
      D.26605 = (int) D.26433;
      bin_writer_fseek (acfg, D.26605);
      D.26606 = secth[5].sh_size;
      bin_writer_fwrite (acfg, relocs, D.26606, 1);
      D.26441 = sections[6];
      if (D.26441 != 0B) goto <D.26607>; else goto <D.26608>;
      <D.26607>:
      D.26440 = secth[6].sh_offset;
      D.26609 = (int) D.26440;
      bin_writer_fseek (acfg, D.26609);
      D.26441 = sections[6];
      D.26610 = D.26441->data;
      D.26441 = sections[6];
      size.21 = D.26441->cur_offset;
      size.38 = (unsigned int) size.21;
      bin_writer_fwrite (acfg, D.26610, size.38, 1);
      <D.26608>:
      D.26458 = sections[7];
      if (D.26458 != 0B) goto <D.26612>; else goto <D.26613>;
      <D.26612>:
      D.26614 = secth[7].sh_offset;
      D.26615 = (int) D.26614;
      bin_writer_fseek (acfg, D.26615);
      D.26458 = sections[7];
      D.26616 = D.26458->data;
      D.26458 = sections[7];
      size.23 = D.26458->cur_offset;
      size.39 = (unsigned int) size.23;
      bin_writer_fwrite (acfg, D.26616, size.39, 1);
      <D.26613>:
      D.26567 = secth[8].sh_offset;
      D.26618 = (int) D.26567;
      bin_writer_fseek (acfg, D.26618);
      bin_writer_fwrite (acfg, &dynamic, 112, 1);
      D.26569 = secth[8].sh_addr;
      size.40 = (int) D.26569;
      size = size.40;
      D.26620 = secth[9].sh_offset;
      D.26621 = (int) D.26620;
      bin_writer_fseek (acfg, D.26621);
      bin_writer_fwrite (acfg, &size, 4, 1);
      i = 0;
      goto <D.25612>;
      <D.25611>:
      {
        int sect;

        sect = normal_sections[i];
        D.26622 = sections[sect];
        if (D.26622 != 0B) goto <D.26623>; else goto <D.26624>;
        <D.26623>:
        D.26625 = secth[sect].sh_offset;
        D.26626 = (int) D.26625;
        bin_writer_fseek (acfg, D.26626);
        D.26622 = sections[sect];
        D.26627 = D.26622->data;
        D.26622 = sections[sect];
        D.26628 = D.26622->cur_offset;
        D.26629 = (unsigned int) D.26628;
        bin_writer_fwrite (acfg, D.26627, D.26629, 1);
        <D.26624>:
      }
      i = i + 1;
      <D.25612>:
      i.41 = (unsigned int) i;
      if (i.41 <= 5) goto <D.25611>; else goto <D.25613>;
      <D.25613>:
      D.26631 = secth[17].sh_offset;
      D.26632 = (int) D.26631;
      bin_writer_fseek (acfg, D.26632);
      D.26535 = sh_str_table.data;
      D.26633 = D.26535->str;
      D.26535 = sh_str_table.data;
      D.26536 = D.26535->len;
      bin_writer_fwrite (acfg, D.26633, D.26536, 1);
      D.26634 = secth[18].sh_offset;
      D.26635 = (int) D.26634;
      bin_writer_fseek (acfg, D.26635);
      num_local_syms.33 = num_local_syms;
      num_local_syms.34 = (unsigned int) num_local_syms.33;
      D.26545 = num_local_syms.34 * 16;
      bin_writer_fwrite (acfg, symtab, D.26545, 1);
      D.26636 = secth[19].sh_offset;
      D.26637 = (int) D.26636;
      bin_writer_fseek (acfg, D.26637);
      D.26552 = str_table.data;
      D.26638 = D.26552->str;
      D.26552 = str_table.data;
      D.26553 = D.26552->len;
      bin_writer_fwrite (acfg, D.26638, D.26553, 1);
      bin_writer_fseek (acfg, file_offset);
      bin_writer_fwrite (acfg, &secth, 800, 1);
      D.26589 = acfg->fp;
      if (D.26589 != 0B) goto <D.26639>; else goto <D.26640>;
      <D.26639>:
      D.26589 = acfg->fp;
      fclose (D.26589);
      <D.26640>:
      D.26641 = 0;
      return D.26641;
    }
  finally
    {
      header = {CLOBBER};
      progh = {CLOBBER};
      secth = {CLOBBER};
      str_table = {CLOBBER};
      sh_str_table = {CLOBBER};
      dyn_str_table = {CLOBBER};
      all_sections = {CLOBBER};
      sections = {CLOBBER};
      dynamic = {CLOBBER};
      size = {CLOBBER};
      num_local_syms = {CLOBBER};
    }
}


str_table_add (struct ElfStrTable * table, const char * value)
{
  struct GString * D.26644;
  struct GString * D.26647;
  struct GHashTable * D.26648;
  struct GHashTable * D.26649;
  void * D.26650;
  int D.26653;
  unsigned int D.26654;
  void * idx.42;
  int idx;

  D.26644 = table->data;
  if (D.26644 == 0B) goto <D.26645>; else goto <D.26646>;
  <D.26645>:
  D.26647 = monoeg_g_string_new_len ("", 1);
  table->data = D.26647;
  D.26648 = monoeg_g_hash_table_new (monoeg_g_str_hash, monoeg_g_str_equal);
  table->hash = D.26648;
  <D.26646>:
  D.26649 = table->hash;
  D.26650 = monoeg_g_hash_table_lookup (D.26649, value);
  idx = (int) D.26650;
  if (idx != 0) goto <D.26651>; else goto <D.26652>;
  <D.26651>:
  D.26653 = idx;
  return D.26653;
  <D.26652>:
  D.26644 = table->data;
  D.26654 = D.26644->len;
  idx = (int) D.26654;
  D.26644 = table->data;
  monoeg_g_string_append (D.26644, value);
  D.26644 = table->data;
  monoeg_g_string_append_c (D.26644, 0);
  D.26649 = table->hash;
  idx.42 = (void *) idx;
  monoeg_g_hash_table_insert_replace (D.26649, value, idx.42, 0);
  D.26653 = idx;
  return D.26653;
}


collect_sections (struct MonoImageWriter * acfg, struct ElfSectHeader * sheaders, struct BinSection * * out, int num)
{
  int D.26657;
  int num_sections.43;
  unsigned int num_sections.44;
  unsigned int D.26662;
  struct BinSection * * D.26663;
  _Bool D.26664;
  long int D.26665;
  long int D.26666;
  int D.25376;
  unsigned int i.45;
  unsigned int D.26672;
  struct BinSection * * D.26673;
  struct BinSection * D.26674;
  char * D.26675;
  char * D.26676;
  int D.26679;
  int i;
  int j;
  int maxs;
  int num_sections;
  struct BinSection * sect;

  num_sections = 0;
  maxs = 0;
  sect = acfg->sections;
  goto <D.25366>;
  <D.25365>:
  D.26657 = sect->subsection;
  if (D.26657 == 0) goto <D.26658>; else goto <D.26659>;
  <D.26658>:
  num_sections.43 = num_sections;
  num_sections = num_sections.43 + 1;
  num_sections.44 = (unsigned int) num_sections.43;
  D.26662 = num_sections.44 * 4;
  D.26663 = out + D.26662;
  *D.26663 = sect;
  D.26664 = num_sections >= num;
  D.26665 = (long int) D.26664;
  D.26666 = __builtin_expect (D.26665, 0);
  if (D.26666 != 0) goto <D.26667>; else goto <D.26668>;
  <D.26667>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 830, "num_sections < num");
  <D.26668>:
  <D.26659>:
  D.26657 = sect->subsection;
  maxs = MAX_EXPR <D.26657, maxs>;
  sect = sect->next;
  <D.25366>:
  if (sect != 0B) goto <D.25365>; else goto <D.25367>;
  <D.25367>:
  i = 0;
  goto <D.25384>;
  <D.25383>:
  j = 1;
  goto <D.25381>;
  <D.25380>:
  sect = acfg->sections;
  goto <D.25378>;
  <D.25377>:
  D.26657 = sect->subsection;
  if (D.26657 == j) goto <D.26669>; else goto <D.26670>;
  <D.26669>:
  {
    size_t __s1_len;
    size_t __s2_len;

    i.45 = (unsigned int) i;
    D.26672 = i.45 * 4;
    D.26673 = out + D.26672;
    D.26674 = *D.26673;
    D.26675 = D.26674->name;
    D.26676 = sect->name;
    D.25376 = __builtin_strcmp (D.26675, D.26676);
  }
  if (D.25376 == 0) goto <D.26677>; else goto <D.26678>;
  <D.26677>:
  i.45 = (unsigned int) i;
  D.26672 = i.45 * 4;
  D.26673 = out + D.26672;
  D.26674 = *D.26673;
  append_subsection (acfg, sheaders, D.26674, sect);
  <D.26678>:
  <D.26670>:
  sect = sect->next;
  <D.25378>:
  if (sect != 0B) goto <D.25377>; else goto <D.25379>;
  <D.25379>:
  j = j + 1;
  <D.25381>:
  if (j <= maxs) goto <D.25380>; else goto <D.25382>;
  <D.25382>:
  i = i + 1;
  <D.25384>:
  if (i < num_sections) goto <D.25383>; else goto <D.25385>;
  <D.25385>:
  D.26679 = num_sections;
  return D.26679;
}


append_subsection (struct MonoImageWriter * acfg, struct ElfSectHeader * sheaders, struct BinSection * sect, struct BinSection * add)
{
  int D.25353;
  int iftmp.46;
  int D.25352;
  const char[12] * D.26684;
  unsigned char D.26685;
  int D.26686;
  unsigned char D.26687;
  int D.26688;
  _Bool D.26689;
  _Bool D.26690;
  _Bool D.26691;
  const unsigned char * D.26694;
  unsigned char D.26695;
  int D.26696;
  const unsigned char * D.26697;
  unsigned char D.26698;
  int D.26699;
  _Bool D.26700;
  _Bool D.26701;
  const unsigned char * D.26704;
  unsigned char D.26705;
  int D.26706;
  const unsigned char * D.26707;
  unsigned char D.26708;
  int D.26709;
  _Bool D.26710;
  _Bool D.26711;
  const unsigned char * D.26714;
  unsigned char D.26715;
  int D.26716;
  const unsigned char * D.26717;
  unsigned char D.26718;
  int D.26719;
  char * D.26721;
  int D.26724;
  guint8 * D.26725;
  int D.26726;
  sizetype D.26727;
  guint8 * D.26728;
  guint8 * D.26729;
  unsigned int D.26730;
  int D.26731;
  int offset;

  offset = sect->cur_offset;
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 11;
    if (__s2_len <= 3) goto <D.26682>; else goto <D.26683>;
    <D.26682>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = sect->name;
      D.26684 = ".debug_line";
      D.26685 = MEM[(const unsigned char *)D.26684];
      D.26686 = (int) D.26685;
      D.26687 = *__s2;
      D.26688 = (int) D.26687;
      __result = D.26686 - D.26688;
      {
        D.26689 = __s2_len != 0;
        D.26690 = __result == 0;
        D.26691 = D.26689 & D.26690;
        if (D.26691 != 0) goto <D.26692>; else goto <D.26693>;
        <D.26692>:
        D.26694 = &MEM[(void *)".debug_line" + 1B];
        D.26695 = *D.26694;
        D.26696 = (int) D.26695;
        D.26697 = __s2 + 1;
        D.26698 = *D.26697;
        D.26699 = (int) D.26698;
        __result = D.26696 - D.26699;
        D.26700 = __s2_len > 1;
        D.26690 = __result == 0;
        D.26701 = D.26700 & D.26690;
        if (D.26701 != 0) goto <D.26702>; else goto <D.26703>;
        <D.26702>:
        D.26704 = &MEM[(void *)".debug_line" + 2B];
        D.26705 = *D.26704;
        D.26706 = (int) D.26705;
        D.26707 = __s2 + 2;
        D.26708 = *D.26707;
        D.26709 = (int) D.26708;
        __result = D.26706 - D.26709;
        D.26710 = __s2_len > 2;
        D.26690 = __result == 0;
        D.26711 = D.26710 & D.26690;
        if (D.26711 != 0) goto <D.26712>; else goto <D.26713>;
        <D.26712>:
        D.26714 = &MEM[(void *)".debug_line" + 3B];
        D.26715 = *D.26714;
        D.26716 = (int) D.26715;
        D.26717 = __s2 + 3;
        D.26718 = *D.26717;
        D.26719 = (int) D.26718;
        __result = D.26716 - D.26719;
        <D.26713>:
        <D.26703>:
        <D.26693>:
      }
      D.25352 = __result;
    }
    iftmp.46 = -D.25352;
    goto <D.26720>;
    <D.26683>:
    D.26721 = sect->name;
    iftmp.46 = __builtin_strcmp (D.26721, ".debug_line");
    <D.26720>:
    D.25353 = iftmp.46;
  }
  if (D.25353 != 0) goto <D.26722>; else goto <D.26723>;
  <D.26722>:
  offset = offset + 7;
  offset = offset & -8;
  <D.26723>:
  bin_writer_emit_ensure_buffer (sect, offset);
  sect->cur_offset = offset;
  D.26724 = add->cur_offset;
  bin_writer_emit_ensure_buffer (sect, D.26724);
  D.26725 = sect->data;
  D.26726 = sect->cur_offset;
  D.26727 = (sizetype) D.26726;
  D.26728 = D.26725 + D.26727;
  D.26729 = add->data;
  D.26724 = add->cur_offset;
  D.26730 = (unsigned int) D.26724;
  memcpy (D.26728, D.26729, D.26730);
  add->parent = sect;
  D.26726 = sect->cur_offset;
  D.26724 = add->cur_offset;
  D.26731 = D.26726 + D.26724;
  sect->cur_offset = D.26731;
  add->cur_offset = offset;
  add->data = 0B;
  add->data_len = 0;
}


build_hash (struct MonoImageWriter * acfg, int num_sections, struct ElfStrTable * dynstr)
{
  int D.26732;
  char * D.26735;
  int D.26736;
  unsigned int D.26737;
  unsigned int D.26738;
  int * D.26739;
  int * D.26740;
  int * data;
  int num_symbols;
  struct BinSymbol * symbol;

  num_symbols = num_sections + 4;
  symbol = acfg->symbols;
  goto <D.25404>;
  <D.25403>:
  D.26732 = symbol->is_global;
  if (D.26732 == 0) goto <D.26733>; else goto <D.26734>;
  <D.26733>:
  // predicted unlikely by continue predictor.
  goto <D.25402>;
  <D.26734>:
  num_symbols = num_symbols + 1;
  D.26735 = symbol->name;
  str_table_add (dynstr, D.26735);
  <D.25402>:
  symbol = symbol->next;
  <D.25404>:
  if (symbol != 0B) goto <D.25403>; else goto <D.25405>;
  <D.25405>:
  str_table_add (dynstr, "__bss_start");
  str_table_add (dynstr, "_edata");
  str_table_add (dynstr, "_end");
  D.26736 = num_symbols + 19;
  D.26737 = (unsigned int) D.26736;
  D.26738 = D.26737 * 4;
  data = monoeg_malloc0 (D.26738);
  *data = 17;
  D.26739 = data + 4;
  *D.26739 = num_symbols;
  D.26740 = data;
  return D.26740;
}


collect_syms (struct MonoImageWriter * acfg, int * hash, struct ElfStrTable * strtab, struct ElfSectHeader * sheaders, int * num_syms)
{
  int * D.26744;
  int D.26745;
  unsigned int D.26746;
  unsigned int D.26747;
  int D.26749;
  unsigned int D.26750;
  unsigned int D.26751;
  unsigned int i.47;
  unsigned int D.26755;
  struct ElfSymbol * D.26756;
  short unsigned int D.26757;
  unsigned int j.48;
  unsigned int D.26759;
  struct ElfSectHeader * D.26760;
  unsigned int D.26761;
  struct BinSection * D.26763;
  int D.25445;
  int iftmp.49;
  int D.25444;
  const char[6] * D.26769;
  unsigned char D.26770;
  int D.26771;
  unsigned char D.26772;
  int D.26773;
  _Bool D.26774;
  _Bool D.26775;
  _Bool D.26776;
  const unsigned char * D.26779;
  unsigned char D.26780;
  int D.26781;
  const unsigned char * D.26782;
  unsigned char D.26783;
  int D.26784;
  _Bool D.26785;
  _Bool D.26786;
  const unsigned char * D.26789;
  unsigned char D.26790;
  int D.26791;
  const unsigned char * D.26792;
  unsigned char D.26793;
  int D.26794;
  _Bool D.26795;
  _Bool D.26796;
  const unsigned char * D.26799;
  unsigned char D.26800;
  int D.26801;
  const unsigned char * D.26802;
  unsigned char D.26803;
  int D.26804;
  char * D.26806;
  int D.26809;
  unsigned int D.26810;
  int D.25454;
  int iftmp.50;
  int D.25453;
  const char[8] * D.26815;
  unsigned char D.26816;
  int D.26817;
  unsigned char D.26818;
  int D.26819;
  _Bool D.26820;
  _Bool D.26821;
  _Bool D.26822;
  const unsigned char * D.26825;
  unsigned char D.26826;
  int D.26827;
  const unsigned char * D.26828;
  unsigned char D.26829;
  int D.26830;
  _Bool D.26831;
  _Bool D.26832;
  const unsigned char * D.26835;
  unsigned char D.26836;
  int D.26837;
  const unsigned char * D.26838;
  unsigned char D.26839;
  int D.26840;
  _Bool D.26841;
  _Bool D.26842;
  const unsigned char * D.26845;
  unsigned char D.26846;
  int D.26847;
  const unsigned char * D.26848;
  unsigned char D.26849;
  int D.26850;
  int D.25463;
  int iftmp.51;
  int D.25462;
  const char[6] * D.26858;
  unsigned char D.26859;
  int D.26860;
  unsigned char D.26861;
  int D.26862;
  _Bool D.26863;
  _Bool D.26864;
  _Bool D.26865;
  const unsigned char * D.26868;
  unsigned char D.26869;
  int D.26870;
  const unsigned char * D.26871;
  unsigned char D.26872;
  int D.26873;
  _Bool D.26874;
  _Bool D.26875;
  const unsigned char * D.26878;
  unsigned char D.26879;
  int D.26880;
  const unsigned char * D.26881;
  unsigned char D.26882;
  int D.26883;
  _Bool D.26884;
  _Bool D.26885;
  const unsigned char * D.26888;
  unsigned char D.26889;
  int D.26890;
  const unsigned char * D.26891;
  unsigned char D.26892;
  int D.26893;
  int D.25472;
  int iftmp.52;
  int D.25471;
  const char[5] * D.26901;
  unsigned char D.26902;
  int D.26903;
  unsigned char D.26904;
  int D.26905;
  _Bool D.26906;
  _Bool D.26907;
  _Bool D.26908;
  const unsigned char * D.26911;
  unsigned char D.26912;
  int D.26913;
  const unsigned char * D.26914;
  unsigned char D.26915;
  int D.26916;
  _Bool D.26917;
  _Bool D.26918;
  const unsigned char * D.26921;
  unsigned char D.26922;
  int D.26923;
  const unsigned char * D.26924;
  unsigned char D.26925;
  int D.26926;
  _Bool D.26927;
  _Bool D.26928;
  const unsigned char * D.26931;
  unsigned char D.26932;
  int D.26933;
  const unsigned char * D.26934;
  unsigned char D.26935;
  int D.26936;
  int D.26940;
  unsigned char iftmp.53;
  unsigned char iftmp.54;
  int D.26950;
  unsigned char D.26954;
  char * D.26955;
  int D.26956;
  unsigned int D.26957;
  Elf32_Half iftmp.55;
  int D.26961;
  int D.26963;
  struct GHashTable * D.26964;
  int D.26967;
  int D.26968;
  int D.26969;
  int D.26970;
  unsigned int D.26971;
  int D.26973;
  unsigned int D.26974;
  char * D.26975;
  _Bool D.26978;
  long int D.26979;
  long int D.26980;
  int D.26983;
  int D.26984;
  int D.26985;
  unsigned int D.26986;
  int D.26987;
  unsigned int D.26988;
  int D.26989;
  unsigned int D.26990;
  int D.26991;
  unsigned int D.26992;
  int D.26997;
  sizetype D.26998;
  sizetype D.26999;
  sizetype D.27000;
  unsigned int D.27001;
  struct GString * D.27004;
  char * D.27005;
  const unsigned char * D.27006;
  long unsigned int D.27007;
  long unsigned int D.27008;
  unsigned int slot.56;
  unsigned int D.27010;
  int * D.27011;
  int D.27012;
  unsigned int D.27015;
  int * D.27016;
  struct ElfSymbol * D.27018;
  struct ElfSymbol * symbols;
  struct BinSymbol * symbol;
  struct BinSection * section;
  int i;
  int * bucket;
  int * chain;
  long unsigned int hashc;

  if (hash != 0B) goto <D.26742>; else goto <D.26743>;
  <D.26742>:
  D.26744 = hash + 4;
  D.26745 = *D.26744;
  D.26746 = (unsigned int) D.26745;
  D.26747 = D.26746 * 16;
  symbols = monoeg_malloc0 (D.26747);
  goto <D.26748>;
  <D.26743>:
  i = 0;
  symbol = acfg->symbols;
  goto <D.25430>;
  <D.25429>:
  i = i + 1;
  symbol = symbol->next;
  <D.25430>:
  if (symbol != 0B) goto <D.25429>; else goto <D.25431>;
  <D.25431>:
  D.26749 = i + 30;
  D.26750 = (unsigned int) D.26749;
  D.26751 = D.26750 * 16;
  symbols = monoeg_malloc0 (D.26751);
  <D.26748>:
  i = 1;
  if (sheaders != 0B) goto <D.26752>; else goto <D.26753>;
  <D.26752>:
  {
    int j;

    j = 1;
    goto <D.25434>;
    <D.25433>:
    i.47 = (unsigned int) i;
    D.26755 = i.47 * 16;
    D.26756 = symbols + D.26755;
    D.26756->st_info = 3;
    i.47 = (unsigned int) i;
    D.26755 = i.47 * 16;
    D.26756 = symbols + D.26755;
    D.26757 = (short unsigned int) j;
    D.26756->st_shndx = D.26757;
    i.47 = (unsigned int) i;
    D.26755 = i.47 * 16;
    D.26756 = symbols + D.26755;
    j.48 = (unsigned int) j;
    D.26759 = j.48 * 40;
    D.26760 = sheaders + D.26759;
    D.26761 = D.26760->sh_addr;
    D.26756->st_value = D.26761;
    i = i + 1;
    j = j + 1;
    <D.25434>:
    if (j <= 19) goto <D.25433>; else goto <D.25435>;
    <D.25435>:
  }
  goto <D.26762>;
  <D.26753>:
  section = acfg->sections;
  goto <D.25474>;
  <D.25473>:
  D.26763 = section->parent;
  if (D.26763 != 0B) goto <D.26764>; else goto <D.26765>;
  <D.26764>:
  // predicted unlikely by continue predictor.
  goto <D.25436>;
  <D.26765>:
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26756->st_info = 3;
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 5;
    if (__s2_len <= 3) goto <D.26767>; else goto <D.26768>;
    <D.26767>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = section->name;
      D.26769 = ".text";
      D.26770 = MEM[(const unsigned char *)D.26769];
      D.26771 = (int) D.26770;
      D.26772 = *__s2;
      D.26773 = (int) D.26772;
      __result = D.26771 - D.26773;
      {
        D.26774 = __s2_len != 0;
        D.26775 = __result == 0;
        D.26776 = D.26774 & D.26775;
        if (D.26776 != 0) goto <D.26777>; else goto <D.26778>;
        <D.26777>:
        D.26779 = &MEM[(void *)".text" + 1B];
        D.26780 = *D.26779;
        D.26781 = (int) D.26780;
        D.26782 = __s2 + 1;
        D.26783 = *D.26782;
        D.26784 = (int) D.26783;
        __result = D.26781 - D.26784;
        D.26785 = __s2_len > 1;
        D.26775 = __result == 0;
        D.26786 = D.26785 & D.26775;
        if (D.26786 != 0) goto <D.26787>; else goto <D.26788>;
        <D.26787>:
        D.26789 = &MEM[(void *)".text" + 2B];
        D.26790 = *D.26789;
        D.26791 = (int) D.26790;
        D.26792 = __s2 + 2;
        D.26793 = *D.26792;
        D.26794 = (int) D.26793;
        __result = D.26791 - D.26794;
        D.26795 = __s2_len > 2;
        D.26775 = __result == 0;
        D.26796 = D.26795 & D.26775;
        if (D.26796 != 0) goto <D.26797>; else goto <D.26798>;
        <D.26797>:
        D.26799 = &MEM[(void *)".text" + 3B];
        D.26800 = *D.26799;
        D.26801 = (int) D.26800;
        D.26802 = __s2 + 3;
        D.26803 = *D.26802;
        D.26804 = (int) D.26803;
        __result = D.26801 - D.26804;
        <D.26798>:
        <D.26788>:
        <D.26778>:
      }
      D.25444 = __result;
    }
    iftmp.49 = -D.25444;
    goto <D.26805>;
    <D.26768>:
    D.26806 = section->name;
    iftmp.49 = __builtin_strcmp (D.26806, ".text");
    <D.26805>:
    D.25445 = iftmp.49;
  }
  if (D.25445 == 0) goto <D.26807>; else goto <D.26808>;
  <D.26807>:
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26756->st_shndx = 6;
  section->shidx = 6;
  section->file_offset = 4096;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26809 = section->virt_offset;
  D.26810 = (unsigned int) D.26809;
  D.26756->st_value = D.26810;
  goto <D.26811>;
  <D.26808>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 7;
    if (__s2_len <= 3) goto <D.26813>; else goto <D.26814>;
    <D.26813>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = section->name;
      D.26815 = ".rodata";
      D.26816 = MEM[(const unsigned char *)D.26815];
      D.26817 = (int) D.26816;
      D.26818 = *__s2;
      D.26819 = (int) D.26818;
      __result = D.26817 - D.26819;
      {
        D.26820 = __s2_len != 0;
        D.26821 = __result == 0;
        D.26822 = D.26820 & D.26821;
        if (D.26822 != 0) goto <D.26823>; else goto <D.26824>;
        <D.26823>:
        D.26825 = &MEM[(void *)".rodata" + 1B];
        D.26826 = *D.26825;
        D.26827 = (int) D.26826;
        D.26828 = __s2 + 1;
        D.26829 = *D.26828;
        D.26830 = (int) D.26829;
        __result = D.26827 - D.26830;
        D.26831 = __s2_len > 1;
        D.26821 = __result == 0;
        D.26832 = D.26831 & D.26821;
        if (D.26832 != 0) goto <D.26833>; else goto <D.26834>;
        <D.26833>:
        D.26835 = &MEM[(void *)".rodata" + 2B];
        D.26836 = *D.26835;
        D.26837 = (int) D.26836;
        D.26838 = __s2 + 2;
        D.26839 = *D.26838;
        D.26840 = (int) D.26839;
        __result = D.26837 - D.26840;
        D.26841 = __s2_len > 2;
        D.26821 = __result == 0;
        D.26842 = D.26841 & D.26821;
        if (D.26842 != 0) goto <D.26843>; else goto <D.26844>;
        <D.26843>:
        D.26845 = &MEM[(void *)".rodata" + 3B];
        D.26846 = *D.26845;
        D.26847 = (int) D.26846;
        D.26848 = __s2 + 3;
        D.26849 = *D.26848;
        D.26850 = (int) D.26849;
        __result = D.26847 - D.26850;
        <D.26844>:
        <D.26834>:
        <D.26824>:
      }
      D.25453 = __result;
    }
    iftmp.50 = -D.25453;
    goto <D.26851>;
    <D.26814>:
    D.26806 = section->name;
    iftmp.50 = __builtin_strcmp (D.26806, ".rodata");
    <D.26851>:
    D.25454 = iftmp.50;
  }
  if (D.25454 == 0) goto <D.26852>; else goto <D.26853>;
  <D.26852>:
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26756->st_shndx = 7;
  section->shidx = 7;
  section->file_offset = 4096;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26809 = section->virt_offset;
  D.26810 = (unsigned int) D.26809;
  D.26756->st_value = D.26810;
  goto <D.26854>;
  <D.26853>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 5;
    if (__s2_len <= 3) goto <D.26856>; else goto <D.26857>;
    <D.26856>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = section->name;
      D.26858 = ".data";
      D.26859 = MEM[(const unsigned char *)D.26858];
      D.26860 = (int) D.26859;
      D.26861 = *__s2;
      D.26862 = (int) D.26861;
      __result = D.26860 - D.26862;
      {
        D.26863 = __s2_len != 0;
        D.26864 = __result == 0;
        D.26865 = D.26863 & D.26864;
        if (D.26865 != 0) goto <D.26866>; else goto <D.26867>;
        <D.26866>:
        D.26868 = &MEM[(void *)".data" + 1B];
        D.26869 = *D.26868;
        D.26870 = (int) D.26869;
        D.26871 = __s2 + 1;
        D.26872 = *D.26871;
        D.26873 = (int) D.26872;
        __result = D.26870 - D.26873;
        D.26874 = __s2_len > 1;
        D.26864 = __result == 0;
        D.26875 = D.26874 & D.26864;
        if (D.26875 != 0) goto <D.26876>; else goto <D.26877>;
        <D.26876>:
        D.26878 = &MEM[(void *)".data" + 2B];
        D.26879 = *D.26878;
        D.26880 = (int) D.26879;
        D.26881 = __s2 + 2;
        D.26882 = *D.26881;
        D.26883 = (int) D.26882;
        __result = D.26880 - D.26883;
        D.26884 = __s2_len > 2;
        D.26864 = __result == 0;
        D.26885 = D.26884 & D.26864;
        if (D.26885 != 0) goto <D.26886>; else goto <D.26887>;
        <D.26886>:
        D.26888 = &MEM[(void *)".data" + 3B];
        D.26889 = *D.26888;
        D.26890 = (int) D.26889;
        D.26891 = __s2 + 3;
        D.26892 = *D.26891;
        D.26893 = (int) D.26892;
        __result = D.26890 - D.26893;
        <D.26887>:
        <D.26877>:
        <D.26867>:
      }
      D.25462 = __result;
    }
    iftmp.51 = -D.25462;
    goto <D.26894>;
    <D.26857>:
    D.26806 = section->name;
    iftmp.51 = __builtin_strcmp (D.26806, ".data");
    <D.26894>:
    D.25463 = iftmp.51;
  }
  if (D.25463 == 0) goto <D.26895>; else goto <D.26896>;
  <D.26895>:
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26756->st_shndx = 10;
  section->shidx = 10;
  section->file_offset = 4124;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26809 = section->virt_offset;
  D.26810 = (unsigned int) D.26809;
  D.26756->st_value = D.26810;
  goto <D.26897>;
  <D.26896>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 4;
    if (__s2_len <= 3) goto <D.26899>; else goto <D.26900>;
    <D.26899>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = section->name;
      D.26901 = ".bss";
      D.26902 = MEM[(const unsigned char *)D.26901];
      D.26903 = (int) D.26902;
      D.26904 = *__s2;
      D.26905 = (int) D.26904;
      __result = D.26903 - D.26905;
      {
        D.26906 = __s2_len != 0;
        D.26907 = __result == 0;
        D.26908 = D.26906 & D.26907;
        if (D.26908 != 0) goto <D.26909>; else goto <D.26910>;
        <D.26909>:
        D.26911 = &MEM[(void *)".bss" + 1B];
        D.26912 = *D.26911;
        D.26913 = (int) D.26912;
        D.26914 = __s2 + 1;
        D.26915 = *D.26914;
        D.26916 = (int) D.26915;
        __result = D.26913 - D.26916;
        D.26917 = __s2_len > 1;
        D.26907 = __result == 0;
        D.26918 = D.26917 & D.26907;
        if (D.26918 != 0) goto <D.26919>; else goto <D.26920>;
        <D.26919>:
        D.26921 = &MEM[(void *)".bss" + 2B];
        D.26922 = *D.26921;
        D.26923 = (int) D.26922;
        D.26924 = __s2 + 2;
        D.26925 = *D.26924;
        D.26926 = (int) D.26925;
        __result = D.26923 - D.26926;
        D.26927 = __s2_len > 2;
        D.26907 = __result == 0;
        D.26928 = D.26927 & D.26907;
        if (D.26928 != 0) goto <D.26929>; else goto <D.26930>;
        <D.26929>:
        D.26931 = &MEM[(void *)".bss" + 3B];
        D.26932 = *D.26931;
        D.26933 = (int) D.26932;
        D.26934 = __s2 + 3;
        D.26935 = *D.26934;
        D.26936 = (int) D.26935;
        __result = D.26933 - D.26936;
        <D.26930>:
        <D.26920>:
        <D.26910>:
      }
      D.25471 = __result;
    }
    iftmp.52 = -D.25471;
    goto <D.26937>;
    <D.26900>:
    D.26806 = section->name;
    iftmp.52 = __builtin_strcmp (D.26806, ".bss");
    <D.26937>:
    D.25472 = iftmp.52;
  }
  if (D.25472 == 0) goto <D.26938>; else goto <D.26939>;
  <D.26938>:
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26756->st_shndx = 11;
  section->shidx = 11;
  section->file_offset = 4132;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26809 = section->virt_offset;
  D.26810 = (unsigned int) D.26809;
  D.26756->st_value = D.26810;
  <D.26939>:
  <D.26897>:
  <D.26854>:
  <D.26811>:
  i = i + 1;
  <D.25436>:
  section = section->next;
  <D.25474>:
  if (section != 0B) goto <D.25473>; else goto <D.25475>;
  <D.25475>:
  <D.26762>:
  symbol = acfg->symbols;
  goto <D.25481>;
  <D.25480>:
  {
    int offset;
    struct BinLabel * lab;

    D.26940 = symbol->is_global;
    if (D.26940 == 0) goto <D.26941>; else goto <D.26942>;
    <D.26941>:
    if (hash != 0B) goto <D.26943>; else goto <D.26944>;
    <D.26943>:
    // predicted unlikely by continue predictor.
    goto <D.25478>;
    <D.26944>:
    <D.26942>:
    i.47 = (unsigned int) i;
    D.26755 = i.47 * 16;
    D.26756 = symbols + D.26755;
    D.26940 = symbol->is_global;
    if (D.26940 != 0) goto <D.26946>; else goto <D.26947>;
    <D.26946>:
    iftmp.53 = 16;
    goto <D.26948>;
    <D.26947>:
    iftmp.53 = 0;
    <D.26948>:
    D.26950 = symbol->is_function;
    if (D.26950 != 0) goto <D.26951>; else goto <D.26952>;
    <D.26951>:
    iftmp.54 = 2;
    goto <D.26953>;
    <D.26952>:
    iftmp.54 = 1;
    <D.26953>:
    D.26954 = iftmp.53 + iftmp.54;
    D.26756->st_info = D.26954;
    i.47 = (unsigned int) i;
    D.26755 = i.47 * 16;
    D.26756 = symbols + D.26755;
    D.26955 = symbol->name;
    D.26956 = str_table_add (strtab, D.26955);
    D.26957 = (unsigned int) D.26956;
    D.26756->st_name = D.26957;
    section = symbol->section;
    i.47 = (unsigned int) i;
    D.26755 = i.47 * 16;
    D.26756 = symbols + D.26755;
    D.26763 = section->parent;
    if (D.26763 != 0B) goto <D.26959>; else goto <D.26960>;
    <D.26959>:
    D.26763 = section->parent;
    D.26961 = D.26763->shidx;
    iftmp.55 = (Elf32_Half) D.26961;
    goto <D.26962>;
    <D.26960>:
    D.26963 = section->shidx;
    iftmp.55 = (Elf32_Half) D.26963;
    <D.26962>:
    D.26756->st_shndx = iftmp.55;
    D.26964 = acfg->labels;
    D.26955 = symbol->name;
    lab = monoeg_g_hash_table_lookup (D.26964, D.26955);
    offset = lab->offset;
    D.26763 = section->parent;
    if (D.26763 != 0B) goto <D.26965>; else goto <D.26966>;
    <D.26965>:
    i.47 = (unsigned int) i;
    D.26755 = i.47 * 16;
    D.26756 = symbols + D.26755;
    D.26763 = section->parent;
    D.26967 = D.26763->virt_offset;
    D.26968 = section->cur_offset;
    D.26969 = D.26967 + D.26968;
    D.26970 = D.26969 + offset;
    D.26971 = (unsigned int) D.26970;
    D.26756->st_value = D.26971;
    goto <D.26972>;
    <D.26966>:
    i.47 = (unsigned int) i;
    D.26755 = i.47 * 16;
    D.26756 = symbols + D.26755;
    D.26809 = section->virt_offset;
    D.26973 = D.26809 + offset;
    D.26974 = (unsigned int) D.26973;
    D.26756->st_value = D.26974;
    <D.26972>:
    D.26975 = symbol->end_label;
    if (D.26975 != 0B) goto <D.26976>; else goto <D.26977>;
    <D.26976>:
    {
      struct BinLabel * elab;

      D.26964 = acfg->labels;
      D.26975 = symbol->end_label;
      elab = monoeg_g_hash_table_lookup (D.26964, D.26975);
      D.26978 = elab == 0B;
      D.26979 = (long int) D.26978;
      D.26980 = __builtin_expect (D.26979, 0);
      if (D.26980 != 0) goto <D.26981>; else goto <D.26982>;
      <D.26981>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 987, "elab");
      <D.26982>:
      i.47 = (unsigned int) i;
      D.26755 = i.47 * 16;
      D.26756 = symbols + D.26755;
      D.26983 = elab->offset;
      D.26984 = lab->offset;
      D.26985 = D.26983 - D.26984;
      D.26986 = (unsigned int) D.26985;
      D.26756->st_size = D.26986;
    }
    <D.26977>:
    i = i + 1;
  }
  <D.25478>:
  symbol = symbol->next;
  <D.25481>:
  if (symbol != 0B) goto <D.25480>; else goto <D.25482>;
  <D.25482>:
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26987 = str_table_add (strtab, "__bss_start");
  D.26988 = (unsigned int) D.26987;
  D.26756->st_name = D.26988;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26756->st_shndx = 65521;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26756->st_info = 16;
  i = i + 1;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26989 = str_table_add (strtab, "_edata");
  D.26990 = (unsigned int) D.26989;
  D.26756->st_name = D.26990;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26756->st_shndx = 65521;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26756->st_info = 16;
  i = i + 1;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26991 = str_table_add (strtab, "_end");
  D.26992 = (unsigned int) D.26991;
  D.26756->st_name = D.26992;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26756->st_shndx = 65521;
  i.47 = (unsigned int) i;
  D.26755 = i.47 * 16;
  D.26756 = symbols + D.26755;
  D.26756->st_info = 16;
  i = i + 1;
  if (num_syms != 0B) goto <D.26993>; else goto <D.26994>;
  <D.26993>:
  *num_syms = i;
  <D.26994>:
  if (hash != 0B) goto <D.26995>; else goto <D.26996>;
  <D.26995>:
  bucket = hash + 8;
  D.26997 = *hash;
  D.26998 = (sizetype) D.26997;
  D.26999 = D.26998 + 2;
  D.27000 = D.26999 * 4;
  chain = hash + D.27000;
  i = 0;
  goto <D.25486>;
  <D.25485>:
  {
    int slot;

    i.47 = (unsigned int) i;
    D.26755 = i.47 * 16;
    D.26756 = symbols + D.26755;
    D.27001 = D.26756->st_name;
    if (D.27001 == 0) goto <D.27002>; else goto <D.27003>;
    <D.27002>:
    // predicted unlikely by continue predictor.
    goto <D.25484>;
    <D.27003>:
    D.27004 = strtab->data;
    D.27005 = D.27004->str;
    i.47 = (unsigned int) i;
    D.26755 = i.47 * 16;
    D.26756 = symbols + D.26755;
    D.27001 = D.26756->st_name;
    D.27006 = D.27005 + D.27001;
    hashc = elf_hash (D.27006);
    D.26997 = *hash;
    D.27007 = (long unsigned int) D.26997;
    D.27008 = hashc % D.27007;
    slot = (int) D.27008;
    slot.56 = (unsigned int) slot;
    D.27010 = slot.56 * 4;
    D.27011 = bucket + D.27010;
    D.27012 = *D.27011;
    if (D.27012 != 0) goto <D.27013>; else goto <D.27014>;
    <D.27013>:
    i.47 = (unsigned int) i;
    D.27015 = i.47 * 4;
    D.27016 = chain + D.27015;
    slot.56 = (unsigned int) slot;
    D.27010 = slot.56 * 4;
    D.27011 = bucket + D.27010;
    D.27012 = *D.27011;
    *D.27016 = D.27012;
    slot.56 = (unsigned int) slot;
    D.27010 = slot.56 * 4;
    D.27011 = bucket + D.27010;
    *D.27011 = i;
    goto <D.27017>;
    <D.27014>:
    slot.56 = (unsigned int) slot;
    D.27010 = slot.56 * 4;
    D.27011 = bucket + D.27010;
    *D.27011 = i;
    <D.27017>:
  }
  <D.25484>:
  i = i + 1;
  <D.25486>:
  D.26744 = hash + 4;
  D.26745 = *D.26744;
  if (D.26745 > i) goto <D.25485>; else goto <D.25487>;
  <D.25487>:
  <D.26996>:
  D.27018 = symbols;
  return D.27018;
}


elf_hash (const unsigned char * name)
{
  long unsigned int D.27020;
  const unsigned char * name.57;
  unsigned char D.27022;
  long unsigned int D.27023;
  long unsigned int D.27026;
  long unsigned int D.27027;
  unsigned char D.27028;
  long unsigned int D.27029;
  long unsigned int h;
  long unsigned int g;

  h = 0;
  goto <D.25392>;
  <D.25391>:
  D.27020 = h << 4;
  name.57 = name;
  name = name.57 + 1;
  D.27022 = *name.57;
  D.27023 = (long unsigned int) D.27022;
  h = D.27020 + D.27023;
  g = h & 4026531840;
  if (g != 0) goto <D.27024>; else goto <D.27025>;
  <D.27024>:
  D.27026 = g >> 24;
  h = D.27026 ^ h;
  <D.27025>:
  D.27027 = ~g;
  h = D.27027 & h;
  <D.25392>:
  D.27028 = *name;
  if (D.27028 != 0) goto <D.25391>; else goto <D.25393>;
  <D.25393>:
  D.27029 = h;
  return D.27029;
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.27033;
  int D.27038;
  void * D.27040;
  unsigned int D.27041;

  D.27033 = __builtin_constant_p (__len);
  if (D.27033 != 0) goto <D.27034>; else goto <D.27035>;
  <D.27034>:
  if (__len == 0) goto <D.27036>; else goto <D.27037>;
  <D.27036>:
  D.27038 = __builtin_constant_p (__ch);
  if (D.27038 == 0) goto <D.27031>; else goto <D.27039>;
  <D.27039>:
  if (__ch != 0) goto <D.27031>; else goto <D.27032>;
  <D.27031>:
  __warn_memset_zero_len ();
  D.27040 = __dest;
  return D.27040;
  <D.27032>:
  <D.27037>:
  <D.27035>:
  D.27041 = __builtin_object_size (__dest, 0);
  D.27040 = __builtin___memset_chk (__dest, __ch, __len, D.27041);
  return D.27040;
}


reloc_symbols (struct MonoImageWriter * acfg, struct ElfSymbol * symbols, struct ElfSectHeader * sheaders, struct ElfStrTable * strtab, gboolean dynamic)
{
  struct BinSection * D.27045;
  unsigned int i.58;
  unsigned int D.27049;
  struct ElfSymbol * D.27050;
  int D.27051;
  unsigned int D.27052;
  unsigned int D.27053;
  struct ElfSectHeader * D.27054;
  unsigned int D.27055;
  unsigned int D.27057;
  struct ElfSectHeader * D.27058;
  unsigned int D.27059;
  int D.27062;
  struct GHashTable * D.27065;
  char * D.27066;
  int D.27069;
  unsigned int D.27070;
  unsigned int D.27071;
  struct ElfSectHeader * D.27072;
  unsigned int D.27073;
  int D.27074;
  unsigned int D.27075;
  unsigned int D.27076;
  unsigned int offset.59;
  unsigned int D.27078;
  unsigned int D.27080;
  struct ElfSectHeader * D.27081;
  unsigned int D.27082;
  struct ElfSectHeader * D.27083;
  unsigned int D.27084;
  unsigned int D.27085;
  unsigned int D.27086;
  unsigned int D.27087;
  unsigned int D.27088;
  struct BinSection * section;
  struct BinSymbol * symbol;
  int i;

  i = 1;
  if (dynamic != 0) goto <D.27043>; else goto <D.27044>;
  <D.27043>:
  section = acfg->sections;
  goto <D.25500>;
  <D.25499>:
  D.27045 = section->parent;
  if (D.27045 != 0B) goto <D.27046>; else goto <D.27047>;
  <D.27046>:
  // predicted unlikely by continue predictor.
  goto <D.25498>;
  <D.27047>:
  i.58 = (unsigned int) i;
  D.27049 = i.58 * 16;
  D.27050 = symbols + D.27049;
  D.27051 = section->shidx;
  D.27052 = (unsigned int) D.27051;
  D.27053 = D.27052 * 40;
  D.27054 = sheaders + D.27053;
  D.27055 = D.27054->sh_addr;
  D.27050->st_value = D.27055;
  i = i + 1;
  <D.25498>:
  section = section->next;
  <D.25500>:
  if (section != 0B) goto <D.25499>; else goto <D.25501>;
  <D.25501>:
  goto <D.27056>;
  <D.27044>:
  i = 1;
  goto <D.25503>;
  <D.25502>:
  i.58 = (unsigned int) i;
  D.27049 = i.58 * 16;
  D.27050 = symbols + D.27049;
  i.58 = (unsigned int) i;
  D.27057 = i.58 * 40;
  D.27058 = sheaders + D.27057;
  D.27059 = D.27058->sh_addr;
  D.27050->st_value = D.27059;
  i = i + 1;
  <D.25503>:
  if (i <= 19) goto <D.25502>; else goto <D.25504>;
  <D.25504>:
  <D.27056>:
  symbol = acfg->symbols;
  goto <D.25509>;
  <D.25508>:
  {
    int offset;
    struct BinLabel * lab;

    if (dynamic != 0) goto <D.27060>; else goto <D.27061>;
    <D.27060>:
    D.27062 = symbol->is_global;
    if (D.27062 == 0) goto <D.27063>; else goto <D.27064>;
    <D.27063>:
    // predicted unlikely by continue predictor.
    goto <D.25507>;
    <D.27064>:
    <D.27061>:
    section = symbol->section;
    D.27065 = acfg->labels;
    D.27066 = symbol->name;
    lab = monoeg_g_hash_table_lookup (D.27065, D.27066);
    offset = lab->offset;
    D.27045 = section->parent;
    if (D.27045 != 0B) goto <D.27067>; else goto <D.27068>;
    <D.27067>:
    i.58 = (unsigned int) i;
    D.27049 = i.58 * 16;
    D.27050 = symbols + D.27049;
    D.27045 = section->parent;
    D.27069 = D.27045->shidx;
    D.27070 = (unsigned int) D.27069;
    D.27071 = D.27070 * 40;
    D.27072 = sheaders + D.27071;
    D.27073 = D.27072->sh_addr;
    D.27074 = section->cur_offset;
    D.27075 = (unsigned int) D.27074;
    D.27076 = D.27073 + D.27075;
    offset.59 = (unsigned int) offset;
    D.27078 = D.27076 + offset.59;
    D.27050->st_value = D.27078;
    goto <D.27079>;
    <D.27068>:
    i.58 = (unsigned int) i;
    D.27049 = i.58 * 16;
    D.27050 = symbols + D.27049;
    D.27051 = section->shidx;
    D.27052 = (unsigned int) D.27051;
    D.27053 = D.27052 * 40;
    D.27054 = sheaders + D.27053;
    D.27055 = D.27054->sh_addr;
    offset.59 = (unsigned int) offset;
    D.27080 = D.27055 + offset.59;
    D.27050->st_value = D.27080;
    <D.27079>:
    i = i + 1;
  }
  <D.25507>:
  symbol = symbol->next;
  <D.25509>:
  if (symbol != 0B) goto <D.25508>; else goto <D.25510>;
  <D.25510>:
  i.58 = (unsigned int) i;
  D.27049 = i.58 * 16;
  D.27050 = symbols + D.27049;
  D.27081 = sheaders + 440;
  D.27082 = D.27081->sh_addr;
  D.27050->st_value = D.27082;
  i = i + 1;
  i.58 = (unsigned int) i;
  D.27049 = i.58 * 16;
  D.27050 = symbols + D.27049;
  D.27083 = sheaders + 400;
  D.27084 = D.27083->sh_addr;
  D.27083 = sheaders + 400;
  D.27085 = D.27083->sh_size;
  D.27086 = D.27084 + D.27085;
  D.27050->st_value = D.27086;
  i = i + 1;
  i.58 = (unsigned int) i;
  D.27049 = i.58 * 16;
  D.27050 = symbols + D.27049;
  D.27081 = sheaders + 440;
  D.27082 = D.27081->sh_addr;
  D.27081 = sheaders + 440;
  D.27087 = D.27081->sh_size;
  D.27088 = D.27082 + D.27087;
  D.27050->st_value = D.27088;
  i = i + 1;
}


resolve_relocations (struct MonoImageWriter * acfg)
{
  int D.27089;
  unsigned int D.27090;
  unsigned int D.27091;
  int D.27092;
  unsigned int start_val.60;
  _Bool D.27096;
  long int D.27097;
  long int D.27098;
  guint8 * data.61;
  unsigned int end_val.62;
  int end_val.63;
  unsigned char D.27105;
  guint8 * D.27106;
  unsigned int D.27107;
  unsigned char D.27108;
  guint8 * D.27109;
  unsigned int D.27110;
  unsigned char D.27111;
  guint8 * D.27112;
  unsigned int D.27113;
  unsigned char D.27114;
  char * D.27117;
  char D.27118;
  unsigned int i.64;
  unsigned int D.27122;
  struct ElfReloc * D.27123;
  unsigned int vaddr.65;
  _Bool D.27125;
  long int D.27126;
  long int D.27127;
  struct ElfReloc * D.27130;
  struct BinReloc * reloc;
  guint8 * data;
  gsize end_val;
  gsize start_val;
  struct ElfReloc * rr;
  int i;
  gsize vaddr;

  try
    {
      D.27089 = acfg->num_relocs;
      D.27090 = (unsigned int) D.27089;
      D.27091 = D.27090 * 8;
      rr = monoeg_malloc0 (D.27091);
      i = 0;
      reloc = acfg->relocations;
      goto <D.25554>;
      <D.25553>:
      resolve_reloc (acfg, reloc, &data, &vaddr, &start_val, &end_val);
      D.27092 = reloc->reloc_type;
      if (D.27092 != 0) goto <D.27093>; else goto <D.27094>;
      <D.27093>:
      start_val.60 = start_val;
      D.27096 = start_val.60 == 0;
      D.27097 = (long int) D.27096;
      D.27098 = __builtin_expect (D.27097, 0);
      if (D.27098 != 0) goto <D.27099>; else goto <D.27100>;
      <D.27099>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 1228, "start_val > 0");
      <D.27100>:
      data.61 = data;
      end_val.62 = end_val;
      end_val.63 = (int) end_val.62;
      do_reloc (acfg, reloc, data.61, end_val.63);
      goto <D.27104>;
      <D.27094>:
      data.61 = data;
      end_val.62 = end_val;
      D.27105 = (unsigned char) end_val.62;
      *data.61 = D.27105;
      data.61 = data;
      D.27106 = data.61 + 1;
      end_val.62 = end_val;
      D.27107 = end_val.62 >> 8;
      D.27108 = (unsigned char) D.27107;
      *D.27106 = D.27108;
      data.61 = data;
      D.27109 = data.61 + 2;
      end_val.62 = end_val;
      D.27110 = end_val.62 >> 16;
      D.27111 = (unsigned char) D.27110;
      *D.27109 = D.27111;
      data.61 = data;
      D.27112 = data.61 + 3;
      end_val.62 = end_val;
      D.27113 = end_val.62 >> 24;
      D.27114 = (unsigned char) D.27113;
      *D.27112 = D.27114;
      <D.27104>:
      start_val.60 = start_val;
      if (start_val.60 == 0) goto <D.27115>; else goto <D.27116>;
      <D.27115>:
      D.27117 = reloc->val1;
      D.27118 = *D.27117;
      if (D.27118 != 46) goto <D.27119>; else goto <D.27120>;
      <D.27119>:
      i.64 = (unsigned int) i;
      D.27122 = i.64 * 8;
      D.27123 = rr + D.27122;
      vaddr.65 = vaddr;
      D.27123->r_offset = vaddr.65;
      i.64 = (unsigned int) i;
      D.27122 = i.64 * 8;
      D.27123 = rr + D.27122;
      D.27123->r_info = 8;
      i = i + 1;
      D.27089 = acfg->num_relocs;
      D.27125 = D.27089 < i;
      D.27126 = (long int) D.27125;
      D.27127 = __builtin_expect (D.27126, 0);
      if (D.27127 != 0) goto <D.27128>; else goto <D.27129>;
      <D.27128>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 1241, "i <= acfg->num_relocs");
      <D.27129>:
      <D.27120>:
      <D.27116>:
      reloc = reloc->next;
      <D.25554>:
      if (reloc != 0B) goto <D.25553>; else goto <D.25555>;
      <D.25555>:
      D.27130 = rr;
      return D.27130;
    }
  finally
    {
      data = {CLOBBER};
      end_val = {CLOBBER};
      start_val = {CLOBBER};
      vaddr = {CLOBBER};
    }
}


resolve_reloc (struct MonoImageWriter * acfg, struct BinReloc * reloc, guint8 * * out_data, gsize * out_vaddr, gsize * out_start_val, gsize * out_end_val)
{
  char * D.27133;
  unsigned int D.27134;
  char * D.27135;
  unsigned int D.27138;
  struct BinSection * D.27140;
  struct BinSection * D.27143;
  int D.27146;
  int D.27147;
  int D.27148;
  int D.27150;
  int D.27152;
  int D.27153;
  struct BinSection * D.27154;
  struct BinSection * D.27155;
  int D.27158;
  sizetype D.27159;
  int D.27160;
  sizetype D.27161;
  int D.27162;
  unsigned int D.27163;
  unsigned int D.27164;
  int D.27166;
  unsigned int start_val.66;
  unsigned int end_val.67;
  guint8 * data;
  gssize end_val;
  gssize start_val;
  gsize vaddr;

  D.27133 = reloc->val1;
  D.27134 = get_label_addr (acfg, D.27133);
  end_val = (gssize) D.27134;
  D.27135 = reloc->val2;
  if (D.27135 != 0B) goto <D.27136>; else goto <D.27137>;
  <D.27136>:
  D.27135 = reloc->val2;
  D.27138 = get_label_addr (acfg, D.27135);
  start_val = (gssize) D.27138;
  goto <D.27139>;
  <D.27137>:
  D.27140 = reloc->val2_section;
  if (D.27140 != 0B) goto <D.27141>; else goto <D.27142>;
  <D.27141>:
  start_val = reloc->val2_offset;
  D.27140 = reloc->val2_section;
  D.27143 = D.27140->parent;
  if (D.27143 != 0B) goto <D.27144>; else goto <D.27145>;
  <D.27144>:
  D.27140 = reloc->val2_section;
  D.27143 = D.27140->parent;
  D.27146 = D.27143->virt_offset;
  D.27140 = reloc->val2_section;
  D.27147 = D.27140->cur_offset;
  D.27148 = D.27146 + D.27147;
  start_val = D.27148 + start_val;
  goto <D.27149>;
  <D.27145>:
  D.27140 = reloc->val2_section;
  D.27150 = D.27140->virt_offset;
  start_val = D.27150 + start_val;
  <D.27149>:
  goto <D.27151>;
  <D.27142>:
  start_val = 0;
  <D.27151>:
  <D.27139>:
  D.27152 = end_val - start_val;
  D.27153 = reloc->offset;
  end_val = D.27152 + D.27153;
  D.27154 = reloc->section;
  D.27155 = D.27154->parent;
  if (D.27155 != 0B) goto <D.27156>; else goto <D.27157>;
  <D.27156>:
  D.27154 = reloc->section;
  D.27155 = D.27154->parent;
  data = D.27155->data;
  D.27154 = reloc->section;
  D.27158 = D.27154->cur_offset;
  D.27159 = (sizetype) D.27158;
  data = data + D.27159;
  D.27160 = reloc->section_offset;
  D.27161 = (sizetype) D.27160;
  data = data + D.27161;
  D.27154 = reloc->section;
  D.27155 = D.27154->parent;
  D.27162 = D.27155->virt_offset;
  vaddr = (gsize) D.27162;
  D.27154 = reloc->section;
  D.27158 = D.27154->cur_offset;
  D.27163 = (unsigned int) D.27158;
  vaddr = D.27163 + vaddr;
  D.27160 = reloc->section_offset;
  D.27164 = (unsigned int) D.27160;
  vaddr = D.27164 + vaddr;
  goto <D.27165>;
  <D.27157>:
  D.27154 = reloc->section;
  data = D.27154->data;
  D.27160 = reloc->section_offset;
  D.27161 = (sizetype) D.27160;
  data = data + D.27161;
  D.27154 = reloc->section;
  D.27166 = D.27154->virt_offset;
  vaddr = (gsize) D.27166;
  D.27160 = reloc->section_offset;
  D.27164 = (unsigned int) D.27160;
  vaddr = D.27164 + vaddr;
  <D.27165>:
  start_val.66 = (unsigned int) start_val;
  *out_start_val = start_val.66;
  end_val.67 = (unsigned int) end_val;
  *out_end_val = end_val.67;
  *out_data = data;
  *out_vaddr = vaddr;
}


get_label_addr (struct MonoImageWriter * acfg, const char * name)
{
  struct GHashTable * D.27169;
  struct BinSection * D.27172;
  int D.27175;
  int D.27176;
  int D.27177;
  int D.27178;
  int D.27180;
  int D.27181;
  gsize D.27182;
  int offset;
  struct BinLabel * lab;
  struct BinSection * section;
  gsize value;

  D.27169 = acfg->labels;
  lab = monoeg_g_hash_table_lookup (D.27169, name);
  if (lab == 0B) goto <D.27170>; else goto <D.27171>;
  <D.27170>:
  monoeg_g_log (0B, 4, "Undefined label: \'%s\'.\n", name);
  <D.25414>:
  goto <D.25414>;
  <D.27171>:
  section = lab->section;
  offset = lab->offset;
  D.27172 = section->parent;
  if (D.27172 != 0B) goto <D.27173>; else goto <D.27174>;
  <D.27173>:
  D.27172 = section->parent;
  D.27175 = D.27172->virt_offset;
  D.27176 = section->cur_offset;
  D.27177 = D.27175 + D.27176;
  D.27178 = D.27177 + offset;
  value = (gsize) D.27178;
  goto <D.27179>;
  <D.27174>:
  D.27180 = section->virt_offset;
  D.27181 = D.27180 + offset;
  value = (gsize) D.27181;
  <D.27179>:
  D.27182 = value;
  return D.27182;
}


do_reloc (struct MonoImageWriter * acfg, struct BinReloc * reloc, guint8 * data, gssize addr)
{
  int D.27184;
  guint8 * D.27187;
  unsigned char D.27188;
  _Bool D.27189;
  long int D.27190;
  long int D.27191;
  _Bool D.27195;
  long int D.27196;
  long int D.27197;
  unsigned int diff.68;
  unsigned int D.27203;
  unsigned int diff.69;
  unsigned int D.27206;
  unsigned int D.27209;
  _Bool D.27211;
  long int D.27212;
  long int D.27213;
  unsigned int D.27216;
  unsigned int D.27219;
  unsigned int D.27220;
  unsigned int D.27221;
  unsigned int D.27223;
  unsigned int D.27224;
  unsigned int D.27225;
  unsigned int D.27226;
  unsigned int D.27227;
  unsigned int D.27228;

  D.27184 = reloc->reloc_type;
  switch (D.27184) <default: <D.25542>, case 28: <D.25529>, case 29: <D.25530>, case 59: <D.25535>>
  <D.25529>:
  <D.25530>:
  {
    guint32 * code;
    guint32 ins;
    int diff;

    code = data;
    ins = *code;
    diff = addr;
    D.27184 = reloc->reloc_type;
    if (D.27184 == 28) goto <D.27185>; else goto <D.27186>;
    <D.27185>:
    D.27187 = data + 3;
    D.27188 = *D.27187;
    D.27189 = D.27188 != 235;
    D.27190 = (long int) D.27189;
    D.27191 = __builtin_expect (D.27190, 0);
    if (D.27191 != 0) goto <D.27192>; else goto <D.27193>;
    <D.27192>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 1171, "data [3] == 0xeb");
    <D.27193>:
    goto <D.27194>;
    <D.27186>:
    D.27187 = data + 3;
    D.27188 = *D.27187;
    D.27195 = D.27188 != 234;
    D.27196 = (long int) D.27195;
    D.27197 = __builtin_expect (D.27196, 0);
    if (D.27197 != 0) goto <D.27198>; else goto <D.27199>;
    <D.27198>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 1174, "data [3] == 0xea");
    <D.27199>:
    <D.27194>:
    diff.68 = (unsigned int) diff;
    if (diff.68 <= 33554431) goto <D.27201>; else goto <D.27202>;
    <D.27201>:
    diff = diff >> 2;
    D.27203 = ins & 4278190080;
    diff.69 = (unsigned int) diff;
    ins = D.27203 | diff.69;
    *code = ins;
    goto <D.27205>;
    <D.27202>:
    diff.68 = (unsigned int) diff;
    D.27206 = diff.68 + 33554432;
    if (D.27206 <= 33554432) goto <D.27207>; else goto <D.27208>;
    <D.27207>:
    diff = diff >> 2;
    D.27203 = ins & 4278190080;
    diff.69 = (unsigned int) diff;
    D.27209 = diff.69 & 16777215;
    ins = D.27203 | D.27209;
    *code = ins;
    goto <D.27210>;
    <D.27208>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "image-writer.c", 1184);
    <D.27210>:
    <D.27205>:
    goto <D.25534>;
  }
  <D.25535>:
  {
    guint8 * code;
    guint32 val;

    code = data;
    val = (guint32) addr;
    D.27211 = val > 16777215;
    D.27212 = (long int) D.27211;
    D.27213 = __builtin_expect (D.27212, 0);
    if (D.27213 != 0) goto <D.27214>; else goto <D.27215>;
    <D.27214>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 1193, "val <= 0xffffff");
    <D.27215>:
    D.27216 = val & 16711680;
    if (D.27216 != 0) goto <D.27217>; else goto <D.27218>;
    <D.27217>:
    {
      arminstr_t * __ainstrp;

      __ainstrp = code;
      D.27216 = val & 16711680;
      D.27219 = D.27216 >> 16;
      D.27220 = D.27219 & 255;
      D.27221 = D.27220 | 3801073664;
      *__ainstrp = D.27221;
      code = __ainstrp + 4;
    }
    goto <D.27222>;
    <D.27218>:
    {
      arminstr_t * __ainstrp;

      __ainstrp = code;
      *__ainstrp = 3801071616;
      code = __ainstrp + 4;
    }
    <D.27222>:
    {
      arminstr_t * __ainstrp;

      __ainstrp = code;
      D.27223 = val & 65280;
      D.27224 = D.27223 >> 8;
      D.27225 = D.27224 & 255;
      D.27226 = D.27225 | 3800878080;
      *__ainstrp = D.27226;
      code = __ainstrp + 4;
    }
    {
      arminstr_t * __ainstrp;

      __ainstrp = code;
      D.27227 = val & 255;
      D.27228 = D.27227 | 3852267520;
      *__ainstrp = D.27228;
      code = __ainstrp + 4;
    }
    goto <D.25534>;
  }
  <D.25542>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "image-writer.c", 1203);
  <D.25534>:
}


bin_writer_fseek (struct MonoImageWriter * acfg, int offset)
{
  struct FILE * D.27229;

  D.27229 = acfg->fp;
  if (D.27229 != 0B) goto <D.27230>; else goto <D.27231>;
  <D.27230>:
  D.27229 = acfg->fp;
  fseek (D.27229, offset, 0);
  goto <D.27232>;
  <D.27231>:
  acfg->out_buf_pos = offset;
  <D.27232>:
}


bin_writer_fwrite (struct MonoImageWriter * acfg, void * val, size_t size, size_t nmemb)
{
  struct FILE * D.27233;
  int D.27237;
  unsigned int D.27238;
  unsigned int D.27239;
  unsigned int D.27240;
  int D.27241;
  unsigned int D.27242;
  _Bool D.27243;
  long int D.27244;
  long int D.27245;
  guint8 * D.27248;
  sizetype D.27249;
  guint8 * D.27250;
  int D.27251;

  D.27233 = acfg->fp;
  if (D.27233 != 0B) goto <D.27234>; else goto <D.27235>;
  <D.27234>:
  D.27233 = acfg->fp;
  fwrite (val, size, nmemb, D.27233);
  goto <D.27236>;
  <D.27235>:
  D.27237 = acfg->out_buf_pos;
  D.27238 = (unsigned int) D.27237;
  D.27239 = size * nmemb;
  D.27240 = D.27238 + D.27239;
  D.27241 = acfg->out_buf_size;
  D.27242 = (unsigned int) D.27241;
  D.27243 = D.27240 > D.27242;
  D.27244 = (long int) D.27243;
  D.27245 = __builtin_expect (D.27244, 0);
  if (D.27245 != 0) goto <D.27246>; else goto <D.27247>;
  <D.27246>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 494, "acfg->out_buf_pos + (size * nmemb) <= acfg->out_buf_size");
  <D.27247>:
  D.27248 = acfg->out_buf;
  D.27237 = acfg->out_buf_pos;
  D.27249 = (sizetype) D.27237;
  D.27250 = D.27248 + D.27249;
  D.27239 = size * nmemb;
  memcpy (D.27250, val, D.27239);
  D.27237 = acfg->out_buf_pos;
  D.27238 = (unsigned int) D.27237;
  D.27239 = size * nmemb;
  D.27240 = D.27238 + D.27239;
  D.27251 = (int) D.27240;
  acfg->out_buf_pos = D.27251;
  <D.27236>:
}


asm_writer_emit_writeout (struct MonoImageWriter * acfg)
{
  struct FILE * D.27252;
  int D.27253;

  D.27252 = acfg->fp;
  fclose (D.27252);
  D.27253 = 0;
  return D.27253;
}


img_writer_emit_byte (struct MonoImageWriter * acfg, guint8 val)
{
  img_writer_emit_bytes (acfg, &val, 1);
}


img_writer_emit_reloc (struct MonoImageWriter * acfg, int reloc_type, const char * symbol, int addend)
{
  int D.27255;

  D.27255 = acfg->use_bin_writer;
  if (D.27255 != 0) goto <D.27256>; else goto <D.27257>;
  <D.27256>:
  bin_writer_emit_reloc (acfg, reloc_type, symbol, addend);
  goto <D.27258>;
  <D.27257>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "image-writer.c", 2268);
  <D.27258>:
}


bin_writer_emit_reloc (struct MonoImageWriter * acfg, int reloc_type, const char * symbol, int addend)
{
  struct BinReloc * reloc;

  reloc = create_reloc (acfg, symbol, ".", addend);
  reloc->reloc_type = reloc_type;
}


img_writer_emit_unset_mode (struct MonoImageWriter * acfg)
{
  int D.27259;

  D.27259 = acfg->use_bin_writer;
  if (D.27259 == 0) goto <D.27260>; else goto <D.27261>;
  <D.27260>:
  asm_writer_emit_unset_mode (acfg);
  <D.27261>:
}


img_writer_get_output (struct MonoImageWriter * acfg, guint32 * size)
{
  int D.27262;
  _Bool D.27263;
  long int D.27264;
  long int D.27265;
  int D.27268;
  unsigned int D.27269;
  guint8 * D.27270;
  guint8 * buf;

  D.27262 = acfg->use_bin_writer;
  D.27263 = D.27262 == 0;
  D.27264 = (long int) D.27263;
  D.27265 = __builtin_expect (D.27264, 0);
  if (D.27265 != 0) goto <D.27266>; else goto <D.27267>;
  <D.27266>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 2299, "acfg->use_bin_writer");
  <D.27267>:
  buf = acfg->out_buf;
  D.27268 = acfg->out_buf_size;
  D.27269 = (unsigned int) D.27268;
  *size = D.27269;
  acfg->out_buf = 0B;
  D.27270 = buf;
  return D.27270;
}


bin_writer_supported ()
{
  gboolean D.27272;

  D.27272 = 1;
  return D.27272;
}


img_writer_create (struct FILE * fp, gboolean use_bin_writer)
{
  _Bool D.27276;
  long int D.27277;
  long int D.27278;
  struct MonoMemPool * D.27281;
  struct MonoImageWriter * D.27282;
  struct MonoImageWriter * w;

  w = monoeg_malloc0 (208);
  if (use_bin_writer == 0) goto <D.27274>; else goto <D.27275>;
  <D.27274>:
  D.27276 = fp == 0B;
  D.27277 = (long int) D.27276;
  D.27278 = __builtin_expect (D.27277, 0);
  if (D.27278 != 0) goto <D.27279>; else goto <D.27280>;
  <D.27279>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 2341, "fp");
  <D.27280>:
  <D.27275>:
  w->fp = fp;
  w->use_bin_writer = use_bin_writer;
  D.27281 = mono_mempool_new ();
  w->mempool = D.27281;
  D.27282 = w;
  return D.27282;
}


img_writer_destroy (struct MonoImageWriter * w)
{
  struct MonoMemPool * D.27284;

  D.27284 = w->mempool;
  mono_mempool_destroy (D.27284);
  monoeg_g_free (w);
}


img_writer_subsections_supported (struct MonoImageWriter * acfg)
{
  gboolean D.27285;

  D.27285 = 1;
  return D.27285;
}


img_writer_get_fp (struct MonoImageWriter * acfg)
{
  struct FILE * D.27287;

  D.27287 = acfg->fp;
  return D.27287;
}


img_writer_get_temp_label_prefix (struct MonoImageWriter * acfg)
{
  const char * D.27289;

  D.27289 = ".L";
  return D.27289;
}


