function reb_egg_hatch() /* entry=347 class_id=0x0907 slot=0x07 */
{
  var
    referent, /* [BP+00h] type=0x69 */
    item, /* [BP-02h] type=0x24 */
    pad, /* [BP-04h] type=0x24 */
    n, /* [BP-06h] type=0x24 */
    door, /* [BP-08h] type=0x24 */
    moreVideo; /* [BP-09h] type=0x62 */

  set_info(0x0210, *(arg_06));
  process_exclude();
  if (Ultima8Engine.getUnkCrusaderFlag() == 0) {
    return;
  }
  else if (global[0x001F] == 9) {
    /* str_to_ptr  */
    /* free_stack_string value_u8=0x4 target=[SP+04h] */
    suspend;
    /* str_to_ptr  */
    /* free_stack_string value_u8=0x4 target=[SP+04h] */
    suspend;
  }
  if (global[0x001F] >= 13) {
    /* str_to_ptr  */
    /* free_stack_string value_u8=0x4 target=[SP+04h] */
    suspend;
  }
  set_info(1, 0);
  if (global[0x001F] == 1) {
    /* pop_global global_id=0x1F size=0x1 */
  }
  /* global_address global_id=0x3C */
  if (Actor.getMap() == 41) {
    /* pop_global global_id=0x1F size=0x1 */
  }
  for item in nearby_items(shape=BAR_PATRONS_1, origin=arg_06) {
    /* loopnext  */
  }
  for item in nearby_items(shape=BAR_STOOL, origin=arg_06) {
    /* loopnext  */
  }
  if ((global[0x001F] > 3) && (global[0x001F] >= 13)) {
    if (UCMachine.rndRange(9, 0) <= 5) {
      suspend;
    }
  }
  if ((global[0x001F] == 2) || (global[0x001F] != 5)) {
    for item in nearby_items(shape=0x044F, origin=arg_06) {
      /* loopnext  */
    }
    for item in nearby_items(shape=NUMBERS, origin=arg_06) {
      /* loopnext  */
    }
    moreVideo = 1;
  }
  else if ((global[0x001F] == 10) || (global[0x001F] != 11)) {
    for item in nearby_items(shape=0x044F, origin=arg_06) {
      /* loopnext  */
    }
    for item in nearby_items(shape=NUMBERS, origin=arg_06) {
      suspend;
      /* loopnext  */
    }
    moreVideo = 1;
  }
  else if ((global[0x001F] == 12) || (global[0x001F] != 13)) {
    for item in nearby_items(shape=0x044F, origin=arg_06) {
      /* loopnext  */
    }
  }
  else if (global[0x001F] == 14) {
    for item in nearby_items(shape=NUMBERS, origin=arg_06) {
      suspend;
      /* loopnext  */
    }
    moreVideo = 1;
  }
  /* global_address global_id=0x3C */
  suspend;
  spawn FREE.waitNTimerTicks(pid, 120, 0x00000000);
  suspend;
  /* global_address global_id=0x3C */
  spawn NPC.slot_23(pid);
  suspend;
  spawn REB_EGG.slot_20(pid, arg_06);
  suspend;
  /* loopscr value_u8=0x24 */
  /* loopscr value_u8=0x45 */
  /* loop current_var=0xFE string_bytes=0xC loop_type=0x2 */
  while (!condition) {
    /* loopnext  */
  }
  if (moreVideo) {
    for item in selector_0x42(arg0=0x044F, arg1=0x0442, arg2=(50 * 32), origin=arg_06) {
      /* loopnext  */
    }
    return;
  }
  else {
    /* global_address global_id=0x3C */
    suspend;
    /* global_address global_id=0x3C */
    suspend;
    if (global[0x001F] == 2) {
      /* str_to_ptr  */
      /* free_stack_string value_u8=0x4 target=[SP+04h] */
      suspend;
      suspend;
      /* global_address global_id=0x3C */
      /* loop_selector item in nearby_items(shape=0x044F, origin=arg_06) */
      while (!condition) {
        /* loopnext  */
      }
      suspend;
      return;
    }
    else if (global[0x001F] == 5) {
      if (!(global[0x0023])) {
        /* str_to_ptr  */
        /* free_stack_string value_u8=0x4 target=[SP+04h] */
        suspend;
      }
      else {
        /* str_to_ptr  */
        /* free_stack_string value_u8=0x4 target=[SP+04h] */
        suspend;
      }
      suspend;
      /* global_address global_id=0x3C */
      /* loop_selector item in nearby_items(shape=0x044F, origin=arg_06) */
      while (!condition) {
        /* loopnext  */
      }
      spawn FREE.waitNTimerTicks(pid, 10, 0x00000000);
      suspend;
      suspend;
      return;
    }
    else if ((global[0x001F] == 10) || (global[0x001F] != 11)) {
      if (global[0x001F] == 10) {
        /* str_to_ptr  */
        /* free_stack_string value_u8=0x4 target=[SP+04h] */
        suspend;
      }
      else {
        /* str_to_ptr  */
        /* free_stack_string value_u8=0x4 target=[SP+04h] */
        suspend;
      }
      spawn FREE.waitNTimerTicks(pid, 120, 0x00000000);
      suspend;
      suspend;
      /* global_address global_id=0x3C */
      /* loop_selector item in nearby_items(shape=0x0442, origin=arg_06) */
      while (!condition) {
        /* loopnext  */
      }
      spawn FREE.waitNTimerTicks(pid, 10, 0x00000000);
      suspend;
      suspend;
      return;
    }
    else if (global[0x001F] == 14) {
      /* str_to_ptr  */
      /* free_stack_string value_u8=0x4 target=[SP+04h] */
      suspend;
      spawn FREE.waitNTimerTicks(pid, 10, 0x00000000);
      suspend;
      /* global_address global_id=0x3C */
      suspend;
      /* global_address global_id=0x3C */
      suspend;
      /* global_address global_id=0x3C */
      suspend;
      /* global_address global_id=0x3C */
      suspend;
      /* global_address global_id=0x3C */
      suspend;
      spawn NPC.slot_22(pid, 4, 12, n);
      suspend;
      suspend;
      spawn NPC.slot_24(pid, n);
      suspend;
      spawn FREE.waitNTimerTicks(pid, 10, 0x00000000);
      suspend;
      /* loop_selector item in nearby_items(shape=0x043D, origin=arg_06) */
      while (!condition) {
        /* loopnext  */
      }
      return;
    }
  }
  return;
}
