function door2_slot_31() /* entry=377 class_id=0x0A07 slot=0x31 */
{
  var
    referent, /* [BP+00h] type=0x69 */
    doorList, /* [BP-02h] type=0x6C */
    doorList2, /* [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=0x5 */
    /* free_local_list bp_offset=0xFE target=[BP-02h] */
    doorList = 0x0189;
    /* create_list element_size=0x2 count=0x5 */
    /* free_local_list bp_offset=0xFC target=[BP-04h] */
    doorList2 = 0x0187;
    class_0A0C_slot_3A(0x0193, 0x0192, 0x0191, 0x0190, 0x018D, 0x018C, 0x018B, 0x018A, 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_1B61:
    if condition goto block_1B6F;

  block_1B64:
    door1 = item;
    /* loopnext  */
    goto block_1B61;

  block_1B6F:
    /* 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_1B8F:
    if condition goto block_1B9D;

  block_1B92:
    door2 = item;
    /* loopnext  */
    goto block_1B8F;

  block_1B9D:
    if (door1 && door2) goto block_1E43;

  block_1BB0:
    counter = 1;

  block_1BC4:
    if (counter <= (maxFrame - 1)) goto block_1E43;

  block_1BD5:
    class_0A0C_slot_2D(Item.getZ(door1), Item.legal_create(door1), Intrinsic0013(door1), 0, doorList, (maxFrame - counter), list_element(size=0x2), door1);
    if (!retval) goto block_1C17;

  block_1C10:
    nonLegalDoor1 = 1;

  block_1C17:
    class_0A0C_slot_2D(Item.getZ(door2), Item.legal_create(door2), (Intrinsic0013(door2) + 16), 0, doorList2, (maxFrame - counter), list_element(size=0x2), door2);
    if (!retval) goto block_1C5C;

  block_1C55:
    nonLegalDoor2 = 1;

  block_1C5C:
    if ((!nonLegalDoor1) && (!nonLegalDoor2)) goto block_1CAB;

  block_1C6C:
    spawn class_0A0C_slot_32(pid, 5, 0x00000000);
    suspend;
    goto block_1E36;

  block_1CAB:
    spawn class_0A0C_slot_32(pid, 30, 0x00000000);
    suspend;
    if nonLegalDoor1 goto block_1D25;

  block_1CD9:

  block_1D25:
    if nonLegalDoor2 goto block_1D45;

  block_1D2D:

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

  block_1D52:
    if (counter2 <= maxFrame) goto block_1E2C;

  block_1D5D:
    if (!bool) goto block_1DD0;

  block_1DA0:
    bool = 1;
    goto block_1DF9;

  block_1DD0:

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

  block_1E2C:
    /* word_to_dword  */
    /* pop_result  */
    goto block_1E4D;

  block_1E36:
    counter = (1 + counter);
    goto block_1BC4;

  block_1E43:
    /* word_to_dword  */
    /* pop_result  */
    goto block_1E4D;

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

}
