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

  D.23342 = acfg->use_bin_writer;
  if (D.23342 != 0) goto <D.23343>; else goto <D.23344>;
  <D.23343>:
  bin_writer_emit_start (acfg);
  goto <D.23345>;
  <D.23344>:
  asm_writer_emit_start (acfg);
  <D.23345>:
}


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

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


asm_writer_emit_start (struct MonoImageWriter * acfg)
{

}


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

  D.23347 = acfg->use_bin_writer;
  if (D.23347 != 0) goto <D.23348>; else goto <D.23349>;
  <D.23348>:
  bin_writer_emit_section_change (acfg, section_name, subsection_index);
  goto <D.23350>;
  <D.23349>:
  asm_writer_emit_section_change (acfg, section_name, subsection_index);
  <D.23350>:
  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.23351;
  int D.23354;
  int D.22639;
  char * D.23357;
  int D.23360;
  int D.22648;
  char * D.23363;
  gchar * D.23368;
  struct BinSection * D.23369;
  struct BinSection * section;

  D.23351 = acfg->cur_section;
  if (D.23351 != 0B) goto <D.23352>; else goto <D.23353>;
  <D.23352>:
  D.23351 = acfg->cur_section;
  D.23354 = D.23351->subsection;
  if (D.23354 == subsection_index) goto <D.23355>; else goto <D.23356>;
  <D.23355>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.23351 = acfg->cur_section;
    D.23357 = D.23351->name;
    D.22639 = __builtin_strcmp (D.23357, section_name);
  }
  if (D.22639 == 0) goto <D.23358>; else goto <D.23359>;
  <D.23358>:
  return;
  <D.23359>:
  <D.23356>:
  <D.23353>:
  section = acfg->sections;
  goto <D.22650>;
  <D.22649>:
  D.23360 = section->subsection;
  if (D.23360 == subsection_index) goto <D.23361>; else goto <D.23362>;
  <D.23361>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.23363 = section->name;
    D.22648 = __builtin_strcmp (D.23363, section_name);
  }
  if (D.22648 == 0) goto <D.23364>; else goto <D.23365>;
  <D.23364>:
  acfg->cur_section = section;
  return;
  <D.23365>:
  <D.23362>:
  section = section->next;
  <D.22650>:
  if (section != 0B) goto <D.22649>; else goto <D.22651>;
  <D.22651>:
  if (section == 0B) goto <D.23366>; else goto <D.23367>;
  <D.23366>:
  section = monoeg_malloc0 (52);
  D.23368 = monoeg_strdup (section_name);
  section->name = D.23368;
  section->subsection = subsection_index;
  D.23369 = acfg->sections;
  section->next = D.23369;
  acfg->sections = section;
  acfg->cur_section = section;
  <D.23367>:
}


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

  if (str != 0B) goto <D.23371>; else goto <D.23372>;
  <D.23371>:
  D.23373 = __strdup (str);
  return D.23373;
  <D.23372>:
  D.23373 = 0B;
  return D.23373;
}


asm_writer_emit_section_change (struct MonoImageWriter * acfg, const char * section_name, int subsection_index)
{
  int D.23110;
  int iftmp.0;
  int D.23109;
  const char[6] * D.23381;
  unsigned char D.23382;
  int D.23383;
  unsigned char D.23384;
  int D.23385;
  _Bool D.23386;
  _Bool D.23387;
  _Bool D.23388;
  const unsigned char * D.23391;
  unsigned char D.23392;
  int D.23393;
  const unsigned char * D.23394;
  unsigned char D.23395;
  int D.23396;
  _Bool D.23397;
  _Bool D.23398;
  const unsigned char * D.23401;
  unsigned char D.23402;
  int D.23403;
  const unsigned char * D.23404;
  unsigned char D.23405;
  int D.23406;
  _Bool D.23407;
  _Bool D.23408;
  const unsigned char * D.23411;
  unsigned char D.23412;
  int D.23413;
  const unsigned char * D.23414;
  unsigned char D.23415;
  int D.23416;
  int D.23119;
  int iftmp.1;
  int D.23118;
  const char[6] * D.23422;
  unsigned char D.23423;
  int D.23424;
  unsigned char D.23425;
  int D.23426;
  _Bool D.23427;
  _Bool D.23428;
  _Bool D.23429;
  const unsigned char * D.23432;
  unsigned char D.23433;
  int D.23434;
  const unsigned char * D.23435;
  unsigned char D.23436;
  int D.23437;
  _Bool D.23438;
  _Bool D.23439;
  const unsigned char * D.23442;
  unsigned char D.23443;
  int D.23444;
  const unsigned char * D.23445;
  unsigned char D.23446;
  int D.23447;
  _Bool D.23448;
  _Bool D.23449;
  const unsigned char * D.23452;
  unsigned char D.23453;
  int D.23454;
  const unsigned char * D.23455;
  unsigned char D.23456;
  int D.23457;
  int D.23128;
  int iftmp.2;
  int D.23127;
  const char[5] * D.23463;
  unsigned char D.23464;
  int D.23465;
  unsigned char D.23466;
  int D.23467;
  _Bool D.23468;
  _Bool D.23469;
  _Bool D.23470;
  const unsigned char * D.23473;
  unsigned char D.23474;
  int D.23475;
  const unsigned char * D.23476;
  unsigned char D.23477;
  int D.23478;
  _Bool D.23479;
  _Bool D.23480;
  const unsigned char * D.23483;
  unsigned char D.23484;
  int D.23485;
  const unsigned char * D.23486;
  unsigned char D.23487;
  int D.23488;
  _Bool D.23489;
  _Bool D.23490;
  const unsigned char * D.23493;
  unsigned char D.23494;
  int D.23495;
  const unsigned char * D.23496;
  unsigned char D.23497;
  int D.23498;
  struct FILE * D.23500;

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

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

      __s2 = section_name;
      D.23381 = ".text";
      D.23382 = MEM[(const unsigned char *)D.23381];
      D.23383 = (int) D.23382;
      D.23384 = *__s2;
      D.23385 = (int) D.23384;
      __result = D.23383 - D.23385;
      {
        D.23386 = __s2_len != 0;
        D.23387 = __result == 0;
        D.23388 = D.23386 & D.23387;
        if (D.23388 != 0) goto <D.23389>; else goto <D.23390>;
        <D.23389>:
        D.23391 = &MEM[(void *)".text" + 1B];
        D.23392 = *D.23391;
        D.23393 = (int) D.23392;
        D.23394 = __s2 + 1;
        D.23395 = *D.23394;
        D.23396 = (int) D.23395;
        __result = D.23393 - D.23396;
        D.23397 = __s2_len > 1;
        D.23387 = __result == 0;
        D.23398 = D.23397 & D.23387;
        if (D.23398 != 0) goto <D.23399>; else goto <D.23400>;
        <D.23399>:
        D.23401 = &MEM[(void *)".text" + 2B];
        D.23402 = *D.23401;
        D.23403 = (int) D.23402;
        D.23404 = __s2 + 2;
        D.23405 = *D.23404;
        D.23406 = (int) D.23405;
        __result = D.23403 - D.23406;
        D.23407 = __s2_len > 2;
        D.23387 = __result == 0;
        D.23408 = D.23407 & D.23387;
        if (D.23408 != 0) goto <D.23409>; else goto <D.23410>;
        <D.23409>:
        D.23411 = &MEM[(void *)".text" + 3B];
        D.23412 = *D.23411;
        D.23413 = (int) D.23412;
        D.23414 = __s2 + 3;
        D.23415 = *D.23414;
        D.23416 = (int) D.23415;
        __result = D.23413 - D.23416;
        <D.23410>:
        <D.23400>:
        <D.23390>:
      }
      D.23109 = __result;
    }
    iftmp.0 = -D.23109;
    goto <D.23417>;
    <D.23380>:
    iftmp.0 = __builtin_strcmp (section_name, ".text");
    <D.23417>:
    D.23110 = iftmp.0;
  }
  if (D.23110 == 0) goto <D.23375>; else goto <D.23418>;
  <D.23418>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = section_name;
      D.23422 = ".data";
      D.23423 = MEM[(const unsigned char *)D.23422];
      D.23424 = (int) D.23423;
      D.23425 = *__s2;
      D.23426 = (int) D.23425;
      __result = D.23424 - D.23426;
      {
        D.23427 = __s2_len != 0;
        D.23428 = __result == 0;
        D.23429 = D.23427 & D.23428;
        if (D.23429 != 0) goto <D.23430>; else goto <D.23431>;
        <D.23430>:
        D.23432 = &MEM[(void *)".data" + 1B];
        D.23433 = *D.23432;
        D.23434 = (int) D.23433;
        D.23435 = __s2 + 1;
        D.23436 = *D.23435;
        D.23437 = (int) D.23436;
        __result = D.23434 - D.23437;
        D.23438 = __s2_len > 1;
        D.23428 = __result == 0;
        D.23439 = D.23438 & D.23428;
        if (D.23439 != 0) goto <D.23440>; else goto <D.23441>;
        <D.23440>:
        D.23442 = &MEM[(void *)".data" + 2B];
        D.23443 = *D.23442;
        D.23444 = (int) D.23443;
        D.23445 = __s2 + 2;
        D.23446 = *D.23445;
        D.23447 = (int) D.23446;
        __result = D.23444 - D.23447;
        D.23448 = __s2_len > 2;
        D.23428 = __result == 0;
        D.23449 = D.23448 & D.23428;
        if (D.23449 != 0) goto <D.23450>; else goto <D.23451>;
        <D.23450>:
        D.23452 = &MEM[(void *)".data" + 3B];
        D.23453 = *D.23452;
        D.23454 = (int) D.23453;
        D.23455 = __s2 + 3;
        D.23456 = *D.23455;
        D.23457 = (int) D.23456;
        __result = D.23454 - D.23457;
        <D.23451>:
        <D.23441>:
        <D.23431>:
      }
      D.23118 = __result;
    }
    iftmp.1 = -D.23118;
    goto <D.23458>;
    <D.23421>:
    iftmp.1 = __builtin_strcmp (section_name, ".data");
    <D.23458>:
    D.23119 = iftmp.1;
  }
  if (D.23119 == 0) goto <D.23375>; else goto <D.23459>;
  <D.23459>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = section_name;
      D.23463 = ".bss";
      D.23464 = MEM[(const unsigned char *)D.23463];
      D.23465 = (int) D.23464;
      D.23466 = *__s2;
      D.23467 = (int) D.23466;
      __result = D.23465 - D.23467;
      {
        D.23468 = __s2_len != 0;
        D.23469 = __result == 0;
        D.23470 = D.23468 & D.23469;
        if (D.23470 != 0) goto <D.23471>; else goto <D.23472>;
        <D.23471>:
        D.23473 = &MEM[(void *)".bss" + 1B];
        D.23474 = *D.23473;
        D.23475 = (int) D.23474;
        D.23476 = __s2 + 1;
        D.23477 = *D.23476;
        D.23478 = (int) D.23477;
        __result = D.23475 - D.23478;
        D.23479 = __s2_len > 1;
        D.23469 = __result == 0;
        D.23480 = D.23479 & D.23469;
        if (D.23480 != 0) goto <D.23481>; else goto <D.23482>;
        <D.23481>:
        D.23483 = &MEM[(void *)".bss" + 2B];
        D.23484 = *D.23483;
        D.23485 = (int) D.23484;
        D.23486 = __s2 + 2;
        D.23487 = *D.23486;
        D.23488 = (int) D.23487;
        __result = D.23485 - D.23488;
        D.23489 = __s2_len > 2;
        D.23469 = __result == 0;
        D.23490 = D.23489 & D.23469;
        if (D.23490 != 0) goto <D.23491>; else goto <D.23492>;
        <D.23491>:
        D.23493 = &MEM[(void *)".bss" + 3B];
        D.23494 = *D.23493;
        D.23495 = (int) D.23494;
        D.23496 = __s2 + 3;
        D.23497 = *D.23496;
        D.23498 = (int) D.23497;
        __result = D.23495 - D.23498;
        <D.23492>:
        <D.23482>:
        <D.23472>:
      }
      D.23127 = __result;
    }
    iftmp.2 = -D.23127;
    goto <D.23499>;
    <D.23462>:
    iftmp.2 = __builtin_strcmp (section_name, ".bss");
    <D.23499>:
    D.23128 = iftmp.2;
  }
  if (D.23128 == 0) goto <D.23375>; else goto <D.23376>;
  <D.23375>:
  D.23500 = acfg->fp;
  fprintf (D.23500, "%s %d\n", section_name, subsection_index);
  goto <D.23377>;
  <D.23376>:
  D.23500 = acfg->fp;
  fprintf (D.23500, ".section \"%s\"\n", section_name);
  D.23500 = acfg->fp;
  fprintf (D.23500, ".subsection %d\n", subsection_index);
  <D.23377>:
}


asm_writer_emit_unset_mode (struct MonoImageWriter * acfg)
{
  int D.23501;
  struct FILE * D.23504;

  D.23501 = acfg->mode;
  if (D.23501 == 0) goto <D.23502>; else goto <D.23503>;
  <D.23502>:
  return;
  <D.23503>:
  D.23504 = acfg->fp;
  fprintf (D.23504, "\n");
  acfg->mode = 0;
}


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

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


img_writer_emit_push_section (struct MonoImageWriter * acfg, const char * section_name, int subsection)
{
  int D.23508;
  _Bool D.23509;
  long int D.23510;
  long int D.23511;
  const char * D.23514;
  int D.23515;
  int D.23516;

  D.23508 = acfg->stack_pos;
  D.23509 = D.23508 > 14;
  D.23510 = (long int) D.23509;
  D.23511 = __builtin_expect (D.23510, 0);
  if (D.23511 != 0) goto <D.23512>; else goto <D.23513>;
  <D.23512>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 2018, "acfg->stack_pos < 16 - 1");
  <D.23513>:
  D.23508 = acfg->stack_pos;
  D.23514 = acfg->current_section;
  acfg->section_stack[D.23508] = D.23514;
  D.23508 = acfg->stack_pos;
  D.23515 = acfg->current_subsection;
  acfg->subsection_stack[D.23508] = D.23515;
  D.23508 = acfg->stack_pos;
  D.23516 = D.23508 + 1;
  acfg->stack_pos = D.23516;
  img_writer_emit_section_change (acfg, section_name, subsection);
}


img_writer_emit_pop_section (struct MonoImageWriter * acfg)
{
  int D.23517;
  _Bool D.23518;
  long int D.23519;
  long int D.23520;
  int D.23523;
  int D.23524;
  const char * D.23525;

  D.23517 = acfg->stack_pos;
  D.23518 = D.23517 <= 0;
  D.23519 = (long int) D.23518;
  D.23520 = __builtin_expect (D.23519, 0);
  if (D.23520 != 0) goto <D.23521>; else goto <D.23522>;
  <D.23521>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 2029, "acfg->stack_pos > 0");
  <D.23522>:
  D.23517 = acfg->stack_pos;
  D.23523 = D.23517 + -1;
  acfg->stack_pos = D.23523;
  D.23517 = acfg->stack_pos;
  D.23524 = acfg->subsection_stack[D.23517];
  D.23517 = acfg->stack_pos;
  D.23525 = acfg->section_stack[D.23517];
  img_writer_emit_section_change (acfg, D.23525, D.23524);
}


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

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


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

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


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

  D.23530 = acfg->use_bin_writer;
  if (D.23530 != 0) goto <D.23531>; else goto <D.23532>;
  <D.23531>:
  bin_writer_emit_global (acfg, name, func);
  goto <D.23533>;
  <D.23532>:
  asm_writer_emit_global (acfg, name, func);
  <D.23533>:
}


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.23534;
  gchar * D.23537;
  struct BinSection * D.23538;
  struct BinSection * D.23539;
  int D.23540;
  struct BinSymbol * D.23541;
  struct BinSymbol * symbol;

  symbol = monoeg_malloc0 (28);
  D.23534 = monoeg_strdup (name);
  symbol->name = D.23534;
  if (end_label != 0B) goto <D.23535>; else goto <D.23536>;
  <D.23535>:
  D.23537 = monoeg_strdup (end_label);
  symbol->end_label = D.23537;
  <D.23536>:
  symbol->is_function = func;
  symbol->is_global = is_global;
  D.23538 = acfg->cur_section;
  symbol->section = D.23538;
  D.23539 = symbol->section;
  D.23540 = D.23539->cur_offset;
  symbol->offset = D.23540;
  D.23541 = acfg->symbols;
  symbol->next = D.23541;
  acfg->symbols = symbol;
}


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

  asm_writer_emit_unset_mode (acfg);
  D.23542 = acfg->fp;
  fprintf (D.23542, "\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.23546;
  const char * stype;

  if (func != 0) goto <D.23543>; else goto <D.23544>;
  <D.23543>:
  stype = "function";
  goto <D.23545>;
  <D.23544>:
  stype = "object";
  <D.23545>:
  asm_writer_emit_unset_mode (acfg);
  D.23546 = acfg->fp;
  fprintf (D.23546, "\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.23547;

  D.23547 = acfg->use_bin_writer;
  if (D.23547 != 0) goto <D.23548>; else goto <D.23549>;
  <D.23548>:
  bin_writer_emit_local_symbol (acfg, name, end_label, func);
  goto <D.23550>;
  <D.23549>:
  asm_writer_emit_local_symbol (acfg, name, end_label, func);
  <D.23550>:
}


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.23551;

  asm_writer_emit_unset_mode (acfg);
  D.23551 = acfg->fp;
  fprintf (D.23551, "\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.23552;

  D.23552 = acfg->use_bin_writer;
  if (D.23552 == 0) goto <D.23553>; else goto <D.23554>;
  <D.23553>:
  asm_writer_emit_symbol_size (acfg, name, end_label);
  <D.23554>:
}


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

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


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

  D.23556 = acfg->use_bin_writer;
  if (D.23556 != 0) goto <D.23557>; else goto <D.23558>;
  <D.23557>:
  bin_writer_emit_label (acfg, name);
  goto <D.23559>;
  <D.23558>:
  asm_writer_emit_label (acfg, name);
  <D.23559>:
}


bin_writer_emit_label (struct MonoImageWriter * acfg, const char * name)
{
  gchar * D.23560;
  struct BinSection * D.23561;
  int D.23562;
  char * D.23563;
  struct GHashTable * D.23564;
  struct BinLabel * label;

  label = monoeg_malloc0 (12);
  D.23560 = monoeg_strdup (name);
  label->name = D.23560;
  D.23561 = acfg->cur_section;
  label->section = D.23561;
  D.23561 = acfg->cur_section;
  D.23562 = D.23561->cur_offset;
  label->offset = D.23562;
  D.23563 = label->name;
  D.23564 = acfg->labels;
  monoeg_g_hash_table_insert_replace (D.23564, D.23563, label, 0);
}


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

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


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

  D.23567 = s;
  return D.23567;
}


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

  D.23569 = acfg->use_bin_writer;
  if (D.23569 != 0) goto <D.23570>; else goto <D.23571>;
  <D.23570>:
  bin_writer_emit_bytes (acfg, buf, size);
  goto <D.23572>;
  <D.23571>:
  asm_writer_emit_bytes (acfg, buf, size);
  <D.23572>:
}


bin_writer_emit_bytes (struct MonoImageWriter * acfg, const guint8 * buf, int size)
{
  struct BinSection * D.23573;
  unsigned int size.3;
  guint8 * D.23575;
  int D.23576;
  sizetype D.23577;
  guint8 * D.23578;
  int D.23579;

  D.23573 = acfg->cur_section;
  bin_writer_emit_ensure_buffer (D.23573, size);
  size.3 = (unsigned int) size;
  D.23573 = acfg->cur_section;
  D.23575 = D.23573->data;
  D.23573 = acfg->cur_section;
  D.23576 = D.23573->cur_offset;
  D.23577 = (sizetype) D.23576;
  D.23578 = D.23575 + D.23577;
  memcpy (D.23578, buf, size.3);
  D.23573 = acfg->cur_section;
  D.23573 = acfg->cur_section;
  D.23576 = D.23573->cur_offset;
  D.23579 = D.23576 + size;
  D.23573->cur_offset = D.23579;
}


bin_writer_emit_ensure_buffer (struct BinSection * section, int size)
{
  int D.23580;
  int D.23581;
  int iftmp.4;
  unsigned int new_size.5;
  unsigned int D.23589;
  guint8 * D.23590;
  int new_offset;

  D.23580 = section->cur_offset;
  new_offset = D.23580 + size;
  D.23581 = section->data_len;
  if (D.23581 <= new_offset) goto <D.23582>; else goto <D.23583>;
  <D.23582>:
  {
    int new_size;
    guint8 * data;

    D.23581 = section->data_len;
    if (D.23581 != 0) goto <D.23585>; else goto <D.23586>;
    <D.23585>:
    D.23581 = section->data_len;
    iftmp.4 = D.23581 * 2;
    goto <D.23587>;
    <D.23586>:
    iftmp.4 = 256;
    <D.23587>:
    new_size = iftmp.4;
    goto <D.22688>;
    <D.22687>:
    new_size = new_size * 2;
    <D.22688>:
    if (new_size <= new_offset) goto <D.22687>; else goto <D.22689>;
    <D.22689>:
    new_size.5 = (unsigned int) new_size;
    data = monoeg_malloc0 (new_size.5);
    D.23581 = section->data_len;
    D.23589 = (unsigned int) D.23581;
    D.23590 = section->data;
    memcpy (data, D.23590, D.23589);
    D.23590 = section->data;
    monoeg_g_free (D.23590);
    section->data = data;
    section->data_len = new_size;
  }
  <D.23583>:
}


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

  D.23592 = __builtin_object_size (__dest, 0);
  D.23591 = __builtin___memcpy_chk (__dest, __src, __len, D.23592);
  return D.23591;
}


asm_writer_emit_bytes (struct MonoImageWriter * acfg, const guint8 * buf, int size)
{
  int D.23594;
  char * byte_to_str.6;
  void * byte_to_str.7;
  int D.23601;
  sizetype D.23602;
  char * D.23603;
  int D.23604;
  unsigned int D.23605;
  unsigned int D.23606;
  sizetype i.8;
  const guint8 * D.23610;
  unsigned char D.23611;
  int D.23612;
  struct FILE * D.23613;
  int D.23615;
  sizetype D.23616;
  char * D.23617;
  int D.23618;
  int i;

  D.23594 = acfg->mode;
  if (D.23594 != 1) goto <D.23595>; else goto <D.23596>;
  <D.23595>:
  acfg->mode = 1;
  acfg->col_count = 0;
  <D.23596>:
  byte_to_str.6 = byte_to_str;
  if (byte_to_str.6 == 0B) goto <D.23598>; else goto <D.23599>;
  <D.23598>:
  byte_to_str.7 = monoeg_malloc0 (2048);
  byte_to_str = byte_to_str.7;
  i = 0;
  goto <D.23185>;
  <D.23184>:
  byte_to_str.6 = byte_to_str;
  D.23601 = i * 8;
  D.23602 = (sizetype) D.23601;
  D.23603 = byte_to_str.6 + D.23602;
  sprintf (D.23603, ",%d", i);
  i = i + 1;
  <D.23185>:
  if (i <= 255) goto <D.23184>; else goto <D.23186>;
  <D.23186>:
  <D.23599>:
  i = 0;
  goto <D.23188>;
  <D.23187>:
  D.23604 = acfg->col_count;
  D.23605 = (unsigned int) D.23604;
  D.23606 = D.23605 & 31;
  if (D.23606 == 0) goto <D.23607>; else goto <D.23608>;
  <D.23607>:
  i.8 = (sizetype) i;
  D.23610 = buf + i.8;
  D.23611 = *D.23610;
  D.23612 = (int) D.23611;
  D.23613 = acfg->fp;
  fprintf (D.23613, "\n\t.byte %d", D.23612);
  goto <D.23614>;
  <D.23608>:
  D.23613 = acfg->fp;
  byte_to_str.6 = byte_to_str;
  i.8 = (sizetype) i;
  D.23610 = buf + i.8;
  D.23611 = *D.23610;
  D.23612 = (int) D.23611;
  D.23615 = D.23612 * 8;
  D.23616 = (sizetype) D.23615;
  D.23617 = byte_to_str.6 + D.23616;
  fputs (D.23617, D.23613);
  <D.23614>:
  i = i + 1;
  D.23604 = acfg->col_count;
  D.23618 = D.23604 + 1;
  acfg->col_count = D.23618;
  <D.23188>:
  if (i < size) goto <D.23187>; else goto <D.23189>;
  <D.23189>:
}


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

  D.23620 = __builtin_object_size (__s, 1);
  D.23619 = __builtin___sprintf_chk (__s, 1, D.23620, __fmt, __builtin_va_arg_pack ());
  return D.23619;
}


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

  D.23622 = acfg->use_bin_writer;
  if (D.23622 != 0) goto <D.23623>; else goto <D.23624>;
  <D.23623>:
  bin_writer_emit_string (acfg, value);
  goto <D.23625>;
  <D.23624>:
  asm_writer_emit_string (acfg, value);
  <D.23625>:
}


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

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


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

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


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

  D.23629 = acfg->use_bin_writer;
  if (D.23629 != 0) goto <D.23630>; else goto <D.23631>;
  <D.23630>:
  bin_writer_emit_line (acfg);
  goto <D.23632>;
  <D.23631>:
  asm_writer_emit_line (acfg);
  <D.23632>:
}


bin_writer_emit_line (struct MonoImageWriter * acfg)
{

}


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

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


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

  D.23634 = acfg->use_bin_writer;
  if (D.23634 != 0) goto <D.23635>; else goto <D.23636>;
  <D.23635>:
  bin_writer_emit_alignment (acfg, size);
  goto <D.23637>;
  <D.23636>:
  asm_writer_emit_alignment (acfg, size);
  <D.23637>:
}


bin_writer_emit_alignment (struct MonoImageWriter * acfg, int size)
{
  struct BinSection * D.23638;
  int D.23639;
  int D.23640;
  int D.23641;
  int D.23644;
  int offset;
  int add;

  D.23638 = acfg->cur_section;
  offset = D.23638->cur_offset;
  D.23639 = size + -1;
  offset = D.23639 + offset;
  D.23640 = -size;
  offset = D.23640 & offset;
  D.23638 = acfg->cur_section;
  D.23641 = D.23638->cur_offset;
  add = offset - D.23641;
  if (add != 0) goto <D.23642>; else goto <D.23643>;
  <D.23642>:
  D.23638 = acfg->cur_section;
  bin_writer_emit_ensure_buffer (D.23638, add);
  D.23638 = acfg->cur_section;
  D.23638 = acfg->cur_section;
  D.23641 = D.23638->cur_offset;
  D.23644 = D.23641 + add;
  D.23638->cur_offset = D.23644;
  <D.23643>:
}


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

  asm_writer_emit_unset_mode (acfg);
  D.23645 = acfg->fp;
  fprintf (D.23645, "\t.balign %d\n", size);
}


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

  D.23646 = acfg->use_bin_writer;
  if (D.23646 != 0) goto <D.23647>; else goto <D.23648>;
  <D.23647>:
  bin_writer_emit_pointer_unaligned (acfg, target);
  goto <D.23649>;
  <D.23648>:
  asm_writer_emit_pointer_unaligned (acfg, target);
  <D.23649>:
}


bin_writer_emit_pointer_unaligned (struct MonoImageWriter * acfg, const char * target)
{
  struct BinSection * D.23652;
  int D.23653;
  unsigned int D.23654;
  unsigned int D.23655;
  int D.23656;
  gchar * D.23657;
  struct BinReloc * D.23658;
  int D.22722;
  int iftmp.9;
  int D.22721;
  struct BinSection * D.23662;
  const char[6] * D.23663;
  unsigned char D.23664;
  int D.23665;
  unsigned char D.23666;
  int D.23667;
  _Bool D.23668;
  _Bool D.23669;
  _Bool D.23670;
  const unsigned char * D.23673;
  unsigned char D.23674;
  int D.23675;
  const unsigned char * D.23676;
  unsigned char D.23677;
  int D.23678;
  _Bool D.23679;
  _Bool D.23680;
  const unsigned char * D.23683;
  unsigned char D.23684;
  int D.23685;
  const unsigned char * D.23686;
  unsigned char D.23687;
  int D.23688;
  _Bool D.23689;
  _Bool D.23690;
  const unsigned char * D.23693;
  unsigned char D.23694;
  int D.23695;
  const unsigned char * D.23696;
  unsigned char D.23697;
  int D.23698;
  char * D.23700;
  int D.23703;
  int D.23704;
  struct BinReloc * reloc;

  if (target == 0B) goto <D.23650>; else goto <D.23651>;
  <D.23650>:
  D.23652 = acfg->cur_section;
  D.23652 = acfg->cur_section;
  D.23653 = D.23652->cur_offset;
  D.23654 = (unsigned int) D.23653;
  D.23655 = D.23654 + 4;
  D.23656 = (int) D.23655;
  D.23652->cur_offset = D.23656;
  return;
  <D.23651>:
  reloc = monoeg_malloc0 (36);
  D.23657 = monoeg_strdup (target);
  reloc->val1 = D.23657;
  D.23652 = acfg->cur_section;
  reloc->section = D.23652;
  D.23652 = acfg->cur_section;
  D.23653 = D.23652->cur_offset;
  reloc->section_offset = D.23653;
  D.23658 = acfg->relocations;
  reloc->next = D.23658;
  acfg->relocations = reloc;
  {
    size_t __s1_len;
    size_t __s2_len;

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

      D.23662 = reloc->section;
      __s2 = D.23662->name;
      D.23663 = ".data";
      D.23664 = MEM[(const unsigned char *)D.23663];
      D.23665 = (int) D.23664;
      D.23666 = *__s2;
      D.23667 = (int) D.23666;
      __result = D.23665 - D.23667;
      {
        D.23668 = __s2_len != 0;
        D.23669 = __result == 0;
        D.23670 = D.23668 & D.23669;
        if (D.23670 != 0) goto <D.23671>; else goto <D.23672>;
        <D.23671>:
        D.23673 = &MEM[(void *)".data" + 1B];
        D.23674 = *D.23673;
        D.23675 = (int) D.23674;
        D.23676 = __s2 + 1;
        D.23677 = *D.23676;
        D.23678 = (int) D.23677;
        __result = D.23675 - D.23678;
        D.23679 = __s2_len > 1;
        D.23669 = __result == 0;
        D.23680 = D.23679 & D.23669;
        if (D.23680 != 0) goto <D.23681>; else goto <D.23682>;
        <D.23681>:
        D.23683 = &MEM[(void *)".data" + 2B];
        D.23684 = *D.23683;
        D.23685 = (int) D.23684;
        D.23686 = __s2 + 2;
        D.23687 = *D.23686;
        D.23688 = (int) D.23687;
        __result = D.23685 - D.23688;
        D.23689 = __s2_len > 2;
        D.23669 = __result == 0;
        D.23690 = D.23689 & D.23669;
        if (D.23690 != 0) goto <D.23691>; else goto <D.23692>;
        <D.23691>:
        D.23693 = &MEM[(void *)".data" + 3B];
        D.23694 = *D.23693;
        D.23695 = (int) D.23694;
        D.23696 = __s2 + 3;
        D.23697 = *D.23696;
        D.23698 = (int) D.23697;
        __result = D.23695 - D.23698;
        <D.23692>:
        <D.23682>:
        <D.23672>:
      }
      D.22721 = __result;
    }
    iftmp.9 = -D.22721;
    goto <D.23699>;
    <D.23661>:
    D.23662 = reloc->section;
    D.23700 = D.23662->name;
    iftmp.9 = __builtin_strcmp (D.23700, ".data");
    <D.23699>:
    D.22722 = iftmp.9;
  }
  if (D.22722 == 0) goto <D.23701>; else goto <D.23702>;
  <D.23701>:
  D.23703 = acfg->num_relocs;
  D.23704 = D.23703 + 1;
  acfg->num_relocs = D.23704;
  <D.23702>:
  D.23652 = acfg->cur_section;
  D.23652 = acfg->cur_section;
  D.23653 = D.23652->cur_offset;
  D.23654 = (unsigned int) D.23653;
  D.23655 = D.23654 + 4;
  D.23656 = (int) D.23655;
  D.23652->cur_offset = D.23656;
}


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

  asm_writer_emit_unset_mode (acfg);
  if (target != 0B) goto <D.23707>; else goto <D.23708>;
  <D.23707>:
  iftmp.10 = target;
  goto <D.23709>;
  <D.23708>:
  iftmp.10 = "0";
  <D.23709>:
  D.23710 = acfg->fp;
  fprintf (D.23710, "\t%s %s\n", ".long", iftmp.10);
}


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

  D.23711 = acfg->use_bin_writer;
  if (D.23711 != 0) goto <D.23712>; else goto <D.23713>;
  <D.23712>:
  bin_writer_emit_pointer (acfg, target);
  goto <D.23714>;
  <D.23713>:
  asm_writer_emit_pointer (acfg, target);
  <D.23714>:
}


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.23715;

  D.23715 = acfg->use_bin_writer;
  if (D.23715 != 0) goto <D.23716>; else goto <D.23717>;
  <D.23716>:
  bin_writer_emit_int16 (acfg, value);
  goto <D.23718>;
  <D.23717>:
  asm_writer_emit_int16 (acfg, value);
  <D.23718>:
}


bin_writer_emit_int16 (struct MonoImageWriter * acfg, int value)
{
  struct BinSection * D.23719;
  guint8 * D.23720;
  int D.23721;
  sizetype D.23722;
  int D.23723;
  unsigned char D.23724;
  guint8 * D.23725;
  int D.23726;
  unsigned char D.23727;
  guint8 * data;

  D.23719 = acfg->cur_section;
  bin_writer_emit_ensure_buffer (D.23719, 2);
  D.23719 = acfg->cur_section;
  D.23720 = D.23719->data;
  D.23719 = acfg->cur_section;
  D.23721 = D.23719->cur_offset;
  D.23722 = (sizetype) D.23721;
  data = D.23720 + D.23722;
  D.23719 = acfg->cur_section;
  D.23719 = acfg->cur_section;
  D.23721 = D.23719->cur_offset;
  D.23723 = D.23721 + 2;
  D.23719->cur_offset = D.23723;
  D.23724 = (unsigned char) value;
  *data = D.23724;
  D.23725 = data + 1;
  D.23726 = value >> 8;
  D.23727 = (unsigned char) D.23726;
  *D.23725 = D.23727;
}


asm_writer_emit_int16 (struct MonoImageWriter * acfg, int value)
{
  int D.23728;
  int D.23731;
  int D.23732;
  int D.23733;
  unsigned int D.23734;
  unsigned int D.23735;
  struct FILE * D.23738;

  D.23728 = acfg->mode;
  if (D.23728 != 2) goto <D.23729>; else goto <D.23730>;
  <D.23729>:
  acfg->mode = 2;
  acfg->col_count = 0;
  <D.23730>:
  D.23731 = acfg->col_count;
  D.23732 = D.23731;
  D.23733 = D.23732 + 1;
  acfg->col_count = D.23733;
  D.23734 = (unsigned int) D.23732;
  D.23735 = D.23734 & 7;
  if (D.23735 == 0) goto <D.23736>; else goto <D.23737>;
  <D.23736>:
  D.23738 = acfg->fp;
  fprintf (D.23738, "\n\t%s ", ".hword");
  goto <D.23739>;
  <D.23737>:
  D.23738 = acfg->fp;
  fprintf (D.23738, ", ");
  <D.23739>:
  D.23738 = acfg->fp;
  fprintf (D.23738, "%d", value);
}


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

  D.23740 = acfg->use_bin_writer;
  if (D.23740 != 0) goto <D.23741>; else goto <D.23742>;
  <D.23741>:
  bin_writer_emit_int32 (acfg, value);
  goto <D.23743>;
  <D.23742>:
  asm_writer_emit_int32 (acfg, value);
  <D.23743>:
}


bin_writer_emit_int32 (struct MonoImageWriter * acfg, int value)
{
  struct BinSection * D.23744;
  guint8 * D.23745;
  int D.23746;
  sizetype D.23747;
  int D.23748;
  unsigned char D.23749;
  guint8 * D.23750;
  int D.23751;
  unsigned char D.23752;
  guint8 * D.23753;
  int D.23754;
  unsigned char D.23755;
  guint8 * D.23756;
  int D.23757;
  unsigned char D.23758;
  guint8 * data;

  D.23744 = acfg->cur_section;
  bin_writer_emit_ensure_buffer (D.23744, 4);
  D.23744 = acfg->cur_section;
  D.23745 = D.23744->data;
  D.23744 = acfg->cur_section;
  D.23746 = D.23744->cur_offset;
  D.23747 = (sizetype) D.23746;
  data = D.23745 + D.23747;
  D.23744 = acfg->cur_section;
  D.23744 = acfg->cur_section;
  D.23746 = D.23744->cur_offset;
  D.23748 = D.23746 + 4;
  D.23744->cur_offset = D.23748;
  D.23749 = (unsigned char) value;
  *data = D.23749;
  D.23750 = data + 1;
  D.23751 = value >> 8;
  D.23752 = (unsigned char) D.23751;
  *D.23750 = D.23752;
  D.23753 = data + 2;
  D.23754 = value >> 16;
  D.23755 = (unsigned char) D.23754;
  *D.23753 = D.23755;
  D.23756 = data + 3;
  D.23757 = value >> 24;
  D.23758 = (unsigned char) D.23757;
  *D.23756 = D.23758;
}


asm_writer_emit_int32 (struct MonoImageWriter * acfg, int value)
{
  int D.23759;
  int D.23762;
  int D.23763;
  int D.23764;
  unsigned int D.23765;
  unsigned int D.23766;
  struct FILE * D.23769;

  D.23759 = acfg->mode;
  if (D.23759 != 3) goto <D.23760>; else goto <D.23761>;
  <D.23760>:
  acfg->mode = 3;
  acfg->col_count = 0;
  <D.23761>:
  D.23762 = acfg->col_count;
  D.23763 = D.23762;
  D.23764 = D.23763 + 1;
  acfg->col_count = D.23764;
  D.23765 = (unsigned int) D.23763;
  D.23766 = D.23765 & 7;
  if (D.23766 == 0) goto <D.23767>; else goto <D.23768>;
  <D.23767>:
  D.23769 = acfg->fp;
  fprintf (D.23769, "\n\t%s ", ".long");
  goto <D.23770>;
  <D.23768>:
  D.23769 = acfg->fp;
  fprintf (D.23769, ",");
  <D.23770>:
  D.23769 = acfg->fp;
  fprintf (D.23769, "%d", value);
}


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

  D.23771 = acfg->use_bin_writer;
  if (D.23771 != 0) goto <D.23772>; else goto <D.23773>;
  <D.23772>:
  bin_writer_emit_symbol_diff (acfg, end, start, offset);
  goto <D.23774>;
  <D.23773>:
  asm_writer_emit_symbol_diff (acfg, end, start, offset);
  <D.23774>:
}


bin_writer_emit_symbol_diff (struct MonoImageWriter * acfg, const char * end, const char * start, int offset)
{
  struct BinSection * D.23775;
  int D.23776;
  int D.23777;

  create_reloc (acfg, end, start, offset);
  D.23775 = acfg->cur_section;
  D.23775 = acfg->cur_section;
  D.23776 = D.23775->cur_offset;
  D.23777 = D.23776 + 4;
  D.23775->cur_offset = D.23777;
}


create_reloc (struct MonoImageWriter * acfg, const char * end, const char * start, int offset)
{
  struct MonoMemPool * D.23778;
  char * D.23779;
  int D.22752;
  int iftmp.11;
  int D.22751;
  const char[2] * D.23783;
  unsigned char D.23784;
  int D.23785;
  unsigned char D.23786;
  int D.23787;
  _Bool D.23788;
  _Bool D.23789;
  _Bool D.23790;
  const unsigned char * D.23793;
  unsigned char D.23794;
  int D.23795;
  const unsigned char * D.23796;
  unsigned char D.23797;
  int D.23798;
  _Bool D.23799;
  _Bool D.23800;
  const unsigned char * D.23803;
  unsigned char D.23804;
  int D.23805;
  const unsigned char * D.23806;
  unsigned char D.23807;
  int D.23808;
  _Bool D.23809;
  _Bool D.23810;
  const unsigned char * D.23813;
  unsigned char D.23814;
  int D.23815;
  const unsigned char * D.23816;
  unsigned char D.23817;
  int D.23818;
  struct BinSection * D.23822;
  int D.23823;
  char * D.23825;
  struct BinReloc * D.23826;
  struct BinReloc * D.23827;
  struct BinReloc * reloc;

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

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

      __s2 = start;
      D.23783 = ".";
      D.23784 = MEM[(const unsigned char *)D.23783];
      D.23785 = (int) D.23784;
      D.23786 = *__s2;
      D.23787 = (int) D.23786;
      __result = D.23785 - D.23787;
      {
        D.23788 = __s2_len != 0;
        D.23789 = __result == 0;
        D.23790 = D.23788 & D.23789;
        if (D.23790 != 0) goto <D.23791>; else goto <D.23792>;
        <D.23791>:
        D.23793 = &MEM[(void *)"." + 1B];
        D.23794 = *D.23793;
        D.23795 = (int) D.23794;
        D.23796 = __s2 + 1;
        D.23797 = *D.23796;
        D.23798 = (int) D.23797;
        __result = D.23795 - D.23798;
        D.23799 = __s2_len > 1;
        D.23789 = __result == 0;
        D.23800 = D.23799 & D.23789;
        if (D.23800 != 0) goto <D.23801>; else goto <D.23802>;
        <D.23801>:
        D.23803 = &MEM[(void *)"." + 2B];
        D.23804 = *D.23803;
        D.23805 = (int) D.23804;
        D.23806 = __s2 + 2;
        D.23807 = *D.23806;
        D.23808 = (int) D.23807;
        __result = D.23805 - D.23808;
        D.23809 = __s2_len > 2;
        D.23789 = __result == 0;
        D.23810 = D.23809 & D.23789;
        if (D.23810 != 0) goto <D.23811>; else goto <D.23812>;
        <D.23811>:
        D.23813 = &MEM[(void *)"." + 3B];
        D.23814 = *D.23813;
        D.23815 = (int) D.23814;
        D.23816 = __s2 + 3;
        D.23817 = *D.23816;
        D.23818 = (int) D.23817;
        __result = D.23815 - D.23818;
        <D.23812>:
        <D.23802>:
        <D.23792>:
      }
      D.22751 = __result;
    }
    iftmp.11 = -D.22751;
    goto <D.23819>;
    <D.23782>:
    iftmp.11 = __builtin_strcmp (start, ".");
    <D.23819>:
    D.22752 = iftmp.11;
  }
  if (D.22752 == 0) goto <D.23820>; else goto <D.23821>;
  <D.23820>:
  D.23822 = acfg->cur_section;
  reloc->val2_section = D.23822;
  D.23822 = acfg->cur_section;
  D.23823 = D.23822->cur_offset;
  reloc->val2_offset = D.23823;
  goto <D.23824>;
  <D.23821>:
  D.23778 = acfg->mempool;
  D.23825 = mono_mempool_strdup (D.23778, start);
  reloc->val2 = D.23825;
  <D.23824>:
  reloc->offset = offset;
  D.23822 = acfg->cur_section;
  reloc->section = D.23822;
  D.23822 = acfg->cur_section;
  D.23823 = D.23822->cur_offset;
  reloc->section_offset = D.23823;
  D.23826 = acfg->relocations;
  reloc->next = D.23826;
  acfg->relocations = reloc;
  D.23827 = reloc;
  return D.23827;
}


asm_writer_emit_symbol_diff (struct MonoImageWriter * acfg, const char * end, const char * start, int offset)
{
  int D.23829;
  int D.23212;
  int iftmp.12;
  int D.23211;
  const char[2] * D.23837;
  unsigned char D.23838;
  int D.23839;
  unsigned char D.23840;
  int D.23841;
  _Bool D.23842;
  _Bool D.23843;
  _Bool D.23844;
  const unsigned char * D.23847;
  unsigned char D.23848;
  int D.23849;
  const unsigned char * D.23850;
  unsigned char D.23851;
  int D.23852;
  _Bool D.23853;
  _Bool D.23854;
  const unsigned char * D.23857;
  unsigned char D.23858;
  int D.23859;
  const unsigned char * D.23860;
  unsigned char D.23861;
  int D.23862;
  _Bool D.23863;
  _Bool D.23864;
  const unsigned char * D.23867;
  unsigned char D.23868;
  int D.23869;
  const unsigned char * D.23870;
  unsigned char D.23871;
  int D.23872;
  int D.23876;
  int D.23877;
  struct FILE * D.23878;
  int D.23879;
  int D.23880;
  int D.23881;
  unsigned int D.23882;
  unsigned int D.23883;

  D.23829 = acfg->mode;
  if (D.23829 != 3) goto <D.23830>; else goto <D.23831>;
  <D.23830>:
  acfg->mode = 3;
  acfg->col_count = 0;
  <D.23831>:
  start = get_label (start);
  end = get_label (end);
  if (offset == 0) goto <D.23832>; else goto <D.23833>;
  <D.23832>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = start;
      D.23837 = ".";
      D.23838 = MEM[(const unsigned char *)D.23837];
      D.23839 = (int) D.23838;
      D.23840 = *__s2;
      D.23841 = (int) D.23840;
      __result = D.23839 - D.23841;
      {
        D.23842 = __s2_len != 0;
        D.23843 = __result == 0;
        D.23844 = D.23842 & D.23843;
        if (D.23844 != 0) goto <D.23845>; else goto <D.23846>;
        <D.23845>:
        D.23847 = &MEM[(void *)"." + 1B];
        D.23848 = *D.23847;
        D.23849 = (int) D.23848;
        D.23850 = __s2 + 1;
        D.23851 = *D.23850;
        D.23852 = (int) D.23851;
        __result = D.23849 - D.23852;
        D.23853 = __s2_len > 1;
        D.23843 = __result == 0;
        D.23854 = D.23853 & D.23843;
        if (D.23854 != 0) goto <D.23855>; else goto <D.23856>;
        <D.23855>:
        D.23857 = &MEM[(void *)"." + 2B];
        D.23858 = *D.23857;
        D.23859 = (int) D.23858;
        D.23860 = __s2 + 2;
        D.23861 = *D.23860;
        D.23862 = (int) D.23861;
        __result = D.23859 - D.23862;
        D.23863 = __s2_len > 2;
        D.23843 = __result == 0;
        D.23864 = D.23863 & D.23843;
        if (D.23864 != 0) goto <D.23865>; else goto <D.23866>;
        <D.23865>:
        D.23867 = &MEM[(void *)"." + 3B];
        D.23868 = *D.23867;
        D.23869 = (int) D.23868;
        D.23870 = __s2 + 3;
        D.23871 = *D.23870;
        D.23872 = (int) D.23871;
        __result = D.23869 - D.23872;
        <D.23866>:
        <D.23856>:
        <D.23846>:
      }
      D.23211 = __result;
    }
    iftmp.12 = -D.23211;
    goto <D.23873>;
    <D.23836>:
    iftmp.12 = __builtin_strcmp (start, ".");
    <D.23873>:
    D.23212 = iftmp.12;
  }
  if (D.23212 != 0) goto <D.23874>; else goto <D.23875>;
  <D.23874>:
  {
    char symbol[128];

    try
      {
        D.23876 = acfg->label_gen;
        sprintf (&symbol, "%sDIFF_SYM%d", ".L", D.23876);
        D.23876 = acfg->label_gen;
        D.23877 = D.23876 + 1;
        acfg->label_gen = D.23877;
        D.23878 = acfg->fp;
        fprintf (D.23878, "\n%s=%s - %s", &symbol, end, start);
        D.23878 = acfg->fp;
        fprintf (D.23878, "\n\t%s ", ".long");
        D.23878 = acfg->fp;
        fprintf (D.23878, "%s", &symbol);
        return;
      }
    finally
      {
        symbol = {CLOBBER};
      }
  }
  <D.23875>:
  <D.23833>:
  D.23879 = acfg->col_count;
  D.23880 = D.23879;
  D.23881 = D.23880 + 1;
  acfg->col_count = D.23881;
  D.23882 = (unsigned int) D.23880;
  D.23883 = D.23882 & 7;
  if (D.23883 == 0) goto <D.23884>; else goto <D.23885>;
  <D.23884>:
  D.23878 = acfg->fp;
  fprintf (D.23878, "\n\t%s ", ".long");
  goto <D.23886>;
  <D.23885>:
  D.23878 = acfg->fp;
  fprintf (D.23878, ",");
  <D.23886>:
  if (offset > 0) goto <D.23887>; else goto <D.23888>;
  <D.23887>:
  D.23878 = acfg->fp;
  fprintf (D.23878, "%s - %s + %d", end, start, offset);
  goto <D.23889>;
  <D.23888>:
  if (offset < 0) goto <D.23890>; else goto <D.23891>;
  <D.23890>:
  D.23878 = acfg->fp;
  fprintf (D.23878, "%s - %s %d", end, start, offset);
  goto <D.23892>;
  <D.23891>:
  D.23878 = acfg->fp;
  fprintf (D.23878, "%s - %s", end, start);
  <D.23892>:
  <D.23889>:
}


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

  D.23895 = acfg->use_bin_writer;
  if (D.23895 != 0) goto <D.23896>; else goto <D.23897>;
  <D.23896>:
  bin_writer_emit_zero_bytes (acfg, num);
  goto <D.23898>;
  <D.23897>:
  asm_writer_emit_zero_bytes (acfg, num);
  <D.23898>:
}


bin_writer_emit_zero_bytes (struct MonoImageWriter * acfg, int num)
{
  struct BinSection * D.23899;
  int D.23900;
  int D.23901;

  D.23899 = acfg->cur_section;
  bin_writer_emit_ensure_buffer (D.23899, num);
  D.23899 = acfg->cur_section;
  D.23899 = acfg->cur_section;
  D.23900 = D.23899->cur_offset;
  D.23901 = D.23900 + num;
  D.23899->cur_offset = D.23901;
}


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

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


img_writer_emit_writeout (struct MonoImageWriter * acfg)
{
  int D.23903;
  int D.23906;

  D.23903 = acfg->use_bin_writer;
  if (D.23903 != 0) goto <D.23904>; else goto <D.23905>;
  <D.23904>:
  D.23906 = bin_writer_emit_writeout (acfg);
  return D.23906;
  <D.23905>:
  D.23906 = asm_writer_emit_writeout (acfg);
  return D.23906;
}


bin_writer_emit_writeout (struct MonoImageWriter * acfg)
{
  const char * D.23908;
  int D.23909;
  unsigned int D.23910;
  int D.23911;
  unsigned int D.23912;
  int D.23913;
  unsigned int D.23914;
  int D.23915;
  unsigned int D.23916;
  int D.23917;
  unsigned int D.23918;
  int D.23068;
  const char * D.23919;
  char * D.23920;
  struct BinSection * D.23923;
  int D.23924;
  int num_local_syms.13;
  unsigned int file_offset.14;
  unsigned int D.23927;
  int D.23928;
  int D.23929;
  int * D.23930;
  int D.23931;
  int D.23932;
  unsigned int D.23933;
  unsigned int D.23934;
  int size.15;
  int size.16;
  unsigned int size.17;
  unsigned int D.23938;
  unsigned int D.23939;
  unsigned int D.23940;
  int size.18;
  unsigned int D.23942;
  struct GString * D.23943;
  unsigned int D.23944;
  int size.19;
  unsigned int D.23946;
  int D.23947;
  unsigned int D.23948;
  unsigned int D.23949;
  int size.20;
  unsigned int D.23951;
  unsigned int D.23952;
  unsigned int file_offset.21;
  unsigned int D.23954;
  unsigned int D.23955;
  unsigned int D.23956;
  unsigned int D.23957;
  unsigned int D.23958;
  struct BinSection * D.23959;
  int D.23962;
  long long unsigned int D.23965;
  unsigned int D.23966;
  unsigned int D.23967;
  unsigned int D.23968;
  int size.22;
  unsigned int D.23970;
  unsigned int D.23971;
  unsigned int D.23972;
  unsigned int D.23973;
  unsigned int D.23974;
  unsigned int virt_offset.23;
  struct BinSection * D.23976;
  int size.24;
  unsigned int D.23980;
  unsigned int D.23981;
  unsigned int D.23982;
  unsigned int D.23983;
  unsigned int D.23984;
  unsigned int D.23985;
  unsigned int D.23986;
  unsigned int D.23987;
  unsigned int D.23988;
  unsigned int D.23989;
  unsigned int virt_offset.25;
  unsigned int D.23991;
  unsigned int D.23992;
  unsigned int D.23993;
  unsigned int D.23994;
  unsigned int D.23995;
  unsigned int D.23996;
  unsigned int D.23997;
  unsigned int D.23998;
  unsigned int D.23999;
  unsigned int D.24000;
  unsigned int D.24001;
  struct BinSection * D.24002;
  int size.26;
  unsigned int D.24006;
  unsigned int D.24007;
  unsigned int D.24008;
  unsigned int D.24009;
  unsigned int D.24010;
  unsigned int D.24011;
  unsigned int D.24012;
  unsigned int D.24013;
  struct BinSection * D.24014;
  int size.27;
  unsigned int D.24018;
  unsigned int D.24019;
  unsigned int D.24020;
  unsigned int D.24021;
  unsigned int D.24022;
  struct BinSection * D.24023;
  int size.28;
  struct BinSection * D.24028;
  int size.29;
  struct BinSection * D.24033;
  int size.30;
  struct BinSection * D.24038;
  int size.31;
  struct BinSection * D.24043;
  int size.32;
  unsigned int D.24048;
  unsigned int D.24049;
  unsigned int D.24050;
  unsigned int D.24051;
  unsigned int D.24052;
  struct GString * D.24053;
  unsigned int D.24054;
  int size.33;
  unsigned int D.24056;
  unsigned int D.24057;
  unsigned int D.24058;
  unsigned int D.24059;
  unsigned int D.24060;
  int num_local_syms.34;
  unsigned int num_local_syms.35;
  unsigned int D.24063;
  int size.36;
  unsigned int D.24065;
  unsigned int D.24066;
  unsigned int D.24067;
  unsigned int D.24068;
  unsigned int D.24069;
  struct GString * D.24070;
  unsigned int D.24071;
  int size.37;
  unsigned int D.24075;
  unsigned int D.24076;
  _Bool D.24077;
  long int D.24078;
  long int D.24079;
  unsigned int D.24082;
  unsigned int D.24083;
  unsigned int D.24084;
  unsigned int D.24085;
  unsigned int D.24086;
  unsigned int D.24087;
  unsigned int D.24088;
  unsigned int D.24089;
  unsigned int D.24090;
  unsigned int D.24091;
  unsigned int D.24092;
  unsigned int D.24093;
  unsigned int D.24094;
  unsigned int D.24095;
  unsigned int D.24096;
  unsigned int D.24097;
  unsigned int D.24098;
  unsigned int D.24099;
  struct BinSection * D.24100;
  unsigned int D.24103;
  int D.24104;
  unsigned int D.24105;
  int D.24106;
  struct FILE * D.24107;
  unsigned int file_offset.38;
  unsigned int D.24111;
  int D.24112;
  int D.24113;
  unsigned int D.24114;
  void * D.24115;
  int D.24116;
  int D.24117;
  unsigned int D.24118;
  unsigned int D.24119;
  char * D.24120;
  int D.24121;
  unsigned int D.24122;
  int D.24123;
  unsigned int D.24124;
  int D.24127;
  unsigned int size.39;
  guint8 * D.24129;
  unsigned int D.24132;
  int D.24133;
  unsigned int size.40;
  guint8 * D.24135;
  int D.24136;
  int size.41;
  unsigned int D.24138;
  int D.24139;
  struct BinSection * D.24140;
  unsigned int D.24143;
  int D.24144;
  int D.24145;
  unsigned int D.24146;
  guint8 * D.24147;
  unsigned int i.42;
  unsigned int D.24149;
  int D.24150;
  char * D.24151;
  unsigned int D.24152;
  int D.24153;
  unsigned int D.24154;
  int D.24155;
  char * D.24156;
  int D.24159;
  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.23056>;
      <D.23055>:
      D.23908 = section_info[i].name;
      D.23909 = str_table_add (&sh_str_table, D.23908);
      D.23910 = (unsigned int) D.23909;
      secth[i].sh_name = D.23910;
      D.23911 = section_info[i].type;
      D.23912 = (unsigned int) D.23911;
      secth[i].sh_type = D.23912;
      D.23913 = section_info[i].align;
      D.23914 = (unsigned int) D.23913;
      secth[i].sh_addralign = D.23914;
      D.23915 = section_info[i].flags;
      D.23916 = (unsigned int) D.23915;
      secth[i].sh_flags = D.23916;
      D.23917 = section_info[i].esize;
      D.23918 = (unsigned int) D.23917;
      secth[i].sh_entsize = D.23918;
      i = i + 1;
      <D.23056>:
      if (i <= 19) goto <D.23055>; else goto <D.23057>;
      <D.23057>:
      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.23073>;
      <D.23072>:
      {
        struct BinSection * sect;
        int j;

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

          D.23919 = section_info[j].name;
          D.23920 = sect->name;
          D.23068 = __builtin_strcmp (D.23920, D.23919);
        }
        if (D.23068 == 0) goto <D.23921>; else goto <D.23922>;
        <D.23921>:
        sect->shidx = j;
        goto <D.23069>;
        <D.23922>:
        j = j + 1;
        <D.23071>:
        if (j <= 19) goto <D.23070>; else goto <D.23069>;
        <D.23069>:
        D.23923 = all_sections[i];
        D.23924 = D.23923->shidx;
        sections[D.23924] = sect;
      }
      i = i + 1;
      <D.23073>:
      if (i < num_sections) goto <D.23072>; else goto <D.23074>;
      <D.23074>:
      dynsym = collect_syms (acfg, hash, &dyn_str_table, 0B, 0B);
      num_local_syms.13 = MEM[(int *)hash + 4B];
      num_local_syms = num_local_syms.13;
      symtab = collect_syms (acfg, 0B, &str_table, &secth, &num_local_syms);
      virt_offset = 180;
      file_offset = virt_offset;
      file_offset.14 = (unsigned int) file_offset;
      secth[1].sh_offset = file_offset.14;
      D.23927 = secth[1].sh_offset;
      secth[1].sh_addr = D.23927;
      D.23928 = *hash;
      D.23929 = D.23928 + 2;
      D.23930 = hash + 4;
      D.23931 = *D.23930;
      D.23932 = D.23929 + D.23931;
      D.23933 = (unsigned int) D.23932;
      D.23934 = D.23933 * 4;
      size.15 = (int) D.23934;
      size = size.15;
      size.16 = size;
      file_offset = file_offset + size.16;
      virt_offset = file_offset;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[1].sh_size = size.17;
      file_offset.14 = (unsigned int) file_offset;
      secth[2].sh_offset = file_offset.14;
      D.23938 = secth[2].sh_offset;
      secth[2].sh_addr = D.23938;
      D.23930 = hash + 4;
      D.23931 = *D.23930;
      D.23939 = (unsigned int) D.23931;
      D.23940 = D.23939 * 16;
      size.18 = (int) D.23940;
      size = size.18;
      size.16 = size;
      file_offset = file_offset + size.16;
      virt_offset = file_offset;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[2].sh_size = size.17;
      file_offset.14 = (unsigned int) file_offset;
      secth[3].sh_offset = file_offset.14;
      D.23942 = secth[3].sh_offset;
      secth[3].sh_addr = D.23942;
      D.23943 = dyn_str_table.data;
      D.23944 = D.23943->len;
      size.19 = (int) D.23944;
      size = size.19;
      size.16 = size;
      file_offset = file_offset + size.16;
      virt_offset = file_offset;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[3].sh_size = size.17;
      file_offset = file_offset + 3;
      file_offset = file_offset & -4;
      file_offset.14 = (unsigned int) file_offset;
      secth[4].sh_offset = file_offset.14;
      D.23946 = secth[4].sh_offset;
      secth[4].sh_addr = D.23946;
      D.23947 = acfg->num_relocs;
      D.23948 = (unsigned int) D.23947;
      D.23949 = D.23948 * 8;
      size.20 = (int) D.23949;
      size = size.20;
      size.16 = size;
      file_offset = file_offset + size.16;
      virt_offset = file_offset;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[4].sh_size = size.17;
      file_offset.14 = (unsigned int) file_offset;
      secth[5].sh_offset = file_offset.14;
      D.23951 = secth[5].sh_offset;
      secth[5].sh_addr = D.23951;
      size = 0;
      size.16 = size;
      file_offset = file_offset + size.16;
      virt_offset = file_offset;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[5].sh_size = size.17;
      D.23952 = secth[6].sh_addralign;
      file_offset.21 = (unsigned int) file_offset;
      D.23954 = D.23952 + file_offset.21;
      D.23955 = D.23954 + 4294967295;
      D.23952 = secth[6].sh_addralign;
      D.23956 = -D.23952;
      D.23957 = D.23955 & D.23956;
      file_offset = (int) D.23957;
      virt_offset = file_offset;
      file_offset.14 = (unsigned int) file_offset;
      secth[6].sh_offset = file_offset.14;
      D.23958 = secth[6].sh_offset;
      secth[6].sh_addr = D.23958;
      D.23959 = sections[6];
      if (D.23959 != 0B) goto <D.23960>; else goto <D.23961>;
      <D.23960>:
      D.23959 = sections[6];
      D.23962 = D.23959->has_addr;
      if (D.23962 != 0) goto <D.23963>; else goto <D.23964>;
      <D.23963>:
      D.23959 = sections[6];
      D.23965 = D.23959->addr;
      D.23966 = (unsigned int) D.23965;
      secth[6].sh_addr = D.23966;
      D.23967 = secth[6].sh_flags;
      D.23968 = D.23967 & 4294967293;
      secth[6].sh_flags = D.23968;
      <D.23964>:
      D.23959 = sections[6];
      size.22 = D.23959->cur_offset;
      size = size.22;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[6].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      <D.23961>:
      D.23970 = secth[7].sh_addralign;
      file_offset.21 = (unsigned int) file_offset;
      D.23971 = D.23970 + file_offset.21;
      D.23972 = D.23971 + 4294967295;
      D.23970 = secth[7].sh_addralign;
      D.23973 = -D.23970;
      D.23974 = D.23972 & D.23973;
      file_offset = (int) D.23974;
      virt_offset = file_offset;
      virt_offset.23 = (unsigned int) virt_offset;
      secth[7].sh_addr = virt_offset.23;
      file_offset.14 = (unsigned int) file_offset;
      secth[7].sh_offset = file_offset.14;
      D.23976 = sections[7];
      if (D.23976 != 0B) goto <D.23977>; else goto <D.23978>;
      <D.23977>:
      D.23976 = sections[7];
      size.24 = D.23976->cur_offset;
      size = size.24;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[7].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      size.16 = size;
      virt_offset = virt_offset + size.16;
      <D.23978>:
      D.23980 = secth[8].sh_addralign;
      file_offset.21 = (unsigned int) file_offset;
      D.23981 = D.23980 + file_offset.21;
      D.23982 = D.23981 + 4294967295;
      D.23980 = secth[8].sh_addralign;
      D.23983 = -D.23980;
      D.23984 = D.23982 & D.23983;
      file_offset = (int) D.23984;
      virt_offset = file_offset;
      virt_offset = virt_offset + 4096;
      virt_offset.23 = (unsigned int) virt_offset;
      secth[8].sh_addr = virt_offset.23;
      file_offset.14 = (unsigned int) file_offset;
      secth[8].sh_offset = file_offset.14;
      size = 112;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[8].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      size.16 = size;
      virt_offset = virt_offset + size.16;
      D.23985 = secth[9].sh_addralign;
      file_offset.21 = (unsigned int) file_offset;
      D.23986 = D.23985 + file_offset.21;
      D.23987 = D.23986 + 4294967295;
      D.23985 = secth[9].sh_addralign;
      D.23988 = -D.23985;
      D.23989 = D.23987 & D.23988;
      file_offset = (int) D.23989;
      D.23985 = secth[9].sh_addralign;
      virt_offset.25 = (unsigned int) virt_offset;
      D.23991 = D.23985 + virt_offset.25;
      D.23992 = D.23991 + 4294967295;
      D.23985 = secth[9].sh_addralign;
      D.23988 = -D.23985;
      D.23993 = D.23992 & D.23988;
      virt_offset = (int) D.23993;
      virt_offset.23 = (unsigned int) virt_offset;
      secth[9].sh_addr = virt_offset.23;
      file_offset.14 = (unsigned int) file_offset;
      secth[9].sh_offset = file_offset.14;
      size = 12;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[9].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      size.16 = size;
      virt_offset = virt_offset + size.16;
      D.23994 = secth[10].sh_addralign;
      file_offset.21 = (unsigned int) file_offset;
      D.23995 = D.23994 + file_offset.21;
      D.23996 = D.23995 + 4294967295;
      D.23994 = secth[10].sh_addralign;
      D.23997 = -D.23994;
      D.23998 = D.23996 & D.23997;
      file_offset = (int) D.23998;
      D.23994 = secth[10].sh_addralign;
      virt_offset.25 = (unsigned int) virt_offset;
      D.23999 = D.23994 + virt_offset.25;
      D.24000 = D.23999 + 4294967295;
      D.23994 = secth[10].sh_addralign;
      D.23997 = -D.23994;
      D.24001 = D.24000 & D.23997;
      virt_offset = (int) D.24001;
      virt_offset.23 = (unsigned int) virt_offset;
      secth[10].sh_addr = virt_offset.23;
      file_offset.14 = (unsigned int) file_offset;
      secth[10].sh_offset = file_offset.14;
      D.24002 = sections[10];
      if (D.24002 != 0B) goto <D.24003>; else goto <D.24004>;
      <D.24003>:
      D.24002 = sections[10];
      size.26 = D.24002->cur_offset;
      size = size.26;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[10].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      size.16 = size;
      virt_offset = virt_offset + size.16;
      <D.24004>:
      D.24006 = secth[11].sh_addralign;
      file_offset.21 = (unsigned int) file_offset;
      D.24007 = D.24006 + file_offset.21;
      D.24008 = D.24007 + 4294967295;
      D.24006 = secth[11].sh_addralign;
      D.24009 = -D.24006;
      D.24010 = D.24008 & D.24009;
      file_offset = (int) D.24010;
      D.24006 = secth[11].sh_addralign;
      virt_offset.25 = (unsigned int) virt_offset;
      D.24011 = D.24006 + virt_offset.25;
      D.24012 = D.24011 + 4294967295;
      D.24006 = secth[11].sh_addralign;
      D.24009 = -D.24006;
      D.24013 = D.24012 & D.24009;
      virt_offset = (int) D.24013;
      virt_offset.23 = (unsigned int) virt_offset;
      secth[11].sh_addr = virt_offset.23;
      file_offset.14 = (unsigned int) file_offset;
      secth[11].sh_offset = file_offset.14;
      D.24014 = sections[11];
      if (D.24014 != 0B) goto <D.24015>; else goto <D.24016>;
      <D.24015>:
      D.24014 = sections[11];
      size.27 = D.24014->cur_offset;
      size = size.27;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[11].sh_size = size.17;
      <D.24016>:
      D.24018 = secth[12].sh_addralign;
      file_offset.21 = (unsigned int) file_offset;
      D.24019 = D.24018 + file_offset.21;
      D.24020 = D.24019 + 4294967295;
      D.24018 = secth[12].sh_addralign;
      D.24021 = -D.24018;
      D.24022 = D.24020 & D.24021;
      file_offset = (int) D.24022;
      file_offset.14 = (unsigned int) file_offset;
      secth[12].sh_offset = file_offset.14;
      D.24023 = sections[12];
      if (D.24023 != 0B) goto <D.24024>; else goto <D.24025>;
      <D.24024>:
      D.24023 = sections[12];
      size.28 = D.24023->cur_offset;
      size = size.28;
      goto <D.24027>;
      <D.24025>:
      size = 0;
      <D.24027>:
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[12].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      file_offset.14 = (unsigned int) file_offset;
      secth[13].sh_offset = file_offset.14;
      D.24028 = sections[13];
      if (D.24028 != 0B) goto <D.24029>; else goto <D.24030>;
      <D.24029>:
      D.24028 = sections[13];
      size.29 = D.24028->cur_offset;
      size = size.29;
      goto <D.24032>;
      <D.24030>:
      size = 0;
      <D.24032>:
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[13].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      file_offset.14 = (unsigned int) file_offset;
      secth[14].sh_offset = file_offset.14;
      D.24033 = sections[14];
      if (D.24033 != 0B) goto <D.24034>; else goto <D.24035>;
      <D.24034>:
      D.24033 = sections[14];
      size.30 = D.24033->cur_offset;
      size = size.30;
      goto <D.24037>;
      <D.24035>:
      size = 0;
      <D.24037>:
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[14].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      file_offset.14 = (unsigned int) file_offset;
      secth[15].sh_offset = file_offset.14;
      D.24038 = sections[15];
      if (D.24038 != 0B) goto <D.24039>; else goto <D.24040>;
      <D.24039>:
      D.24038 = sections[15];
      size.31 = D.24038->cur_offset;
      size = size.31;
      goto <D.24042>;
      <D.24040>:
      size = 0;
      <D.24042>:
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[15].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      file_offset.14 = (unsigned int) file_offset;
      secth[16].sh_offset = file_offset.14;
      D.24043 = sections[16];
      if (D.24043 != 0B) goto <D.24044>; else goto <D.24045>;
      <D.24044>:
      D.24043 = sections[16];
      size.32 = D.24043->cur_offset;
      size = size.32;
      goto <D.24047>;
      <D.24045>:
      size = 0;
      <D.24047>:
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[16].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      D.24048 = secth[17].sh_addralign;
      file_offset.21 = (unsigned int) file_offset;
      D.24049 = D.24048 + file_offset.21;
      D.24050 = D.24049 + 4294967295;
      D.24048 = secth[17].sh_addralign;
      D.24051 = -D.24048;
      D.24052 = D.24050 & D.24051;
      file_offset = (int) D.24052;
      file_offset.14 = (unsigned int) file_offset;
      secth[17].sh_offset = file_offset.14;
      D.24053 = sh_str_table.data;
      D.24054 = D.24053->len;
      size.33 = (int) D.24054;
      size = size.33;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[17].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      D.24056 = secth[18].sh_addralign;
      file_offset.21 = (unsigned int) file_offset;
      D.24057 = D.24056 + file_offset.21;
      D.24058 = D.24057 + 4294967295;
      D.24056 = secth[18].sh_addralign;
      D.24059 = -D.24056;
      D.24060 = D.24058 & D.24059;
      file_offset = (int) D.24060;
      file_offset.14 = (unsigned int) file_offset;
      secth[18].sh_offset = file_offset.14;
      num_local_syms.34 = num_local_syms;
      num_local_syms.35 = (unsigned int) num_local_syms.34;
      D.24063 = num_local_syms.35 * 16;
      size.36 = (int) D.24063;
      size = size.36;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[18].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      D.24065 = secth[19].sh_addralign;
      file_offset.21 = (unsigned int) file_offset;
      D.24066 = D.24065 + file_offset.21;
      D.24067 = D.24066 + 4294967295;
      D.24065 = secth[19].sh_addralign;
      D.24068 = -D.24065;
      D.24069 = D.24067 & D.24068;
      file_offset = (int) D.24069;
      file_offset.14 = (unsigned int) file_offset;
      secth[19].sh_offset = file_offset.14;
      D.24070 = str_table.data;
      D.24071 = D.24070->len;
      size.37 = (int) D.24071;
      size = size.37;
      size.16 = size;
      size.17 = (unsigned int) size.16;
      secth[19].sh_size = size.17;
      size.16 = size;
      file_offset = file_offset + size.16;
      i = 1;
      goto <D.23076>;
      <D.23075>:
      D.23917 = section_info[i].esize;
      if (D.23917 != 0) goto <D.24073>; else goto <D.24074>;
      <D.24073>:
      D.24075 = secth[i].sh_size;
      D.23917 = section_info[i].esize;
      D.23918 = (unsigned int) D.23917;
      D.24076 = D.24075 % D.23918;
      D.24077 = D.24076 != 0;
      D.24078 = (long int) D.24077;
      D.24079 = __builtin_expect (D.24078, 0);
      if (D.24079 != 0) goto <D.24080>; else goto <D.24081>;
      <D.24080>:
      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.24081>:
      <D.24074>:
      i = i + 1;
      <D.23076>:
      if (i <= 19) goto <D.23075>; else goto <D.23077>;
      <D.23077>:
      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.23079>;
      <D.23078>:
      header.e_ident[i] = 0;
      i = i + 1;
      <D.23079>:
      if (i <= 15) goto <D.23078>; else goto <D.23080>;
      <D.23080>:
      header.e_type = 3;
      header.e_machine = 3;
      header.e_version = 1;
      header.e_phoff = 52;
      header.e_ehsize = 52;
      header.e_phentsize = 32;
      header.e_phnum = 4;
      D.24082 = secth[6].sh_addr;
      header.e_entry = D.24082;
      header.e_shstrndx = 17;
      header.e_shentsize = 40;
      header.e_shnum = 20;
      file_offset.14 = (unsigned int) file_offset;
      header.e_shoff = file_offset.14;
      i = 0;
      dynamic[i].d_tag = 4;
      D.23927 = secth[1].sh_offset;
      dynamic[i].d_un.d_val = D.23927;
      i = i + 1;
      dynamic[i].d_tag = 5;
      D.23942 = secth[3].sh_offset;
      dynamic[i].d_un.d_val = D.23942;
      i = i + 1;
      dynamic[i].d_tag = 6;
      D.23938 = secth[2].sh_offset;
      dynamic[i].d_un.d_val = D.23938;
      i = i + 1;
      dynamic[i].d_tag = 10;
      D.23943 = dyn_str_table.data;
      D.23944 = D.23943->len;
      dynamic[i].d_un.d_val = D.23944;
      i = i + 1;
      dynamic[i].d_tag = 11;
      dynamic[i].d_un.d_val = 16;
      i = i + 1;
      dynamic[i].d_tag = 17;
      D.23946 = secth[4].sh_offset;
      dynamic[i].d_un.d_val = D.23946;
      i = i + 1;
      dynamic[i].d_tag = 18;
      D.24083 = secth[4].sh_size;
      dynamic[i].d_un.d_val = D.24083;
      i = i + 1;
      dynamic[i].d_tag = 19;
      dynamic[i].d_un.d_val = 8;
      i = i + 1;
      dynamic[i].d_tag = 1879048186;
      D.23947 = acfg->num_relocs;
      D.24084 = (unsigned int) D.23947;
      dynamic[i].d_un.d_val = D.24084;
      i = i + 1;
      memset (&progh, 0, 128);
      progh[0].p_type = 1;
      D.24085 = secth[8].sh_offset;
      progh[0].p_memsz = D.24085;
      D.24086 = progh[0].p_memsz;
      progh[0].p_filesz = D.24086;
      progh[0].p_align = 4096;
      progh[0].p_flags = 5;
      progh[1].p_type = 1;
      D.24085 = secth[8].sh_offset;
      progh[1].p_offset = D.24085;
      D.24087 = secth[8].sh_addr;
      progh[1].p_paddr = D.24087;
      D.24088 = progh[1].p_paddr;
      progh[1].p_vaddr = D.24088;
      D.24089 = secth[11].sh_offset;
      D.24085 = secth[8].sh_offset;
      D.24090 = D.24089 - D.24085;
      progh[1].p_filesz = D.24090;
      D.24091 = secth[11].sh_addr;
      D.24092 = secth[11].sh_size;
      D.24093 = D.24091 + D.24092;
      D.24087 = secth[8].sh_addr;
      D.24094 = D.24093 - D.24087;
      progh[1].p_memsz = D.24094;
      progh[1].p_align = 4096;
      progh[1].p_flags = 6;
      progh[2].p_type = 2;
      D.24085 = secth[8].sh_offset;
      progh[2].p_offset = D.24085;
      D.24087 = secth[8].sh_addr;
      progh[2].p_paddr = D.24087;
      D.24095 = progh[2].p_paddr;
      progh[2].p_vaddr = D.24095;
      D.24096 = secth[8].sh_size;
      progh[2].p_memsz = D.24096;
      D.24097 = progh[2].p_memsz;
      progh[2].p_filesz = D.24097;
      progh[2].p_align = 4;
      progh[2].p_flags = 6;
      progh[3].p_type = 1685382481;
      D.24085 = secth[8].sh_offset;
      progh[3].p_offset = D.24085;
      D.24087 = secth[8].sh_addr;
      progh[3].p_paddr = D.24087;
      D.24098 = progh[3].p_paddr;
      progh[3].p_vaddr = D.24098;
      D.24096 = secth[8].sh_size;
      progh[3].p_memsz = D.24096;
      D.24099 = progh[3].p_memsz;
      progh[3].p_filesz = D.24099;
      progh[3].p_align = 4;
      progh[3].p_flags = 6;
      i = 0;
      goto <D.23082>;
      <D.23081>:
      D.24100 = sections[i];
      if (D.24100 != 0B) goto <D.24101>; else goto <D.24102>;
      <D.24101>:
      D.24100 = sections[i];
      D.24103 = secth[i].sh_offset;
      D.24104 = (int) D.24103;
      D.24100->file_offset = D.24104;
      D.24100 = sections[i];
      D.24105 = secth[i].sh_addr;
      D.24106 = (int) D.24105;
      D.24100->virt_offset = D.24106;
      <D.24102>:
      i = i + 1;
      <D.23082>:
      if (i <= 19) goto <D.23081>; else goto <D.23083>;
      <D.23083>:
      reloc_symbols (acfg, dynsym, &secth, &dyn_str_table, 1);
      reloc_symbols (acfg, symtab, &secth, &str_table, 0);
      relocs = resolve_relocations (acfg);
      D.24107 = acfg->fp;
      if (D.24107 == 0B) goto <D.24108>; else goto <D.24109>;
      <D.24108>:
      file_offset.38 = (unsigned int) file_offset;
      D.24111 = file_offset.38 + 800;
      D.24112 = (int) D.24111;
      acfg->out_buf_size = D.24112;
      D.24113 = acfg->out_buf_size;
      D.24114 = (unsigned int) D.24113;
      D.24115 = monoeg_malloc (D.24114);
      acfg->out_buf = D.24115;
      <D.24109>:
      bin_writer_fwrite (acfg, &header, 52, 1);
      bin_writer_fwrite (acfg, &progh, 128, 1);
      D.23928 = *hash;
      D.23930 = hash + 4;
      D.23931 = *D.23930;
      D.24116 = D.23928 + D.23931;
      D.24117 = D.24116 + 2;
      D.24118 = (unsigned int) D.24117;
      D.24119 = D.24118 * 4;
      bin_writer_fwrite (acfg, hash, D.24119, 1);
      D.23930 = hash + 4;
      D.23931 = *D.23930;
      D.23939 = (unsigned int) D.23931;
      D.23940 = D.23939 * 16;
      bin_writer_fwrite (acfg, dynsym, D.23940, 1);
      D.23943 = dyn_str_table.data;
      D.23944 = D.23943->len;
      D.23943 = dyn_str_table.data;
      D.24120 = D.23943->str;
      bin_writer_fwrite (acfg, D.24120, D.23944, 1);
      D.23946 = secth[4].sh_offset;
      D.24121 = (int) D.23946;
      bin_writer_fseek (acfg, D.24121);
      D.23947 = acfg->num_relocs;
      D.24122 = (unsigned int) D.23947;
      bin_writer_fwrite (acfg, relocs, 8, D.24122);
      D.23951 = secth[5].sh_offset;
      D.24123 = (int) D.23951;
      bin_writer_fseek (acfg, D.24123);
      D.24124 = secth[5].sh_size;
      bin_writer_fwrite (acfg, relocs, D.24124, 1);
      D.23959 = sections[6];
      if (D.23959 != 0B) goto <D.24125>; else goto <D.24126>;
      <D.24125>:
      D.23958 = secth[6].sh_offset;
      D.24127 = (int) D.23958;
      bin_writer_fseek (acfg, D.24127);
      D.23959 = sections[6];
      size.22 = D.23959->cur_offset;
      size.39 = (unsigned int) size.22;
      D.23959 = sections[6];
      D.24129 = D.23959->data;
      bin_writer_fwrite (acfg, D.24129, size.39, 1);
      <D.24126>:
      D.23976 = sections[7];
      if (D.23976 != 0B) goto <D.24130>; else goto <D.24131>;
      <D.24130>:
      D.24132 = secth[7].sh_offset;
      D.24133 = (int) D.24132;
      bin_writer_fseek (acfg, D.24133);
      D.23976 = sections[7];
      size.24 = D.23976->cur_offset;
      size.40 = (unsigned int) size.24;
      D.23976 = sections[7];
      D.24135 = D.23976->data;
      bin_writer_fwrite (acfg, D.24135, size.40, 1);
      <D.24131>:
      D.24085 = secth[8].sh_offset;
      D.24136 = (int) D.24085;
      bin_writer_fseek (acfg, D.24136);
      bin_writer_fwrite (acfg, &dynamic, 112, 1);
      D.24087 = secth[8].sh_addr;
      size.41 = (int) D.24087;
      size = size.41;
      D.24138 = secth[9].sh_offset;
      D.24139 = (int) D.24138;
      bin_writer_fseek (acfg, D.24139);
      bin_writer_fwrite (acfg, &size, 4, 1);
      i = 0;
      goto <D.23086>;
      <D.23085>:
      {
        int sect;

        sect = normal_sections[i];
        D.24140 = sections[sect];
        if (D.24140 != 0B) goto <D.24141>; else goto <D.24142>;
        <D.24141>:
        D.24143 = secth[sect].sh_offset;
        D.24144 = (int) D.24143;
        bin_writer_fseek (acfg, D.24144);
        D.24140 = sections[sect];
        D.24145 = D.24140->cur_offset;
        D.24146 = (unsigned int) D.24145;
        D.24140 = sections[sect];
        D.24147 = D.24140->data;
        bin_writer_fwrite (acfg, D.24147, D.24146, 1);
        <D.24142>:
      }
      i = i + 1;
      <D.23086>:
      i.42 = (unsigned int) i;
      if (i.42 <= 5) goto <D.23085>; else goto <D.23087>;
      <D.23087>:
      D.24149 = secth[17].sh_offset;
      D.24150 = (int) D.24149;
      bin_writer_fseek (acfg, D.24150);
      D.24053 = sh_str_table.data;
      D.24054 = D.24053->len;
      D.24053 = sh_str_table.data;
      D.24151 = D.24053->str;
      bin_writer_fwrite (acfg, D.24151, D.24054, 1);
      D.24152 = secth[18].sh_offset;
      D.24153 = (int) D.24152;
      bin_writer_fseek (acfg, D.24153);
      num_local_syms.34 = num_local_syms;
      num_local_syms.35 = (unsigned int) num_local_syms.34;
      D.24063 = num_local_syms.35 * 16;
      bin_writer_fwrite (acfg, symtab, D.24063, 1);
      D.24154 = secth[19].sh_offset;
      D.24155 = (int) D.24154;
      bin_writer_fseek (acfg, D.24155);
      D.24070 = str_table.data;
      D.24071 = D.24070->len;
      D.24070 = str_table.data;
      D.24156 = D.24070->str;
      bin_writer_fwrite (acfg, D.24156, D.24071, 1);
      bin_writer_fseek (acfg, file_offset);
      bin_writer_fwrite (acfg, &secth, 800, 1);
      D.24107 = acfg->fp;
      if (D.24107 != 0B) goto <D.24157>; else goto <D.24158>;
      <D.24157>:
      D.24107 = acfg->fp;
      fclose (D.24107);
      <D.24158>:
      D.24159 = 0;
      return D.24159;
    }
  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.24162;
  struct GString * D.24165;
  struct GHashTable * D.24166;
  struct GHashTable * D.24167;
  void * D.24168;
  int D.24171;
  unsigned int D.24172;
  void * idx.43;
  int idx;

  D.24162 = table->data;
  if (D.24162 == 0B) goto <D.24163>; else goto <D.24164>;
  <D.24163>:
  D.24165 = monoeg_g_string_new_len ("", 1);
  table->data = D.24165;
  D.24166 = monoeg_g_hash_table_new (monoeg_g_str_hash, monoeg_g_str_equal);
  table->hash = D.24166;
  <D.24164>:
  D.24167 = table->hash;
  D.24168 = monoeg_g_hash_table_lookup (D.24167, value);
  idx = (int) D.24168;
  if (idx != 0) goto <D.24169>; else goto <D.24170>;
  <D.24169>:
  D.24171 = idx;
  return D.24171;
  <D.24170>:
  D.24162 = table->data;
  D.24172 = D.24162->len;
  idx = (int) D.24172;
  D.24162 = table->data;
  monoeg_g_string_append (D.24162, value);
  D.24162 = table->data;
  monoeg_g_string_append_c (D.24162, 0);
  idx.43 = (void *) idx;
  D.24167 = table->hash;
  monoeg_g_hash_table_insert_replace (D.24167, value, idx.43, 0);
  D.24171 = idx;
  return D.24171;
}


collect_sections (struct MonoImageWriter * acfg, struct ElfSectHeader * sheaders, struct BinSection * * out, int num)
{
  int D.24175;
  int num_sections.44;
  unsigned int num_sections.45;
  unsigned int D.24180;
  struct BinSection * * D.24181;
  _Bool D.24182;
  long int D.24183;
  long int D.24184;
  int D.22864;
  char * D.24189;
  unsigned int i.46;
  unsigned int D.24191;
  struct BinSection * * D.24192;
  struct BinSection * D.24193;
  char * D.24194;
  int D.24197;
  int i;
  int j;
  int maxs;
  int num_sections;
  struct BinSection * sect;

  num_sections = 0;
  maxs = 0;
  sect = acfg->sections;
  goto <D.22854>;
  <D.22853>:
  D.24175 = sect->subsection;
  if (D.24175 == 0) goto <D.24176>; else goto <D.24177>;
  <D.24176>:
  num_sections.44 = num_sections;
  num_sections = num_sections.44 + 1;
  num_sections.45 = (unsigned int) num_sections.44;
  D.24180 = num_sections.45 * 4;
  D.24181 = out + D.24180;
  *D.24181 = sect;
  D.24182 = num_sections >= num;
  D.24183 = (long int) D.24182;
  D.24184 = __builtin_expect (D.24183, 0);
  if (D.24184 != 0) goto <D.24185>; else goto <D.24186>;
  <D.24185>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 830, "num_sections < num");
  <D.24186>:
  <D.24177>:
  D.24175 = sect->subsection;
  maxs = MAX_EXPR <D.24175, maxs>;
  sect = sect->next;
  <D.22854>:
  if (sect != 0B) goto <D.22853>; else goto <D.22855>;
  <D.22855>:
  i = 0;
  goto <D.22872>;
  <D.22871>:
  j = 1;
  goto <D.22869>;
  <D.22868>:
  sect = acfg->sections;
  goto <D.22866>;
  <D.22865>:
  D.24175 = sect->subsection;
  if (D.24175 == j) goto <D.24187>; else goto <D.24188>;
  <D.24187>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.24189 = sect->name;
    i.46 = (unsigned int) i;
    D.24191 = i.46 * 4;
    D.24192 = out + D.24191;
    D.24193 = *D.24192;
    D.24194 = D.24193->name;
    D.22864 = __builtin_strcmp (D.24194, D.24189);
  }
  if (D.22864 == 0) goto <D.24195>; else goto <D.24196>;
  <D.24195>:
  i.46 = (unsigned int) i;
  D.24191 = i.46 * 4;
  D.24192 = out + D.24191;
  D.24193 = *D.24192;
  append_subsection (acfg, sheaders, D.24193, sect);
  <D.24196>:
  <D.24188>:
  sect = sect->next;
  <D.22866>:
  if (sect != 0B) goto <D.22865>; else goto <D.22867>;
  <D.22867>:
  j = j + 1;
  <D.22869>:
  if (j <= maxs) goto <D.22868>; else goto <D.22870>;
  <D.22870>:
  i = i + 1;
  <D.22872>:
  if (i < num_sections) goto <D.22871>; else goto <D.22873>;
  <D.22873>:
  D.24197 = num_sections;
  return D.24197;
}


append_subsection (struct MonoImageWriter * acfg, struct ElfSectHeader * sheaders, struct BinSection * sect, struct BinSection * add)
{
  int D.22841;
  int iftmp.47;
  int D.22840;
  const char[12] * D.24202;
  unsigned char D.24203;
  int D.24204;
  unsigned char D.24205;
  int D.24206;
  _Bool D.24207;
  _Bool D.24208;
  _Bool D.24209;
  const unsigned char * D.24212;
  unsigned char D.24213;
  int D.24214;
  const unsigned char * D.24215;
  unsigned char D.24216;
  int D.24217;
  _Bool D.24218;
  _Bool D.24219;
  const unsigned char * D.24222;
  unsigned char D.24223;
  int D.24224;
  const unsigned char * D.24225;
  unsigned char D.24226;
  int D.24227;
  _Bool D.24228;
  _Bool D.24229;
  const unsigned char * D.24232;
  unsigned char D.24233;
  int D.24234;
  const unsigned char * D.24235;
  unsigned char D.24236;
  int D.24237;
  char * D.24239;
  int D.24242;
  unsigned int D.24243;
  guint8 * D.24244;
  guint8 * D.24245;
  int D.24246;
  sizetype D.24247;
  guint8 * D.24248;
  int D.24249;
  int offset;

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

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

      __s2 = sect->name;
      D.24202 = ".debug_line";
      D.24203 = MEM[(const unsigned char *)D.24202];
      D.24204 = (int) D.24203;
      D.24205 = *__s2;
      D.24206 = (int) D.24205;
      __result = D.24204 - D.24206;
      {
        D.24207 = __s2_len != 0;
        D.24208 = __result == 0;
        D.24209 = D.24207 & D.24208;
        if (D.24209 != 0) goto <D.24210>; else goto <D.24211>;
        <D.24210>:
        D.24212 = &MEM[(void *)".debug_line" + 1B];
        D.24213 = *D.24212;
        D.24214 = (int) D.24213;
        D.24215 = __s2 + 1;
        D.24216 = *D.24215;
        D.24217 = (int) D.24216;
        __result = D.24214 - D.24217;
        D.24218 = __s2_len > 1;
        D.24208 = __result == 0;
        D.24219 = D.24218 & D.24208;
        if (D.24219 != 0) goto <D.24220>; else goto <D.24221>;
        <D.24220>:
        D.24222 = &MEM[(void *)".debug_line" + 2B];
        D.24223 = *D.24222;
        D.24224 = (int) D.24223;
        D.24225 = __s2 + 2;
        D.24226 = *D.24225;
        D.24227 = (int) D.24226;
        __result = D.24224 - D.24227;
        D.24228 = __s2_len > 2;
        D.24208 = __result == 0;
        D.24229 = D.24228 & D.24208;
        if (D.24229 != 0) goto <D.24230>; else goto <D.24231>;
        <D.24230>:
        D.24232 = &MEM[(void *)".debug_line" + 3B];
        D.24233 = *D.24232;
        D.24234 = (int) D.24233;
        D.24235 = __s2 + 3;
        D.24236 = *D.24235;
        D.24237 = (int) D.24236;
        __result = D.24234 - D.24237;
        <D.24231>:
        <D.24221>:
        <D.24211>:
      }
      D.22840 = __result;
    }
    iftmp.47 = -D.22840;
    goto <D.24238>;
    <D.24201>:
    D.24239 = sect->name;
    iftmp.47 = __builtin_strcmp (D.24239, ".debug_line");
    <D.24238>:
    D.22841 = iftmp.47;
  }
  if (D.22841 != 0) goto <D.24240>; else goto <D.24241>;
  <D.24240>:
  offset = offset + 7;
  offset = offset & -8;
  <D.24241>:
  bin_writer_emit_ensure_buffer (sect, offset);
  sect->cur_offset = offset;
  D.24242 = add->cur_offset;
  bin_writer_emit_ensure_buffer (sect, D.24242);
  D.24242 = add->cur_offset;
  D.24243 = (unsigned int) D.24242;
  D.24244 = add->data;
  D.24245 = sect->data;
  D.24246 = sect->cur_offset;
  D.24247 = (sizetype) D.24246;
  D.24248 = D.24245 + D.24247;
  memcpy (D.24248, D.24244, D.24243);
  add->parent = sect;
  D.24246 = sect->cur_offset;
  D.24242 = add->cur_offset;
  D.24249 = D.24246 + D.24242;
  sect->cur_offset = D.24249;
  add->cur_offset = offset;
  add->data = 0B;
  add->data_len = 0;
}


build_hash (struct MonoImageWriter * acfg, int num_sections, struct ElfStrTable * dynstr)
{
  int D.24250;
  char * D.24253;
  int D.24254;
  unsigned int D.24255;
  unsigned int D.24256;
  int * D.24257;
  int * D.24258;
  int * data;
  int num_symbols;
  struct BinSymbol * symbol;

  num_symbols = num_sections + 4;
  symbol = acfg->symbols;
  goto <D.22892>;
  <D.22891>:
  D.24250 = symbol->is_global;
  if (D.24250 == 0) goto <D.24251>; else goto <D.24252>;
  <D.24251>:
  // predicted unlikely by continue predictor.
  goto <D.22890>;
  <D.24252>:
  num_symbols = num_symbols + 1;
  D.24253 = symbol->name;
  str_table_add (dynstr, D.24253);
  <D.22890>:
  symbol = symbol->next;
  <D.22892>:
  if (symbol != 0B) goto <D.22891>; else goto <D.22893>;
  <D.22893>:
  str_table_add (dynstr, "__bss_start");
  str_table_add (dynstr, "_edata");
  str_table_add (dynstr, "_end");
  D.24254 = num_symbols + 19;
  D.24255 = (unsigned int) D.24254;
  D.24256 = D.24255 * 4;
  data = monoeg_malloc0 (D.24256);
  *data = 17;
  D.24257 = data + 4;
  *D.24257 = num_symbols;
  D.24258 = data;
  return D.24258;
}


collect_syms (struct MonoImageWriter * acfg, int * hash, struct ElfStrTable * strtab, struct ElfSectHeader * sheaders, int * num_syms)
{
  int * D.24262;
  int D.24263;
  unsigned int D.24264;
  unsigned int D.24265;
  int D.24267;
  unsigned int D.24268;
  unsigned int D.24269;
  unsigned int i.48;
  unsigned int D.24273;
  struct ElfSymbol * D.24274;
  short unsigned int D.24275;
  unsigned int j.49;
  unsigned int D.24277;
  struct ElfSectHeader * D.24278;
  unsigned int D.24279;
  struct BinSection * D.24281;
  int D.22933;
  int iftmp.50;
  int D.22932;
  const char[6] * D.24287;
  unsigned char D.24288;
  int D.24289;
  unsigned char D.24290;
  int D.24291;
  _Bool D.24292;
  _Bool D.24293;
  _Bool D.24294;
  const unsigned char * D.24297;
  unsigned char D.24298;
  int D.24299;
  const unsigned char * D.24300;
  unsigned char D.24301;
  int D.24302;
  _Bool D.24303;
  _Bool D.24304;
  const unsigned char * D.24307;
  unsigned char D.24308;
  int D.24309;
  const unsigned char * D.24310;
  unsigned char D.24311;
  int D.24312;
  _Bool D.24313;
  _Bool D.24314;
  const unsigned char * D.24317;
  unsigned char D.24318;
  int D.24319;
  const unsigned char * D.24320;
  unsigned char D.24321;
  int D.24322;
  char * D.24324;
  int D.24327;
  unsigned int D.24328;
  int D.22942;
  int iftmp.51;
  int D.22941;
  const char[8] * D.24333;
  unsigned char D.24334;
  int D.24335;
  unsigned char D.24336;
  int D.24337;
  _Bool D.24338;
  _Bool D.24339;
  _Bool D.24340;
  const unsigned char * D.24343;
  unsigned char D.24344;
  int D.24345;
  const unsigned char * D.24346;
  unsigned char D.24347;
  int D.24348;
  _Bool D.24349;
  _Bool D.24350;
  const unsigned char * D.24353;
  unsigned char D.24354;
  int D.24355;
  const unsigned char * D.24356;
  unsigned char D.24357;
  int D.24358;
  _Bool D.24359;
  _Bool D.24360;
  const unsigned char * D.24363;
  unsigned char D.24364;
  int D.24365;
  const unsigned char * D.24366;
  unsigned char D.24367;
  int D.24368;
  int D.22951;
  int iftmp.52;
  int D.22950;
  const char[6] * D.24376;
  unsigned char D.24377;
  int D.24378;
  unsigned char D.24379;
  int D.24380;
  _Bool D.24381;
  _Bool D.24382;
  _Bool D.24383;
  const unsigned char * D.24386;
  unsigned char D.24387;
  int D.24388;
  const unsigned char * D.24389;
  unsigned char D.24390;
  int D.24391;
  _Bool D.24392;
  _Bool D.24393;
  const unsigned char * D.24396;
  unsigned char D.24397;
  int D.24398;
  const unsigned char * D.24399;
  unsigned char D.24400;
  int D.24401;
  _Bool D.24402;
  _Bool D.24403;
  const unsigned char * D.24406;
  unsigned char D.24407;
  int D.24408;
  const unsigned char * D.24409;
  unsigned char D.24410;
  int D.24411;
  int D.22960;
  int iftmp.53;
  int D.22959;
  const char[5] * D.24419;
  unsigned char D.24420;
  int D.24421;
  unsigned char D.24422;
  int D.24423;
  _Bool D.24424;
  _Bool D.24425;
  _Bool D.24426;
  const unsigned char * D.24429;
  unsigned char D.24430;
  int D.24431;
  const unsigned char * D.24432;
  unsigned char D.24433;
  int D.24434;
  _Bool D.24435;
  _Bool D.24436;
  const unsigned char * D.24439;
  unsigned char D.24440;
  int D.24441;
  const unsigned char * D.24442;
  unsigned char D.24443;
  int D.24444;
  _Bool D.24445;
  _Bool D.24446;
  const unsigned char * D.24449;
  unsigned char D.24450;
  int D.24451;
  const unsigned char * D.24452;
  unsigned char D.24453;
  int D.24454;
  int D.24458;
  unsigned char iftmp.54;
  unsigned char iftmp.55;
  int D.24468;
  unsigned char D.24472;
  char * D.24473;
  int D.24474;
  unsigned int D.24475;
  Elf32_Half iftmp.56;
  int D.24479;
  int D.24481;
  struct GHashTable * D.24482;
  int D.24485;
  int D.24486;
  int D.24487;
  int D.24488;
  unsigned int D.24489;
  int D.24491;
  unsigned int D.24492;
  char * D.24493;
  _Bool D.24496;
  long int D.24497;
  long int D.24498;
  int D.24501;
  int D.24502;
  int D.24503;
  unsigned int D.24504;
  int D.24505;
  unsigned int D.24506;
  int D.24507;
  unsigned int D.24508;
  int D.24509;
  unsigned int D.24510;
  int D.24515;
  sizetype D.24516;
  sizetype D.24517;
  sizetype D.24518;
  unsigned int D.24519;
  struct GString * D.24522;
  char * D.24523;
  const unsigned char * D.24524;
  long unsigned int D.24525;
  long unsigned int D.24526;
  unsigned int slot.57;
  unsigned int D.24528;
  int * D.24529;
  int D.24530;
  unsigned int D.24533;
  int * D.24534;
  struct ElfSymbol * D.24536;
  struct ElfSymbol * symbols;
  struct BinSymbol * symbol;
  struct BinSection * section;
  int i;
  int * bucket;
  int * chain;
  long unsigned int hashc;

  if (hash != 0B) goto <D.24260>; else goto <D.24261>;
  <D.24260>:
  D.24262 = hash + 4;
  D.24263 = *D.24262;
  D.24264 = (unsigned int) D.24263;
  D.24265 = D.24264 * 16;
  symbols = monoeg_malloc0 (D.24265);
  goto <D.24266>;
  <D.24261>:
  i = 0;
  symbol = acfg->symbols;
  goto <D.22918>;
  <D.22917>:
  i = i + 1;
  symbol = symbol->next;
  <D.22918>:
  if (symbol != 0B) goto <D.22917>; else goto <D.22919>;
  <D.22919>:
  D.24267 = i + 30;
  D.24268 = (unsigned int) D.24267;
  D.24269 = D.24268 * 16;
  symbols = monoeg_malloc0 (D.24269);
  <D.24266>:
  i = 1;
  if (sheaders != 0B) goto <D.24270>; else goto <D.24271>;
  <D.24270>:
  {
    int j;

    j = 1;
    goto <D.22922>;
    <D.22921>:
    i.48 = (unsigned int) i;
    D.24273 = i.48 * 16;
    D.24274 = symbols + D.24273;
    D.24274->st_info = 3;
    i.48 = (unsigned int) i;
    D.24273 = i.48 * 16;
    D.24274 = symbols + D.24273;
    D.24275 = (short unsigned int) j;
    D.24274->st_shndx = D.24275;
    i.48 = (unsigned int) i;
    D.24273 = i.48 * 16;
    D.24274 = symbols + D.24273;
    j.49 = (unsigned int) j;
    D.24277 = j.49 * 40;
    D.24278 = sheaders + D.24277;
    D.24279 = D.24278->sh_addr;
    D.24274->st_value = D.24279;
    i = i + 1;
    j = j + 1;
    <D.22922>:
    if (j <= 19) goto <D.22921>; else goto <D.22923>;
    <D.22923>:
  }
  goto <D.24280>;
  <D.24271>:
  section = acfg->sections;
  goto <D.22962>;
  <D.22961>:
  D.24281 = section->parent;
  if (D.24281 != 0B) goto <D.24282>; else goto <D.24283>;
  <D.24282>:
  // predicted unlikely by continue predictor.
  goto <D.22924>;
  <D.24283>:
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24274->st_info = 3;
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = section->name;
      D.24287 = ".text";
      D.24288 = MEM[(const unsigned char *)D.24287];
      D.24289 = (int) D.24288;
      D.24290 = *__s2;
      D.24291 = (int) D.24290;
      __result = D.24289 - D.24291;
      {
        D.24292 = __s2_len != 0;
        D.24293 = __result == 0;
        D.24294 = D.24292 & D.24293;
        if (D.24294 != 0) goto <D.24295>; else goto <D.24296>;
        <D.24295>:
        D.24297 = &MEM[(void *)".text" + 1B];
        D.24298 = *D.24297;
        D.24299 = (int) D.24298;
        D.24300 = __s2 + 1;
        D.24301 = *D.24300;
        D.24302 = (int) D.24301;
        __result = D.24299 - D.24302;
        D.24303 = __s2_len > 1;
        D.24293 = __result == 0;
        D.24304 = D.24303 & D.24293;
        if (D.24304 != 0) goto <D.24305>; else goto <D.24306>;
        <D.24305>:
        D.24307 = &MEM[(void *)".text" + 2B];
        D.24308 = *D.24307;
        D.24309 = (int) D.24308;
        D.24310 = __s2 + 2;
        D.24311 = *D.24310;
        D.24312 = (int) D.24311;
        __result = D.24309 - D.24312;
        D.24313 = __s2_len > 2;
        D.24293 = __result == 0;
        D.24314 = D.24313 & D.24293;
        if (D.24314 != 0) goto <D.24315>; else goto <D.24316>;
        <D.24315>:
        D.24317 = &MEM[(void *)".text" + 3B];
        D.24318 = *D.24317;
        D.24319 = (int) D.24318;
        D.24320 = __s2 + 3;
        D.24321 = *D.24320;
        D.24322 = (int) D.24321;
        __result = D.24319 - D.24322;
        <D.24316>:
        <D.24306>:
        <D.24296>:
      }
      D.22932 = __result;
    }
    iftmp.50 = -D.22932;
    goto <D.24323>;
    <D.24286>:
    D.24324 = section->name;
    iftmp.50 = __builtin_strcmp (D.24324, ".text");
    <D.24323>:
    D.22933 = iftmp.50;
  }
  if (D.22933 == 0) goto <D.24325>; else goto <D.24326>;
  <D.24325>:
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24274->st_shndx = 6;
  section->shidx = 6;
  section->file_offset = 4096;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24327 = section->virt_offset;
  D.24328 = (unsigned int) D.24327;
  D.24274->st_value = D.24328;
  goto <D.24329>;
  <D.24326>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = section->name;
      D.24333 = ".rodata";
      D.24334 = MEM[(const unsigned char *)D.24333];
      D.24335 = (int) D.24334;
      D.24336 = *__s2;
      D.24337 = (int) D.24336;
      __result = D.24335 - D.24337;
      {
        D.24338 = __s2_len != 0;
        D.24339 = __result == 0;
        D.24340 = D.24338 & D.24339;
        if (D.24340 != 0) goto <D.24341>; else goto <D.24342>;
        <D.24341>:
        D.24343 = &MEM[(void *)".rodata" + 1B];
        D.24344 = *D.24343;
        D.24345 = (int) D.24344;
        D.24346 = __s2 + 1;
        D.24347 = *D.24346;
        D.24348 = (int) D.24347;
        __result = D.24345 - D.24348;
        D.24349 = __s2_len > 1;
        D.24339 = __result == 0;
        D.24350 = D.24349 & D.24339;
        if (D.24350 != 0) goto <D.24351>; else goto <D.24352>;
        <D.24351>:
        D.24353 = &MEM[(void *)".rodata" + 2B];
        D.24354 = *D.24353;
        D.24355 = (int) D.24354;
        D.24356 = __s2 + 2;
        D.24357 = *D.24356;
        D.24358 = (int) D.24357;
        __result = D.24355 - D.24358;
        D.24359 = __s2_len > 2;
        D.24339 = __result == 0;
        D.24360 = D.24359 & D.24339;
        if (D.24360 != 0) goto <D.24361>; else goto <D.24362>;
        <D.24361>:
        D.24363 = &MEM[(void *)".rodata" + 3B];
        D.24364 = *D.24363;
        D.24365 = (int) D.24364;
        D.24366 = __s2 + 3;
        D.24367 = *D.24366;
        D.24368 = (int) D.24367;
        __result = D.24365 - D.24368;
        <D.24362>:
        <D.24352>:
        <D.24342>:
      }
      D.22941 = __result;
    }
    iftmp.51 = -D.22941;
    goto <D.24369>;
    <D.24332>:
    D.24324 = section->name;
    iftmp.51 = __builtin_strcmp (D.24324, ".rodata");
    <D.24369>:
    D.22942 = iftmp.51;
  }
  if (D.22942 == 0) goto <D.24370>; else goto <D.24371>;
  <D.24370>:
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24274->st_shndx = 7;
  section->shidx = 7;
  section->file_offset = 4096;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24327 = section->virt_offset;
  D.24328 = (unsigned int) D.24327;
  D.24274->st_value = D.24328;
  goto <D.24372>;
  <D.24371>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = section->name;
      D.24376 = ".data";
      D.24377 = MEM[(const unsigned char *)D.24376];
      D.24378 = (int) D.24377;
      D.24379 = *__s2;
      D.24380 = (int) D.24379;
      __result = D.24378 - D.24380;
      {
        D.24381 = __s2_len != 0;
        D.24382 = __result == 0;
        D.24383 = D.24381 & D.24382;
        if (D.24383 != 0) goto <D.24384>; else goto <D.24385>;
        <D.24384>:
        D.24386 = &MEM[(void *)".data" + 1B];
        D.24387 = *D.24386;
        D.24388 = (int) D.24387;
        D.24389 = __s2 + 1;
        D.24390 = *D.24389;
        D.24391 = (int) D.24390;
        __result = D.24388 - D.24391;
        D.24392 = __s2_len > 1;
        D.24382 = __result == 0;
        D.24393 = D.24392 & D.24382;
        if (D.24393 != 0) goto <D.24394>; else goto <D.24395>;
        <D.24394>:
        D.24396 = &MEM[(void *)".data" + 2B];
        D.24397 = *D.24396;
        D.24398 = (int) D.24397;
        D.24399 = __s2 + 2;
        D.24400 = *D.24399;
        D.24401 = (int) D.24400;
        __result = D.24398 - D.24401;
        D.24402 = __s2_len > 2;
        D.24382 = __result == 0;
        D.24403 = D.24402 & D.24382;
        if (D.24403 != 0) goto <D.24404>; else goto <D.24405>;
        <D.24404>:
        D.24406 = &MEM[(void *)".data" + 3B];
        D.24407 = *D.24406;
        D.24408 = (int) D.24407;
        D.24409 = __s2 + 3;
        D.24410 = *D.24409;
        D.24411 = (int) D.24410;
        __result = D.24408 - D.24411;
        <D.24405>:
        <D.24395>:
        <D.24385>:
      }
      D.22950 = __result;
    }
    iftmp.52 = -D.22950;
    goto <D.24412>;
    <D.24375>:
    D.24324 = section->name;
    iftmp.52 = __builtin_strcmp (D.24324, ".data");
    <D.24412>:
    D.22951 = iftmp.52;
  }
  if (D.22951 == 0) goto <D.24413>; else goto <D.24414>;
  <D.24413>:
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24274->st_shndx = 10;
  section->shidx = 10;
  section->file_offset = 4124;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24327 = section->virt_offset;
  D.24328 = (unsigned int) D.24327;
  D.24274->st_value = D.24328;
  goto <D.24415>;
  <D.24414>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = section->name;
      D.24419 = ".bss";
      D.24420 = MEM[(const unsigned char *)D.24419];
      D.24421 = (int) D.24420;
      D.24422 = *__s2;
      D.24423 = (int) D.24422;
      __result = D.24421 - D.24423;
      {
        D.24424 = __s2_len != 0;
        D.24425 = __result == 0;
        D.24426 = D.24424 & D.24425;
        if (D.24426 != 0) goto <D.24427>; else goto <D.24428>;
        <D.24427>:
        D.24429 = &MEM[(void *)".bss" + 1B];
        D.24430 = *D.24429;
        D.24431 = (int) D.24430;
        D.24432 = __s2 + 1;
        D.24433 = *D.24432;
        D.24434 = (int) D.24433;
        __result = D.24431 - D.24434;
        D.24435 = __s2_len > 1;
        D.24425 = __result == 0;
        D.24436 = D.24435 & D.24425;
        if (D.24436 != 0) goto <D.24437>; else goto <D.24438>;
        <D.24437>:
        D.24439 = &MEM[(void *)".bss" + 2B];
        D.24440 = *D.24439;
        D.24441 = (int) D.24440;
        D.24442 = __s2 + 2;
        D.24443 = *D.24442;
        D.24444 = (int) D.24443;
        __result = D.24441 - D.24444;
        D.24445 = __s2_len > 2;
        D.24425 = __result == 0;
        D.24446 = D.24445 & D.24425;
        if (D.24446 != 0) goto <D.24447>; else goto <D.24448>;
        <D.24447>:
        D.24449 = &MEM[(void *)".bss" + 3B];
        D.24450 = *D.24449;
        D.24451 = (int) D.24450;
        D.24452 = __s2 + 3;
        D.24453 = *D.24452;
        D.24454 = (int) D.24453;
        __result = D.24451 - D.24454;
        <D.24448>:
        <D.24438>:
        <D.24428>:
      }
      D.22959 = __result;
    }
    iftmp.53 = -D.22959;
    goto <D.24455>;
    <D.24418>:
    D.24324 = section->name;
    iftmp.53 = __builtin_strcmp (D.24324, ".bss");
    <D.24455>:
    D.22960 = iftmp.53;
  }
  if (D.22960 == 0) goto <D.24456>; else goto <D.24457>;
  <D.24456>:
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24274->st_shndx = 11;
  section->shidx = 11;
  section->file_offset = 4132;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24327 = section->virt_offset;
  D.24328 = (unsigned int) D.24327;
  D.24274->st_value = D.24328;
  <D.24457>:
  <D.24415>:
  <D.24372>:
  <D.24329>:
  i = i + 1;
  <D.22924>:
  section = section->next;
  <D.22962>:
  if (section != 0B) goto <D.22961>; else goto <D.22963>;
  <D.22963>:
  <D.24280>:
  symbol = acfg->symbols;
  goto <D.22969>;
  <D.22968>:
  {
    int offset;
    struct BinLabel * lab;

    D.24458 = symbol->is_global;
    if (D.24458 == 0) goto <D.24459>; else goto <D.24460>;
    <D.24459>:
    if (hash != 0B) goto <D.24461>; else goto <D.24462>;
    <D.24461>:
    // predicted unlikely by continue predictor.
    goto <D.22966>;
    <D.24462>:
    <D.24460>:
    i.48 = (unsigned int) i;
    D.24273 = i.48 * 16;
    D.24274 = symbols + D.24273;
    D.24458 = symbol->is_global;
    if (D.24458 != 0) goto <D.24464>; else goto <D.24465>;
    <D.24464>:
    iftmp.54 = 16;
    goto <D.24466>;
    <D.24465>:
    iftmp.54 = 0;
    <D.24466>:
    D.24468 = symbol->is_function;
    if (D.24468 != 0) goto <D.24469>; else goto <D.24470>;
    <D.24469>:
    iftmp.55 = 2;
    goto <D.24471>;
    <D.24470>:
    iftmp.55 = 1;
    <D.24471>:
    D.24472 = iftmp.54 + iftmp.55;
    D.24274->st_info = D.24472;
    i.48 = (unsigned int) i;
    D.24273 = i.48 * 16;
    D.24274 = symbols + D.24273;
    D.24473 = symbol->name;
    D.24474 = str_table_add (strtab, D.24473);
    D.24475 = (unsigned int) D.24474;
    D.24274->st_name = D.24475;
    section = symbol->section;
    i.48 = (unsigned int) i;
    D.24273 = i.48 * 16;
    D.24274 = symbols + D.24273;
    D.24281 = section->parent;
    if (D.24281 != 0B) goto <D.24477>; else goto <D.24478>;
    <D.24477>:
    D.24281 = section->parent;
    D.24479 = D.24281->shidx;
    iftmp.56 = (Elf32_Half) D.24479;
    goto <D.24480>;
    <D.24478>:
    D.24481 = section->shidx;
    iftmp.56 = (Elf32_Half) D.24481;
    <D.24480>:
    D.24274->st_shndx = iftmp.56;
    D.24473 = symbol->name;
    D.24482 = acfg->labels;
    lab = monoeg_g_hash_table_lookup (D.24482, D.24473);
    offset = lab->offset;
    D.24281 = section->parent;
    if (D.24281 != 0B) goto <D.24483>; else goto <D.24484>;
    <D.24483>:
    i.48 = (unsigned int) i;
    D.24273 = i.48 * 16;
    D.24274 = symbols + D.24273;
    D.24281 = section->parent;
    D.24485 = D.24281->virt_offset;
    D.24486 = section->cur_offset;
    D.24487 = D.24485 + D.24486;
    D.24488 = D.24487 + offset;
    D.24489 = (unsigned int) D.24488;
    D.24274->st_value = D.24489;
    goto <D.24490>;
    <D.24484>:
    i.48 = (unsigned int) i;
    D.24273 = i.48 * 16;
    D.24274 = symbols + D.24273;
    D.24327 = section->virt_offset;
    D.24491 = D.24327 + offset;
    D.24492 = (unsigned int) D.24491;
    D.24274->st_value = D.24492;
    <D.24490>:
    D.24493 = symbol->end_label;
    if (D.24493 != 0B) goto <D.24494>; else goto <D.24495>;
    <D.24494>:
    {
      struct BinLabel * elab;

      D.24493 = symbol->end_label;
      D.24482 = acfg->labels;
      elab = monoeg_g_hash_table_lookup (D.24482, D.24493);
      D.24496 = elab == 0B;
      D.24497 = (long int) D.24496;
      D.24498 = __builtin_expect (D.24497, 0);
      if (D.24498 != 0) goto <D.24499>; else goto <D.24500>;
      <D.24499>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 987, "elab");
      <D.24500>:
      i.48 = (unsigned int) i;
      D.24273 = i.48 * 16;
      D.24274 = symbols + D.24273;
      D.24501 = elab->offset;
      D.24502 = lab->offset;
      D.24503 = D.24501 - D.24502;
      D.24504 = (unsigned int) D.24503;
      D.24274->st_size = D.24504;
    }
    <D.24495>:
    i = i + 1;
  }
  <D.22966>:
  symbol = symbol->next;
  <D.22969>:
  if (symbol != 0B) goto <D.22968>; else goto <D.22970>;
  <D.22970>:
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24505 = str_table_add (strtab, "__bss_start");
  D.24506 = (unsigned int) D.24505;
  D.24274->st_name = D.24506;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24274->st_shndx = 65521;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24274->st_info = 16;
  i = i + 1;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24507 = str_table_add (strtab, "_edata");
  D.24508 = (unsigned int) D.24507;
  D.24274->st_name = D.24508;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24274->st_shndx = 65521;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24274->st_info = 16;
  i = i + 1;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24509 = str_table_add (strtab, "_end");
  D.24510 = (unsigned int) D.24509;
  D.24274->st_name = D.24510;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24274->st_shndx = 65521;
  i.48 = (unsigned int) i;
  D.24273 = i.48 * 16;
  D.24274 = symbols + D.24273;
  D.24274->st_info = 16;
  i = i + 1;
  if (num_syms != 0B) goto <D.24511>; else goto <D.24512>;
  <D.24511>:
  *num_syms = i;
  <D.24512>:
  if (hash != 0B) goto <D.24513>; else goto <D.24514>;
  <D.24513>:
  bucket = hash + 8;
  D.24515 = *hash;
  D.24516 = (sizetype) D.24515;
  D.24517 = D.24516 + 2;
  D.24518 = D.24517 * 4;
  chain = hash + D.24518;
  i = 0;
  goto <D.22974>;
  <D.22973>:
  {
    int slot;

    i.48 = (unsigned int) i;
    D.24273 = i.48 * 16;
    D.24274 = symbols + D.24273;
    D.24519 = D.24274->st_name;
    if (D.24519 == 0) goto <D.24520>; else goto <D.24521>;
    <D.24520>:
    // predicted unlikely by continue predictor.
    goto <D.22972>;
    <D.24521>:
    D.24522 = strtab->data;
    D.24523 = D.24522->str;
    i.48 = (unsigned int) i;
    D.24273 = i.48 * 16;
    D.24274 = symbols + D.24273;
    D.24519 = D.24274->st_name;
    D.24524 = D.24523 + D.24519;
    hashc = elf_hash (D.24524);
    D.24515 = *hash;
    D.24525 = (long unsigned int) D.24515;
    D.24526 = hashc % D.24525;
    slot = (int) D.24526;
    slot.57 = (unsigned int) slot;
    D.24528 = slot.57 * 4;
    D.24529 = bucket + D.24528;
    D.24530 = *D.24529;
    if (D.24530 != 0) goto <D.24531>; else goto <D.24532>;
    <D.24531>:
    i.48 = (unsigned int) i;
    D.24533 = i.48 * 4;
    D.24534 = chain + D.24533;
    slot.57 = (unsigned int) slot;
    D.24528 = slot.57 * 4;
    D.24529 = bucket + D.24528;
    D.24530 = *D.24529;
    *D.24534 = D.24530;
    slot.57 = (unsigned int) slot;
    D.24528 = slot.57 * 4;
    D.24529 = bucket + D.24528;
    *D.24529 = i;
    goto <D.24535>;
    <D.24532>:
    slot.57 = (unsigned int) slot;
    D.24528 = slot.57 * 4;
    D.24529 = bucket + D.24528;
    *D.24529 = i;
    <D.24535>:
  }
  <D.22972>:
  i = i + 1;
  <D.22974>:
  D.24262 = hash + 4;
  D.24263 = *D.24262;
  if (D.24263 > i) goto <D.22973>; else goto <D.22975>;
  <D.22975>:
  <D.24514>:
  D.24536 = symbols;
  return D.24536;
}


elf_hash (const unsigned char * name)
{
  long unsigned int D.24538;
  const unsigned char * name.58;
  unsigned char D.24540;
  long unsigned int D.24541;
  long unsigned int D.24544;
  long unsigned int D.24545;
  unsigned char D.24546;
  long unsigned int D.24547;
  long unsigned int h;
  long unsigned int g;

  h = 0;
  goto <D.22880>;
  <D.22879>:
  D.24538 = h << 4;
  name.58 = name;
  name = name.58 + 1;
  D.24540 = *name.58;
  D.24541 = (long unsigned int) D.24540;
  h = D.24538 + D.24541;
  g = h & 4026531840;
  if (g != 0) goto <D.24542>; else goto <D.24543>;
  <D.24542>:
  D.24544 = g >> 24;
  h = D.24544 ^ h;
  <D.24543>:
  D.24545 = ~g;
  h = D.24545 & h;
  <D.22880>:
  D.24546 = *name;
  if (D.24546 != 0) goto <D.22879>; else goto <D.22881>;
  <D.22881>:
  D.24547 = h;
  return D.24547;
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.24551;
  int D.24556;
  void * D.24558;
  unsigned int D.24559;

  D.24551 = __builtin_constant_p (__len);
  if (D.24551 != 0) goto <D.24552>; else goto <D.24553>;
  <D.24552>:
  if (__len == 0) goto <D.24554>; else goto <D.24555>;
  <D.24554>:
  D.24556 = __builtin_constant_p (__ch);
  if (D.24556 == 0) goto <D.24549>; else goto <D.24557>;
  <D.24557>:
  if (__ch != 0) goto <D.24549>; else goto <D.24550>;
  <D.24549>:
  __warn_memset_zero_len ();
  D.24558 = __dest;
  return D.24558;
  <D.24550>:
  <D.24555>:
  <D.24553>:
  D.24559 = __builtin_object_size (__dest, 0);
  D.24558 = __builtin___memset_chk (__dest, __ch, __len, D.24559);
  return D.24558;
}


reloc_symbols (struct MonoImageWriter * acfg, struct ElfSymbol * symbols, struct ElfSectHeader * sheaders, struct ElfStrTable * strtab, gboolean dynamic)
{
  struct BinSection * D.24563;
  unsigned int i.59;
  unsigned int D.24567;
  struct ElfSymbol * D.24568;
  int D.24569;
  unsigned int D.24570;
  unsigned int D.24571;
  struct ElfSectHeader * D.24572;
  unsigned int D.24573;
  unsigned int D.24575;
  struct ElfSectHeader * D.24576;
  unsigned int D.24577;
  int D.24580;
  char * D.24583;
  struct GHashTable * D.24584;
  int D.24587;
  unsigned int D.24588;
  unsigned int D.24589;
  struct ElfSectHeader * D.24590;
  unsigned int D.24591;
  int D.24592;
  unsigned int D.24593;
  unsigned int D.24594;
  unsigned int offset.60;
  unsigned int D.24596;
  unsigned int D.24598;
  struct ElfSectHeader * D.24599;
  unsigned int D.24600;
  struct ElfSectHeader * D.24601;
  unsigned int D.24602;
  unsigned int D.24603;
  unsigned int D.24604;
  unsigned int D.24605;
  unsigned int D.24606;
  struct BinSection * section;
  struct BinSymbol * symbol;
  int i;

  i = 1;
  if (dynamic != 0) goto <D.24561>; else goto <D.24562>;
  <D.24561>:
  section = acfg->sections;
  goto <D.22988>;
  <D.22987>:
  D.24563 = section->parent;
  if (D.24563 != 0B) goto <D.24564>; else goto <D.24565>;
  <D.24564>:
  // predicted unlikely by continue predictor.
  goto <D.22986>;
  <D.24565>:
  i.59 = (unsigned int) i;
  D.24567 = i.59 * 16;
  D.24568 = symbols + D.24567;
  D.24569 = section->shidx;
  D.24570 = (unsigned int) D.24569;
  D.24571 = D.24570 * 40;
  D.24572 = sheaders + D.24571;
  D.24573 = D.24572->sh_addr;
  D.24568->st_value = D.24573;
  i = i + 1;
  <D.22986>:
  section = section->next;
  <D.22988>:
  if (section != 0B) goto <D.22987>; else goto <D.22989>;
  <D.22989>:
  goto <D.24574>;
  <D.24562>:
  i = 1;
  goto <D.22991>;
  <D.22990>:
  i.59 = (unsigned int) i;
  D.24567 = i.59 * 16;
  D.24568 = symbols + D.24567;
  i.59 = (unsigned int) i;
  D.24575 = i.59 * 40;
  D.24576 = sheaders + D.24575;
  D.24577 = D.24576->sh_addr;
  D.24568->st_value = D.24577;
  i = i + 1;
  <D.22991>:
  if (i <= 19) goto <D.22990>; else goto <D.22992>;
  <D.22992>:
  <D.24574>:
  symbol = acfg->symbols;
  goto <D.22997>;
  <D.22996>:
  {
    int offset;
    struct BinLabel * lab;

    if (dynamic != 0) goto <D.24578>; else goto <D.24579>;
    <D.24578>:
    D.24580 = symbol->is_global;
    if (D.24580 == 0) goto <D.24581>; else goto <D.24582>;
    <D.24581>:
    // predicted unlikely by continue predictor.
    goto <D.22995>;
    <D.24582>:
    <D.24579>:
    section = symbol->section;
    D.24583 = symbol->name;
    D.24584 = acfg->labels;
    lab = monoeg_g_hash_table_lookup (D.24584, D.24583);
    offset = lab->offset;
    D.24563 = section->parent;
    if (D.24563 != 0B) goto <D.24585>; else goto <D.24586>;
    <D.24585>:
    i.59 = (unsigned int) i;
    D.24567 = i.59 * 16;
    D.24568 = symbols + D.24567;
    D.24563 = section->parent;
    D.24587 = D.24563->shidx;
    D.24588 = (unsigned int) D.24587;
    D.24589 = D.24588 * 40;
    D.24590 = sheaders + D.24589;
    D.24591 = D.24590->sh_addr;
    D.24592 = section->cur_offset;
    D.24593 = (unsigned int) D.24592;
    D.24594 = D.24591 + D.24593;
    offset.60 = (unsigned int) offset;
    D.24596 = D.24594 + offset.60;
    D.24568->st_value = D.24596;
    goto <D.24597>;
    <D.24586>:
    i.59 = (unsigned int) i;
    D.24567 = i.59 * 16;
    D.24568 = symbols + D.24567;
    D.24569 = section->shidx;
    D.24570 = (unsigned int) D.24569;
    D.24571 = D.24570 * 40;
    D.24572 = sheaders + D.24571;
    D.24573 = D.24572->sh_addr;
    offset.60 = (unsigned int) offset;
    D.24598 = D.24573 + offset.60;
    D.24568->st_value = D.24598;
    <D.24597>:
    i = i + 1;
  }
  <D.22995>:
  symbol = symbol->next;
  <D.22997>:
  if (symbol != 0B) goto <D.22996>; else goto <D.22998>;
  <D.22998>:
  i.59 = (unsigned int) i;
  D.24567 = i.59 * 16;
  D.24568 = symbols + D.24567;
  D.24599 = sheaders + 440;
  D.24600 = D.24599->sh_addr;
  D.24568->st_value = D.24600;
  i = i + 1;
  i.59 = (unsigned int) i;
  D.24567 = i.59 * 16;
  D.24568 = symbols + D.24567;
  D.24601 = sheaders + 400;
  D.24602 = D.24601->sh_addr;
  D.24601 = sheaders + 400;
  D.24603 = D.24601->sh_size;
  D.24604 = D.24602 + D.24603;
  D.24568->st_value = D.24604;
  i = i + 1;
  i.59 = (unsigned int) i;
  D.24567 = i.59 * 16;
  D.24568 = symbols + D.24567;
  D.24599 = sheaders + 440;
  D.24600 = D.24599->sh_addr;
  D.24599 = sheaders + 440;
  D.24605 = D.24599->sh_size;
  D.24606 = D.24600 + D.24605;
  D.24568->st_value = D.24606;
  i = i + 1;
}


resolve_relocations (struct MonoImageWriter * acfg)
{
  int D.24607;
  unsigned int D.24608;
  unsigned int D.24609;
  int D.24610;
  unsigned int start_val.61;
  _Bool D.24614;
  long int D.24615;
  long int D.24616;
  unsigned int end_val.62;
  int end_val.63;
  guint8 * data.64;
  unsigned char D.24623;
  guint8 * D.24624;
  unsigned int D.24625;
  unsigned char D.24626;
  guint8 * D.24627;
  unsigned int D.24628;
  unsigned char D.24629;
  guint8 * D.24630;
  unsigned int D.24631;
  unsigned char D.24632;
  char * D.24635;
  char D.24636;
  unsigned int i.65;
  unsigned int D.24640;
  struct ElfReloc * D.24641;
  unsigned int vaddr.66;
  _Bool D.24643;
  long int D.24644;
  long int D.24645;
  struct ElfReloc * D.24648;
  struct BinReloc * reloc;
  guint8 * data;
  gsize end_val;
  gsize start_val;
  struct ElfReloc * rr;
  int i;
  gsize vaddr;

  try
    {
      D.24607 = acfg->num_relocs;
      D.24608 = (unsigned int) D.24607;
      D.24609 = D.24608 * 8;
      rr = monoeg_malloc0 (D.24609);
      i = 0;
      reloc = acfg->relocations;
      goto <D.23028>;
      <D.23027>:
      resolve_reloc (acfg, reloc, &data, &vaddr, &start_val, &end_val);
      D.24610 = reloc->reloc_type;
      if (D.24610 != 0) goto <D.24611>; else goto <D.24612>;
      <D.24611>:
      start_val.61 = start_val;
      D.24614 = start_val.61 == 0;
      D.24615 = (long int) D.24614;
      D.24616 = __builtin_expect (D.24615, 0);
      if (D.24616 != 0) goto <D.24617>; else goto <D.24618>;
      <D.24617>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 1228, "start_val > 0");
      <D.24618>:
      end_val.62 = end_val;
      end_val.63 = (int) end_val.62;
      data.64 = data;
      do_reloc (acfg, reloc, data.64, end_val.63);
      goto <D.24622>;
      <D.24612>:
      data.64 = data;
      end_val.62 = end_val;
      D.24623 = (unsigned char) end_val.62;
      *data.64 = D.24623;
      data.64 = data;
      D.24624 = data.64 + 1;
      end_val.62 = end_val;
      D.24625 = end_val.62 >> 8;
      D.24626 = (unsigned char) D.24625;
      *D.24624 = D.24626;
      data.64 = data;
      D.24627 = data.64 + 2;
      end_val.62 = end_val;
      D.24628 = end_val.62 >> 16;
      D.24629 = (unsigned char) D.24628;
      *D.24627 = D.24629;
      data.64 = data;
      D.24630 = data.64 + 3;
      end_val.62 = end_val;
      D.24631 = end_val.62 >> 24;
      D.24632 = (unsigned char) D.24631;
      *D.24630 = D.24632;
      <D.24622>:
      start_val.61 = start_val;
      if (start_val.61 == 0) goto <D.24633>; else goto <D.24634>;
      <D.24633>:
      D.24635 = reloc->val1;
      D.24636 = *D.24635;
      if (D.24636 != 46) goto <D.24637>; else goto <D.24638>;
      <D.24637>:
      i.65 = (unsigned int) i;
      D.24640 = i.65 * 8;
      D.24641 = rr + D.24640;
      vaddr.66 = vaddr;
      D.24641->r_offset = vaddr.66;
      i.65 = (unsigned int) i;
      D.24640 = i.65 * 8;
      D.24641 = rr + D.24640;
      D.24641->r_info = 8;
      i = i + 1;
      D.24607 = acfg->num_relocs;
      D.24643 = D.24607 < i;
      D.24644 = (long int) D.24643;
      D.24645 = __builtin_expect (D.24644, 0);
      if (D.24645 != 0) goto <D.24646>; else goto <D.24647>;
      <D.24646>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 1241, "i <= acfg->num_relocs");
      <D.24647>:
      <D.24638>:
      <D.24634>:
      reloc = reloc->next;
      <D.23028>:
      if (reloc != 0B) goto <D.23027>; else goto <D.23029>;
      <D.23029>:
      D.24648 = rr;
      return D.24648;
    }
  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.24651;
  unsigned int D.24652;
  char * D.24653;
  unsigned int D.24656;
  struct BinSection * D.24658;
  struct BinSection * D.24661;
  int D.24664;
  int D.24665;
  int D.24666;
  int D.24668;
  int D.24670;
  int D.24671;
  struct BinSection * D.24672;
  struct BinSection * D.24673;
  int D.24676;
  sizetype D.24677;
  int D.24678;
  sizetype D.24679;
  int D.24680;
  unsigned int D.24681;
  unsigned int D.24682;
  int D.24684;
  unsigned int start_val.67;
  unsigned int end_val.68;
  guint8 * data;
  gssize end_val;
  gssize start_val;
  gsize vaddr;

  D.24651 = reloc->val1;
  D.24652 = get_label_addr (acfg, D.24651);
  end_val = (gssize) D.24652;
  D.24653 = reloc->val2;
  if (D.24653 != 0B) goto <D.24654>; else goto <D.24655>;
  <D.24654>:
  D.24653 = reloc->val2;
  D.24656 = get_label_addr (acfg, D.24653);
  start_val = (gssize) D.24656;
  goto <D.24657>;
  <D.24655>:
  D.24658 = reloc->val2_section;
  if (D.24658 != 0B) goto <D.24659>; else goto <D.24660>;
  <D.24659>:
  start_val = reloc->val2_offset;
  D.24658 = reloc->val2_section;
  D.24661 = D.24658->parent;
  if (D.24661 != 0B) goto <D.24662>; else goto <D.24663>;
  <D.24662>:
  D.24658 = reloc->val2_section;
  D.24661 = D.24658->parent;
  D.24664 = D.24661->virt_offset;
  D.24658 = reloc->val2_section;
  D.24665 = D.24658->cur_offset;
  D.24666 = D.24664 + D.24665;
  start_val = D.24666 + start_val;
  goto <D.24667>;
  <D.24663>:
  D.24658 = reloc->val2_section;
  D.24668 = D.24658->virt_offset;
  start_val = D.24668 + start_val;
  <D.24667>:
  goto <D.24669>;
  <D.24660>:
  start_val = 0;
  <D.24669>:
  <D.24657>:
  D.24670 = end_val - start_val;
  D.24671 = reloc->offset;
  end_val = D.24670 + D.24671;
  D.24672 = reloc->section;
  D.24673 = D.24672->parent;
  if (D.24673 != 0B) goto <D.24674>; else goto <D.24675>;
  <D.24674>:
  D.24672 = reloc->section;
  D.24673 = D.24672->parent;
  data = D.24673->data;
  D.24672 = reloc->section;
  D.24676 = D.24672->cur_offset;
  D.24677 = (sizetype) D.24676;
  data = data + D.24677;
  D.24678 = reloc->section_offset;
  D.24679 = (sizetype) D.24678;
  data = data + D.24679;
  D.24672 = reloc->section;
  D.24673 = D.24672->parent;
  D.24680 = D.24673->virt_offset;
  vaddr = (gsize) D.24680;
  D.24672 = reloc->section;
  D.24676 = D.24672->cur_offset;
  D.24681 = (unsigned int) D.24676;
  vaddr = D.24681 + vaddr;
  D.24678 = reloc->section_offset;
  D.24682 = (unsigned int) D.24678;
  vaddr = D.24682 + vaddr;
  goto <D.24683>;
  <D.24675>:
  D.24672 = reloc->section;
  data = D.24672->data;
  D.24678 = reloc->section_offset;
  D.24679 = (sizetype) D.24678;
  data = data + D.24679;
  D.24672 = reloc->section;
  D.24684 = D.24672->virt_offset;
  vaddr = (gsize) D.24684;
  D.24678 = reloc->section_offset;
  D.24682 = (unsigned int) D.24678;
  vaddr = D.24682 + vaddr;
  <D.24683>:
  start_val.67 = (unsigned int) start_val;
  *out_start_val = start_val.67;
  end_val.68 = (unsigned int) end_val;
  *out_end_val = end_val.68;
  *out_data = data;
  *out_vaddr = vaddr;
}


get_label_addr (struct MonoImageWriter * acfg, const char * name)
{
  struct GHashTable * D.24687;
  struct BinSection * D.24690;
  int D.24693;
  int D.24694;
  int D.24695;
  int D.24696;
  int D.24698;
  int D.24699;
  gsize D.24700;
  int offset;
  struct BinLabel * lab;
  struct BinSection * section;
  gsize value;

  D.24687 = acfg->labels;
  lab = monoeg_g_hash_table_lookup (D.24687, name);
  if (lab == 0B) goto <D.24688>; else goto <D.24689>;
  <D.24688>:
  monoeg_g_log (0B, 4, "Undefined label: \'%s\'.\n", name);
  <D.22902>:
  goto <D.22902>;
  <D.24689>:
  section = lab->section;
  offset = lab->offset;
  D.24690 = section->parent;
  if (D.24690 != 0B) goto <D.24691>; else goto <D.24692>;
  <D.24691>:
  D.24690 = section->parent;
  D.24693 = D.24690->virt_offset;
  D.24694 = section->cur_offset;
  D.24695 = D.24693 + D.24694;
  D.24696 = D.24695 + offset;
  value = (gsize) D.24696;
  goto <D.24697>;
  <D.24692>:
  D.24698 = section->virt_offset;
  D.24699 = D.24698 + offset;
  value = (gsize) D.24699;
  <D.24697>:
  D.24700 = value;
  return D.24700;
}


do_reloc (struct MonoImageWriter * acfg, struct BinReloc * reloc, guint8 * data, gssize addr)
{
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "image-writer.c", 1206);
}


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

  D.24702 = acfg->fp;
  if (D.24702 != 0B) goto <D.24703>; else goto <D.24704>;
  <D.24703>:
  D.24702 = acfg->fp;
  fseek (D.24702, offset, 0);
  goto <D.24705>;
  <D.24704>:
  acfg->out_buf_pos = offset;
  <D.24705>:
}


bin_writer_fwrite (struct MonoImageWriter * acfg, void * val, size_t size, size_t nmemb)
{
  struct FILE * D.24706;
  int D.24710;
  unsigned int D.24711;
  unsigned int D.24712;
  unsigned int D.24713;
  int D.24714;
  unsigned int D.24715;
  _Bool D.24716;
  long int D.24717;
  long int D.24718;
  guint8 * D.24721;
  sizetype D.24722;
  guint8 * D.24723;
  int D.24724;

  D.24706 = acfg->fp;
  if (D.24706 != 0B) goto <D.24707>; else goto <D.24708>;
  <D.24707>:
  D.24706 = acfg->fp;
  fwrite (val, size, nmemb, D.24706);
  goto <D.24709>;
  <D.24708>:
  D.24710 = acfg->out_buf_pos;
  D.24711 = (unsigned int) D.24710;
  D.24712 = size * nmemb;
  D.24713 = D.24711 + D.24712;
  D.24714 = acfg->out_buf_size;
  D.24715 = (unsigned int) D.24714;
  D.24716 = D.24713 > D.24715;
  D.24717 = (long int) D.24716;
  D.24718 = __builtin_expect (D.24717, 0);
  if (D.24718 != 0) goto <D.24719>; else goto <D.24720>;
  <D.24719>:
  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.24720>:
  D.24712 = size * nmemb;
  D.24721 = acfg->out_buf;
  D.24710 = acfg->out_buf_pos;
  D.24722 = (sizetype) D.24710;
  D.24723 = D.24721 + D.24722;
  memcpy (D.24723, val, D.24712);
  D.24710 = acfg->out_buf_pos;
  D.24711 = (unsigned int) D.24710;
  D.24712 = size * nmemb;
  D.24713 = D.24711 + D.24712;
  D.24724 = (int) D.24713;
  acfg->out_buf_pos = D.24724;
  <D.24709>:
}


asm_writer_emit_writeout (struct MonoImageWriter * acfg)
{
  struct FILE * D.24725;
  int D.24726;

  D.24725 = acfg->fp;
  fclose (D.24725);
  D.24726 = 0;
  return D.24726;
}


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.24728;

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


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.24732;

  D.24732 = acfg->use_bin_writer;
  if (D.24732 == 0) goto <D.24733>; else goto <D.24734>;
  <D.24733>:
  asm_writer_emit_unset_mode (acfg);
  <D.24734>:
}


img_writer_get_output (struct MonoImageWriter * acfg, guint32 * size)
{
  int D.24735;
  _Bool D.24736;
  long int D.24737;
  long int D.24738;
  int D.24741;
  unsigned int D.24742;
  guint8 * D.24743;
  guint8 * buf;

  D.24735 = acfg->use_bin_writer;
  D.24736 = D.24735 == 0;
  D.24737 = (long int) D.24736;
  D.24738 = __builtin_expect (D.24737, 0);
  if (D.24738 != 0) goto <D.24739>; else goto <D.24740>;
  <D.24739>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 2299, "acfg->use_bin_writer");
  <D.24740>:
  buf = acfg->out_buf;
  D.24741 = acfg->out_buf_size;
  D.24742 = (unsigned int) D.24741;
  *size = D.24742;
  acfg->out_buf = 0B;
  D.24743 = buf;
  return D.24743;
}


bin_writer_supported ()
{
  gboolean D.24745;

  D.24745 = 1;
  return D.24745;
}


img_writer_create (struct FILE * fp, gboolean use_bin_writer)
{
  _Bool D.24749;
  long int D.24750;
  long int D.24751;
  struct MonoMemPool * D.24754;
  struct MonoImageWriter * D.24755;
  struct MonoImageWriter * w;

  w = monoeg_malloc0 (208);
  if (use_bin_writer == 0) goto <D.24747>; else goto <D.24748>;
  <D.24747>:
  D.24749 = fp == 0B;
  D.24750 = (long int) D.24749;
  D.24751 = __builtin_expect (D.24750, 0);
  if (D.24751 != 0) goto <D.24752>; else goto <D.24753>;
  <D.24752>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image-writer.c", 2341, "fp");
  <D.24753>:
  <D.24748>:
  w->fp = fp;
  w->use_bin_writer = use_bin_writer;
  D.24754 = mono_mempool_new ();
  w->mempool = D.24754;
  D.24755 = w;
  return D.24755;
}


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

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


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

  D.24758 = 1;
  return D.24758;
}


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

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


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

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


