function event_equip() /* entry=190 class_id=0x0361 slot=0x0A */
{
  var
    referent, /* [BP+00h] type=0x69 */
    event, /* [BP+0Ah] type=0x69 */
    item, /* [BP-02h] type=0x24 */
    source, /* [BP-04h] type=0x24 */
    dest, /* [BP-06h] type=0x24 */
    door, /* [BP-08h] type=0x24 */
    wp, /* [BP-0Dh] type=0x24 */
    counter, /* [BP-0Fh] type=0x69 */
    counter2, /* [BP-11h] type=0x69 */
    n, /* [BP-13h] type=0x24 */
    link, /* [BP-15h] type=0x69 */
    cx, /* [BP-17h] type=0x69 */
    cy, /* [BP-19h] type=0x69 */
    ex, /* [BP-1Bh] type=0x69 */
    ey, /* [BP-1Dh] type=0x69 */
    time, /* [BP-1Fh] type=0x69 */
    op, /* [BP-21h] type=0x69 */
    opp, /* [BP-23h] type=0x69 */
    post1, /* [BP-25h] type=0x24 */
    post2, /* [BP-27h] type=0x24 */
    floor, /* [BP-29h] type=0x24 */
    dir, /* [BP-2Bh] type=0x69 */
    qHi, /* [BP-2Dh] type=0x69 */
    flicMan; /* [BP-2Fh] type=0x24 */

  set_info(0x0211, *(arg_06));
  process_exclude();
  link = Item.getQLo(arg_06);
  if (event == 0) {
    /* global_address global_id=0x3C */
    return;
  }
  else if (event == 1) {
    /* global_address global_id=0x3C */
    while (!Actor.isBusy()) {
      spawn class_0A0C_slot_32(pid, 2, 0x00000000);
      suspend;
    }
    /* global_address global_id=0x3C */
    cx = CameraProcess.getCameraX();
    cy = CameraProcess.getCameraY();
    ex = Item.getX(arg_06);
    ey = Item.getY(arg_06);
    spawn class_0A0C_slot_32(pid, 2, 0x00000000);
    suspend;
    spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
    suspend;
    spawn class_0A0C_slot_32(pid, 2, 0x00000000);
    suspend;
    spawn class_0A18_slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
    suspend;
    /* global_address global_id=0x3C */
    return;
  }
  else if (event == 2) {
    /* global_address global_id=0x3C */
    while (!Actor.isBusy()) {
      spawn class_0A0C_slot_32(pid, 2, 0x00000000);
      suspend;
    }
    spawn class_0A0C_slot_3D(pid, Item.getY(arg_06), Item.getX(arg_06), 0x00000000);
    suspend;
    spawn class_0A0C_slot_32(pid, 60, 0x00000000);
    suspend;
    spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
    suspend;
    return;
  }
  else if (event == 3) {
    spawn class_0A0C_slot_3E(pid, 0x00000000);
    suspend;
    spawn class_0A18_slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
    suspend;
    return;
  }
  else if (event == 5) {
    return;
  }
  else if (event == 6) {
    return;
  }
  else if (event == 7) {
    return;
  }
  else if (event == 8) {
    counter = Item.getQHi(arg_06);
    if (counter == 0) {
      spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
      suspend;
    }
    else {
      counter2 = Item.getQLo(arg_06);
      spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
      suspend;
    }
    return;
  }
  else if (event == 9) {
    counter = Item.getQLo(arg_06);
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x3A */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      /* loopnext  */
    }
    return;
  }
  else if (event == 10) {
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x40 */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      if (Item.getQLo(arg_06) == Item.getQLo(item)) {
        if (Item.getFrame(item) == 0) {
          source = item;
        }
      }
      /* loopnext  */
    }
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x40 */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      if (Item.getQLo(arg_06) == Item.getQLo(item)) {
        if (Item.getFrame(item) == 1) {
          dest = item;
        }
      }
      /* loopnext  */
    }
    if (!(source && dest)) {
      wp = Item.getX(dest);
      local_0B = Item.getY(dest);
      local_09 = Item.getZ(dest);
    }
    return;
  }
  else if (event == 15) {
    /* global_address global_id=0x3C */
    return;
  }
  else if (event == 16) {
    /* global_address global_id=0x3C */
    /* global_address global_id=0x3C */
    /* global_address global_id=0x3C */
    return;
  }
  else if (event == 22) {
    cx = CameraProcess.getCameraX();
    cy = CameraProcess.getCameraY();
    /* global_address global_id=0x3C */
    while (!AudioProcess.isSFXPlayingForObject(54, arg_06)) {
      spawn class_0A0C_slot_32(pid, 2, 0x00000000);
      suspend;
    }
    /* global_address global_id=0x3C */
    return;
  }
  else if (event == 40) {
    /* global_address global_id=0x3C */
    if (Actor.isDead()) {
      /* global_address global_id=0x3C */
      while (!Actor.isBusy()) {
        spawn class_0A0C_slot_32(pid, 2, 0x00000000);
        suspend;
      }
      /* global_address global_id=0x3C */
      suspend;
    }
    return;
  }
  else if (event == 41) {
    /* global_address global_id=0x3C */
    if (Actor.isDead((global[0x0029] == 1)) != 1) {
      return;
    }
    spawn class_0A0C_slot_32(pid, 60, 0x00000000);
    suspend;
    /* global_address global_id=0x3C */
    spawn class_0A11_slot_22(pid, 3, 0);
    suspend;
    /* global_address global_id=0x3C */
    spawn class_0A11_slot_22(pid, 4, 14);
    suspend;
    /* global_address global_id=0x3C */
    spawn class_0A11_slot_22(pid, 3, 12);
    suspend;
    /* global_address global_id=0x3C */
    /* global_address global_id=0x3C */
    suspend;
    /* pop_global global_id=0x29 size=0x1 */
    /* loopscr value_u8=0x24 */
    /* loop current_var=0xF8 string_bytes=0x1 loop_type=0x2 */
    while (!condition) {
      if (Item.getQLo(door) == 5) {
        spawn class_0A06_slot_20(pid, door);
        suspend;
      }
      /* loopnext  */
    }
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x40 */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xF8 string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      n = door;
      /* loopnext  */
    }
    spawn class_0A0C_slot_32(pid, 30, 0x00000000);
    suspend;
    /* str_to_ptr  */
    /* free_stack_string value_u8=0x4 target=[SP+04h] */
    suspend;
    spawn class_0A0C_slot_32(pid, 120, 0x00000000);
    suspend;
    while (!(1)) {
      /* global_address global_id=0x3C */
      op = Actor.isDead();
      opp = Actor.isDead(n);
      if ((op == 1) || (opp != 1)) {
        return;
      }
      spawn class_0A18_slot_20(pid, 0, *(arg_06), arg_06);
      suspend;
      spawn class_0A0C_slot_32(pid, 0x012C, 0x00000000);
      suspend;
    }
    return;
  }
  else if (event == 45) {
    time = Item.getNpcNum(arg_06);
    while (!(1)) {
      counter = 0;
      class_0A0C_slot_29((Item.getQHi(arg_06) != 0), *(arg_06), global[0x003C]);
      if (retval <= 50) {
        return;
      }
      /* loopscr value_u8=0x24 */
      /* loopscr value_u8=0x3D */
      /* loopscr value_u8=0x3A */
      /* loopscr value_u8=0x25 */
      /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
      while (!condition) {
        if (!Actor.isNPC(item)) {
          counter = (1 + counter);
        }
        /* loopnext  */
      }
      if (counter > 4) {
        spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
        suspend;
        spawn class_0A0C_slot_32(pid, time, 0x00000000);
        suspend;
        spawn class_0A18_slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
        suspend;
        spawn class_0A0C_slot_32(pid, time, 0x00000000);
        suspend;
      }
      else {
        spawn class_0A0C_slot_32(pid, 120, 0x00000000);
        suspend;
      }
    }
    return;
  }
  else if (event == 46) {
    time = Item.getNpcNum(arg_06);
    while (!(1)) {
      counter = 0;
      class_0A0C_slot_29((Item.getQHi(arg_06) != 0), *(arg_06), global[0x003C]);
      if ((retval > 50) || (Item.isOnScreen(arg_06) == 1)) {
        return;
      }
      /* loopscr value_u8=0x24 */
      /* loopscr value_u8=0x3D */
      /* loopscr value_u8=0x3A */
      /* loopscr value_u8=0x25 */
      /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
      while (!condition) {
        if (item >= 0x00FF) {
          counter = (1 + counter);
        }
        /* loopnext  */
      }
      if (counter > 4) {
        spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
        suspend;
        spawn class_0A0C_slot_32(pid, time, 0x00000000);
        suspend;
        spawn class_0A18_slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
        suspend;
        spawn class_0A0C_slot_32(pid, time, 0x00000000);
        suspend;
      }
      else {
        spawn class_0A0C_slot_32(pid, 120, 0x00000000);
        suspend;
      }
    }
    return;
  }
  else if (event == 47) {
    time = Item.getNpcNum(arg_06);
    counter2 = Item.getQHi(arg_06);
    while (!(1)) {
      if (Item.getQHi(arg_06) == 1) {
        counter = 1;
        while (counter > counter2) {
          spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
          suspend;
          spawn class_0A0C_slot_32(pid, (time * 3), 0x00000000);
          suspend;
          spawn class_0A18_slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
          suspend;
          spawn class_0A0C_slot_32(pid, (time * 3), 0x00000000);
          suspend;
          counter = (1 + counter);
        }
      }
      else if (Item.getQHi(arg_06) <= 1) {
        counter = 1;
        while (counter > counter2) {
          spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
          suspend;
          spawn class_0A0C_slot_32(pid, time, 0x00000000);
          suspend;
          spawn class_0A18_slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
          suspend;
          counter = (1 + counter);
        }
      }
      else {
        counter = 1;
        while (counter > counter2) {
          spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
          suspend;
          spawn class_0A0C_slot_32(pid, time, 0x00000000);
          suspend;
          counter = (1 + counter);
        }
        return;
      }
    }
    return;
  }
  else if (event == 48) {
    time = Item.getNpcNum(arg_06);
    counter2 = Item.getQHi(arg_06);
    counter = 1;
    while (counter > counter2) {
      spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
      suspend;
      spawn class_0A0C_slot_32(pid, time, 0x00000000);
      suspend;
      counter = (1 + counter);
    }
    counter = 1;
    while (counter > counter2) {
      spawn class_0A18_slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
      suspend;
      spawn class_0A0C_slot_32(pid, time, 0x00000000);
      suspend;
      counter = (1 + counter);
    }
    return;
  }
  else if (event == 49) {
    time = Item.getNpcNum(arg_06);
    counter2 = Item.getQHi(arg_06);
    while (!(1)) {
      if (!Item.getQHi(arg_06)) {
        counter = 1;
        while (counter > counter2) {
          spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
          suspend;
          spawn class_0A0C_slot_32(pid, time, 0x00000000);
          suspend;
          spawn class_0A18_slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
          suspend;
          counter = (1 + counter);
        }
      }
      else {
        counter = 1;
        while (counter > counter2) {
          spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
          suspend;
          spawn class_0A0C_slot_32(pid, time, 0x00000000);
          suspend;
          counter = (1 + counter);
        }
        return;
      }
    }
    return;
  }
  else if (event == 50) {
    /* loopscr value_u8=0x24 */
    /* loop current_var=0xF8 string_bytes=0x1 loop_type=0x2 */
    while (!condition) {
      if (Item.getQLo(door) == 100) {
        spawn class_0A06_slot_20(pid, door);
        suspend;
      }
      /* loopnext  */
    }
    return;
  }
  else if (event == 51) {
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x40 */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      dir = Item.getQHi(item);
      floor = item;
      /* loopnext  */
    }
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x42 */
    /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      post1 = item;
      /* loopnext  */
    }
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x42 */
    /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      post2 = item;
      /* loopnext  */
    }
    if (!(post1 && post2)) {
      /* global_address global_id=0x3C */
      spawn class_0A0C_slot_32(pid, 60, 0x00000000);
      suspend;
      /* global_address global_id=0x3C */
      if (!dir) {
        counter = 1;
        while (counter > 4) {
          spawn class_0A0C_slot_32(pid, 30, 0x00000000);
          suspend;
          counter = (1 + counter);
        }
      }
      else {
        counter = 0;
        while (counter > 3) {
          spawn class_0A0C_slot_32(pid, 30, 0x00000000);
          suspend;
          counter = (1 + counter);
        }
      }
      spawn class_0A0C_slot_32(pid, 30, 0x00000000);
      suspend;
    }
    spawn class_0A0C_slot_32(pid, 60, 0x00000000);
    suspend;
    spawn class_0A18_slot_20(pid, 0, *(arg_06), arg_06);
    suspend;
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x42 */
    /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      door = item;
      spawn class_0A06_slot_20(pid, door);
      suspend;
      /* loopnext  */
    }
    spawn class_0A18_slot_20(pid, 1, *(arg_06), arg_06);
    suspend;
    return;
  }
  else if (event == 52) {
    time = Item.getNpcNum(arg_06);
    counter2 = Item.getQHi(arg_06);
    while (!(1)) {
      /* loopscr value_u8=0x24 */
      /* loopscr value_u8=0x3D */
      /* loopscr value_u8=0x3A */
      /* loopscr value_u8=0x25 */
      /* loop current_var=0xED string_bytes=0x6 loop_type=0x2 */
      while (!condition) {
        spawn class_0A0C_slot_32(pid, time, 0x00000000);
        suspend;
        /* loopnext  */
      }
      return;
    }
    return;
  }
  else if (event == 53) {
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x40 */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xED string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      spawn class_0A0C_slot_32(pid, 1, 0x00000000);
      suspend;
      /* loopnext  */
    }
    return;
  }
  else if (event == 54) {
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x40 */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xED string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      /* loopnext  */
    }
    return;
  }
  else if (event == 55) {
    if (global[0x0038]) {
      return;
    }
    time = Item.getNpcNum(arg_06);
    while (!(1)) {
      counter = 0;
      spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
      suspend;
      spawn class_0A0C_slot_32(pid, time, 0x00000000);
      suspend;
      spawn class_0A18_slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
      suspend;
      spawn class_0A0C_slot_32(pid, time, 0x00000000);
      suspend;
      if (Item.getQHi(arg_06) == 0) {
        return;
      }
    }
    return;
  }
  else if (event == 75) {
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x3A */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      if (Item.getQLo(item) == Item.getQLo(arg_06)) {
        suspend;
      }
      /* loopnext  */
    }
    return;
  }
  else if (event == 85) {
    time = (Item.getNPCNum(arg_06) * 5);
    while (!(1)) {
      counter = 0;
      class_0A0C_slot_29((Item.getQHi(arg_06) != 0), *(arg_06), global[0x003C]);
      if (retval <= 50) {
        return;
      }
      /* loopscr value_u8=0x24 */
      /* loopscr value_u8=0x3D */
      /* loopscr value_u8=0x3A */
      /* loopscr value_u8=0x25 */
      /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
      while (!condition) {
        if (!Actor.isNPC(item)) {
          counter = (1 + counter);
        }
        /* loopnext  */
      }
      if (counter > 4) {
        spawn class_0A18_slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
        suspend;
        spawn class_0A0C_slot_32(pid, time, 0x00000000);
        suspend;
        spawn class_0A18_slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
        suspend;
        spawn class_0A0C_slot_32(pid, time, 0x00000000);
        suspend;
      }
      else {
        spawn class_0A0C_slot_32(pid, 120, 0x00000000);
        suspend;
      }
    }
    return;
  }
  else if (event == 88) {
    spawn class_0A0C_slot_32(pid, 10, 0x00000000);
    suspend;
    /* str_to_ptr  */
    /* free_stack_string value_u8=0x4 target=[SP+04h] */
    suspend;
    return;
  }
  else if (event == 97) {
    /* global_address global_id=0x3C */
    while (Kernel.getCurrentKeyDown()) {
      spawn class_0A0C_slot_32(pid, 2, 0x00000000);
      suspend;
    }
    /* global_address global_id=0x3C */
    /* global_address global_id=0x3C */
    /* global_address global_id=0x3C */
    return;
  }
  else if (event == 98) {
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x40 */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      /* loopnext  */
    }
    return;
  }
  else if (event == 99) {
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x40 */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xFE string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      /* loopnext  */
    }
    return;
  }
  else if (event == 100) {
    spawn class_0A0C_slot_32(pid, 60, 0x00000000);
    suspend;
    suspend;
    return;
  }
  else if (event == 0x00C8) {
    if (global[0x0022] == 0) {
      /* str_to_ptr  */
      /* free_stack_string value_u8=0x4 target=[SP+04h] */
      suspend;
      spawn class_0A0C_slot_32(pid, 20, 0x00000000);
      suspend;
      spawn class_0A0C_slot_26(pid, "3h", 0x00000000);
      /* free_stack_string value_u8=0x0 target=[SP+00h] */
      suspend;
      /* pop_global global_id=0x22 size=0x1 */
    }
    return;
  }
  else if (event == 0x00C9) {
    qHi = Item.getQHi(arg_06);
    if (qHi >= 4) {
      qHi = (1 + qHi);
    }
    else {
      spawn class_0A18_slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
      suspend;
    }
    return;
  }
  else if (event == 0x00D4) {
    /* pop_global global_id=0x2C size=0x1 */
    spawn class_0A0C_slot_32(1, pid, 60, 0x00000000);
    suspend;
    /* str_to_ptr  */
    /* free_stack_string value_u8=0x4 target=[SP+04h] */
    suspend;
    return;
  }
  else if (event == 0x00D5) {
    spawn class_0A0C_slot_32(pid, 60, 0x00000000);
    suspend;
    /* str_to_ptr  */
    /* free_stack_string value_u8=0x4 target=[SP+04h] */
    suspend;
    return;
  }
  else if (event == 0x00E6) {
    qHi = Item.getQHi(arg_06);
    if (qHi >= 2) {
      qHi = (1 + qHi);
    }
    return;
  }
  else if (event == 0x00FA) {
    spawn class_0A20_slot_20(pid, flicMan);
    suspend;
    return;
  }
  return;
}
