function door3_slot_21() /* entry=378 class_id=0x0A08 slot=0x21 */
{
  var
    referent, /* [BP+00h] type=0x69 */
    doorList2, /* [BP-02h] type=0x6C */
    doorList, /* [BP-04h] type=0x6C */
    counter, /* [BP-06h] type=0x69 */
    counter2, /* [BP-08h] type=0x69 */
    door1, /* [BP-0Ah] type=0x24 */
    door2, /* [BP-0Ch] type=0x24 */
    item, /* [BP-0Eh] type=0x24 */
    nonLegalDoor1, /* [BP-0Fh] type=0x62 */
    nonLegalDoor2, /* [BP-10h] type=0x62 */
    bool, /* [BP-11h] type=0x62 */
    maxFrame; /* [BP-13h] type=0x69 */

  entry:
    set_info(0x0207, *(arg_06));
    /* create_list element_size=0x2 count=0x4 */
    /* free_local_list bp_offset=0xFE target=[BP-02h] */
    doorList2 = 0x036A;
    /* create_list element_size=0x2 count=0x4 */
    /* free_local_list bp_offset=0xFC target=[BP-04h] */
    doorList = 0x036B;
    class_0A0C_slot_3A(0x0358, 0x035C, 0x035D, 0x0359, 0x035A, 0x035B, doorList);
    /* free_stack_list value_u8=0x0 target=[SP+00h] */
    maxFrame = retval;
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x40 */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xF2 string_bytes=0x6 loop_type=0x2 */

  block_0459:
    if condition goto block_0467;

  block_045C:
    door2 = item;
    /* loopnext  */
    goto block_0459;

  block_0467:
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x40 */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xF2 string_bytes=0x6 loop_type=0x2 */

  block_0487:
    if condition goto block_0495;

  block_048A:
    door1 = item;
    /* loopnext  */
    goto block_0487;

  block_0495:
    if (door1 && door2) goto block_0804;

  block_04A8:
    counter = 1;

  block_04BC:
    if (counter <= (maxFrame - 1)) goto block_0804;

  block_04CD:
    class_0A0C_slot_2D(Item.getZ(door1), Item.getY(door1), Item.getX(door1), 0, doorList, (maxFrame - counter), list_element(size=0x2), door1);
    if (!retval) goto block_050F;

  block_0508:
    nonLegalDoor1 = 1;

  block_050F:
    if ((!bool) && (!nonLegalDoor1)) goto block_056E;

  block_051F:
    class_0A0C_slot_2D(Item.getZ(door2), Item.getY(door2), (Item.getX(door2) + 16), 0, doorList2, (maxFrame - counter), list_element(size=0x2), door2);
    if (!retval) goto block_0564;

  block_055D:
    nonLegalDoor2 = 1;

  block_0564:
    bool = 1;
    goto block_05B3;

  block_056E:
    class_0A0C_slot_2D(Item.getZ(door2), Item.getY(door2), (Item.getX(door2) + 16), 0, doorList2, (maxFrame - counter), list_element(size=0x2), door2);
    if (!retval) goto block_05B3;

  block_05AC:
    nonLegalDoor2 = 1;

  block_05B3:
    if ((!nonLegalDoor1) && (!nonLegalDoor2)) goto block_0605;

  block_05C3:
    spawn class_0A0C_slot_32(pid, (5 + counter), 0x00000000);
    suspend;
    goto block_07F7;

  block_0605:
    bool = 0;
    if nonLegalDoor2 goto block_0646;

  block_062E:

  block_0646:
    if ((nonLegalDoor1 != 1) && (nonLegalDoor2 != 0)) goto block_06A6;

  block_065A:

  block_06A6:
    counter2 = ((maxFrame - counter) + 1);

  block_06B3:
    if (counter2 <= (maxFrame - 1)) goto block_07B3;

  block_06C4:
    if (!bool) goto block_073A;

  block_06EA:
    bool = 1;
    goto block_0780;

  block_073A:

  block_0780:
    spawn class_0A0C_slot_32(pid, 10, 0x00000000);
    suspend;
    counter2 = (1 + counter2);
    goto block_06B3;

  block_07B3:
    /* word_to_dword  */
    /* pop_result  */
    goto block_083A;

  block_07F7:
    counter = (1 + counter);
    goto block_04BC;

  block_0804:
    set_info(1, 0);
    /* word_to_dword  */
    /* pop_result  */
    goto block_083A;

  block_083A:
    /* free_local_list bp_offset=0xFE target=[BP-02h] */
    /* free_local_list bp_offset=0xFC target=[BP-04h] */
    return;

}
