
/*
 * ?CreateBeacon@TethysGame@@SIHW4map_id@@HHHHH@Z
 * public: static int __fastcall TethysGame::CreateBeacon(enum map_id,int,int,int,int,int)
 */
int32_t CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z = 0xd5ba;

uint32_t fun_11001de0(int32_t ecx, int32_t a2, int32_t a3, int32_t a4, int32_t a5) {
    uint32_t eax6;
    int32_t eax7;
    int32_t eax8;
    uint32_t eax9;
    int32_t eax10;
    uint32_t edx11;

    eax6 = eax7 - (eax8 + reinterpret_cast<uint1_t>(eax9 < eax10 + reinterpret_cast<uint1_t>(edx11 < 1))) & 2;
    switch (ecx) {
        addr_0x11001fdd_3:
    default:
        return eax6;
    case 0:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 4;
    case 1:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 34;
    case 2:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0x8e;
    case 3:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 94;
    case 4:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 18;
    case 5:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 66;
    case 6:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0x71;
    case 7:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 72;
    case 8:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0x9d;
    case 9:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xd7;
    case 10:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0x9b;
    case 11:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xbf;
    case 12:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xc6;
    case 13:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xed;
    case 14:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xe5;
    case 15:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xe3;
    case 16:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xbe;
    case 17:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 61;
    case 18:
        eax6 = reinterpret_cast<uint32_t>(CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81, 87, 0, eax6, 0xff));
        goto addr_0x11001fdd_3;
    }
}

void fun_11001c70(int32_t ecx, int32_t a2, int32_t a3, int32_t a4, int32_t a5) {
    switch (ecx) {
        addr_0x11001db3_3:
    default:
        return;
    case 0:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xcf;
    case 1:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xdf;
    case 2:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xe5;
    case 3:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xfb;
    case 4:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xfb;
    case 5:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xdd;
    case 6:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xf6;
    case 7:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xe9;
    case 8:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xe9;
    case 9:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xd7;
    case 10:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81, 0xc9, 1, 2, 0xff);
        goto addr_0x11001db3_3;
    }
}

void fun_11001af0(int32_t ecx, int32_t a2, int32_t a3, int32_t a4, int32_t a5) {
    int32_t edx6;

    switch (ecx) {
        addr_0x11001c31_3:
    default:
        return;
    case 0:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xa4;
    case 1:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0xbc;
    case 2:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0x87;
    case 3:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0x80;
    case 4:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 0x9b;
    case 5:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 78;
    case 6:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 27;
    case 7:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 12;
    case 8:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 17;
    case 9:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 55;
    case 10:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto 74;
    case 11:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81, 0xf7, edx6, 1, 0xff);
        goto addr_0x11001c31_3;
    }
}

void fun_11001930(int32_t ecx, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6) {
    int32_t edx7;
    int32_t edx8;
    int32_t edx9;
    int32_t edx10;
    int32_t edx11;
    int32_t edx12;
    int32_t edx13;
    int32_t edx14;
    int32_t edx15;
    int32_t edx16;
    int32_t edx17;
    int32_t edx18;

    switch (ecx) {
        addr_0x11001ab7_3:
    default:
        return;
    case 0:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto edx7;
    case 1:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto edx8;
    case 2:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto edx9;
    case 3:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto edx10;
    case 4:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto edx11;
    case 5:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto edx12;
    case 6:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto edx13;
    case 7:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto edx14;
    case 8:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto edx15;
    case 9:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto edx16;
    case 10:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81);
        goto edx17;
    case 11:
        CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81, 0x8c, edx18, a2, 0xff);
        goto addr_0x11001ab7_3;
    }
}

struct s0 {
    signed char[12] pad12;
    int32_t f12;
    uint32_t f16;
    int32_t f20;
};

/* ?Player@@3PAV_Player@@A */
struct s0* Player_3PAV_Player_A = reinterpret_cast<struct s0*>(0xd4ba);

/*
 * ?Difficulty@_Player@@QBEHXZ
 * public: int __thiscall _Player::Difficulty(void)const
 */
int32_t Difficulty__Player_QBEHXZ = 0xd636;

/*
 * ?GetRand@TethysGame@@SIHH@Z
 * public: static int __fastcall TethysGame::GetRand(int)
 */
int32_t GetRand_TethysGame_SIHH_Z = 0xd696;

void fun_11002030(struct s0* ecx, int32_t a2, int32_t a3, int32_t a4, int32_t a5) {
    struct s0* ecx6;
    int32_t edi7;
    int32_t esi8;
    int32_t eax9;
    int32_t esi10;
    int32_t edi11;
    int32_t eax12;
    int32_t eax13;
    int32_t eax14;
    int32_t eax15;
    int32_t eax16;
    int32_t eax17;
    int32_t eax18;
    int32_t eax19;
    int32_t eax20;
    int32_t eax21;
    int32_t eax22;
    int32_t eax23;
    int32_t eax24;
    int32_t eax25;

    ecx6 = Player_3PAV_Player_A;
    eax9 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx6, edi7, esi8, __return_address()));
    if (eax9) {
        esi10 = GetRand_TethysGame_SIHH_Z;
        edi11 = CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z;
    } else {
        esi10 = GetRand_TethysGame_SIHH_Z;
        eax12 = reinterpret_cast<int32_t>(esi10(13, 1, 2, 0xff, edi7, esi8, __return_address()));
        esi10(16, eax12 + 15, 1, 2, 0xff, edi7, esi8, __return_address());
        edi11 = CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z;
        edi11(81, eax12 + 15, 1, 2, 0xff, edi7, esi8, __return_address());
    }
    eax13 = reinterpret_cast<int32_t>(esi10(14, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(13, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax14 = reinterpret_cast<int32_t>(esi10(9, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(12, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax15 = reinterpret_cast<int32_t>(esi10(11, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(12, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax16 = reinterpret_cast<int32_t>(esi10(6, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(13, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax17 = reinterpret_cast<int32_t>(esi10(11, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(8, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax18 = reinterpret_cast<int32_t>(esi10(8, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(10, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax19 = reinterpret_cast<int32_t>(esi10(12, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(15, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax20 = reinterpret_cast<int32_t>(esi10(12, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(12, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax21 = reinterpret_cast<int32_t>(esi10(12, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(12, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax22 = reinterpret_cast<int32_t>(esi10(9, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(9, eax22 + 0xef, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax22 + 0xef, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax23 = reinterpret_cast<int32_t>(esi10(14, 0, 0xff, 0xff, eax22 + 0xef, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(13, eax23 + 5, 0, 0xff, 0xff, eax22 + 0xef, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax23 + 5, 0, 0xff, 0xff, eax22 + 0xef, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax24 = reinterpret_cast<int32_t>(esi10(4, 0, 0xff, 0xff, eax23 + 5, 0, 0xff, 0xff, eax22 + 0xef, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(13, eax24 + 0x86, 0, 0xff, 0xff, eax23 + 5, 0, 0xff, 0xff, eax22 + 0xef, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax24 + 0x86, 0, 0xff, 0xff, eax23 + 5, 0, 0xff, 0xff, eax22 + 0xef, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    eax25 = reinterpret_cast<int32_t>(esi10(4, 0, 0xff, 0xff, eax24 + 0x86, 0, 0xff, 0xff, eax23 + 5, 0, 0xff, 0xff, eax22 + 0xef, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address()));
    esi10(13, eax25 + 0x8a, 0, 0xff, 0xff, eax24 + 0x86, 0, 0xff, 0xff, eax23 + 5, 0, 0xff, 0xff, eax22 + 0xef, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    edi11(81, eax25 + 0x8a, 0, 0xff, 0xff, eax24 + 0x86, 0, 0xff, 0xff, eax23 + 5, 0, 0xff, 0xff, eax22 + 0xef, 0, 0xff, 0xff, eax21 + 0x6c, 0, 0xff, 0xff, eax20 + 46, 0, 0xff, 0xff, eax19 + 0x68, 0, 0xff, 0xff, eax18 + 0x6e, 0, 0xff, 0xff, eax17 + 0x76, 1, 0xff, 0xff, eax16 + 0xa8, 1, 0xff, 0xff, eax15 + 0xe2, 1, 0xff, 0xff, eax14 + 0xf0, 1, 0xff, 0xff, eax13 + 0x6b, 1, 0xff, 0xff, edi7, esi8, __return_address());
    esi10(4);
    esi10(13);
    edi11(81);
    goto 0xff;
}

struct s1 {
    struct s1* f0;
    signed char[3] pad4;
    signed char f4;
    signed char[11] pad16;
    int32_t f16;
};

struct s2 {
    struct s2* f0;
    signed char[2060] pad2064;
    struct s1* f2064;
};

signed char* fun_11007270(struct s1* a1, struct s2** a2, void** a3);

int32_t HeapSize = 0xdede;

void* fun_110061b0(struct s1* a1) {
    void* esp2;
    signed char* eax3;
    int32_t esi4;
    uint32_t ecx5;

    esp2 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 8);
    eax3 = fun_11007270(a1, reinterpret_cast<int32_t>(esp2) - 4 + 4, reinterpret_cast<int32_t>(esp2) + 4);
    if (!eax3) {
        HeapSize();
        goto esi4;
    } else {
        ecx5 = 0;
        *reinterpret_cast<signed char*>(&ecx5) = *eax3;
        return ecx5 << 4;
    }
}

struct s3 {
    signed char[2064] pad2064;
    uint32_t f2064;
};

struct s1* fun_11006200(void* a1);

void fun_110077f0(struct s1* a1);

int32_t g1100cfc4;

int32_t HeapReAlloc = 0xdec4;

void* g1100bf94 = reinterpret_cast<void*>(0x1e0);

struct s4 {
    signed char[2064] pad2064;
    int32_t f2064;
};

struct s5 {
    signed char* f0;
    int32_t f4;
    signed char f8;
    signed char[239] pad248;
    signed char f248;
};

int32_t fun_11007720(struct s4* a1, struct s5* a2, signed char* a3, void* a4);

struct s1* fun_11007320(void* a1);

void fun_110072d0(struct s3* a1, void* a2, signed char* a3, int32_t a4, signed char* a5, void* a6);

int32_t HeapAlloc = 0xded2;

int32_t g1100b774 = 0;

int32_t fun_11006f90(void* a1);

struct s1* fun_11006000(struct s1* a1, void* a2) {
    struct s3* v3;
    struct s3* ebx4;
    void* v5;
    void* esi6;
    void* ebx7;
    signed char* v8;
    signed char* edi9;
    int32_t* esp10;
    int32_t v11;
    int32_t ebp12;
    struct s1* eax13;
    struct s1* v14;
    signed char* eax15;
    signed char* ebp16;
    int32_t ecx17;
    int32_t eax18;
    int1_t cf19;
    void* esi20;
    struct s4* v21;
    struct s5* v22;
    int32_t eax23;
    struct s1* eax24;
    uint32_t eax25;
    void* eax26;
    struct s1* edi27;
    struct s1* esi28;
    signed char** esp29;
    signed char* v30;
    uint32_t ecx31;
    uint32_t ecx32;
    struct s3* v33;
    void* v34;
    void* v35;
    int32_t eax36;
    int32_t v37;
    signed char* eax38;
    uint32_t eax39;
    void* eax40;
    signed char* edi41;
    signed char* esi42;
    signed char* v43;
    signed char** esp44;
    signed char* v45;
    uint32_t ecx46;
    uint32_t ecx47;
    int1_t zf48;
    int32_t eax49;

    v3 = ebx4;
    v5 = esi6;
    ebx7 = a2;
    v8 = edi9;
    esp10 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 12 - 4 - 4 - 4 - 4);
    v11 = ebp12;
    if (!a1) {
        eax13 = fun_11006200(ebx7);
        return eax13;
    }
    if (!ebx7) {
        fun_110077f0(a1);
        return 0;
    }
    if (reinterpret_cast<uint32_t>(ebx7) <= 0xffffffe0) {
        if (!ebx7) {
            ebx7 = reinterpret_cast<void*>(16);
        } else {
            ebx7 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ebx7) + 15 & 0xfffffff0);
        }
    }
    do {
        v14 = reinterpret_cast<struct s1*>(0);
        if (reinterpret_cast<uint32_t>(ebx7) <= 0xffffffe0) {
            eax15 = fun_11007270(a1, esp10 + 6, esp10 + 5);
            esp10 = esp10 - 1 - 1 - 1 - 1 + 1 + 3;
            ebp16 = eax15;
            if (!ebp16) {
                ecx17 = g1100cfc4;
                eax18 = reinterpret_cast<int32_t>(HeapReAlloc(ecx17, 0, a1, ebx7));
                esp10 = esp10 - 1 - 1 - 1 - 1 - 1 + 1;
                v11 = eax18;
            } else {
                cf19 = reinterpret_cast<uint32_t>(ebx7) < reinterpret_cast<uint32_t>(g1100bf94);
                if (cf19) {
                    esi20 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ebx7) >> 4);
                    eax23 = fun_11007720(v21, v22, ebp16, esi20);
                    esp10 = esp10 - 1 - 1 - 1 - 1 - 1 + 1 + 4;
                    if (!eax23) {
                        eax24 = fun_11007320(esi20);
                        v14 = eax24;
                        esp10 = esp10 - 1 - 1 + 1 + 1;
                        if (eax24) {
                            eax25 = 0;
                            *reinterpret_cast<signed char*>(&eax25) = *ebp16;
                            eax26 = reinterpret_cast<void*>(eax25 << 4);
                            if (reinterpret_cast<uint32_t>(eax26) >= reinterpret_cast<uint32_t>(ebx7)) {
                                eax26 = ebx7;
                            }
                            edi27 = v14;
                            esi28 = a1;
                            esp29 = reinterpret_cast<signed char**>(esp10 - 1);
                            v30 = ebp16;
                            ecx31 = reinterpret_cast<uint32_t>(eax26) >> 2;
                            while (ecx31) {
                                --ecx31;
                                *reinterpret_cast<struct s1**>(&edi27->f0) = *reinterpret_cast<struct s1**>(&esi28->f0);
                                edi27 = reinterpret_cast<struct s1*>(&edi27->f4);
                                esi28 = reinterpret_cast<struct s1*>(&esi28->f4);
                            }
                            ecx32 = reinterpret_cast<uint32_t>(eax26) & 3;
                            while (ecx32) {
                                --ecx32;
                                *reinterpret_cast<struct s1**>(&edi27->f0) = *reinterpret_cast<struct s1**>(&esi28->f0);
                                edi27 = reinterpret_cast<struct s1*>(&edi27->pad4);
                                esi28 = reinterpret_cast<struct s1*>(&esi28->pad4);
                            }
                            fun_110072d0(v33, v34, v30, v11, v8, v5);
                            esp10 = reinterpret_cast<int32_t*>(esp29 - 1 - 1 - 1 + 1 + 3);
                        }
                    } else {
                        v14 = a1;
                    }
                }
                if (v14) 
                    break;
                v35 = ebx7;
                eax36 = g1100cfc4;
                v37 = eax36;
                eax38 = reinterpret_cast<signed char*>(HeapAlloc(v37, 0, v35));
                esp10 = esp10 - 1 - 1 - 1 - 1 + 1;
                v8 = eax38;
                if (eax38) {
                    eax39 = 0;
                    *reinterpret_cast<signed char*>(&eax39) = *ebp16;
                    eax40 = reinterpret_cast<void*>(eax39 << 4);
                    if (reinterpret_cast<uint32_t>(eax40) >= reinterpret_cast<uint32_t>(ebx7)) {
                        eax40 = ebx7;
                    }
                    edi41 = v8;
                    esi42 = v43;
                    esp44 = reinterpret_cast<signed char**>(esp10 - 1);
                    v45 = ebp16;
                    ecx46 = reinterpret_cast<uint32_t>(eax40) >> 2;
                    while (ecx46) {
                        --ecx46;
                        *edi41 = *esi42;
                        edi41 = edi41 + 4;
                        esi42 = esi42 + 4;
                    }
                    ecx47 = reinterpret_cast<uint32_t>(eax40) & 3;
                    while (ecx47) {
                        --ecx47;
                        *edi41 = *esi42;
                        ++edi41;
                        ++esi42;
                    }
                    fun_110072d0(v3, v5, v45, v37, 0, v35);
                    esp10 = reinterpret_cast<int32_t*>(esp44 - 1 - 1 - 1 + 1 + 3);
                }
            }
        }
        if (v14) 
            break;
        zf48 = g1100b774 == 0;
        if (zf48) 
            break;
        eax49 = fun_11006f90(ebx7);
        esp10 = esp10 - 1 - 1 + 1 + 1;
    } while (eax49);
    goto addr_0x11006192_39;
    return v14;
    addr_0x11006192_39:
    return 0;
}

int32_t g1100b45c = 0;

int32_t g1100b460 = 0;

void fun_11006d50();

void fun_11006d90(int32_t a1);

int32_t __image_base = 0x11005f00;

struct s1* fun_11005e90(int32_t a1) {
    int32_t eax2;
    int1_t zf3;
    struct s1* eax4;

    eax2 = g1100b45c;
    if (eax2 == 1 || !eax2 && (zf3 = g1100b460 == 1, zf3)) {
        fun_11006d50();
    }
    fun_11006d90(a1);
    eax4 = reinterpret_cast<struct s1*>(__image_base(0xff));
    return eax4;
}

void fun_11006d10(int32_t a1, int32_t a2, int32_t a3, int32_t a4) {
    g1100b460 = a1;
    return;
}

struct s1* g1100cec0;

uint32_t g1100cfc0;

int32_t GetStartupInfoA = 0xdf44;

int32_t GetStdHandle = 0xdf34;

struct s6 {
    uint32_t f0;
    unsigned char f4;
};

struct s7 {
    struct s1* f0;
    signed char[3] pad4;
    unsigned char f4;
};

int32_t GetFileType = 0xdf26;

int32_t SetHandleCount = 0xdf14;

struct s8 {
    int32_t f0;
    unsigned char f4;
};

void fun_11006330() {
    struct s1* eax1;
    struct s1* esi2;
    struct s1* eax3;
    int16_t v4;
    int32_t v5;
    int32_t esi6;
    int32_t ebx7;
    uint32_t esi8;
    struct s6* v9;
    unsigned char* edi10;
    int32_t* ebx11;
    int1_t less12;
    struct s7* edi13;
    uint32_t eax14;
    struct s1* eax15;
    uint32_t eax16;
    uint32_t eax17;
    int32_t v18;
    uint32_t ebp19;
    int32_t v20;
    int32_t eax21;
    struct s8* ecx22;
    struct s1** ebp23;
    struct s1* eax24;
    int1_t less25;

    eax1 = fun_11006200(0x100);
    esi2 = eax1;
    if (!esi2) {
        fun_11005e90(27);
    }
    g1100cec0 = esi2;
    g1100cfc0 = 32;
    if (reinterpret_cast<unsigned char>(reinterpret_cast<unsigned char>(esi2) + 0x100) > reinterpret_cast<unsigned char>(esi2)) {
        do {
            esi2->f4 = 0;
            esi2 = reinterpret_cast<struct s1*>(reinterpret_cast<unsigned char>(esi2) + 8);
            *reinterpret_cast<int32_t*>(reinterpret_cast<unsigned char>(esi2) + 0xfffffff8) = -1;
            *reinterpret_cast<signed char*>(reinterpret_cast<unsigned char>(esi2) + 0xfffffffd) = 10;
            eax3 = g1100cec0;
        } while (reinterpret_cast<unsigned char>(reinterpret_cast<unsigned char>(eax3) + 0x100) > reinterpret_cast<unsigned char>(esi2));
    }
    GetStartupInfoA();
    if (!v4 || !v5) {
        addr_0x1100647d_7:
        esi6 = 0;
        ebx7 = GetStdHandle;
    } else {
        esi8 = v9->f0;
        edi10 = &v9->f4;
        ebx11 = reinterpret_cast<int32_t*>(esi8 + reinterpret_cast<uint32_t>(edi10));
        if (reinterpret_cast<int32_t>(esi8) >= reinterpret_cast<int32_t>(0x800)) {
            esi8 = 0x800;
        }
        less12 = reinterpret_cast<int32_t>(g1100cfc0) < reinterpret_cast<int32_t>(esi8);
        if (!less12) 
            goto addr_0x11006433_11; else 
            goto addr_0x110063d6_12;
    }
    do {
        edi13 = reinterpret_cast<struct s7*>(esi6 * 8 + reinterpret_cast<unsigned char>(g1100cec0));
        if (!reinterpret_cast<int1_t>(edi13->f0 == 0xffffffff)) {
            edi13->f4 = reinterpret_cast<unsigned char>(edi13->f4 | 0x80);
        } else {
            eax14 = 0xfffffff6;
            edi13->f4 = 0x81;
            if (esi6) {
                eax14 = 12 - reinterpret_cast<uint1_t>(esi6 + 0xffffffff < 1);
            }
            eax15 = reinterpret_cast<struct s1*>(ebx7(eax14));
            if (eax15 == 0xffffffff || (eax16 = reinterpret_cast<uint32_t>(GetFileType(eax15, eax14)), eax16 == 0)) {
                edi13->f4 = reinterpret_cast<unsigned char>(edi13->f4 | 64);
            } else {
                eax17 = eax16 & 0xff;
                edi13->f0 = eax15;
                if (eax17 != 2) {
                    if (eax17 == 3) {
                        edi13->f4 = reinterpret_cast<unsigned char>(edi13->f4 | 8);
                    }
                } else {
                    edi13->f4 = reinterpret_cast<unsigned char>(edi13->f4 | 64);
                }
            }
        }
        ++esi6;
    } while (esi6 < 3);
    SetHandleCount();
    goto v18;
    addr_0x11006433_11:
    ebp19 = 0;
    if (!(reinterpret_cast<uint1_t>(reinterpret_cast<int32_t>(esi8) < reinterpret_cast<int32_t>(0)) | reinterpret_cast<uint1_t>(esi8 == 0))) {
        do {
            if (*ebx11 != -1 && (*edi10 & 1 && (*edi10 & 8 || (v20 = *ebx11, eax21 = reinterpret_cast<int32_t>(GetFileType(v20)), !!eax21)))) {
                ecx22 = reinterpret_cast<struct s8*>(*reinterpret_cast<int32_t**>((reinterpret_cast<int32_t>(ebp19 & 0xffffffe7) >> 3) + 0x1100cec0) + (ebp19 & 31) * 2);
                ecx22->f0 = *ebx11;
                ecx22->f4 = *edi10;
            }
            ++ebp19;
            ++edi10;
            ++ebx11;
        } while (reinterpret_cast<int32_t>(ebp19) < reinterpret_cast<int32_t>(esi8));
        goto addr_0x1100647d_7;
    }
    addr_0x110063d6_12:
    ebp23 = reinterpret_cast<struct s1**>(0x1100cec4);
    do {
        eax24 = fun_11006200(0x100);
        if (!eax24) 
            break;
        *ebp23 = eax24;
        g1100cfc0 = g1100cfc0 + 32;
        if (reinterpret_cast<unsigned char>(reinterpret_cast<unsigned char>(eax24) + 0x100) > reinterpret_cast<unsigned char>(eax24)) {
            do {
                eax24->f4 = 0;
                eax24 = reinterpret_cast<struct s1*>(reinterpret_cast<unsigned char>(eax24) + 8);
                *reinterpret_cast<int32_t*>(reinterpret_cast<unsigned char>(eax24) + 0xfffffff8) = -1;
                *reinterpret_cast<signed char*>(reinterpret_cast<unsigned char>(eax24) + 0xfffffffd) = 10;
            } while (reinterpret_cast<unsigned char>(reinterpret_cast<unsigned char>(*ebp23) + 0x100) > reinterpret_cast<unsigned char>(eax24));
        }
        ebp23 = ebp23 + 4;
        less25 = reinterpret_cast<int32_t>(g1100cfc0) < reinterpret_cast<int32_t>(esi8);
    } while (less25);
    goto addr_0x1100642b_33;
    esi8 = g1100cfc0;
    goto addr_0x11006433_11;
    addr_0x1100642b_33:
    goto addr_0x11006433_11;
}

int32_t fun_110068b0(signed char a1);

int32_t fun_11006b70() {
    int32_t eax1;

    eax1 = fun_110068b0(0xfd);
    return eax1;
}

int32_t GetModuleFileNameA = 0xdf56;

struct s1** g1100cfd4;

struct s1** g1100b49c = reinterpret_cast<struct s1**>(0);

void fun_110066d0(struct s1** a1, struct s1* a2, struct s1* a3, int32_t* a4, int32_t* a5);

struct s1* g1100b484 = reinterpret_cast<struct s1*>(0);

int32_t g1100b480 = 0;

void fun_11006630() {
    struct s1** esi1;
    void* esp2;
    struct s1** eax3;
    void* edi4;
    struct s1* eax5;
    void* esp6;
    int32_t esi7;

    esi1 = reinterpret_cast<struct s1**>(0x1100cdb0);
    GetModuleFileNameA();
    esp2 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 8 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
    eax3 = g1100cfd4;
    g1100b49c = reinterpret_cast<struct s1**>(0x1100cdb0);
    if (*eax3) {
        esi1 = g1100cfd4;
    }
    fun_110066d0(esi1, 0, 0, reinterpret_cast<int32_t>(esp2) + 8, reinterpret_cast<int32_t>(esp2) + 12);
    eax5 = fun_11006200(0x410 + reinterpret_cast<uint32_t>(edi4));
    esp6 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp2) - 4 - 4 - 4 - 4 - 4 - 4 + 4 + 20 - 4 - 4 + 4 + 4);
    if (!eax5) {
        fun_11005e90(8);
        esp6 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp6) - 4 - 4 + 4 + 4);
    }
    fun_110066d0(esi1, eax5, eax5 + 52, reinterpret_cast<int32_t>(esp6) + 8, reinterpret_cast<int32_t>(esp6) + 12);
    g1100b484 = eax5;
    g1100b480 = 0x103;
    goto esi7;
}

struct s1* g1100b450 = reinterpret_cast<struct s1*>(0);

struct s1* g1100b48c = reinterpret_cast<struct s1*>(0);

void fun_11006540() {
    struct s1* edx1;
    struct s1** esi2;
    struct s1* edi3;
    int32_t ecx4;
    int32_t eax5;
    struct s1* eax6;
    struct s1* ebx7;
    struct s1* ebp8;
    struct s1* eax9;
    struct s1* edi10;
    int32_t ecx11;
    void* ecx12;
    void* v13;
    struct s1* eax14;
    struct s1* edi15;
    int32_t ecx16;
    void* eax17;
    struct s1* ecx18;
    uint32_t ecx19;
    struct s1* edi20;
    uint32_t ecx21;
    struct s1* eax22;

    edx1 = g1100b450;
    esi2 = reinterpret_cast<struct s1**>(0);
    if (*reinterpret_cast<struct s1**>(&edx1->f0)) {
        do {
            if (*reinterpret_cast<struct s1**>(&edx1->f0) != 61) {
                ++esi2;
            }
            edi3 = edx1;
            ecx4 = -1;
            eax5 = eax5 - eax5;
            do {
                if (!ecx4) 
                    break;
                --ecx4;
                edi3 = reinterpret_cast<struct s1*>(&edi3->pad4);
                ++esi2;
            } while (*reinterpret_cast<struct s1**>(&edi3->f0) != *reinterpret_cast<struct s1**>(&eax5));
            edx1 = reinterpret_cast<struct s1*>(reinterpret_cast<unsigned char>(edx1) + ~ecx4);
        } while (*reinterpret_cast<struct s1**>(&edx1->f0));
    }
    eax6 = fun_11006200(reinterpret_cast<uint32_t>(esi2) * 4 + 4);
    g1100b48c = eax6;
    ebx7 = eax6;
    if (!ebx7) {
        fun_11005e90(9);
    }
    ebp8 = g1100b450;
    eax9 = ebp8;
    if (*reinterpret_cast<struct s1**>(&ebp8->f0)) {
        do {
            edi10 = ebp8;
            ecx11 = -1;
            eax9 = reinterpret_cast<struct s1*>(reinterpret_cast<unsigned char>(eax9) - reinterpret_cast<unsigned char>(eax9));
            do {
                if (!ecx11) 
                    break;
                --ecx11;
                edi10 = reinterpret_cast<struct s1*>(&edi10->pad4);
            } while (*reinterpret_cast<struct s1**>(&edi10->f0) != eax9);
            ecx12 = reinterpret_cast<void*>(~ecx11);
            v13 = ecx12;
            if (*reinterpret_cast<struct s1**>(&ebp8->f0) != 61) {
                eax14 = fun_11006200(ecx12);
                *reinterpret_cast<struct s1**>(&ebx7->f0) = eax14;
                if (!eax14) {
                    eax14 = fun_11005e90(9);
                }
                edi15 = ebp8;
                ecx16 = -1;
                eax17 = reinterpret_cast<void*>(reinterpret_cast<unsigned char>(eax14) - reinterpret_cast<unsigned char>(eax14));
                do {
                    if (!ecx16) 
                        break;
                    --ecx16;
                    edi15 = reinterpret_cast<struct s1*>(&edi15->pad4);
                } while (*reinterpret_cast<struct s1**>(&edi15->f0) != *reinterpret_cast<struct s1**>(&eax17));
                ecx18 = reinterpret_cast<struct s1*>(~ecx16);
                eax9 = ecx18;
                ecx19 = reinterpret_cast<unsigned char>(ecx18) >> 2;
                esi2 = reinterpret_cast<struct s1**>(reinterpret_cast<unsigned char>(edi15) - reinterpret_cast<unsigned char>(ecx18));
                edi20 = *reinterpret_cast<struct s1**>(&ebx7->f0);
                ebx7 = reinterpret_cast<struct s1*>(&ebx7->f4);
                while (ecx19) {
                    --ecx19;
                    *reinterpret_cast<struct s1**>(&edi20->f0) = *esi2;
                    edi20 = reinterpret_cast<struct s1*>(&edi20->f4);
                    esi2 = esi2 + 4;
                }
                ecx21 = reinterpret_cast<unsigned char>(eax9) & 3;
                while (ecx21) {
                    --ecx21;
                    *reinterpret_cast<struct s1**>(&edi20->f0) = *esi2;
                    edi20 = reinterpret_cast<struct s1*>(&edi20->pad4);
                    ++esi2;
                }
            }
            ebp8 = reinterpret_cast<struct s1*>(reinterpret_cast<unsigned char>(ebp8) + reinterpret_cast<uint32_t>(v13));
        } while (*reinterpret_cast<struct s1**>(&ebp8->f0));
    }
    eax22 = g1100b450;
    fun_110077f0(eax22);
    g1100b450 = reinterpret_cast<struct s1*>(0);
    *reinterpret_cast<struct s1**>(&ebx7->f0) = reinterpret_cast<struct s1*>(0);
    return;
}

int32_t g1100cfd0;

void fun_11005fe0(int32_t* a1, int32_t* a2);

void fun_11005ed0() {
    int32_t eax1;

    eax1 = g1100cfd0;
    if (eax1) {
        eax1();
    }
    fun_11005fe0(0x1100908c, 0x11009094);
    fun_11005fe0(0x11009000, 0x11009088);
    return;
}

void fun_11005f30(int32_t a1, int32_t a2, int32_t a3);

void fun_11005f20() {
    fun_11005f30(0, 0, 1);
    return;
}

int32_t g1100b44c = 0;

int32_t g1100b4a8 = 0;

void fun_11006510();

void fun_110062f0();

int32_t GetVersion = 0xde80;

uint32_t g1100b470 = 0;

int32_t GetModuleHandleA = 0xde6c;

int32_t GetProcAddress = 0xde5a;

int32_t fun_110062b0();

int32_t g1100b47c = 0;

uint32_t g1100b478 = 0;

uint32_t g1100b474 = 0;

int32_t GetCommandLineA = 0xde48;

struct s1* fun_11006b80();

int16_t fun_11005ca0(int32_t a1, int32_t a2, int32_t a3) {
    int32_t eax4;
    int1_t zf5;
    uint32_t eax6;
    int1_t zf7;
    int32_t eax8;
    int32_t eax9;
    int32_t eax10;
    int32_t edx11;
    uint32_t ecx12;
    uint32_t eax13;
    struct s1** eax14;
    struct s1* eax15;
    int1_t zf16;

    if (a2 != 1) {
        if (!a2) {
            eax4 = g1100b44c;
            if (reinterpret_cast<uint1_t>(eax4 < 0) | reinterpret_cast<uint1_t>(eax4 == 0)) {
                return 0;
            } else {
                zf5 = g1100b4a8 == 0;
                g1100b44c = eax4 - 1;
                if (zf5) {
                    fun_11005f20();
                }
                fun_11006510();
                fun_110062f0();
                return 1;
            }
        }
    } else {
        eax6 = reinterpret_cast<uint32_t>(GetVersion());
        zf7 = g1100b460 == 0;
        g1100b470 = eax6;
        if (zf7) {
            if (*reinterpret_cast<signed char*>(&eax6) == 3 && eax6 & 0x80000000) {
                fun_11006d10(2, __return_address(), a1, a2);
            }
            eax8 = reinterpret_cast<int32_t>(GetModuleHandleA("kernel32.dll"));
            if (eax8 && (eax9 = reinterpret_cast<int32_t>(GetProcAddress(eax8, "IsTNT", "kernel32.dll")), !!eax9)) {
                fun_11006d10(1, eax8, "IsTNT", "kernel32.dll");
            }
        }
        eax10 = fun_110062b0();
        if (eax10) {
            edx11 = 0;
            ecx12 = g1100b470;
            *reinterpret_cast<signed char*>(&edx11) = *reinterpret_cast<signed char*>(reinterpret_cast<int32_t>(&ecx12) + 1);
            eax13 = ecx12 & 0xff;
            g1100b47c = edx11;
            g1100b478 = eax13;
            g1100b470 = ecx12 >> 16;
            g1100b474 = (eax13 << 8) + edx11;
            eax14 = reinterpret_cast<struct s1**>(GetCommandLineA());
            g1100cfd4 = eax14;
            eax15 = fun_11006b80();
            zf16 = g1100cfd4 == 0;
            g1100b450 = eax15;
            if (zf16 || !eax15) {
                fun_110062f0();
                return 0;
            } else {
                fun_11006330();
                fun_11006b70();
                fun_11006630();
                fun_11006540();
                fun_11005ed0();
                ++g1100b44c;
            }
        } else {
            return 0;
        }
    }
    return 1;
}

int32_t g1100b770 = 0;

void fun_11006d50() {
    int32_t eax1;
    int1_t zf2;
    int32_t eax3;

    eax1 = g1100b45c;
    if (eax1 == 1 || !eax1 && (zf2 = g1100b460 == 1, zf2)) {
        fun_11006d90(0xfc);
        eax3 = g1100b770;
        if (eax3) {
            eax3();
        }
        fun_11006d90(0xff);
    }
    return;
}

void fun_11005fe0(int32_t* a1, int32_t* a2) {
    int32_t* edi3;
    int32_t* esi4;
    int32_t eax5;

    edi3 = a2;
    esi4 = a1;
    if (reinterpret_cast<uint32_t>(edi3) > reinterpret_cast<uint32_t>(esi4)) {
        do {
            eax5 = *esi4;
            if (eax5) {
                eax5();
            }
            ++esi4;
        } while (reinterpret_cast<uint32_t>(edi3) > reinterpret_cast<uint32_t>(esi4));
    }
    return;
}

struct s1* fun_11006220(void* a1, int32_t a2);

struct s1* fun_11006200(void* a1) {
    int32_t eax2;
    struct s1* eax3;

    eax2 = g1100b774;
    eax3 = fun_11006220(a1, eax2);
    return eax3;
}

int32_t HeapFree = 0xe032;

void fun_110077f0(struct s1* a1) {
    int32_t* esp2;
    signed char* eax3;
    int32_t eax4;
    struct s3* v5;
    void* v6;
    int32_t esi7;
    signed char* v8;
    void* v9;

    esp2 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 8 - 4);
    if (a1) {
        eax3 = fun_11007270(a1, esp2 + 2, esp2 + 1);
        if (!eax3) {
            eax4 = g1100cfc4;
            HeapFree(eax4, 0, a1);
        } else {
            fun_110072d0(v5, v6, eax3, esi7, v8, v9);
            return;
        }
    }
    return;
}

signed char* fun_11007270(struct s1* a1, struct s2** a2, void** a3) {
    struct s2* ecx4;
    struct s1* edx5;
    void* ecx6;

    ecx4 = reinterpret_cast<struct s2*>(0x1100b778);
    edx5 = a1;
    do {
        if (!ecx4->f2064) 
            continue;
        if (reinterpret_cast<unsigned char>(ecx4->f2064) >= reinterpret_cast<unsigned char>(edx5)) 
            continue;
        if (reinterpret_cast<unsigned char>(reinterpret_cast<unsigned char>(ecx4->f2064) + 0x400000) > reinterpret_cast<unsigned char>(edx5)) 
            break;
        ecx4 = ecx4->f0;
    } while (!reinterpret_cast<int1_t>(ecx4 == 0x1100b778));
    goto addr_0x1100729a_6;
    *a2 = ecx4;
    ecx6 = reinterpret_cast<void*>(reinterpret_cast<unsigned char>(edx5) & 0xfffff000);
    *a3 = ecx6;
    return (reinterpret_cast<int32_t>(reinterpret_cast<unsigned char>(edx5) - reinterpret_cast<uint32_t>(ecx6) - 0x100) >> 4) + reinterpret_cast<uint32_t>(ecx6) + 8;
    addr_0x1100729a_6:
    return 0;
}

int32_t fun_11007720(struct s4* a1, struct s5* a2, signed char* a3, void* a4) {
    int32_t eax5;
    void* edx6;
    signed char* ebx7;
    void* ecx8;
    signed char* edi9;
    struct s5* esi10;
    signed char* ebp11;
    int1_t zf12;
    int32_t eax13;
    int32_t esi14;
    int32_t edi15;

    eax5 = 0;
    edx6 = reinterpret_cast<void*>(0);
    ebx7 = a3;
    ecx8 = a4;
    *reinterpret_cast<signed char*>(&edx6) = *ebx7;
    if (reinterpret_cast<uint32_t>(ecx8) >= reinterpret_cast<uint32_t>(edx6)) {
        if (reinterpret_cast<uint32_t>(ecx8) > reinterpret_cast<uint32_t>(edx6) && (edi9 = reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(ebx7) + reinterpret_cast<uint32_t>(ecx8)), esi10 = a2, reinterpret_cast<uint32_t>(edi9) <= reinterpret_cast<uint32_t>(&esi10->f248))) {
            ebp11 = reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edx6) + reinterpret_cast<uint32_t>(ebx7));
            zf12 = ebp11 == edi9;
            if (reinterpret_cast<uint32_t>(ebp11) < reinterpret_cast<uint32_t>(edi9)) {
                do {
                    if (*ebp11) 
                        break;
                    ++ebp11;
                } while (reinterpret_cast<uint32_t>(ebp11) < reinterpret_cast<uint32_t>(edi9));
                zf12 = ebp11 == edi9;
            }
            if (zf12) {
                *ebx7 = *reinterpret_cast<signed char*>(&ecx8);
                if (reinterpret_cast<uint32_t>(ebx7) <= reinterpret_cast<uint32_t>(esi10->f0) && reinterpret_cast<uint32_t>(esi10->f0) < reinterpret_cast<uint32_t>(edi9)) {
                    if (reinterpret_cast<uint32_t>(&esi10->f248) <= reinterpret_cast<uint32_t>(edi9)) {
                        esi10->f4 = 0;
                        esi10->f0 = &esi10->f8;
                    } else {
                        eax13 = 0;
                        esi10->f0 = edi9;
                        if (!*edi9) {
                            do {
                                ++eax13;
                                ++edi9;
                            } while (!*edi9);
                        }
                        esi10->f4 = eax13;
                    }
                }
                esi14 = reinterpret_cast<int32_t>(esi10) - a1->f2064 >> 12;
                *reinterpret_cast<signed char*>(esi14 + reinterpret_cast<int32_t>(a1) + 16) = reinterpret_cast<signed char>(*reinterpret_cast<signed char*>(esi14 + reinterpret_cast<int32_t>(a1) + 16) + reinterpret_cast<signed char>(*reinterpret_cast<signed char*>(&edx6) - *reinterpret_cast<signed char*>(&ecx8)));
                eax5 = 1;
            }
        }
        return eax5;
    } else {
        *ebx7 = *reinterpret_cast<signed char*>(&ecx8);
        edi15 = reinterpret_cast<int32_t>(a2) - a1->f2064 >> 12;
        *reinterpret_cast<signed char*>(edi15 + reinterpret_cast<int32_t>(a1) + 16) = reinterpret_cast<signed char>(*reinterpret_cast<signed char*>(edi15 + reinterpret_cast<int32_t>(a1) + 16) + reinterpret_cast<signed char>(*reinterpret_cast<signed char*>(&edx6) - *reinterpret_cast<signed char*>(&ecx8)));
        *reinterpret_cast<signed char*>((reinterpret_cast<int32_t>(a2) - a1->f2064 >> 12) + reinterpret_cast<int32_t>(a1) + 0x410) = -15;
        return 1;
    }
}

struct s9 {
    signed char[16] pad16;
    signed char f16;
    signed char[1023] pad1040;
    signed char f1040;
};

int32_t g1100bf90 = 0;

void fun_11007190(int32_t a1);

void fun_110072d0(struct s3* a1, void* a2, signed char* a3, int32_t a4, signed char* a5, void* a6) {
    struct s9* ecx7;
    int1_t zf8;

    ecx7 = reinterpret_cast<struct s9*>((reinterpret_cast<int32_t>(reinterpret_cast<uint32_t>(a2) - a1->f2064) >> 12) + reinterpret_cast<int32_t>(a1));
    ecx7->f16 = reinterpret_cast<signed char>(ecx7->f16 + *a3);
    *a3 = 0;
    ecx7->f1040 = -15;
    if (ecx7->f16 == -16 && (++g1100bf90, zf8 = g1100bf90 == 32, zf8)) {
        fun_11007190(16);
    }
    return;
}

int32_t g1100ceb4;

int32_t fun_11006f90(void* a1) {
    int32_t ecx2;
    int32_t eax3;

    ecx2 = g1100ceb4;
    if (!ecx2 || (eax3 = reinterpret_cast<int32_t>(ecx2(a1)), eax3 == 0)) {
        return 0;
    } else {
        return 1;
    }
}

struct s1* fun_11006270(void* a1) {
    void* esi2;
    int1_t below_or_equal3;
    struct s1* eax4;
    int32_t eax5;

    esi2 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(a1) + 15 & 0xfffffff0);
    below_or_equal3 = reinterpret_cast<uint32_t>(esi2) <= reinterpret_cast<uint32_t>(g1100bf94);
    if (!below_or_equal3 || (eax4 = fun_11007320(reinterpret_cast<uint32_t>(esi2) >> 4), !eax4)) {
        eax5 = g1100cfc4;
        HeapAlloc(eax5, 0, esi2);
    }
    goto __return_address();
}

struct s11 {
    signed char* f0;
    uint32_t f4;
    signed char f8;
    signed char[239] pad248;
    signed char f248;
    signed char[7] pad256;
    struct s1* f256;
};

struct s10 {
    struct s10* f0;
    struct s10* f4;
    void* f8;
    void* f12;
    signed char f16;
    signed char f17;
    signed char[1021] pad1039;
    signed char f1039;
    signed char[1024] pad2064;
    struct s11* f2064;
};

struct s10* __image_base = reinterpret_cast<struct s10*>(0x1100b778);

struct s12 {
    signed char* f0;
    void* f4;
    signed char f8;
    signed char[239] pad248;
    signed char f248;
};

struct s1* fun_110075a0(struct s12* a1, void* a2, void* a3);

int32_t VirtualAlloc = 0xe03e;

struct s13 {
    signed char* f0;
    signed char[4] pad8;
    signed char f8;
};

struct s14 {
    signed char[16] pad16;
    signed char f16;
    signed char[1023] pad1040;
    signed char f1040;
};

struct s15 {
    signed char* f0;
    uint32_t f4;
    signed char f8;
};

struct s10* fun_11006fc0();

struct s1* fun_11007320(void* a1) {
    void* ebx2;
    int32_t v3;
    int32_t ebp4;
    struct s10* edi5;
    void* esi6;
    void* ebp7;
    void* eax8;
    void* ecx9;
    struct s12* v10;
    struct s1* eax11;
    void* ebp12;
    void* esi13;
    void* eax14;
    void* ecx15;
    struct s12* v16;
    struct s1* eax17;
    int1_t zf18;
    struct s10* esi19;
    void* edx20;
    void* ecx21;
    void* edi22;
    signed char** eax23;
    void* ecx24;
    struct s13* ebp25;
    struct s14* edx26;
    void* ecx27;
    struct s15* eax28;
    struct s10* eax29;
    struct s11* edx30;

    ebx2 = a1;
    v3 = ebp4;
    edi5 = __image_base;
    do {
        if (edi5->f2064) {
            esi6 = edi5->f8;
            if (reinterpret_cast<int32_t>(esi6) < reinterpret_cast<int32_t>(0x400)) {
                ebp7 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(esi6) << 12);
                do {
                    eax8 = reinterpret_cast<void*>(0);
                    *reinterpret_cast<signed char*>(&eax8) = *reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi6) + 16);
                    if (reinterpret_cast<uint32_t>(eax8) >= reinterpret_cast<uint32_t>(ebx2) && (*reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi6) + 16) != -1 && (ecx9 = reinterpret_cast<void*>(0), *reinterpret_cast<signed char*>(&ecx9) = *reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi6) + 0x410), reinterpret_cast<uint32_t>(ecx9) > reinterpret_cast<uint32_t>(ebx2)))) {
                        v10 = reinterpret_cast<struct s12*>(reinterpret_cast<uint32_t>(edi5->f2064) + reinterpret_cast<uint32_t>(ebp7));
                        eax11 = fun_110075a0(v10, eax8, ebx2);
                        if (eax11) 
                            goto addr_0x11007460_7;
                        *reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi6) + 0x410) = *reinterpret_cast<signed char*>(&ebx2);
                    }
                    ebp7 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ebp7) + 0x1000);
                    esi6 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(esi6) + 1);
                } while (reinterpret_cast<int32_t>(ebp7) < reinterpret_cast<int32_t>(0x400000));
            }
            ebp12 = reinterpret_cast<void*>(0);
            esi13 = reinterpret_cast<void*>(0);
            if (reinterpret_cast<int32_t>(edi5->f8) > reinterpret_cast<int32_t>(0)) {
                do {
                    eax14 = reinterpret_cast<void*>(0);
                    *reinterpret_cast<signed char*>(&eax14) = *reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi13) + 16);
                    if (reinterpret_cast<uint32_t>(eax14) >= reinterpret_cast<uint32_t>(ebx2) && (*reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi13) + 16) != -1 && (ecx15 = reinterpret_cast<void*>(0), *reinterpret_cast<signed char*>(&ecx15) = *reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi13) + 0x410), reinterpret_cast<uint32_t>(ecx15) > reinterpret_cast<uint32_t>(ebx2)))) {
                        v16 = reinterpret_cast<struct s12*>(reinterpret_cast<uint32_t>(edi5->f2064) + reinterpret_cast<uint32_t>(ebp12));
                        eax17 = fun_110075a0(v16, eax14, ebx2);
                        if (eax17) 
                            goto addr_0x11007472_13;
                        *reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi13) + 0x410) = *reinterpret_cast<signed char*>(&ebx2);
                    }
                    ebp12 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ebp12) + 0x1000);
                    esi13 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(esi13) + 1);
                } while (reinterpret_cast<int32_t>(edi5->f8) > reinterpret_cast<int32_t>(esi13));
            }
        }
        edi5 = edi5->f0;
        zf18 = __image_base == edi5;
    } while (!zf18);
    esi19 = reinterpret_cast<struct s10*>(0x1100b778);
    do {
        if (!esi19->f2064) 
            continue;
        if (!reinterpret_cast<int1_t>(esi19->f12 == 0xffffffff)) 
            break;
        esi19 = esi19->f0;
    } while (!reinterpret_cast<int1_t>(esi19 == 0x1100b778));
    goto addr_0x11007420_21;
    edx20 = esi19->f12;
    ecx21 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(edx20) + 16);
    if (reinterpret_cast<int32_t>(ecx21) >= reinterpret_cast<int32_t>(0x400)) {
        ecx21 = reinterpret_cast<void*>(0x400);
    }
    edi22 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(edx20) + 1);
    if (reinterpret_cast<int32_t>(ecx21) > reinterpret_cast<int32_t>(edi22)) {
        do {
            if (*reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(esi19) + reinterpret_cast<uint32_t>(edi22) + 16) != -1) 
                break;
            edi22 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(edi22) + 1);
        } while (reinterpret_cast<int32_t>(ecx21) > reinterpret_cast<int32_t>(edi22));
    }
    eax23 = reinterpret_cast<signed char**>(VirtualAlloc());
    if (!reinterpret_cast<int1_t>(eax23 == (reinterpret_cast<uint32_t>(edx20) << 12) + reinterpret_cast<uint32_t>(esi19->f2064))) {
        goto v3;
    } else {
        ecx24 = esi19->f12;
        ebp25 = reinterpret_cast<struct s13*>((reinterpret_cast<uint32_t>(ecx24) << 12) + reinterpret_cast<uint32_t>(esi19->f2064));
        if (reinterpret_cast<int32_t>(ecx24) < reinterpret_cast<int32_t>(edi22)) {
            do {
                ecx24 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ecx24) + 1);
                ebp25->f0 = &ebp25->f8;
                ebp25 = reinterpret_cast<struct s13*>(reinterpret_cast<uint32_t>(ebp25) + 0x1000);
                edx26 = reinterpret_cast<struct s14*>(reinterpret_cast<uint32_t>(esi19) + reinterpret_cast<uint32_t>(ecx24) - 1);
                *reinterpret_cast<int32_t*>(reinterpret_cast<uint32_t>(ebp25) + 0xfffff004) = 0xf0;
                *reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(ebp25) + 0xfffff0f8) = -1;
                edx26->f16 = -16;
                edx26->f1040 = -15;
            } while (reinterpret_cast<int32_t>(ecx24) < reinterpret_cast<int32_t>(edi22));
        }
        __image_base = esi19;
        if (reinterpret_cast<int32_t>(edi22) < reinterpret_cast<int32_t>(0x400)) {
            do {
                if (*reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(esi19) + reinterpret_cast<uint32_t>(edi22) + 16) == -1) 
                    break;
                edi22 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(edi22) + 1);
            } while (reinterpret_cast<int32_t>(edi22) < reinterpret_cast<int32_t>(0x400));
        }
        ecx27 = esi19->f12;
        esi19->f12 = reinterpret_cast<void*>(0xffffffff);
        if (reinterpret_cast<int32_t>(edi22) < reinterpret_cast<int32_t>(0x400)) {
            esi19->f12 = edi22;
        }
        eax28 = reinterpret_cast<struct s15*>(reinterpret_cast<uint32_t>(esi19->f2064) + (reinterpret_cast<uint32_t>(ecx27) << 12));
        eax28->f8 = *reinterpret_cast<signed char*>(&ebx2);
        esi19->f8 = ecx27;
        *reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(esi19) + reinterpret_cast<uint32_t>(ecx27) + 16) = reinterpret_cast<signed char>(*reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(esi19) + reinterpret_cast<uint32_t>(ecx27) + 16) - *reinterpret_cast<signed char*>(&ebx2));
        eax28->f0 = reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(ebx2) + reinterpret_cast<uint32_t>(eax28) + 8);
        eax28->f4 = eax28->f4 - reinterpret_cast<uint32_t>(ebx2);
        goto v3;
    }
    addr_0x11007420_21:
    eax29 = fun_11006fc0();
    if (!eax29) {
        return 0;
    } else {
        edx30 = eax29->f2064;
        edx30->f8 = *reinterpret_cast<signed char*>(&ebx2);
        __image_base = eax29;
        edx30->f0 = reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(ebx2) + reinterpret_cast<uint32_t>(edx30) + 8);
        edx30->f4 = 0xf0 - reinterpret_cast<uint32_t>(ebx2);
        eax29->f16 = reinterpret_cast<signed char>(eax29->f16 - *reinterpret_cast<signed char*>(&ebx2));
        return &eax29->f2064->f256;
    }
    addr_0x11007472_13:
    __image_base = edi5;
    *reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi13) + 16) = reinterpret_cast<signed char>(*reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi13) + 16) - *reinterpret_cast<signed char*>(&ebx2));
    edi5->f8 = esi13;
    return eax17;
    addr_0x11007460_7:
    __image_base = edi5;
    *reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi6) + 16) = reinterpret_cast<signed char>(*reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edi5) + reinterpret_cast<uint32_t>(esi6) + 16) - *reinterpret_cast<signed char*>(&ebx2));
    edi5->f8 = esi6;
    return eax11;
}

void fun_110066d0(struct s1** a1, struct s1* a2, struct s1* a3, int32_t* a4, int32_t* a5) {
    int32_t* ecx6;
    struct s1** esi7;
    struct s1* eax8;
    struct s1* edx9;
    int32_t edx10;
    struct s1* dl11;
    int32_t ebx12;
    uint32_t edi13;
    struct s1* edx14;
    int32_t ebx15;
    uint32_t ebp16;
    struct s1** edx17;
    uint32_t ebp18;
    uint32_t edx19;
    int32_t ebx20;
    int32_t ebx21;

    ecx6 = a5;
    esi7 = a1;
    eax8 = a3;
    *ecx6 = 0;
    *a4 = 1;
    if (a2) {
        edx9 = a2;
        a2 = reinterpret_cast<struct s1*>(&a2->f4);
        *reinterpret_cast<struct s1**>(&edx9->f0) = eax8;
    }
    if (*esi7 == 34) {
        ++esi7;
        if (*esi7 != 34) {
            do {
                if (!*esi7) 
                    break;
                edx10 = 0;
                *reinterpret_cast<struct s1**>(&edx10) = *esi7;
                if (*reinterpret_cast<unsigned char*>(edx10 + 0x1100b4c1) & 4 && (*ecx6 = *ecx6 + 1, !!eax8)) {
                    ++esi7;
                    *reinterpret_cast<struct s1**>(&eax8->f0) = *esi7;
                    eax8 = reinterpret_cast<struct s1*>(&eax8->pad4);
                }
                *ecx6 = *ecx6 + 1;
                if (eax8) {
                    *reinterpret_cast<struct s1**>(&eax8->f0) = *esi7;
                    eax8 = reinterpret_cast<struct s1*>(&eax8->pad4);
                }
                ++esi7;
            } while (!reinterpret_cast<int1_t>(*esi7 == 34));
        }
        *ecx6 = *ecx6 + 1;
        if (eax8) {
            *reinterpret_cast<struct s1**>(&eax8->f0) = reinterpret_cast<struct s1*>(0);
            eax8 = reinterpret_cast<struct s1*>(&eax8->pad4);
        }
        if (reinterpret_cast<int1_t>(*esi7 == 34)) {
            ++esi7;
        }
    } else {
        do {
            *ecx6 = *ecx6 + 1;
            if (eax8) {
                *reinterpret_cast<struct s1**>(&eax8->f0) = *esi7;
                eax8 = reinterpret_cast<struct s1*>(&eax8->pad4);
            }
            dl11 = *esi7;
            ++esi7;
            ebx12 = 0;
            *reinterpret_cast<struct s1**>(&ebx12) = dl11;
            if (*reinterpret_cast<unsigned char*>(ebx12 + 0x1100b4c1) & 4) {
                *ecx6 = *ecx6 + 1;
                if (eax8) {
                    *reinterpret_cast<struct s1**>(&eax8->f0) = *esi7;
                    eax8 = reinterpret_cast<struct s1*>(&eax8->pad4);
                }
                ++esi7;
            }
            if (dl11 == 32) 
                break;
            if (!dl11) 
                goto addr_0x11006740_23;
        } while (!reinterpret_cast<int1_t>(dl11 == 9));
        if (dl11) {
            if (eax8) {
                *reinterpret_cast<struct s1**>(reinterpret_cast<unsigned char>(eax8) + 0xffffffff) = reinterpret_cast<struct s1*>(0);
            }
        } else {
            addr_0x11006740_23:
            --esi7;
        }
    }
    edi13 = 0;
    while (*esi7) {
        while (*esi7 == 32 || reinterpret_cast<int1_t>(*esi7 == 9)) {
            ++esi7;
        }
        if (!*esi7) 
            break;
        if (a2) {
            edx14 = a2;
            a2 = reinterpret_cast<struct s1*>(&a2->f4);
            *reinterpret_cast<struct s1**>(&edx14->f0) = eax8;
        }
        *a4 = *a4 + 1;
        while (1) {
            ebx15 = 1;
            ebp16 = 0;
            if (reinterpret_cast<int1_t>(*esi7 == 92)) {
                do {
                    ++esi7;
                    ++ebp16;
                } while (*esi7 == 92);
            }
            if (reinterpret_cast<int1_t>(*esi7 == 34)) {
                if (!(ebp16 & 1)) {
                    if (!edi13 || (edx17 = esi7 + 1, !reinterpret_cast<int1_t>(*edx17 == 34))) {
                        ebx15 = 0;
                    } else {
                        esi7 = edx17;
                    }
                    edi13 = -(edi13 - (edi13 + reinterpret_cast<uint1_t>(edi13 < edi13 + reinterpret_cast<uint1_t>(edi13 < 1))));
                }
                ebp16 = ebp16 >> 1;
            }
            ebp18 = ebp16 - 1;
            if (ebp16) {
                do {
                    if (eax8) {
                        *reinterpret_cast<struct s1**>(&eax8->f0) = reinterpret_cast<struct s1*>(92);
                        eax8 = reinterpret_cast<struct s1*>(&eax8->pad4);
                    }
                    edx19 = ebp18;
                    *ecx6 = *ecx6 + 1;
                    --ebp18;
                } while (edx19);
            }
            if (!*esi7) 
                break;
            if (edi13) 
                goto addr_0x11006836_51;
            if (*esi7 == 32) 
                break;
            if (*esi7 == 9) 
                break;
            addr_0x11006836_51:
            if (ebx15) {
                if (!eax8) {
                    ebx20 = 0;
                    *reinterpret_cast<struct s1**>(&ebx20) = *esi7;
                    if (*reinterpret_cast<unsigned char*>(ebx20 + 0x1100b4c1) & 4) {
                        ++esi7;
                        *ecx6 = *ecx6 + 1;
                    }
                    *ecx6 = *ecx6 + 1;
                } else {
                    ebx21 = 0;
                    *reinterpret_cast<struct s1**>(&ebx21) = *esi7;
                    if (*reinterpret_cast<unsigned char*>(ebx21 + 0x1100b4c1) & 4) {
                        *reinterpret_cast<struct s1**>(&eax8->f0) = *esi7;
                        ++esi7;
                        eax8 = reinterpret_cast<struct s1*>(&eax8->pad4);
                        *ecx6 = *ecx6 + 1;
                    }
                    eax8 = reinterpret_cast<struct s1*>(&eax8->pad4);
                    ++esi7;
                    *reinterpret_cast<struct s1**>(reinterpret_cast<unsigned char>(eax8) + 0xffffffff) = *esi7;
                    *ecx6 = *ecx6 + 1;
                    continue;
                }
            }
            ++esi7;
        }
        if (eax8) {
            *reinterpret_cast<struct s1**>(&eax8->f0) = reinterpret_cast<struct s1*>(0);
            eax8 = reinterpret_cast<struct s1*>(&eax8->pad4);
        }
        *ecx6 = *ecx6 + 1;
    }
    if (a2) {
        *reinterpret_cast<struct s1**>(&a2->f0) = reinterpret_cast<struct s1*>(0);
    }
    *a4 = *a4 + 1;
    return;
}

signed char g1100b5d0 = 0;

signed char g1100b5c4 = 0;

signed char g1100b5c8 = 0;

signed char g1100b5d4 = 0;

signed char g1100b5d8 = 0;

void fun_11006b40() {
    signed char* edi1;
    int32_t ecx2;

    edi1 = reinterpret_cast<signed char*>(0x1100b4c0);
    ecx2 = 64;
    while (ecx2) {
        --ecx2;
        *edi1 = reinterpret_cast<signed char>(0);
        edi1 = edi1 + 4;
    }
    *edi1 = 0;
    g1100b5d0 = reinterpret_cast<signed char>(0);
    g1100b5c4 = reinterpret_cast<signed char>(0);
    g1100b5c8 = reinterpret_cast<signed char>(0);
    g1100b5d4 = reinterpret_cast<signed char>(0);
    g1100b5d8 = reinterpret_cast<signed char>(0);
    return;
}

void fun_11006b2c();

signed char fun_11006ae0(signed char a1) {
    uint32_t eax2;
    int32_t ecx3;

    eax2 = reinterpret_cast<uint32_t>(a1 - 0x3a4);
    if (eax2 > 18) 
        goto addr_0x11006afd_2;
    ecx3 = 0;
    *reinterpret_cast<signed char*>(&ecx3) = *reinterpret_cast<signed char*>(eax2 + reinterpret_cast<int32_t>(fun_11006b2c));
    switch (ecx3) {
    case 0:
        return 0x411;
    case 1:
        return 0x804;
    case 2:
        return 0x412;
    case 3:
        return 0x404;
        addr_0x11006afd_2:
    case 4:
        return 0;
    }
}

int32_t WriteFile = 0xe026;

unsigned char* fun_110078e0(unsigned char* a1, unsigned char* a2, uint32_t a3);

void fun_11007840(void* a1, int32_t a2, int32_t a3);

void fun_11006d90(int32_t a1) {
    int32_t ecx2;
    int32_t* eax3;
    int32_t edx4;
    void* esp5;
    int32_t ebx6;
    int1_t zf7;
    int1_t zf8;
    int1_t zf9;
    int1_t zf10;
    struct s1* eax11;
    int32_t esi12;
    int32_t v13;
    int32_t eax14;
    signed char* edx15;
    void* eax16;
    signed char* edi17;
    void* v18;
    int32_t ecx19;
    int32_t eax20;
    int32_t ebp21;
    void* eax22;
    void* esp23;
    int32_t ecx24;
    unsigned char* ebp25;
    int32_t ecx26;
    unsigned char* eax27;
    signed char v28;
    int32_t ecx29;
    void* eax30;
    void* esp31;
    signed char v32;
    int32_t ecx33;
    unsigned char* edi34;
    int32_t ecx35;
    void* eax36;
    uint32_t edx37;
    int32_t ecx38;
    void* eax39;
    signed char v40;
    uint32_t ecx41;
    uint32_t ecx42;
    signed char* edi43;
    int32_t ecx44;
    void* eax45;
    uint32_t edx46;
    int32_t ecx47;
    void* eax48;
    signed char v49;
    uint32_t ecx50;
    uint32_t ecx51;
    signed char* edi52;
    int32_t ecx53;
    void* eax54;
    uint32_t edx55;
    int32_t ecx56;
    void* eax57;
    signed char v58;
    uint32_t ecx59;
    uint32_t ecx60;
    void* esp61;
    int32_t v62;

    ecx2 = 0;
    eax3 = reinterpret_cast<int32_t*>(0x1100b6e0);
    edx4 = a1;
    esp5 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 0x1a8 - 4 - 4 - 4 - 4);
    do {
        if (*eax3 == edx4) 
            break;
        eax3 = eax3 + 2;
        ++ecx2;
    } while (reinterpret_cast<uint32_t>(eax3) < 0x1100b770);
    ebx6 = ecx2 * 8;
    if (*reinterpret_cast<int32_t*>(ecx2 * 8 + 0x1100b6e0) == edx4) {
        zf7 = g1100b45c == 1;
        if (zf7 || (zf8 = g1100b45c == 0, zf8) && (zf9 = g1100b460 == 1, zf9)) {
            zf10 = g1100cec0 == 0;
            if (zf10 || (eax11 = g1100cec0, esi12 = eax11->f16, esi12 == -1)) {
                v13 = 0xf4;
                eax14 = reinterpret_cast<int32_t>(GetStdHandle(0xf4));
                esp5 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp5) - 4 - 4 + 4);
                esi12 = eax14;
            }
            edx15 = *reinterpret_cast<signed char**>(ebx6 + 0x1100b6e4);
            v13 = 0;
            eax16 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp5) - 4 + 20);
            edi17 = edx15;
            v18 = eax16;
            ecx19 = -1;
            eax20 = reinterpret_cast<int32_t>(eax16) - reinterpret_cast<int32_t>(eax16);
            do {
                if (!ecx19) 
                    break;
                --ecx19;
                ++edi17;
                ++esi12;
            } while (*edi17 != *reinterpret_cast<signed char*>(&eax20));
            WriteFile(esi12, edx15, ~ecx19 - 1, v18, v13);
        } else {
            if (edx4 != 0xfc) {
                ebp21 = GetModuleFileNameA;
                eax22 = reinterpret_cast<void*>(ebp21());
                esp23 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp5) - 4 - 4 - 4 - 4 + 4);
                if (!eax22) {
                    ecx24 = 5;
                    while (ecx24) {
                        --ecx24;
                    }
                }
                ebp25 = reinterpret_cast<unsigned char*>(reinterpret_cast<int32_t>(esp23) + 0xb4);
                ecx26 = -1;
                eax27 = reinterpret_cast<unsigned char*>(reinterpret_cast<int32_t>(eax22) - reinterpret_cast<int32_t>(eax22));
                do {
                    if (!ecx26) 
                        break;
                    --ecx26;
                } while (v28 != *reinterpret_cast<signed char*>(&eax27));
                if (reinterpret_cast<uint32_t>(~ecx26) > 60) {
                    ecx29 = -1;
                    eax30 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(eax27) - reinterpret_cast<uint32_t>(eax27));
                    esp31 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp23) - 4);
                    do {
                        if (!ecx29) 
                            break;
                        --ecx29;
                    } while (v32 != *reinterpret_cast<signed char*>(&eax30));
                    ebp25 = reinterpret_cast<unsigned char*>(reinterpret_cast<int32_t>(esp31) + ~ecx29 + 0x7c);
                    eax27 = fun_110078e0(ebp25, 0x110082ec, 3);
                    esp23 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp31) - 4 - 4 - 4 + 4 + 12);
                }
                ecx33 = 6;
                while (ecx33) {
                    --ecx33;
                }
                edi34 = ebp25;
                ecx35 = -1;
                eax36 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(eax27) - reinterpret_cast<uint32_t>(eax27));
                do {
                    if (!ecx35) 
                        break;
                    --ecx35;
                    ++edi34;
                } while (*edi34 != *reinterpret_cast<unsigned char*>(&eax36));
                edx37 = reinterpret_cast<uint32_t>(~ecx35);
                ecx38 = -1;
                eax39 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(eax36) - reinterpret_cast<uint32_t>(eax36));
                do {
                    if (!ecx38) 
                        break;
                    --ecx38;
                } while (v40 != *reinterpret_cast<signed char*>(&eax39));
                ecx41 = edx37 >> 2;
                while (ecx41) {
                    --ecx41;
                }
                ecx42 = edx37 & 3;
                while (ecx42) {
                    --ecx42;
                }
                edi43 = reinterpret_cast<signed char*>(0x110082cc);
                ecx44 = -1;
                eax45 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(eax39) - reinterpret_cast<uint32_t>(eax39));
                do {
                    if (!ecx44) 
                        break;
                    --ecx44;
                    ++edi43;
                } while (*edi43 != *reinterpret_cast<signed char*>(&eax45));
                edx46 = reinterpret_cast<uint32_t>(~ecx44);
                ecx47 = -1;
                eax48 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(eax45) - reinterpret_cast<uint32_t>(eax45));
                do {
                    if (!ecx47) 
                        break;
                    --ecx47;
                } while (v49 != *reinterpret_cast<signed char*>(&eax48));
                ecx50 = edx46 >> 2;
                while (ecx50) {
                    --ecx50;
                }
                ecx51 = edx46 & 3;
                while (ecx51) {
                    --ecx51;
                }
                edi52 = *reinterpret_cast<signed char**>(ebx6 + 0x1100b6e4);
                ecx53 = -1;
                eax54 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(eax48) - reinterpret_cast<uint32_t>(eax48));
                do {
                    if (!ecx53) 
                        break;
                    --ecx53;
                    ++edi52;
                } while (*edi52 != *reinterpret_cast<signed char*>(&eax54));
                edx55 = reinterpret_cast<uint32_t>(~ecx53);
                ecx56 = -1;
                eax57 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(eax54) - reinterpret_cast<uint32_t>(eax54));
                do {
                    if (!ecx56) 
                        break;
                    --ecx56;
                } while (v58 != *reinterpret_cast<signed char*>(&eax57));
                ecx59 = edx55 >> 2;
                while (ecx59) {
                    --ecx59;
                }
                ecx60 = edx55 & 3;
                esp61 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp23) - 4 - 4);
                while (ecx60) {
                    --ecx60;
                }
                fun_11007840(reinterpret_cast<int32_t>(esp61) + 28, "Microsoft Visual C++ Runtime Library", 0x12010);
                goto v62;
            }
        }
    }
    return;
}

unsigned char* fun_110078e0(unsigned char* a1, unsigned char* a2, uint32_t a3) {
    uint32_t ecx4;
    uint32_t ebx5;
    unsigned char* esi6;
    unsigned char* edi7;
    uint32_t ecx8;
    unsigned char eax9;
    uint32_t ecx10;
    unsigned char edx11;

    ecx4 = a3;
    if (!ecx4) {
        addr_0x11007963_2:
        return a1;
    } else {
        ebx5 = ecx4;
        esi6 = a2;
        edi7 = a1;
        if (!(reinterpret_cast<uint32_t>(esi6) & 3)) {
            ecx8 = ecx4 >> 2;
            if (!ecx8) {
                goto addr_0x11007925_6;
            }
        }
        do {
            eax9 = *esi6;
            ++esi6;
            *edi7 = eax9;
            ++edi7;
            --ecx4;
            if (!ecx4) 
                goto addr_0x11007932_8;
            if (!eax9) 
                break;
        } while (reinterpret_cast<uint32_t>(esi6) & 3);
        goto addr_0x11007919_11;
    }
    if (reinterpret_cast<uint32_t>(edi7) & 3) {
        do {
            *edi7 = eax9;
            ++edi7;
            --ecx4;
            if (!ecx4) 
                goto addr_0x110079d6_14;
        } while (reinterpret_cast<uint32_t>(edi7) & 3);
    }
    ebx5 = ecx4;
    ecx10 = ecx4 >> 2;
    if (ecx10) 
        goto addr_0x110079c7_17; else 
        goto addr_0x1100795b_18;
    addr_0x11007919_11:
    ebx5 = ecx4;
    ecx8 = ecx4 >> 2;
    if (ecx8) {
        do {
            edx11 = *esi6;
            esi6 = esi6 + 4;
            if ((*esi6 ^ 0xffffffff ^ 0x7efefeff + *esi6) & 0x81010100) {
                if (!*reinterpret_cast<signed char*>(&edx11)) 
                    break;
                if (!*reinterpret_cast<signed char*>(&edx11 + 1)) 
                    goto addr_0x110079b1_22;
                if (!(edx11 & 0xff0000)) 
                    goto addr_0x110079a7_24;
                if (!(edx11 & 0xff000000)) 
                    goto addr_0x110079a3_26;
            }
            *edi7 = edx11;
            edi7 = edi7 + 4;
            --ecx8;
        } while (ecx8);
        goto addr_0x11007920_28;
    } else {
        addr_0x11007920_28:
        ebx5 = ebx5 & 3;
        if (!ebx5) {
            addr_0x11007932_8:
            return a1;
        } else {
            do {
                addr_0x11007925_6:
                eax9 = *esi6;
                ++esi6;
                *edi7 = eax9;
                ++edi7;
                if (!eax9) 
                    goto addr_0x1100795e_29;
                --ebx5;
            } while (ebx5);
            goto addr_0x11007932_8;
        }
    }
    *edi7 = reinterpret_cast<unsigned char>(0);
    addr_0x110079bf_32:
    edi7 = edi7 + 4;
    eax9 = reinterpret_cast<unsigned char>(0);
    ecx10 = ecx8 - 1;
    if (!ecx10) {
        addr_0x110079d1_33:
        ebx5 = ebx5 & 3;
        if (ebx5) {
            do {
                addr_0x1100795b_18:
                *edi7 = eax9;
                ++edi7;
                addr_0x1100795e_29:
                --ebx5;
            } while (ebx5);
        } else {
            addr_0x110079d6_14:
            return a1;
        }
    } else {
        addr_0x110079c7_17:
        eax9 = reinterpret_cast<unsigned char>(0);
        goto addr_0x110079c9_34;
    }
    goto addr_0x11007963_2;
    do {
        addr_0x110079c9_34:
        *edi7 = reinterpret_cast<unsigned char>(0);
        edi7 = edi7 + 4;
        --ecx10;
    } while (ecx10);
    goto addr_0x110079d1_33;
    addr_0x110079b1_22:
    *edi7 = reinterpret_cast<unsigned char>(edx11 & 0xff);
    goto addr_0x110079bf_32;
    addr_0x110079a7_24:
    *edi7 = reinterpret_cast<unsigned char>(edx11 & 0xffff);
    goto addr_0x110079bf_32;
    addr_0x110079a3_26:
    *edi7 = edx11;
    goto addr_0x110079bf_32;
}

int32_t g1100bfb4 = 0;

int32_t LoadLibraryA = 0xe04e;

int32_t g1100bfb8 = 0;

int32_t g1100bfbc = 0;

void fun_11007840(void* a1, int32_t a2, int32_t a3) {
    int32_t esi4;
    int1_t zf5;
    int32_t eax6;
    int32_t ebx7;
    int32_t eax8;
    int32_t ebx9;
    int32_t eax10;
    int32_t eax11;
    int32_t eax12;
    int32_t eax13;
    int1_t zf14;

    esi4 = 0;
    zf5 = g1100bfb4 == 0;
    if (zf5) {
        eax6 = reinterpret_cast<int32_t>(LoadLibraryA());
        if (!eax6 || (ebx7 = GetProcAddress, eax8 = reinterpret_cast<int32_t>(ebx7(eax6, "MessageBoxA")), g1100bfb4 = eax8, eax8 == 0)) {
            goto ebx9;
        } else {
            eax10 = reinterpret_cast<int32_t>(ebx7(eax6, "GetActiveWindow", eax6, "MessageBoxA"));
            g1100bfb8 = eax10;
            eax11 = reinterpret_cast<int32_t>(ebx7(eax6, "GetLastActivePopup", eax6, "GetActiveWindow", eax6, "MessageBoxA"));
            g1100bfbc = eax11;
        }
    }
    eax12 = g1100bfb8;
    if (eax12) {
        eax13 = reinterpret_cast<int32_t>(eax12());
        esi4 = eax13;
    }
    if (esi4 && (zf14 = g1100bfbc == 0, !zf14)) {
        g1100bfbc(esi4);
    }
    g1100bfb4();
    goto a3;
}

int32_t VirtualFree = 0xdf06;

int32_t g1100bf88 = 0;

void fun_11007130(struct s10* a1) {
    int1_t zf2;
    struct s10* eax3;
    struct s10* ecx4;

    VirtualFree();
    zf2 = __image_base == a1;
    if (zf2) {
        __image_base = a1->f4;
    }
    if (a1 == 0x1100b778) {
        g1100bf88 = 0;
        goto 0;
    } else {
        eax3 = a1->f0;
        ecx4 = a1->f4;
        ecx4->f0 = eax3;
        a1->f0->f4 = a1->f4;
        HeapFree();
        goto 0;
    }
}

struct s10* __image_base = reinterpret_cast<struct s10*>(0x1100b778);

void fun_11007190(int32_t a1) {
    int32_t v2;
    int32_t ebx3;
    struct s10* esi4;
    int1_t zf5;
    void* ebp6;
    signed char* ebx7;
    uint32_t edi8;
    struct s11* eax9;
    int32_t eax10;
    struct s10* eax11;
    int32_t edx12;
    signed char* ecx13;

    v2 = ebx3;
    esi4 = __image_base;
    while (1) {
        if (!esi4->f2064) {
            addr_0x1100724c_3:
            zf5 = esi4 == __image_base;
            if (zf5) 
                break;
            if (a1 > 0) 
                continue; else 
                break;
        } else {
            ebp6 = reinterpret_cast<void*>(0x3ff);
            ebx7 = &esi4->f1039;
            edi8 = 0x3ff000;
            do {
                if (*ebx7 == -16 && (eax9 = esi4->f2064, eax10 = reinterpret_cast<int32_t>(VirtualFree(reinterpret_cast<uint32_t>(eax9) + edi8, 0x1000, 0x4000)), !!eax10)) {
                    *ebx7 = -1;
                    --g1100bf90;
                    if (esi4->f12 == 0xffffffff || reinterpret_cast<int32_t>(ebp6) < reinterpret_cast<int32_t>(esi4->f12)) {
                        esi4->f12 = ebp6;
                    }
                    --v2;
                    if (!v2) 
                        break;
                }
                edi8 = edi8 - 0x1000;
                ebp6 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ebp6) - 1);
                --ebx7;
            } while (reinterpret_cast<int32_t>(edi8) >= reinterpret_cast<int32_t>(0));
            eax11 = esi4;
            esi4 = esi4->f4;
            if (1) 
                goto addr_0x1100724c_3;
            if (eax11->f16 != -1) 
                goto addr_0x1100724c_3;
        }
        edx12 = 1;
        ecx13 = &eax11->f17;
        do {
            if (*ecx13 != -1) 
                break;
            ++edx12;
            ++ecx13;
        } while (edx12 < 0x400);
        if (edx12 != 0x400) 
            goto addr_0x1100724c_3;
        fun_11007130(eax11);
        goto addr_0x1100724c_3;
    }
    return;
}

struct s1* fun_110075a0(struct s12* a1, void* a2, void* a3) {
    struct s12* eax4;
    void* edx5;
    void* ecx6;
    signed char* edi7;
    signed char* ebp8;
    signed char* ecx9;
    void* esi10;
    signed char* ebp11;
    void* ebx12;
    signed char* ecx13;
    void* ebx14;
    signed char* esi15;
    void* ebx16;
    signed char* ecx17;
    void* ebx18;
    signed char* esi19;

    eax4 = a1;
    edx5 = a3;
    ecx6 = eax4->f4;
    edi7 = eax4->f0;
    ebp8 = edi7;
    if (reinterpret_cast<uint32_t>(edx5) <= reinterpret_cast<uint32_t>(ecx6)) {
        *edi7 = *reinterpret_cast<signed char*>(&edx5);
        if (reinterpret_cast<uint32_t>(edx5) + reinterpret_cast<uint32_t>(edi7) >= reinterpret_cast<uint32_t>(&eax4->f248)) {
            eax4->f4 = reinterpret_cast<void*>(0);
            eax4->f0 = &eax4->f8;
        } else {
            eax4->f0 = reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(eax4->f0) + reinterpret_cast<uint32_t>(edx5));
            eax4->f4 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(eax4->f4) - reinterpret_cast<uint32_t>(edx5));
        }
        return (reinterpret_cast<uint32_t>(edi7) - reinterpret_cast<uint32_t>(eax4) << 4) + reinterpret_cast<uint32_t>(eax4) + 0x80;
    }
    ecx9 = reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(ecx6) + reinterpret_cast<uint32_t>(edi7));
    if (*ecx9) {
        ebp8 = ecx9;
    }
    esi10 = a2;
    if (reinterpret_cast<uint32_t>(edx5) + reinterpret_cast<uint32_t>(ebp8) < reinterpret_cast<uint32_t>(&eax4->f248)) 
        goto addr_0x11007608_9;
    addr_0x1100768e_10:
    ebp11 = &eax4->f8;
    if (reinterpret_cast<uint32_t>(edi7) <= reinterpret_cast<uint32_t>(&eax4->f8)) {
        addr_0x110076d8_11:
        return 0;
    } else {
        do {
            if (reinterpret_cast<uint32_t>(edx5) + reinterpret_cast<uint32_t>(ebp11) > reinterpret_cast<uint32_t>(eax4) + 0xf7) 
                goto addr_0x110076d8_11;
            if (*ebp11) {
                ebx12 = reinterpret_cast<void*>(0);
                *reinterpret_cast<signed char*>(&ebx12) = *ebp11;
                ebp11 = reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(ebp11) + reinterpret_cast<uint32_t>(ebx12));
            } else {
                ecx13 = ebp11 + 1;
                ebx14 = reinterpret_cast<void*>(1);
                if (!*ecx13) {
                    do {
                        ++ecx13;
                        ebx14 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ebx14) + 1);
                    } while (!*ecx13);
                }
                if (reinterpret_cast<uint32_t>(ebx14) >= reinterpret_cast<uint32_t>(edx5)) 
                    break;
                esi10 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(esi10) - reinterpret_cast<uint32_t>(ebx14));
                if (reinterpret_cast<uint32_t>(edx5) > reinterpret_cast<uint32_t>(esi10)) 
                    goto addr_0x110076df_19;
                ebp11 = ecx13;
            }
        } while (reinterpret_cast<uint32_t>(edi7) > reinterpret_cast<uint32_t>(ebp11));
        goto addr_0x110076d8_11;
    }
    esi15 = reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edx5) + reinterpret_cast<uint32_t>(ebp11));
    if (reinterpret_cast<uint32_t>(esi15) >= reinterpret_cast<uint32_t>(&eax4->f248)) {
        eax4->f4 = reinterpret_cast<void*>(0);
        eax4->f0 = &eax4->f8;
    } else {
        eax4->f0 = esi15;
        eax4->f4 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ebx14) - reinterpret_cast<uint32_t>(edx5));
    }
    *ebp11 = *reinterpret_cast<signed char*>(&edx5);
    return (reinterpret_cast<uint32_t>(ebp11) - reinterpret_cast<uint32_t>(eax4) << 4) + reinterpret_cast<uint32_t>(eax4) + 0x80;
    addr_0x110076df_19:
    return 0;
    do {
        addr_0x11007608_9:
        if (*ebp8) {
            ebx16 = reinterpret_cast<void*>(0);
            *reinterpret_cast<signed char*>(&ebx16) = *ebp8;
            ebp8 = reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(ebp8) + reinterpret_cast<uint32_t>(ebx16));
        } else {
            ecx17 = ebp8 + 1;
            ebx18 = reinterpret_cast<void*>(1);
            if (!*ecx17) {
                do {
                    ++ecx17;
                    ebx18 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ebx18) + 1);
                } while (!*ecx17);
            }
            if (reinterpret_cast<uint32_t>(ebx18) >= reinterpret_cast<uint32_t>(edx5)) 
                goto addr_0x11007658_30;
            if (edi7 != ebp8) {
                esi10 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(esi10) - reinterpret_cast<uint32_t>(ebx18));
                if (reinterpret_cast<uint32_t>(edx5) > reinterpret_cast<uint32_t>(esi10)) 
                    goto addr_0x11007651_33;
                ebp8 = ecx17;
            } else {
                ebp8 = ecx17;
                eax4->f4 = ebx18;
            }
        }
    } while (reinterpret_cast<uint32_t>(edx5) + reinterpret_cast<uint32_t>(ebp8) < reinterpret_cast<uint32_t>(&eax4->f248));
    goto addr_0x1100768e_10;
    addr_0x11007658_30:
    esi19 = reinterpret_cast<signed char*>(reinterpret_cast<uint32_t>(edx5) + reinterpret_cast<uint32_t>(ebp8));
    if (reinterpret_cast<uint32_t>(esi19) >= reinterpret_cast<uint32_t>(&eax4->f248)) {
        eax4->f4 = reinterpret_cast<void*>(0);
        eax4->f0 = &eax4->f8;
    } else {
        eax4->f0 = esi19;
        eax4->f4 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ebx18) - reinterpret_cast<uint32_t>(edx5));
    }
    *ebp8 = *reinterpret_cast<signed char*>(&edx5);
    return (reinterpret_cast<uint32_t>(ebp8) - reinterpret_cast<uint32_t>(eax4) << 4) + reinterpret_cast<uint32_t>(eax4) + 0x80;
    addr_0x11007651_33:
    return 0;
}

int32_t __image_base = 0x1100b778;

struct s16 {
    signed char[16] pad16;
    signed char f16;
    signed char[1023] pad1040;
    signed char f1040;
};

struct s10* fun_11006fc0() {
    int1_t zf1;
    struct s10* eax2;
    struct s10* esi3;
    int32_t edi4;
    int32_t edi5;
    struct s11* eax6;
    struct s11* ebx7;
    int32_t eax8;
    struct s10* eax9;
    int1_t zf10;
    int1_t zf11;
    void* ebp12;
    struct s16* edi13;
    struct s11* edi14;
    int32_t ecx15;
    int32_t eax16;
    int32_t ebp17;

    zf1 = g1100bf88 == 0;
    if (!zf1) {
        eax2 = reinterpret_cast<struct s10*>(HeapAlloc());
        esi3 = eax2;
        if (!esi3) {
            goto edi4;
        }
    } else {
        esi3 = reinterpret_cast<struct s10*>(0x1100b778);
    }
    edi5 = VirtualAlloc;
    eax6 = reinterpret_cast<struct s11*>(edi5());
    ebx7 = eax6;
    if (ebx7) {
        eax8 = reinterpret_cast<int32_t>(edi5());
        if (!eax8) {
            VirtualFree(ebx7, 0, 0x8000);
        } else {
            if (!reinterpret_cast<int1_t>(esi3 == 0x1100b778)) {
                esi3->f0 = reinterpret_cast<struct s10*>(0x1100b778);
                eax9 = __image_base;
                esi3->f4 = eax9;
                __image_base = esi3;
                esi3->f4->f0 = esi3;
            } else {
                zf10 = __image_base == 0;
                if (zf10) {
                    __image_base = 0x1100b778;
                }
                zf11 = __image_base == 0;
                if (zf11) {
                    __image_base = reinterpret_cast<struct s10*>(0x1100b778);
                }
            }
            ebp12 = reinterpret_cast<void*>(0);
            esi3->f2064 = ebx7;
            esi3->f8 = reinterpret_cast<void*>(0);
            esi3->f12 = reinterpret_cast<void*>(16);
            do {
                edi13 = reinterpret_cast<struct s16*>(reinterpret_cast<uint32_t>(esi3) + reinterpret_cast<uint32_t>(ebp12));
                if (reinterpret_cast<int32_t>(ebp12) >= reinterpret_cast<int32_t>(16)) {
                    edi13->f16 = -1;
                } else {
                    edi13->f16 = -16;
                }
                ebp12 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ebp12) + 1);
                edi13->f1040 = -15;
            } while (reinterpret_cast<int32_t>(ebp12) < reinterpret_cast<int32_t>(0x400));
            edi14 = ebx7;
            ecx15 = 0x4000;
            while (ecx15) {
                --ecx15;
                edi14->f0 = reinterpret_cast<signed char*>(0);
                edi14 = reinterpret_cast<struct s11*>(&edi14->f4);
                esi3 = reinterpret_cast<struct s10*>(&esi3->f4);
            }
            if (reinterpret_cast<uint32_t>(esi3->f2064) + 0x10000 > reinterpret_cast<uint32_t>(ebx7)) {
                do {
                    ebx7->f0 = &ebx7->f8;
                    ebx7->f4 = 0xf0;
                    ebx7->f248 = -1;
                    ebx7 = reinterpret_cast<struct s11*>(reinterpret_cast<uint32_t>(ebx7) + 0x1000);
                } while (reinterpret_cast<uint32_t>(esi3->f2064) + 0x10000 > reinterpret_cast<uint32_t>(ebx7));
            }
            goto 0;
        }
    }
    if (esi3 != 0x1100b778) {
        eax16 = g1100cfc4;
        HeapFree(eax16, 0, esi3);
    }
    goto ebp17;
}

struct s1* fun_11005bc0(struct s1* a1);

uint32_t fun_11005c40(int32_t ecx, struct s1* a2) {
    struct s1* eax3;

    eax3 = fun_11005bc0(a2);
    return reinterpret_cast<unsigned char>(eax3) - (reinterpret_cast<unsigned char>(eax3) + reinterpret_cast<uint1_t>(reinterpret_cast<unsigned char>(eax3) < reinterpret_cast<unsigned char>(reinterpret_cast<unsigned char>(eax3) + reinterpret_cast<uint1_t>(reinterpret_cast<unsigned char>(eax3) < reinterpret_cast<unsigned char>(1)))));
}

int32_t HeapCreate = 0xdef8;

int32_t HeapDestroy = 0xdeea;

int32_t fun_110062b0() {
    int32_t eax1;
    struct s10* eax2;
    int32_t eax3;

    eax1 = reinterpret_cast<int32_t>(HeapCreate());
    g1100cfc4 = eax1;
    if (eax1) {
        eax2 = fun_11006fc0();
        if (eax2) {
            goto 1;
        } else {
            eax3 = g1100cfc4;
            HeapDestroy();
            goto eax3;
        }
    } else {
        goto 1;
    }
}

int32_t GetEnvironmentStringsW = 0xdfda;

struct s1** g1100b6dc = reinterpret_cast<struct s1**>(0);

int32_t GetEnvironmentStrings = 0xdfa8;

int32_t FreeEnvironmentStringsA = 0xdf8e;

int32_t WideCharToMultiByte = 0xdff4;

int32_t FreeEnvironmentStringsW = 0xdfc0;

struct s1* fun_11006b80() {
    struct s1** ebx1;
    struct s1** edi2;
    int32_t esi3;
    int1_t zf4;
    struct s1** eax5;
    struct s1** eax6;
    int1_t zf7;
    int1_t zf8;
    struct s1** eax9;
    struct s1** ebp10;
    void* ebp11;
    struct s1* eax12;
    struct s1* v13;
    struct s1* edi14;
    struct s1** esi15;
    uint32_t ecx16;
    uint32_t ecx17;
    struct s1** eax18;
    struct s1** esi19;
    void* eax20;
    struct s1* eax21;
    int32_t eax22;

    ebx1 = reinterpret_cast<struct s1**>(0);
    edi2 = reinterpret_cast<struct s1**>(0);
    esi3 = GetEnvironmentStringsW;
    zf4 = g1100b6dc == 0;
    if (zf4) {
        eax5 = reinterpret_cast<struct s1**>(esi3());
        edi2 = eax5;
        if (!eax5) {
            eax6 = reinterpret_cast<struct s1**>(GetEnvironmentStrings());
            ebx1 = eax6;
            if (!ebx1) {
                return 0;
            } else {
                g1100b6dc = reinterpret_cast<struct s1**>(2);
            }
        } else {
            g1100b6dc = reinterpret_cast<struct s1**>(1);
        }
    }
    zf7 = reinterpret_cast<int1_t>(g1100b6dc == 1);
    if (!zf7) {
        zf8 = reinterpret_cast<int1_t>(g1100b6dc == 2);
        if (!zf8) {
            return 0;
        } else {
            if (ebx1 || (eax9 = reinterpret_cast<struct s1**>(GetEnvironmentStrings()), ebx1 = eax9, !!ebx1)) {
                ebp10 = ebx1;
                if (*ebx1) {
                    addr_0x11006ca8_12:
                    ++ebp10;
                    if (*ebp10) 
                        goto addr_0x11006ca8_12;
                    ++ebp10;
                    if (*ebp10) 
                        goto addr_0x11006ca8_12;
                }
                ebp11 = reinterpret_cast<void*>(reinterpret_cast<uint32_t>(ebp10) - reinterpret_cast<uint32_t>(ebx1) + 1);
                eax12 = fun_11006200(ebp11);
                v13 = eax12;
                if (eax12) {
                    edi14 = v13;
                    esi15 = ebx1;
                    ecx16 = reinterpret_cast<uint32_t>(ebp11) >> 2;
                    while (ecx16) {
                        --ecx16;
                        *reinterpret_cast<struct s1**>(&edi14->f0) = *esi15;
                        edi14 = reinterpret_cast<struct s1*>(&edi14->f4);
                        esi15 = esi15 + 4;
                    }
                    ecx17 = reinterpret_cast<uint32_t>(ebp11) & 3;
                    while (ecx17) {
                        --ecx17;
                        *reinterpret_cast<struct s1**>(&edi14->f0) = *esi15;
                        edi14 = reinterpret_cast<struct s1*>(&edi14->pad4);
                        ++esi15;
                    }
                    FreeEnvironmentStringsA();
                    goto v13;
                } else {
                    FreeEnvironmentStringsA();
                    goto v13;
                }
            } else {
                return 0;
            }
        }
    } else {
        if (edi2 || (eax18 = reinterpret_cast<struct s1**>(esi3()), edi2 = eax18, !!edi2)) {
            esi19 = edi2;
            if (*edi2) {
                addr_0x11006bfa_26:
                esi19 = esi19 + 2;
                if (*esi19) 
                    goto addr_0x11006bfa_26;
                esi19 = esi19 + 2;
                if (*esi19) 
                    goto addr_0x11006bfa_26;
            }
            eax20 = reinterpret_cast<void*>(WideCharToMultiByte());
            if (!eax20 || (eax21 = fun_11006200(eax20), eax21 == 0)) {
                FreeEnvironmentStringsW();
                goto 0;
            } else {
                eax22 = reinterpret_cast<int32_t>(WideCharToMultiByte());
                if (!eax22) {
                    fun_110077f0(eax21);
                }
                FreeEnvironmentStringsW();
                goto eax21;
            }
        } else {
            return 0;
        }
    }
}

struct s17 {
    struct s17* f0;
    signed char[2060] pad2064;
    int32_t f2064;
};

void fun_110062f0() {
    int32_t v1;
    int32_t esi2;
    struct s17* esi3;
    int32_t edi4;
    int32_t eax5;

    v1 = esi2;
    esi3 = reinterpret_cast<struct s17*>(0x1100b778);
    edi4 = VirtualFree;
    do {
        eax5 = esi3->f2064;
        if (eax5) {
            edi4(eax5, 0, 0x8000);
        }
        esi3 = esi3->f0;
    } while (!reinterpret_cast<int1_t>(esi3 == 0x1100b778));
    HeapDestroy();
    goto v1;
}

signed char fun_11006a90(signed char a1);

struct s18 {
    signed char f0;
    signed char f1;
};

struct s19 {
    signed char f0;
    signed char[7] pad8;
    signed char f8;
};

int32_t GetCPInfo = 0xdf6c;

int32_t g1100b5dc = 0;

int32_t fun_110068b0(signed char a1) {
    uint32_t v2;
    uint32_t ebx3;
    signed char eax4;
    signed char ebp5;
    int1_t zf6;
    int32_t v7;
    signed char* eax8;
    unsigned char* edi9;
    unsigned char eax10;
    int32_t ecx11;
    int32_t edi12;
    struct s18* esi13;
    uint32_t edx14;
    uint32_t ebx15;
    unsigned char cl16;
    uint32_t ebx17;
    signed char eax18;
    int32_t eax19;
    signed char ebx20;
    struct s19* ecx21;
    signed char ecx22;
    int32_t eax23;
    int1_t zf24;
    int32_t v25;
    int32_t v26;
    signed char* edi27;
    int32_t ecx28;
    signed char eax29;
    int32_t v30;
    signed char v31;
    uint32_t ecx32;
    uint32_t edx33;
    signed char v34;
    uint32_t eax35;
    signed char v36;
    signed char v37;
    uint32_t eax38;

    v2 = ebx3;
    eax4 = fun_11006a90(a1);
    ebp5 = eax4;
    zf6 = ebp5 == g1100b5c4;
    if (zf6) {
        return 0;
    }
    if (!ebp5) {
        fun_11006b40();
        return 0;
    }
    v7 = 0;
    eax8 = reinterpret_cast<signed char*>(0x1100b5e8);
    do {
        if (*eax8 == ebp5) 
            break;
        eax8 = eax8 + 48;
        ++v7;
    } while (reinterpret_cast<uint32_t>(eax8) < 0x1100b6d8);
    goto addr_0x1100690e_8;
    edi9 = reinterpret_cast<unsigned char*>(0x1100b4c0);
    eax10 = reinterpret_cast<unsigned char>(0);
    ecx11 = 64;
    while (ecx11) {
        --ecx11;
        *edi9 = reinterpret_cast<unsigned char>(0);
        edi9 = edi9 + 4;
    }
    *edi9 = 0;
    edi12 = (v7 + v7 * 2) * 2;
    do {
        esi13 = reinterpret_cast<struct s18*>((eax10 + edi12) * 8 + 0x1100b5f8);
        if (esi13->f0) {
            do {
                if (!esi13->f1) 
                    break;
                edx14 = 0;
                ebx15 = 0;
                *reinterpret_cast<signed char*>(&edx14) = esi13->f0;
                *reinterpret_cast<signed char*>(&ebx15) = esi13->f1;
                if (ebx15 >= edx14) {
                    cl16 = *reinterpret_cast<unsigned char*>(eax10 + 0x1100b5e0);
                    do {
                        *reinterpret_cast<unsigned char*>(edx14 + 0x1100b4c1) = reinterpret_cast<unsigned char>(*reinterpret_cast<unsigned char*>(edx14 + 0x1100b4c1) | cl16);
                        ++edx14;
                        ebx17 = 0;
                        *reinterpret_cast<signed char*>(&ebx17) = esi13->f1;
                    } while (ebx17 >= edx14);
                }
                ++esi13;
            } while (esi13->f0);
        }
        eax10 = reinterpret_cast<unsigned char>(eax10 + 1);
    } while (eax10 < reinterpret_cast<unsigned char>(4));
    g1100b5c4 = ebp5;
    eax18 = fun_11006ae0(ebp5);
    g1100b5c8 = eax18;
    eax19 = v7 << 4;
    ebx20 = *reinterpret_cast<signed char*>(eax19 + eax19 * 2 + reinterpret_cast<int32_t>("!"));
    ecx21 = reinterpret_cast<struct s19*>(eax19 + eax19 * 2 + 0x1100b5ec);
    ecx22 = ecx21->f8;
    g1100b5d0 = ecx21->f0;
    g1100b5d4 = ebx20;
    g1100b5d8 = ecx22;
    return 0;
    addr_0x1100690e_8:
    eax23 = reinterpret_cast<int32_t>(GetCPInfo());
    if (eax23 != 1) {
        zf24 = g1100b5dc == 0;
        if (zf24) {
            goto v25;
        } else {
            fun_11006b40();
            goto v26;
        }
    }
    edi27 = reinterpret_cast<signed char*>(0x1100b4c0);
    ecx28 = 64;
    while (ecx28) {
        --ecx28;
        *edi27 = reinterpret_cast<signed char>(0);
        edi27 = edi27 + 4;
    }
    *edi27 = 0;
    if (v2 > 1) 
        goto addr_0x1100693d_34;
    eax29 = reinterpret_cast<signed char>(0);
    g1100b5c4 = reinterpret_cast<signed char>(0);
    addr_0x11006a4a_36:
    g1100b5c8 = eax29;
    g1100b5d0 = reinterpret_cast<signed char>(0);
    g1100b5d4 = reinterpret_cast<signed char>(0);
    g1100b5d8 = reinterpret_cast<signed char>(0);
    goto v30;
    addr_0x1100693d_34:
    if (*reinterpret_cast<signed char*>(reinterpret_cast<int32_t>(&v7) + 2)) {
        do {
            if (!v31) 
                break;
            ecx32 = 0;
            edx33 = 0;
            *reinterpret_cast<signed char*>(&ecx32) = v34;
            *reinterpret_cast<signed char*>(&edx33) = v31;
            if (edx33 >= ecx32) {
                do {
                    *reinterpret_cast<unsigned char*>(ecx32 + 0x1100b4c1) = reinterpret_cast<unsigned char>(*reinterpret_cast<unsigned char*>(ecx32 + 0x1100b4c1) | 4);
                    ++ecx32;
                    eax35 = 0;
                    *reinterpret_cast<signed char*>(&eax35) = v36;
                } while (eax35 >= ecx32);
            }
        } while (v37);
    }
    eax38 = 1;
    do {
        *reinterpret_cast<unsigned char*>(eax38 + 0x1100b4c1) = reinterpret_cast<unsigned char>(*reinterpret_cast<unsigned char*>(eax38 + 0x1100b4c1) | 8);
        ++eax38;
    } while (eax38 < 0xff);
    g1100b5c4 = ebp5;
    eax29 = fun_11006ae0(ebp5);
    goto addr_0x11006a4a_36;
}

void fun_11006510() {
    struct s1** esi1;
    struct s1* v2;

    esi1 = reinterpret_cast<struct s1**>(0x1100cec0);
    do {
        if (*esi1) {
            v2 = *esi1;
            fun_110077f0(v2);
        }
        esi1 = esi1 + 4;
    } while (reinterpret_cast<uint32_t>(esi1) < 0x1100cfc0);
    return;
}

int32_t g1100b4ac = 0;

int32_t GetCurrentProcess = 0xdeb0;

int32_t TerminateProcess = 0xde9c;

signed char g1100b4a4 = 0;

struct s1* g1100cfcc;

struct s1* g1100cfc8;

int32_t ExitProcess = 0xde8e;

void fun_11005f30(int32_t a1, int32_t a2, int32_t a3) {
    int1_t zf4;
    int32_t esi5;
    int32_t eax6;
    int32_t ebx7;
    int1_t zf8;
    struct s1* edi9;
    struct s1* edi10;
    int1_t cf11;
    struct s1* eax12;
    int1_t cf13;

    zf4 = g1100b4ac == 1;
    esi5 = a1;
    if (zf4) {
        eax6 = reinterpret_cast<int32_t>(GetCurrentProcess(esi5));
        TerminateProcess(eax6, esi5);
    }
    g1100b4a8 = 1;
    ebx7 = a3;
    g1100b4a4 = *reinterpret_cast<signed char*>(&ebx7);
    if (!a2) {
        zf8 = g1100cfcc == 0;
        if (!zf8 && (edi9 = g1100cfc8, edi10 = reinterpret_cast<struct s1*>(reinterpret_cast<unsigned char>(edi9) - 4), cf11 = reinterpret_cast<unsigned char>(edi10) < reinterpret_cast<unsigned char>(g1100cfcc), !cf11)) {
            do {
                eax12 = *reinterpret_cast<struct s1**>(&edi10->f0);
                if (eax12) {
                    eax12();
                }
                edi10 = reinterpret_cast<struct s1*>(reinterpret_cast<unsigned char>(edi10) - 4);
                cf13 = reinterpret_cast<unsigned char>(edi10) < reinterpret_cast<unsigned char>(g1100cfcc);
            } while (!cf13);
        }
        fun_11005fe0(0x11009098, 0x1100909c);
    }
    fun_11005fe0(0x110090a0, 0x110090a4);
    if (!ebx7) {
        g1100b4ac = 1;
        ExitProcess(esi5);
    }
    return;
}

int32_t g1100cfd8;

int32_t DisableThreadLibraryCalls = 0xe00a;

int16_t fun_11006d20(int32_t a1, int32_t a2, int32_t a3) {
    int1_t zf4;

    if (a2 == 1 && (zf4 = g1100cfd8 == 0, zf4)) {
        DisableThreadLibraryCalls(a1);
    }
    return 1;
}

struct s1* fun_11006220(void* a1, int32_t a2) {
    void* esi3;
    int32_t edi4;
    struct s1* eax5;
    int32_t eax6;

    esi3 = a1;
    if (reinterpret_cast<uint32_t>(esi3) > 0xffffffe0) {
        return 0;
    }
    if (!esi3) {
        esi3 = reinterpret_cast<void*>(1);
    }
    edi4 = a2;
    do {
        eax5 = reinterpret_cast<struct s1*>(0);
        if (reinterpret_cast<uint32_t>(esi3) <= 0xffffffe0) {
            eax5 = fun_11006270(esi3);
        }
        if (eax5) 
            break;
        if (!edi4) 
            break;
        eax6 = fun_11006f90(esi3);
    } while (eax6);
    goto addr_0x11006265_11;
    addr_0x11006267_12:
    return eax5;
    addr_0x11006265_11:
    eax5 = reinterpret_cast<struct s1*>(0);
    goto addr_0x11006267_12;
}

struct s1* fun_11005bc0(struct s1* a1) {
    struct s1* eax2;
    void* eax3;
    struct s1* ecx4;
    void* ecx5;
    struct s1* eax6;
    void* eax7;
    struct s1* ecx8;
    struct s1* eax9;
    struct s1* ecx10;
    void* ecx11;
    struct s1* ecx12;

    eax2 = g1100cfcc;
    eax3 = fun_110061b0(eax2);
    ecx4 = g1100cfc8;
    ecx5 = reinterpret_cast<void*>(reinterpret_cast<unsigned char>(ecx4) - reinterpret_cast<unsigned char>(g1100cfcc));
    if (reinterpret_cast<uint32_t>(eax3) < reinterpret_cast<uint32_t>(ecx5) + 4) {
        eax6 = g1100cfcc;
        eax7 = fun_110061b0(eax6);
        ecx8 = g1100cfcc;
        eax9 = fun_11006000(ecx8, reinterpret_cast<uint32_t>(eax7) + 16);
        if (eax9) {
            ecx10 = g1100cfc8;
            ecx11 = reinterpret_cast<void*>(reinterpret_cast<unsigned char>(ecx10) - reinterpret_cast<unsigned char>(g1100cfcc));
            g1100cfcc = eax9;
            g1100cfc8 = reinterpret_cast<struct s1*>((reinterpret_cast<uint32_t>(ecx11) & 0xfffffffc) + reinterpret_cast<unsigned char>(eax9));
        } else {
            return 0;
        }
    }
    ecx12 = g1100cfc8;
    *reinterpret_cast<struct s1**>(&ecx12->f0) = a1;
    g1100cfc8 = reinterpret_cast<struct s1*>(&g1100cfc8->f4);
    return a1;
}

signed char g1100bfb0 = 0;

int32_t GetACP = 0xdf78;

int32_t GetOEMCP = 0xdf82;

signed char fun_11006a90(signed char a1) {
    signed char eax2;

    g1100b5dc = 0;
    eax2 = a1;
    if (eax2 != -2) {
        if (eax2 != -3) {
            if (eax2 == -4) {
                g1100b5dc = 1;
                eax2 = g1100bfb0;
            }
            return eax2;
        } else {
            g1100b5dc = 1;
            goto GetACP;
        }
    } else {
        g1100b5dc = 1;
        goto GetOEMCP;
    }
}

/*
 * ?CreateUnit@TethysGame@@SIHAAVUnit@@W4map_id@@ULOCATION@@H1H@Z
 * public: static int __fastcall TethysGame::CreateUnit(class Unit &,enum map_id,struct LOCATION,int,enum map_id,int)
 */
int32_t CreateUnit_TethysGame_SIHAAVUnit_W4map_id_ULOCATION_H1H_Z = 0xd654;

/*
 * ?SetFactoryCargo@Unit@@QAEXHW4map_id@@0@Z
 * public: void __thiscall Unit::SetFactoryCargo(int,enum map_id,enum map_id)
 */
int32_t SetFactoryCargo_Unit_QAEXHW4map_id_0_Z = 0xd60a;

/*
 * ?CreateWallOrTube@TethysGame@@SIHHHHW4map_id@@@Z
 * public: static int __fastcall TethysGame::CreateWallOrTube(int,int,int,enum map_id)
 */
int32_t CreateWallOrTube_TethysGame_SIHHHHW4map_id_Z = 0xd586;

/*
 * ?DoSetLights@Unit@@QAEXH@Z
 * public: void __thiscall Unit::DoSetLights(int)
 */
int32_t DoSetLights_Unit_QAEXH_Z = 0xd5ec;

void fun_11001230(int32_t a1, int32_t a2, int32_t a3, int32_t a4) {
    void* esp5;
    int32_t esi6;
    int32_t ebp7;
    int32_t edi8;
    int32_t esi9;
    int32_t ebx10;
    void* esp11;
    void* esp12;
    struct s0* ecx13;
    int32_t edi14;
    int32_t eax15;
    void* esp16;
    int32_t v17;
    int32_t ebx18;
    int32_t* esp19;
    int32_t v20;
    void* esp21;
    void* esp22;
    void* esp23;
    void* esp24;
    int32_t v25;
    struct s0* ecx26;
    int32_t eax27;
    void* esp28;
    void* esp29;
    void* esp30;
    int32_t ebp31;
    void* esp32;
    void* esp33;
    void* esp34;
    void* esp35;
    void* esp36;
    void* esp37;
    void* esp38;
    int32_t edi39;
    void* esp40;
    void* esp41;
    void* esp42;
    void* esp43;
    void* esp44;
    void* esp45;
    void* esp46;
    void* esp47;
    int32_t ebp48;
    void* esp49;
    void* esp50;
    void* esp51;
    void* esp52;
    int32_t ebp53;
    void* esp54;
    void* esp55;
    void* esp56;
    void* esp57;
    int32_t ebp58;
    void* esp59;
    int32_t ebp60;
    void* esp61;
    void* esp62;
    void* esp63;
    void* esp64;
    void* esp65;
    void* esp66;
    void* esp67;
    void* esp68;
    void* esp69;
    void* esp70;
    void* esp71;
    void* esp72;
    void* esp73;

    esp5 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 12 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4);
    esi6 = CreateUnit_TethysGame_SIHAAVUnit_W4map_id_ULOCATION_H1H_Z;
    esi6(reinterpret_cast<int32_t>(esp5) + 40, 69, 52, 0, 0, 0, ebp7, edi8, esi9, ebx10);
    esp11 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp5) - 4 - 4 + 4 - 4 - 4 - 4 - 4);
    esi6(reinterpret_cast<int32_t>(esp11) + 40, 69, 45, 0, 0, 0, 69, 52, 0, 0, 0);
    esp12 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp11) - 4 - 4 + 4 - 4);
    esi6(reinterpret_cast<int32_t>(esp12) + 28, 58, 52, 0, 0, 0, 69, 45, 0, 0);
    ecx13 = Player_3PAV_Player_A;
    edi14 = Difficulty__Player_QBEHXZ;
    eax15 = reinterpret_cast<int32_t>(edi14(ecx13, 58, 52, 0, 0, 0, 69, 45, 0, 0));
    esp16 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp12) - 4 - 4 - 4 - 4 - 4 + 4 - 4 + 4);
    if (!eax15) {
        v17 = 30;
        ebx18 = SetFactoryCargo_Unit_QAEXHW4map_id_0_Z;
        ebx18(reinterpret_cast<int32_t>(esp16) + 24, 0, 30, 0, 58, 52, 0, 0, 0, 69, 45, 0, 0);
        esp19 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp16) - 4 - 4 - 4 - 4 + 4 - 4 - 4);
        v20 = 58;
    } else {
        if (eax15 == 1) {
            v17 = 30;
            ebx18 = SetFactoryCargo_Unit_QAEXHW4map_id_0_Z;
            ebx18(reinterpret_cast<int32_t>(esp16) + 24, 0, 30, 0, 58, 52, 0, 0, 0, 69, 45, 0, 0);
            esp21 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp16) - 4 - 4 - 4 - 4 + 4);
            v20 = 39;
            ebx18(reinterpret_cast<int32_t>(esp21) + 24, 1, 39, 0, 0, 30, 0, 58, 52, 0, 0, 0, 69, 45, 0, 0);
            esp22 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp21) - 4 - 4 - 4 - 4 + 4 - 4 - 4 - 4);
            goto addr_0x11001324_5;
        } else {
            if (eax15 == 2) {
                v17 = 39;
                ebx18 = SetFactoryCargo_Unit_QAEXHW4map_id_0_Z;
                ebx18(reinterpret_cast<int32_t>(esp16) + 24, 0, 39, 0, 58, 52, 0, 0, 0, 69, 45, 0, 0);
                esp19 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp16) - 4 - 4 - 4 - 4 + 4 - 4 - 4);
                v20 = 35;
            } else {
                goto addr_0x1100132a_9;
            }
        }
    }
    esp22 = reinterpret_cast<void*>(esp19 - 1);
    addr_0x11001324_5:
    ebx18(reinterpret_cast<int32_t>(esp22) + 36, 1, v20, 0, 0, v17, 0, 58, 52, 0, 0, 0, 69, 45, 0, 0);
    esp16 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp22) - 4 + 4);
    addr_0x1100132a_9:
    esp23 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp16) - 4 - 4 - 4 - 4 - 4);
    esi6(reinterpret_cast<int32_t>(esp23) + 44, 80, 51, 0, 0, 0, 58, 52, 0, 0);
    esp24 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp23) - 4 + 4 - 4 - 4 - 4 - 4);
    v25 = 55;
    esi6(reinterpret_cast<int32_t>(esp24) + 40, 55, 40, 0, 0, 0, 80, 51, 0, 0);
    ecx26 = Player_3PAV_Player_A;
    eax27 = reinterpret_cast<int32_t>(edi14(ecx26, 55, 40, 0, 0, 0, 80, 51, 0, 0));
    esp28 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp24) - 4 - 4 + 4 - 4 + 4);
    if (!eax27) {
        esp29 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp28) - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp29) + 40, 63, 50, 0, 0, 0, 55, 40, 0, 0);
        v25 = 48;
        esp30 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp29) - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp30) + 44, 58, 48, 0, 0, 0, 63, 50, 0, 0);
        ebp31 = CreateWallOrTube_TethysGame_SIHHHHW4map_id_Z;
        ebp31(58, 0, 17, 58, 48, 0, 0, 0, 63, 50, 0, 0);
        esp32 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp30) - 4 + 4 - 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp32) + 44, 58, 57, 0, 0, 0, 0, 17, 58, 48);
        ebp31(58, 0, 17, 58, 57, 0, 0, 0, 0, 17, 58, 48);
        esp33 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp32) - 4 + 4 - 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp33) + 40, 69, 55, 0, 0, 0, 0, 17, 58, 57);
        esp34 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp33) - 4 - 4 + 4 - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp34) + 40, 75, 45, 0, 0, 0, 69, 55, 0, 0);
        esp35 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp34) - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp35) + 44, 55, 48, 0, 0, 0, 75, 45, 0, 0);
        ebp31(72, 0, 17, 55, 48, 0, 0, 0, 75, 45, 0, 0);
        ebp31(73, 0, 17, 0, 17, 55, 48, 0, 0, 0, 75, 45, 0, 0);
        esp36 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp35) - 4 + 4 - 4 - 4 - 4 + 4 - 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp36) + 40, 54, 53, 0, 0, 0, 0, 17, 0, 17);
        esp37 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp36) - 4 - 4 + 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp37) + 32, 73, 48, 0, 28, 0, 54, 53, 0, 0);
        esp38 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp37) - 4 - 4 - 4 - 4 + 4);
        edi39 = DoSetLights_Unit_QAEXH_Z;
        edi39(reinterpret_cast<int32_t>(esp38) + 24, 1, 73, 48, 0, 28, 0, 54, 53, 0, 0);
        esp40 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp38) - 4 - 4 + 4 - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp40) + 40, 73, 50, 0, 54, 0, 1, 73, 48, 0);
        esp41 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp40) - 4 - 4 + 4);
        edi39(reinterpret_cast<int32_t>(esp41) + 24, 1, 73, 50, 0, 54, 0, 1, 73, 48, 0);
        esp42 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp41) - 4 - 4 + 4 - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp42) + 40, 62, 45, 0, 0, 0, 1, 73, 50, 0);
        esp43 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp42) - 4 - 4 + 4);
        edi39(reinterpret_cast<int32_t>(esp43) + 24, 1, 62, 45, 0, 0, 0, 1, 73, 50, 0);
        esp44 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp43) - 4 - 4 + 4 - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp44) + 40, 79, 47, 0, 0, 0, 1, 62, 45, 0);
        esp45 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp44) - 4 - 4 + 4);
        edi39(reinterpret_cast<int32_t>(esp45) + 24, 1, 79, 47, 0, 0, 0, 1, 62, 45, 0);
        esp46 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp45) - 4 - 4 + 4 - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp46) + 40, 64, 46, 0, 0, 0, 1, 79, 47, 0);
        esp47 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp46) - 4 - 4 + 4);
        edi39(reinterpret_cast<int32_t>(esp47) + 24, 1, 64, 46, 0, 0, 0, 1, 79, 47, 0);
        ebp48 = CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z;
        ebp48(81, 34, 0, 1, 0xff, 1, 64, 46, 0, 0, 0, 1, 79, 47, 0);
        esp49 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp47) - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4);
        esi6(reinterpret_cast<int32_t>(esp49) + 40, 73, 34, 0, 0, 0, 34, 0, 1, 0xff, 1);
        esp28 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp49) - 4 - 4 + 4);
    } else {
        if (eax27 == 1) {
            esp50 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp28) - 4 - 4 - 4 - 4);
            esi6(reinterpret_cast<int32_t>(esp50) + 40, 58, 58, 0, 0, 0, 55, 40, 0, 0);
            v25 = 45;
            esp51 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp50) - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4);
            esi6(reinterpret_cast<int32_t>(esp51) + 44, 74, 45, 0, 0, 0, 58, 58, 0, 0);
            esp52 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp51) - 4 + 4 - 4 - 4 - 4 - 4);
            esi6(reinterpret_cast<int32_t>(esp52) + 40, 54, 53, 0, 0, 0, 74, 45, 0, 0);
            ebp53 = CreateWallOrTube_TethysGame_SIHHHHW4map_id_Z;
            ebp53(72, 0, 17, 54, 53, 0, 0, 0, 74, 45, 0, 0);
            ebp53(58, 0, 17, 0, 17, 54, 53, 0, 0, 0, 74, 45, 0, 0);
            ebp53(58, 0, 17, 0, 17, 0, 17, 54, 53, 0, 0, 0, 74, 45, 0, 0);
            esp54 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp52) - 4 - 4 + 4 - 4 - 4 - 4 + 4 - 4 - 4 - 4 + 4 - 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4);
            esi6(reinterpret_cast<int32_t>(esp54) + 44, 70, 57, 0, 0, 0, 0, 17, 0, 17);
            esp55 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp54) - 4 + 4);
            edi39 = DoSetLights_Unit_QAEXH_Z;
            edi39(reinterpret_cast<int32_t>(esp55) + 24, 1, 70, 57, 0, 0, 0, 0, 17, 0, 17);
            esp56 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp55) - 4 - 4 + 4 - 4);
            esi6(reinterpret_cast<int32_t>(esp56) + 28, 64, 45, 0, 30, 0, 1, 70, 57, 0);
            esp57 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp56) - 4 - 4 - 4 - 4 - 4 + 4);
            edi39(reinterpret_cast<int32_t>(esp57) + 24, 1, 64, 45, 0, 30, 0, 1, 70, 57, 0);
            ebp58 = CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z;
            ebp58(81, 30, 0, 1, 0xff, 1, 64, 45, 0, 30, 0, 1, 70, 57, 0);
            esp28 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp57) - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4 + 4);
        } else {
            if (eax27 == 2) {
                esp59 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp28) - 4 - 4 - 4 - 4 - 4);
                esi6(reinterpret_cast<int32_t>(esp59) + 44, 64, 45, 0, 0, 0, 55, 40, 0, 0);
                CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z(81, 37, 0, 1, 0xff, 64, 45, 0, 0, 0, 55, 40, 0, 0);
                ebp60 = CreateWallOrTube_TethysGame_SIHHHHW4map_id_Z;
                ebp60(66, 0, 17, 37, 0, 1, 0xff, 64, 45, 0, 0, 0, 55, 40, 0, 0);
                ebp60(67, 0, 17, 0, 17, 37, 0, 1, 0xff, 64, 45, 0, 0, 0, 55, 40, 0, 0);
                esp28 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp59) - 4 + 4 - 4 - 4 - 4 - 4 - 4 + 4 - 4 - 4 - 4 + 4 - 4 - 4 - 4 + 4);
            }
            edi39 = DoSetLights_Unit_QAEXH_Z;
        }
    }
    esp61 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp28) - 4 - 4 - 4 - 4 - 4);
    esi6(reinterpret_cast<int32_t>(esp61) + 44, 76, 55, 0, 0, 0, v25, 40, 0, 0);
    esp62 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp61) - 4 + 4);
    edi39(reinterpret_cast<int32_t>(esp62) + 24, 1, 76, 55, 0, 0, 0, v25, 40, 0, 0);
    esp63 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp62) - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4);
    esi6(reinterpret_cast<int32_t>(esp63) + 44, 78, 55, 0, 0, 0, 1, 76, 55, 0);
    esp64 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp63) - 4 + 4);
    edi39(reinterpret_cast<int32_t>(esp64) + 24, 1, 78, 55, 0, 0, 0, 1, 76, 55, 0);
    esp65 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp64) - 4 - 4 + 4 - 4);
    esi6(reinterpret_cast<int32_t>(esp65) + 28, 80, 55, 0, 0, 0, 1, 78, 55, 0);
    esp66 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp65) - 4 - 4 - 4 - 4 - 4 + 4);
    edi39(reinterpret_cast<int32_t>(esp66) + 24, 1, 80, 55, 0, 0, 0, 1, 78, 55, 0);
    esp67 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp66) - 4 - 4 + 4 - 4 - 4 - 4 - 4);
    esi6(reinterpret_cast<int32_t>(esp67) + 40, 61, 56, 0, 0, 0, 1, 80, 55, 0);
    esp68 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp67) - 4 - 4 + 4);
    edi39(reinterpret_cast<int32_t>(esp68) + 24, 1, 61, 56, 0, 0, 0, 1, 80, 55, 0);
    esp69 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp68) - 4 - 4 + 4 - 4 - 4 - 4 - 4);
    esi6(reinterpret_cast<int32_t>(esp69) + 40, 61, 46, 0, 0, 0, 1, 61, 56, 0, 0);
    esp70 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp69) - 4 - 4 + 4);
    edi39(reinterpret_cast<int32_t>(esp70) + 24, 1, 61, 46, 0, 0, 0, 1, 61, 56, 0, 0);
    esp71 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp70) - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4);
    esi6(reinterpret_cast<int32_t>(esp71) + 44);
    esp72 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp71) - 4 + 4);
    edi39(reinterpret_cast<int32_t>(esp72) + 24, 1);
    esp73 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp72) - 4 - 4 + 4 - 4 - 4 - 4 - 4);
    esi6(reinterpret_cast<int32_t>(esp73) + 40);
    edi39(reinterpret_cast<int32_t>(esp73) - 4 - 4 + 4 + 24);
    goto 63;
}

struct s20 {
    int32_t f0;
    int32_t f4;
    int32_t f8;
    int32_t f12;
    int32_t f16;
    int32_t f20;
};

/*
 * ?SetLavaPossible@GameMap@@SIXULOCATION@@H@Z
 * public: static void __fastcall GameMap::SetLavaPossible(struct LOCATION,int)
 */
int32_t SetLavaPossible_GameMap_SIXULOCATION_H_Z = 0xd558;

void fun_11001190(int32_t a1, int32_t a2, int32_t a3, int32_t a4) {
    struct s20* esi5;
    int32_t edi6;
    int32_t ebp7;
    int32_t ebx8;
    int32_t v9;
    int32_t v10;
    int32_t ebx11;
    int32_t v12;
    int32_t v13;
    int32_t ebx14;
    int32_t v15;
    int32_t v16;

    esi5 = reinterpret_cast<struct s20*>(0x11009164);
    edi6 = SetLavaPossible_GameMap_SIXULOCATION_H_Z;
    do {
        ebp7 = *reinterpret_cast<int32_t*>(reinterpret_cast<uint32_t>(esi5) - 4);
        ebx8 = esi5->f0;
        if (ebx8 >= 0 && esi5->f4 >= ebx8) {
            v9 = ebp7;
            do {
                v10 = ebx8;
                ++ebx8;
                edi6(1, v9, v10);
            } while (esi5->f4 >= ebx8);
        }
        ebx11 = esi5->f8;
        if (ebx11 >= 0 && esi5->f12 >= ebx11) {
            v12 = ebp7;
            do {
                v13 = ebx11;
                ++ebx11;
                edi6(1, v12, v13);
            } while (esi5->f12 >= ebx11);
        }
        ebx14 = esi5->f16;
        if (ebx14 >= 0 && esi5->f20 >= ebx14) {
            v15 = ebp7;
            do {
                v16 = ebx14;
                ++ebx14;
                edi6(1, v15, v16);
            } while (esi5->f20 >= ebx14);
        }
        esi5 = reinterpret_cast<struct s20*>(reinterpret_cast<uint32_t>(esi5) + 28);
    } while (reinterpret_cast<uint32_t>(esi5) < 0x11009fb8);
    return;
}

/*
 * ?InitialSetTile@GameMap@@SIXULOCATION@@H@Z
 * public: static void __fastcall GameMap::InitialSetTile(struct LOCATION,int)
 */
int32_t InitialSetTile_GameMap_SIXULOCATION_H_Z = 0xd6b4;

void fun_11002290(int32_t a1, int32_t a2, int32_t a3, int32_t a4) {
    int32_t v5;
    int32_t ebx6;
    int32_t v7;
    int32_t esi8;
    int32_t v9;
    int32_t edi10;
    int32_t v11;
    int32_t ebp12;
    int32_t edi13;
    int32_t eax14;
    int32_t esi15;
    int32_t eax16;
    int32_t ebx17;
    int32_t eax18;
    int32_t eax19;
    int32_t eax20;
    int32_t ebx21;
    int32_t eax22;
    int32_t esi23;
    int32_t eax24;
    int32_t eax25;
    int32_t ebx26;
    int32_t eax27;
    int32_t esi28;
    int32_t eax29;
    int32_t eax30;
    int32_t v31;
    int32_t eax32;
    int32_t esi33;
    int32_t eax34;
    int32_t eax35;
    int32_t ebx36;
    int32_t eax37;
    struct s0* ecx38;
    int32_t eax39;
    int32_t esi40;
    int32_t esi41;
    int32_t esi42;

    v5 = ebx6;
    v7 = esi8;
    v9 = edi10;
    v11 = ebp12;
    edi13 = GetRand_TethysGame_SIHH_Z;
    eax14 = reinterpret_cast<int32_t>(edi13(19, v11, v9, v7, v5));
    esi15 = eax14;
    eax16 = reinterpret_cast<int32_t>(edi13(19, v11, v9, v7, v5));
    ebx17 = eax16;
    if (eax16 == esi15) {
        do {
            eax18 = reinterpret_cast<int32_t>(edi13(19, v11, v9, v7, v5));
            ebx17 = eax18;
        } while (eax18 == esi15);
    }
    addr_0x110022c0_3:
    eax19 = reinterpret_cast<int32_t>(edi13(19, v11, v9, v7, v5));
    if (eax19 == esi15) 
        goto addr_0x110022c0_3;
    if (eax19 == ebx17) 
        goto addr_0x110022c0_3;
    fun_11001de0(esi15, v11, v9, v7, v5);
    fun_11001de0(ebx17, v11, v9, v7, v5);
    fun_11001de0(eax19, v11, v9, v7, v5);
    eax20 = reinterpret_cast<int32_t>(edi13(11, v11, v9, v7, v5));
    ebx21 = eax20;
    eax22 = reinterpret_cast<int32_t>(edi13(11, v11, v9, v7, v5));
    esi23 = eax22;
    if (eax22 == ebx21) {
        do {
            eax24 = reinterpret_cast<int32_t>(edi13(11, v11, v9, v7, v5));
            esi23 = eax24;
        } while (eax24 == ebx21);
    }
    fun_11001c70(ebx21, v11, v9, v7, v5);
    fun_11001c70(esi23, v11, v9, v7, v5);
    eax25 = reinterpret_cast<int32_t>(edi13(12, v11, v9, v7, v5));
    ebx26 = eax25;
    eax27 = reinterpret_cast<int32_t>(edi13(12, v11, v9, v7, v5));
    esi28 = eax27;
    if (eax27 == ebx26) {
        do {
            eax29 = reinterpret_cast<int32_t>(edi13(12, v11, v9, v7, v5));
            esi28 = eax29;
        } while (eax29 == ebx26);
    }
    fun_11001af0(ebx26, v11, v9, v7, v5);
    fun_11001af0(esi28, v11, v9, v7, v5);
    eax30 = reinterpret_cast<int32_t>(edi13(12, v11, v9, v7, v5));
    v31 = eax30;
    eax32 = reinterpret_cast<int32_t>(edi13(12, v11, v9, v7, v5));
    esi33 = eax32;
    if (esi33 == v31) {
        do {
            eax34 = reinterpret_cast<int32_t>(edi13(12, v11, v9, v7, v5));
            esi33 = eax34;
        } while (esi33 == v31);
    }
    addr_0x11002385_11:
    eax35 = reinterpret_cast<int32_t>(edi13(12, v11, v9, v7, v5));
    ebx36 = eax35;
    if (ebx36 == v31) 
        goto addr_0x11002385_11;
    if (ebx36 == esi33) 
        goto addr_0x11002385_11;
    addr_0x1100239a_13:
    eax37 = reinterpret_cast<int32_t>(edi13(12, v11, v9, v7, v5));
    if (eax37 == v31) 
        goto addr_0x1100239a_13;
    if (eax37 == esi33) 
        goto addr_0x1100239a_13;
    if (eax37 == ebx36) 
        goto addr_0x1100239a_13;
    fun_11001930(v31, 0, v11, v9, v7, v5);
    fun_11001930(esi33, 0, v11, v9, v7, v5);
    fun_11001930(ebx36, 0xff, v11, v9, v7, v5);
    fun_11001930(eax37, 0xff, v11, v9, v7, v5);
    ecx38 = Player_3PAV_Player_A;
    eax39 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx38, v11, v9, v7, v5));
    if (!eax39 || (eax39 == 1 || eax39 == 2)) {
        fun_11002030(ecx38, v11, v9, v7, v5);
    }
    esi40 = CreateWallOrTube_TethysGame_SIHHHHW4map_id_Z;
    esi40(61, 0, 17, v11, v9, v7, v5);
    esi40(62, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(63, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(64, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(65, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(66, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(67, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(69, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(69, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(69, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(69, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(72, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(73, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(74, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(75, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(76, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi40(77, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, v11, v9, v7, v5);
    esi41 = InitialSetTile_GameMap_SIXULOCATION_H_Z;
    esi41(0x447, 0xc3, 0x98, 0, 17, 0, 17);
    esi41(0x453, 0xc4, 0x98, 0xc3, 0x98, 0, 17);
    esi41(0x45e, 0xc3, 0x99, 0xc4, 0x98, 0xc3, 0x98);
    esi41(0x469, 0xc4, 0x99, 0xc3, 0x99, 0xc4, 0x98);
    esi41(0x489, 0xc9, 0x94, 0xc4, 0x99, 0xc3, 0x99);
    esi41(0x494, 0xca, 0x94, 0xc9, 0x94, 0xc4, 0x99);
    esi41(0x4a0, 0xc9, 0x95, 0xca, 0x94, 0xc9, 0x94);
    esi41(0x4ab, 0xca, 0x95, 0xc9, 0x95, 0xca, 0x94);
    esi41(0x474, 0xce, 6, 0xca, 0x95, 0xc9, 0x95);
    esi41(0x47e, 0xce, 7, 0xce, 6, 0xca, 0x95);
    esi41(0x474, 0xce, 0xa0, 0xce, 7, 0xce, 6);
    esi41(0x47e, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42 = CreateBeacon_TethysGame_SIHW4map_id_HHHHH_Z;
    esi42(82, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(82, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(82, 0x8f, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(82, 29, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(82, 0x77, 0xff, 0xff, 0xff, 29, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(82, 0xca, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, 29, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(83, 0xf8, 0xff, 0xff, 0xff, 0xca, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, 29, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(83, 0x9b, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xca, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, 29, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(83, 0x9b, 0xff, 0xff, 0xff, 0x9b, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xca, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, 29, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(83, 0x93, 0xff, 0xff, 0xff, 0x9b, 0xff, 0xff, 0xff, 0x9b, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xca, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, 29, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(83, 0xdd, 0xff, 0xff, 0xff, 0x93, 0xff, 0xff, 0xff, 0x9b, 0xff, 0xff, 0xff, 0x9b, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xca, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, 29, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(83, 0xc7, 0xff, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0x93, 0xff, 0xff, 0xff, 0x9b, 0xff, 0xff, 0xff, 0x9b, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xca, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, 29, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(83, 10, 0xff, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0x93, 0xff, 0xff, 0xff, 0x9b, 0xff, 0xff, 0xff, 0x9b, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xca, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, 29, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 9, 0xff, 0xff, 0xff, 0xce, 0xa1, 0xce, 0xa0, 0xce, 7, 0xce);
    esi42(83, 47, 0xff);
    esi42(83);
    goto 0xff;
}

/*
 * ?SetOre@_Player@@QAEXH@Z
 * public: void __thiscall _Player::SetOre(int)
 */
int32_t SetOre__Player_QAEXH_Z = 0xde1e;

/*
 * ?ForceMoraleGood@TethysGame@@SIXH@Z
 * public: static void __fastcall TethysGame::ForceMoraleGood(int)
 */
int32_t ForceMoraleGood_TethysGame_SIXH_Z = 0xddf8;

/*
 * ?CreateTimeTrigger@@YI?AVTrigger@@HHHPBD@Z
 * class Trigger __fastcall CreateTimeTrigger(int,int,int,char const *)
 */
int32_t CreateTimeTrigger_YI_AVTrigger_HHHPBD_Z = 0xd7f0;

/*
 * ??1ScStub@@QAE@XZ
 * public: __thiscall ScStub::~ScStub(void)
 */
int32_t 1ScStub_QAE_XZ = 0xd370;

/*
 * ?SetFoodStored@_Player@@QAEXH@Z
 * public: void __thiscall _Player::SetFoodStored(int)
 */
int32_t SetFoodStored__Player_QAEXH_Z = 0xddd6;

/*
 * ?SetWorkers@_Player@@QAEXH@Z
 * public: void __thiscall _Player::SetWorkers(int)
 */
int32_t SetWorkers__Player_QAEXH_Z = 0xddb6;

/*
 * ?SetScientists@_Player@@QAEXH@Z
 * public: void __thiscall _Player::SetScientists(int)
 */
int32_t SetScientists__Player_QAEXH_Z = 0xdd94;

/*
 * ?SetKids@_Player@@QAEXH@Z
 * public: void __thiscall _Player::SetKids(int)
 */
int32_t SetKids__Player_QAEXH_Z = 0xdd78;

/*
 * ?MarkResearchComplete@_Player@@QAEXH@Z
 * public: void __thiscall _Player::MarkResearchComplete(int)
 */
int32_t MarkResearchComplete__Player_QAEXH_Z = 0xdd4e;

void fun_11005a40(int32_t a1, int32_t a2, int32_t a3, int32_t a4) {
    struct s0* ecx5;
    int32_t esi6;
    struct s0* ecx7;
    int32_t esi8;
    int32_t eax9;
    void* esp10;
    struct s0* ecx11;
    int32_t eax12;
    struct s0* ecx13;
    struct s0* ecx14;
    struct s0* ecx15;
    struct s0* ecx16;
    struct s0* ecx17;
    int32_t esi18;
    struct s0* ecx19;
    struct s0* ecx20;
    struct s0* ecx21;
    struct s0* ecx22;
    struct s0* ecx23;
    struct s0* ecx24;
    int32_t esi25;
    struct s0* ecx26;
    struct s0* ecx27;
    struct s0* ecx28;
    struct s0* ecx29;
    struct s0* ecx30;
    struct s0* ecx31;

    ecx5 = Player_3PAV_Player_A;
    SetOre__Player_QAEXH_Z(ecx5, 0x1388, esi6);
    ecx7 = Player_3PAV_Player_A;
    esi8 = Difficulty__Player_QBEHXZ;
    eax9 = reinterpret_cast<int32_t>(esi8(ecx7, 0x1388, esi6));
    if (!eax9) {
        ForceMoraleGood_TethysGame_SIXH_Z(-1, 0x1388, esi6);
        esp10 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 4 - 4 - 4 - 4 + 4 - 4 + 4 - 4 + 4);
        CreateTimeTrigger_YI_AVTrigger_HHHPBD_Z(reinterpret_cast<int32_t>(esp10) + 4, 1, 10, "ReleaseMorale", 0x1388, esi6);
        1ScStub_QAE_XZ(reinterpret_cast<int32_t>(esp10) - 4 - 4 - 4 - 4 + 4 + 4, 1, 10, "ReleaseMorale", 0x1388, esi6);
    }
    ecx11 = Player_3PAV_Player_A;
    eax12 = reinterpret_cast<int32_t>(esi8(ecx11, 0x1388, esi6));
    if (!eax12) {
        ecx13 = Player_3PAV_Player_A;
        SetFoodStored__Player_QAEXH_Z(ecx13, 0xbb8, 0x1388, esi6);
        ecx14 = Player_3PAV_Player_A;
        SetWorkers__Player_QAEXH_Z(ecx14, 25, 0xbb8, 0x1388, esi6);
        ecx15 = Player_3PAV_Player_A;
        SetScientists__Player_QAEXH_Z(ecx15, 20, 25, 0xbb8, 0x1388, esi6);
        ecx16 = Player_3PAV_Player_A;
        SetKids__Player_QAEXH_Z(ecx16);
        ecx17 = Player_3PAV_Player_A;
        esi18 = MarkResearchComplete__Player_QAEXH_Z;
        esi18(ecx17, 0xce8);
        ecx19 = Player_3PAV_Player_A;
        esi18(ecx19);
        goto 30;
    } else {
        if (eax12 == 1) {
            ecx20 = Player_3PAV_Player_A;
            SetFoodStored__Player_QAEXH_Z(ecx20, 0x7d0, 0x1388, esi6);
            ecx21 = Player_3PAV_Player_A;
            SetWorkers__Player_QAEXH_Z(ecx21, 20, 0x7d0, 0x1388, esi6);
            ecx22 = Player_3PAV_Player_A;
            SetScientists__Player_QAEXH_Z(ecx22, 15, 20, 0x7d0, 0x1388, esi6);
            ecx23 = Player_3PAV_Player_A;
            SetKids__Player_QAEXH_Z(ecx23);
            ecx24 = Player_3PAV_Player_A;
            esi25 = MarkResearchComplete__Player_QAEXH_Z;
            esi25(ecx24, 0xce8);
            ecx26 = Player_3PAV_Player_A;
            esi25(ecx26);
            goto 25;
        } else {
            ecx27 = Player_3PAV_Player_A;
            SetFoodStored__Player_QAEXH_Z(ecx27, 0x3e8, 0x1388, esi6);
            ecx28 = Player_3PAV_Player_A;
            SetWorkers__Player_QAEXH_Z(ecx28, 25, 0x3e8, 0x1388, esi6);
            ecx29 = Player_3PAV_Player_A;
            SetScientists__Player_QAEXH_Z(ecx29);
            ecx30 = Player_3PAV_Player_A;
            SetKids__Player_QAEXH_Z(ecx30, 15);
            ecx31 = Player_3PAV_Player_A;
            MarkResearchComplete__Player_QAEXH_Z(ecx31);
            goto 10;
        }
    }
}

/*
 * ?CreateResourceTrigger@@YI?AVTrigger@@HHW4trig_res@@HHW4compare_mode@@PBD@Z
 * class Trigger __fastcall CreateResourceTrigger(int,int,enum trig_res,int,int,enum compare_mode,char const *)
 */
int32_t CreateResourceTrigger_YI_AVTrigger_HHW4trig_res_HHW4compare_mode_PBD_Z = 0xdcda;

/*
 * ?CreateVictoryCondition@@YI?AVTrigger@@HHAAV1@PBD@Z
 * class Trigger __fastcall CreateVictoryCondition(int,int,class Trigger &,char const *)
 */
int32_t CreateVictoryCondition_YI_AVTrigger_HHAAV1_PBD_Z = 0xdca4;

int32_t g1100cbf4;

int32_t g1100cbf0;

int32_t g1100cbec;

/*
 * ?CreateTimeTrigger@@YI?AVTrigger@@HHHHPBD@Z
 * class Trigger __fastcall CreateTimeTrigger(int,int,int,int,char const *)
 */
int32_t CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z = 0xd708;

/*
 * ?CreateResearchTrigger@@YI?AVTrigger@@HHHHPBD@Z
 * class Trigger __fastcall CreateResearchTrigger(int,int,int,int,char const *)
 */
int32_t CreateResearchTrigger_YI_AVTrigger_HHHHPBD_Z = 0xdc72;

/*
 * ?CreateOperationalTrigger@@YI?AVTrigger@@HHHW4map_id@@HW4compare_mode@@PBD@Z
 * class Trigger __fastcall CreateOperationalTrigger(int,int,int,enum map_id,int,enum compare_mode,char const *)
 */
int32_t CreateOperationalTrigger_YI_AVTrigger_HHHW4map_id_HW4compare_mode_PBD_Z = 0xdc22;

/*
 * ?CreateFailureCondition@@YI?AVTrigger@@HHAAV1@PBD@Z
 * class Trigger __fastcall CreateFailureCondition(int,int,class Trigger &,char const *)
 */
int32_t CreateFailureCondition_YI_AVTrigger_HHAAV1_PBD_Z = 0xdb12;

void fun_11005380() {
    struct s0* ecx1;
    int32_t edi2;
    int32_t ebp3;
    void* edi4;
    int32_t esi5;
    int32_t ebx6;
    int32_t eax7;
    void* esp8;
    int32_t esi9;
    void* esp10;
    void* esp11;
    void* esp12;
    int32_t ebx13;
    void* esp14;
    void* esp15;
    void* esp16;
    void* esp17;
    void* esp18;
    void* esp19;
    void* esp20;
    void* esp21;
    void* esp22;
    struct s0* ecx23;
    int32_t eax24;
    void* esp25;
    int32_t v26;
    void* esp27;
    void* esp28;
    int32_t v29;
    void* esp30;
    void* esp31;
    int32_t v32;
    void* esp33;
    void* esp34;
    int32_t v35;
    void* esp36;
    void* esp37;
    int32_t v38;
    void* esp39;
    int32_t v40;
    void* esp41;
    void* esp42;
    void* esp43;
    int32_t v44;
    int32_t v45;
    void* esp46;
    void* ecx47;
    void* esp48;
    void* esp49;
    void* esp50;
    void* esp51;
    void* esp52;
    void* esp53;
    void* esp54;
    void* esp55;
    void* esp56;
    void* esp57;
    void* esp58;
    void* esp59;
    void* esp60;
    void* esp61;
    void* esp62;
    void* esp63;
    void* esp64;
    void* esp65;
    void* esp66;
    void* esp67;
    void* esp68;
    void* esp69;
    void* esp70;
    void* esp71;
    void* esp72;
    void* esp73;
    struct s0* ecx74;
    int32_t eax75;
    void* esp76;
    int32_t ebp77;
    void* esp78;
    void* esp79;
    void* esp80;
    void* esp81;
    void* esp82;
    void* esp83;
    void* esp84;
    void* esp85;
    void* esp86;
    void* esp87;
    void* esp88;
    struct s0* ecx89;
    int32_t eax90;
    void* esp91;
    void* esp92;
    void* esp93;
    void* esp94;
    void* esp95;
    void* esp96;
    void* esp97;
    void* esp98;
    void* esp99;
    void* esp100;
    void* esp101;
    void* esp102;
    void* esp103;
    void* esp104;
    int32_t ebp105;
    void* esp106;
    void* esp107;
    void* esp108;

    ecx1 = Player_3PAV_Player_A;
    edi2 = Difficulty__Player_QBEHXZ;
    eax7 = reinterpret_cast<int32_t>(edi2(ecx1, ebp3, edi4, esi5, ebx6));
    esp8 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 12 - 4 - 4 - 4 - 4 - 4 + 4);
    if (!eax7) {
        esi9 = CreateResourceTrigger_YI_AVTrigger_HHW4trig_res_HHW4compare_mode_PBD_Z;
        esi9(reinterpret_cast<int32_t>(esp8) + 20, 1, 6, 0x1c2, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
        esp10 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp8) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
        esp11 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp10) - 4);
        CreateVictoryCondition_YI_AVTrigger_HHAAV1_PBD_Z(reinterpret_cast<int32_t>(esp11) + 20, 0, reinterpret_cast<int32_t>(esp10) + 20, "Build your population to 450 colonists.", 1, 6, 0x1c2, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
        esp12 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp11) - 4 - 4 - 4 + 4);
        ebx13 = 1ScStub_QAE_XZ;
        ebx13(reinterpret_cast<int32_t>(esp12) + 16, 0, reinterpret_cast<int32_t>(esp10) + 20, "Build your population to 450 colonists.", 1, 6, 0x1c2, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
        esp14 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp12) - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp14) + 20, 0, reinterpret_cast<int32_t>(esp10) + 20, "Build your population to 450 colonists.", 1, 6, 0x1c2, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
        esp8 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp14) - 4 + 4);
    } else {
        if (eax7 == 1) {
            esi9 = CreateResourceTrigger_YI_AVTrigger_HHW4trig_res_HHW4compare_mode_PBD_Z;
            esi9(reinterpret_cast<int32_t>(esp8) + 20, 1, 6, 0x258, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
            esp15 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp8) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
            esp16 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp15) - 4);
            CreateVictoryCondition_YI_AVTrigger_HHAAV1_PBD_Z(reinterpret_cast<int32_t>(esp16) + 20, 0, reinterpret_cast<int32_t>(esp15) + 20, "Build your population to 600 colonists.", 1, 6, 0x258, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
            esp17 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp16) - 4 - 4 - 4 + 4);
            ebx13 = 1ScStub_QAE_XZ;
            ebx13(reinterpret_cast<int32_t>(esp17) + 16, 0, reinterpret_cast<int32_t>(esp15) + 20, "Build your population to 600 colonists.", 1, 6, 0x258, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
            esp18 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp17) - 4 + 4);
            ebx13(reinterpret_cast<int32_t>(esp18) + 20, 0, reinterpret_cast<int32_t>(esp15) + 20, "Build your population to 600 colonists.", 1, 6, 0x258, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
            esp8 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp18) - 4 + 4);
        } else {
            if (eax7 == 2) {
                esi9 = CreateResourceTrigger_YI_AVTrigger_HHW4trig_res_HHW4compare_mode_PBD_Z;
                esi9(reinterpret_cast<int32_t>(esp8) + 20, 1, 6, 0x2ee, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
                esp19 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp8) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
                esp20 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp19) - 4);
                CreateVictoryCondition_YI_AVTrigger_HHAAV1_PBD_Z(reinterpret_cast<int32_t>(esp20) + 20, 0, reinterpret_cast<int32_t>(esp19) + 20, "Build your population to 750 colonists.", 1, 6, 0x2ee, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
                esp21 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp20) - 4 - 4 - 4 + 4);
                ebx13 = 1ScStub_QAE_XZ;
                ebx13(reinterpret_cast<int32_t>(esp21) + 16, 0, reinterpret_cast<int32_t>(esp19) + 20, "Build your population to 750 colonists.", 1, 6, 0x2ee, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
                esp22 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp21) - 4 + 4);
                ebx13(reinterpret_cast<int32_t>(esp22) + 20, 0, reinterpret_cast<int32_t>(esp19) + 20, "Build your population to 750 colonists.", 1, 6, 0x2ee, 0, 2, "NoResponseToTrigger", ebp3, edi4, esi5, ebx6);
                esp8 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp22) - 4 + 4);
            } else {
                ebx13 = 1ScStub_QAE_XZ;
                esi9 = CreateResourceTrigger_YI_AVTrigger_HHW4trig_res_HHW4compare_mode_PBD_Z;
            }
        }
    }
    g1100cbf4 = 0;
    g1100cbf0 = 0;
    g1100cbec = 0;
    ecx23 = Player_3PAV_Player_A;
    eax24 = reinterpret_cast<int32_t>(edi2(ecx23, ebp3, edi4, esi5, ebx6));
    esp25 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp8) - 4 + 4);
    if (!eax24) {
        v26 = 100;
        esi9(reinterpret_cast<int32_t>(esp25) + 16, 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp27 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp25) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp27) + 16, 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp28 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp27) - 4 + 4);
        v29 = 0xb4;
        esi9(reinterpret_cast<int32_t>(esp28) + 16, 1, 6, 0xb4, 0, 4, "Lava", 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp30 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp28) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp30) + 16, 1, 6, 0xb4, 0, 4, "Lava", 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp31 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp30) - 4 + 4);
        v32 = 0x16f;
        esi9(reinterpret_cast<int32_t>(esp31) + 16, 1, 6, 0x16f, 0, 4, "Lava", 1, 6, 0xb4, 0, 4, "Lava", 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp33 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp31) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp33) + 16, 1, 6, 0x16f, 0, 4, "Lava", 1, 6, 0xb4, 0, 4, "Lava", 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp34 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp33) - 4 + 4);
        v35 = 90;
        esi9(reinterpret_cast<int32_t>(esp34) + 16, 1, 6, 90, 0, 4, "StormRepeat", 1, 6, 0x16f, 0, 4, "Lava", 1, 6, 0xb4, 0, 4, "Lava", 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp36 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp34) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp36) + 16, 1, 6, 90, 0, 4, "StormRepeat", 1, 6, 0x16f, 0, 4, "Lava", 1, 6, 0xb4, 0, 4, "Lava", 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp37 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp36) - 4 + 4);
        v38 = 0xf9;
        esi9(reinterpret_cast<int32_t>(esp37) + 16, 1, 6, 0xf9, 0, 4, "TornadoRepeat", 1, 6, 90, 0, 4, "StormRepeat", 1, 6, 0x16f, 0, 4, "Lava", 1, 6, 0xb4, 0, 4, "Lava", 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp39 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp37) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp39) + 16, 1, 6, 0xf9, 0, 4, "TornadoRepeat", 1, 6, 90, 0, 4, "StormRepeat", 1, 6, 0x16f, 0, 4, "Lava", 1, 6, 0xb4, 0, 4, "Lava", 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        v40 = 52;
        esp41 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp39) - 4 + 4 - 4 - 4 - 4 - 4 - 4 - 4);
        esi9(reinterpret_cast<int32_t>(esp41) + 40, 1, 6, 52, 0, 4, "MeteorRepeat", 1, 6, 0xf9, 0, 4, "TornadoRepeat", 1, 6, 90, 0, 4, "StormRepeat", 1, 6, 0x16f, 0, 4, "Lava", 1, 6, 0xb4, 0, 4, "Lava", 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp42 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp41) - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp42) + 16, 1, 6, 52, 0, 4, "MeteorRepeat", 1, 6, 0xf9, 0, 4, "TornadoRepeat", 1, 6, 90, 0, 4, "StormRepeat", 1, 6, 0x16f, 0, 4, "Lava", 1, 6, 0xb4, 0, 4, "Lava", 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp43 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp42) - 4 + 4);
        v44 = 0x2af8;
        v45 = 0x1770;
        CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z(reinterpret_cast<int32_t>(esp43) + 16, 0, 0x1770, 0x2af8, "Quake", 1, 6, 52, 0, 4, "MeteorRepeat", 1, 6, 0xf9, 0, 4, "TornadoRepeat", 1, 6, 90, 0, 4, "StormRepeat", 1, 6, 0x16f, 0, 4, "Lava", 1, 6, 0xb4, 0, 4, "Lava", 1, 6, 100, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
        esp46 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp43) - 4 - 4 - 4 - 4 - 4 + 4);
        ecx47 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp46) + 16);
    } else {
        if (eax24 == 1) {
            v26 = 0x96;
            esi9(reinterpret_cast<int32_t>(esp25) + 16, 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp48 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp25) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
            ebx13(reinterpret_cast<int32_t>(esp48) + 16, 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp49 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp48) - 4 + 4);
            v29 = 0x10e;
            esi9(reinterpret_cast<int32_t>(esp49) + 16, 1, 6, 0x10e, 0, 4, "Lava", 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp50 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp49) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
            ebx13(reinterpret_cast<int32_t>(esp50) + 16, 1, 6, 0x10e, 0, 4, "Lava", 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp51 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp50) - 4 + 4);
            v32 = 0x226;
            esi9(reinterpret_cast<int32_t>(esp51) + 16, 1, 6, 0x226, 0, 4, "Lava", 1, 6, 0x10e, 0, 4, "Lava", 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp52 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp51) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
            ebx13(reinterpret_cast<int32_t>(esp52) + 16, 1, 6, 0x226, 0, 4, "Lava", 1, 6, 0x10e, 0, 4, "Lava", 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp53 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp52) - 4 + 4);
            v35 = 0xa0;
            esi9(reinterpret_cast<int32_t>(esp53) + 16, 1, 6, 0xa0, 0, 4, "StormRepeat", 1, 6, 0x226, 0, 4, "Lava", 1, 6, 0x10e, 0, 4, "Lava", 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp54 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp53) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
            ebx13(reinterpret_cast<int32_t>(esp54) + 16, 1, 6, 0xa0, 0, 4, "StormRepeat", 1, 6, 0x226, 0, 4, "Lava", 1, 6, 0x10e, 0, 4, "Lava", 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp55 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp54) - 4 + 4);
            v38 = 90;
            esi9(reinterpret_cast<int32_t>(esp55) + 16, 1, 6, 90, 0, 4, "TornadoRepeat", 1, 6, 0xa0, 0, 4, "StormRepeat", 1, 6, 0x226, 0, 4, "Lava", 1, 6, 0x10e, 0, 4, "Lava", 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp56 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp55) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
            ebx13(reinterpret_cast<int32_t>(esp56) + 16, 1, 6, 90, 0, 4, "TornadoRepeat", 1, 6, 0xa0, 0, 4, "StormRepeat", 1, 6, 0x226, 0, 4, "Lava", 1, 6, 0x10e, 0, 4, "Lava", 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            v40 = 0x118;
            esp57 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp56) - 4 + 4 - 4 - 4 - 4 - 4 - 4 - 4);
            esi9(reinterpret_cast<int32_t>(esp57) + 40, 1, 6, 0x118, 0, 4, "MeteorRepeat", 1, 6, 90, 0, 4, "TornadoRepeat", 1, 6, 0xa0, 0, 4, "StormRepeat", 1, 6, 0x226, 0, 4, "Lava", 1, 6, 0x10e, 0, 4, "Lava", 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp58 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp57) - 4 + 4);
            ebx13(reinterpret_cast<int32_t>(esp58) + 16, 1, 6, 0x118, 0, 4, "MeteorRepeat", 1, 6, 90, 0, 4, "TornadoRepeat", 1, 6, 0xa0, 0, 4, "StormRepeat", 1, 6, 0x226, 0, 4, "Lava", 1, 6, 0x10e, 0, 4, "Lava", 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp59 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp58) - 4 + 4);
            v44 = 0x32c8;
            v45 = 0x1f40;
            CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z(reinterpret_cast<int32_t>(esp59) + 16, 0, 0x1f40, 0x32c8, "Quake", 1, 6, 0x118, 0, 4, "MeteorRepeat", 1, 6, 90, 0, 4, "TornadoRepeat", 1, 6, 0xa0, 0, 4, "StormRepeat", 1, 6, 0x226, 0, 4, "Lava", 1, 6, 0x10e, 0, 4, "Lava", 1, 6, 0x96, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
            esp46 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp59) - 4 - 4 - 4 - 4 - 4 + 4);
            ecx47 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp46) + 16);
        } else {
            if (eax24 == 2) {
                v26 = 0xc8;
                esi9(reinterpret_cast<int32_t>(esp25) + 16, 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp60 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp25) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
                ebx13(reinterpret_cast<int32_t>(esp60) + 16, 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp61 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp60) - 4 + 4);
                v29 = 0x168;
                esi9(reinterpret_cast<int32_t>(esp61) + 16, 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp62 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp61) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
                ebx13(reinterpret_cast<int32_t>(esp62) + 16, 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp63 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp62) - 4 + 4);
                v32 = 0x276;
                esi9(reinterpret_cast<int32_t>(esp63) + 16, 1, 6, 0x276, 0, 4, "Lava", 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp64 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp63) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
                ebx13(reinterpret_cast<int32_t>(esp64) + 16, 1, 6, 0x276, 0, 4, "Lava", 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp65 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp64) - 4 + 4);
                v35 = 0xcd;
                esi9(reinterpret_cast<int32_t>(esp65) + 16, 1, 6, 0xcd, 0, 4, "StormRepeat", 1, 6, 0x276, 0, 4, "Lava", 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp66 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp65) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
                ebx13(reinterpret_cast<int32_t>(esp66) + 16, 1, 6, 0xcd, 0, 4, "StormRepeat", 1, 6, 0x276, 0, 4, "Lava", 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp67 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp66) - 4 + 4);
                v38 = 100;
                esi9(reinterpret_cast<int32_t>(esp67) + 16, 1, 6, 100, 0, 4, "TornadoRepeat", 1, 6, 0xcd, 0, 4, "StormRepeat", 1, 6, 0x276, 0, 4, "Lava", 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp68 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp67) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
                ebx13(reinterpret_cast<int32_t>(esp68) + 16, 1, 6, 100, 0, 4, "TornadoRepeat", 1, 6, 0xcd, 0, 4, "StormRepeat", 1, 6, 0x276, 0, 4, "Lava", 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                v40 = 0x168;
                esp69 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp68) - 4 + 4 - 4 - 4 - 4 - 4 - 4 - 4);
                esi9(reinterpret_cast<int32_t>(esp69) + 40, 1, 6, 0x168, 0, 4, "MeteorRepeat", 1, 6, 100, 0, 4, "TornadoRepeat", 1, 6, 0xcd, 0, 4, "StormRepeat", 1, 6, 0x276, 0, 4, "Lava", 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp70 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp69) - 4 + 4);
                ebx13(reinterpret_cast<int32_t>(esp70) + 16, 1, 6, 0x168, 0, 4, "MeteorRepeat", 1, 6, 100, 0, 4, "TornadoRepeat", 1, 6, 0xcd, 0, 4, "StormRepeat", 1, 6, 0x276, 0, 4, "Lava", 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp71 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp70) - 4 + 4);
                v44 = 0x2ee0;
                v45 = 0x1f40;
                CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z(reinterpret_cast<int32_t>(esp71) + 16, 0, 0x1f40, 0x2ee0, "Quake", 1, 6, 0x168, 0, 4, "MeteorRepeat", 1, 6, 100, 0, 4, "TornadoRepeat", 1, 6, 0xcd, 0, 4, "StormRepeat", 1, 6, 0x276, 0, 4, "Lava", 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp72 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp71) - 4 - 4 - 4 - 4 - 4 + 4);
                ebx13(reinterpret_cast<int32_t>(esp72) + 16, 0, 0x1f40, 0x2ee0, "Quake", 1, 6, 0x168, 0, 4, "MeteorRepeat", 1, 6, 100, 0, 4, "TornadoRepeat", 1, 6, 0xcd, 0, 4, "StormRepeat", 1, 6, 0x276, 0, 4, "Lava", 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp73 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp72) - 4 + 4);
                esi9(reinterpret_cast<int32_t>(esp73) + 16, 1, 6, 0x1f4, 0, 4, "BigQuake", 0, 0x1f40, 0x2ee0, "Quake", 1, 6, 0x168, 0, 4, "MeteorRepeat", 1, 6, 100, 0, 4, "TornadoRepeat", 1, 6, 0xcd, 0, 4, "StormRepeat", 1, 6, 0x276, 0, 4, "Lava", 1, 6, 0x168, 0, 4, "Lava", 1, 6, 0xc8, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
                esp46 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp73) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
                ecx47 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp46) + 16);
            } else {
                goto addr_0x110057f3_15;
            }
        }
    }
    ebx13(ecx47, 0, v45, v44, "Quake", 1, 6, v40, 0, 4, "MeteorRepeat", 1, 6, v38, 0, 4, "TornadoRepeat", 1, 6, v35, 0, 4, "StormRepeat", 1, 6, v32, 0, 4, "Lava", 1, 6, v29, 0, 4, "Lava", 1, 6, v26, 0, 4, "Lava", ebp3, edi4, esi5, ebx6);
    esp25 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp46) - 4 + 4);
    addr_0x110057f3_15:
    ecx74 = Player_3PAV_Player_A;
    eax75 = reinterpret_cast<int32_t>(edi2(ecx74, ebp3, edi4, esi5, ebx6));
    esp76 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp25) - 4 + 4);
    if (!eax75) {
        ebp77 = CreateResearchTrigger_YI_AVTrigger_HHHHPBD_Z;
    } else {
        ebp77 = CreateResearchTrigger_YI_AVTrigger_HHHHPBD_Z;
        ebp77(reinterpret_cast<int32_t>(esp76) + 16, 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        esp78 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp76) - 4 - 4 - 4 - 4 - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp78) + 16, 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        esp79 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp78) - 4 + 4);
        ebp77(reinterpret_cast<int32_t>(esp79) + 16, 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        esp80 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp79) - 4 - 4 - 4 - 4 - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp80) + 16, 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        esp81 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp80) - 4 + 4);
        ebp77(reinterpret_cast<int32_t>(esp81) + 16, 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        esp82 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp81) - 4 - 4 - 4 - 4 - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp82) + 16, 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        esp83 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp82) - 4 + 4);
        CreateTimeTrigger_YI_AVTrigger_HHHPBD_Z(reinterpret_cast<int32_t>(esp83) + 16, 1, 0x1b58, "ScoutArrive", 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        esp84 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp83) - 4 - 4 - 4 - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp84) + 16, 1, 0x1b58, "ScoutArrive", 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        esp85 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp84) - 4 + 4);
        esi9(reinterpret_cast<int32_t>(esp85) + 16, 1, 6, 0x1d6, 0, 4, "BigWave3", 1, 0x1b58, "ScoutArrive", 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        esp86 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp85) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp86) + 16, 1, 6, 0x1d6, 0, 4, "BigWave3", 1, 0x1b58, "ScoutArrive", 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        esp87 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp86) - 4 + 4);
        esi9(reinterpret_cast<int32_t>(esp87) + 16, 1, 6, 0x21c, 0, 4, "BigWave3", 1, 6, 0x1d6, 0, 4, "BigWave3", 1, 0x1b58, "ScoutArrive", 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        esp88 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp87) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
        ebx13(reinterpret_cast<int32_t>(esp88) + 16, 1, 6, 0x21c, 0, 4, "BigWave3", 1, 6, 0x1d6, 0, 4, "BigWave3", 1, 0x1b58, "ScoutArrive", 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
        ecx89 = Player_3PAV_Player_A;
        eax90 = reinterpret_cast<int32_t>(edi2(ecx89, 1, 6, 0x21c, 0, 4, "BigWave3", 1, 6, 0x1d6, 0, 4, "BigWave3", 1, 0x1b58, "ScoutArrive", 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6));
        esp76 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp88) - 4 + 4 - 4 + 4);
        if (eax90 == 2) {
            esi9(reinterpret_cast<int32_t>(esp76) + 16, 1, 6, 0x276, 0, 4, "BigWave3", 1, 6, 0x21c, 0, 4, "BigWave3", 1, 6, 0x1d6, 0, 4, "BigWave3", 1, 0x1b58, "ScoutArrive", 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
            esp91 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp76) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
            ebx13(reinterpret_cast<int32_t>(esp91) + 16, 1, 6, 0x276, 0, 4, "BigWave3", 1, 6, 0x21c, 0, 4, "BigWave3", 1, 6, 0x1d6, 0, 4, "BigWave3", 1, 0x1b58, "ScoutArrive", 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
            esp92 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp91) - 4 + 4);
            esi9(reinterpret_cast<int32_t>(esp92) + 16, 1, 6, 0x2b2, 0, 4, "BigWave3", 1, 6, 0x276, 0, 4, "BigWave3", 1, 6, 0x21c, 0, 4, "BigWave3", 1, 6, 0x1d6, 0, 4, "BigWave3", 1, 0x1b58, "ScoutArrive", 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
            esp93 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp92) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
            ebx13(reinterpret_cast<int32_t>(esp93) + 16, 1, 6, 0x2b2, 0, 4, "BigWave3", 1, 6, 0x276, 0, 4, "BigWave3", 1, 6, 0x21c, 0, 4, "BigWave3", 1, 6, 0x1d6, 0, 4, "BigWave3", 1, 0x1b58, "ScoutArrive", 1, 0x2009, 0, "ResearchedBig", 1, 0x1451, 0, "ResearchedMed", 1, 0xf0b, 0, "ResearchedWeapons", ebp3, edi4, esi5, ebx6);
            esp76 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp93) - 4 + 4);
        }
    }
    ebp77(reinterpret_cast<int32_t>(esp76) + 16, 1, 0x1bbe, 0, "ResStarflare", ebp3, edi4, esi5, ebx6);
    esp94 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp76) - 4 - 4 - 4 - 4 - 4 + 4);
    ebx13(reinterpret_cast<int32_t>(esp94) + 16, 1, 0x1bbe, 0, "ResStarflare", ebp3, edi4, esi5, ebx6);
    esp95 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp94) - 4 + 4);
    ebp77(reinterpret_cast<int32_t>(esp95) + 16, 1, 0x1582, 0, "ResRailGun", 1, 0x1bbe, 0, "ResStarflare", ebp3, edi4, esi5, ebx6);
    esp96 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp95) - 4 - 4 - 4 - 4 - 4 + 4);
    ebx13(reinterpret_cast<int32_t>(esp96) + 16, 1, 0x1582, 0, "ResRailGun", 1, 0x1bbe, 0, "ResStarflare", ebp3, edi4, esi5, ebx6);
    esp97 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp96) - 4 + 4);
    ebp77(reinterpret_cast<int32_t>(esp97) + 16, 1, 0x1584, 0, "ResEMP", 1, 0x1582, 0, "ResRailGun", 1, 0x1bbe, 0, "ResStarflare", ebp3, edi4, esi5, ebx6);
    esp98 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp97) - 4 - 4 - 4 - 4 - 4 + 4);
    ebx13(reinterpret_cast<int32_t>(esp98) + 16, 1, 0x1584, 0, "ResEMP", 1, 0x1582, 0, "ResRailGun", 1, 0x1bbe, 0, "ResStarflare", ebp3, edi4, esi5, ebx6);
    esp99 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp98) - 4 + 4);
    ebp77(reinterpret_cast<int32_t>(esp99) + 16, 1, 0x2137, 0, "ResAcid", 1, 0x1584, 0, "ResEMP", 1, 0x1582, 0, "ResRailGun", 1, 0x1bbe, 0, "ResStarflare", ebp3, edi4, esi5, ebx6);
    esp100 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp99) - 4 - 4 - 4 - 4 - 4 + 4);
    ebx13(reinterpret_cast<int32_t>(esp100) + 16, 1, 0x2137, 0, "ResAcid", 1, 0x1584, 0, "ResEMP", 1, 0x1582, 0, "ResRailGun", 1, 0x1bbe, 0, "ResStarflare", ebp3, edi4, esi5, ebx6);
    esp101 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp100) - 4 + 4);
    ebp77(reinterpret_cast<int32_t>(esp101) + 16, 1, 0x2776, 0, "ResThor", 1, 0x2137, 0, "ResAcid", 1, 0x1584, 0, "ResEMP", 1, 0x1582, 0, "ResRailGun", 1, 0x1bbe, 0, "ResStarflare", ebp3, edi4, esi5, ebx6);
    esp102 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp101) - 4 - 4 - 4 - 4 - 4 + 4);
    ebx13(reinterpret_cast<int32_t>(esp102) + 16, 1, 0x2776, 0, "ResThor", 1, 0x2137, 0, "ResAcid", 1, 0x1584, 0, "ResEMP", 1, 0x1582, 0, "ResRailGun", 1, 0x1bbe, 0, "ResStarflare", ebp3, edi4, esi5, ebx6);
    esp103 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp102) - 4 + 4);
    CreateOperationalTrigger_YI_AVTrigger_HHHW4map_id_HW4compare_mode_PBD_Z(reinterpret_cast<int32_t>(esp103) + 24, 1);
    esp104 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp103) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4 - 4);
    ebp105 = CreateFailureCondition_YI_AVTrigger_HHAAV1_PBD_Z;
    ebp105(reinterpret_cast<int32_t>(esp104) + 20);
    esp106 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp104) - 4 - 4 - 4 + 4);
    ebx13(reinterpret_cast<int32_t>(esp106) + 16);
    esp107 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp106) - 4 + 4);
    CreateTimeTrigger_YI_AVTrigger_HHHPBD_Z(reinterpret_cast<int32_t>(esp107) + 16);
    esp108 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp107) - 4 - 4 - 4 - 4 + 4);
    ebx13(reinterpret_cast<int32_t>(esp108) + 16);
    ebx13(reinterpret_cast<int32_t>(esp108) - 4 + 4 + 24);
    goto 0;
}

void fun_11001000() {
    return;
}

/*
 * ?SetEarthquake@TethysGame@@SIXHHH@Z
 * public: static void __fastcall TethysGame::SetEarthquake(int,int,int)
 */
int32_t SetEarthquake_TethysGame_SIXHHH_Z = 0xd7ca;

void BigQuake() {
    int32_t esi1;
    int32_t eax2;
    int32_t esi3;

    esi1 = GetRand_TethysGame_SIHH_Z;
    esi1(3);
    eax2 = reinterpret_cast<int32_t>(esi1(3));
    SetEarthquake_TethysGame_SIXHHH_Z(eax2 + 0xe1);
    goto esi3;
}

struct s21 {
    int32_t f0;
    uint32_t f4;
    int32_t f8;
};

/*
 * ?CreateFightGroup@@YI?AVFightGroup@@V_Player@@@Z
 * class FightGroup __fastcall CreateFightGroup(class _Player)
 */
int32_t CreateFightGroup_YI_AVFightGroup_V_Player_Z = 0xd8b6;

/*
 * ?DoAttackEnemy@FightGroup@@QAEXXZ
 * public: void __thiscall FightGroup::DoAttackEnemy(void)
 */
int32_t DoAttackEnemy_FightGroup_QAEXXZ = 0xd892;

/*
 * ?SetRect@FightGroup@@QAEXAAUMAP_RECT@@@Z
 * public: void __thiscall FightGroup::SetRect(struct MAP_RECT &)
 */
int32_t SetRect_FightGroup_QAEXAAUMAP_RECT_Z = 0xd866;

/*
 * ??0PlayerVehicleEnum@@QAE@H@Z
 * public: __thiscall PlayerVehicleEnum::PlayerVehicleEnum(int)
 */
int32_t 0PlayerVehicleEnum_QAE_H_Z = 0xda5a;

/*
 * ?GetNext@PlayerVehicleEnum@@QAEHAAVUnit@@@Z
 * public: int __thiscall PlayerVehicleEnum::GetNext(class Unit &)
 */
int32_t GetNext_PlayerVehicleEnum_QAEHAAVUnit_Z = 0xda2c;

/*
 * ?GetType@Unit@@QBE?AW4map_id@@XZ
 * public: enum map_id __thiscall Unit::GetType(void)const
 */
int32_t GetType_Unit_QBE_AW4map_id_XZ = 0xda08;

/*
 * ?TakeUnit@ScGroup@@QAEXVUnit@@@Z
 * public: void __thiscall ScGroup::TakeUnit(class Unit)
 */
int32_t TakeUnit_ScGroup_QAEXVUnit_Z = 0xd9e4;

/*
 * ?SetLights@ScGroup@@QAEXH@Z
 * public: void __thiscall ScGroup::SetLights(int)
 */
int32_t SetLights_ScGroup_QAEXH_Z = 0xd81e;

void BigWave3() {
    struct s0* ecx1;
    struct s21* ecx2;
    int32_t v3;
    int32_t ebx4;
    int32_t eax5;
    uint32_t edx6;
    int32_t ecx7;
    int32_t* esp8;
    int32_t ebp9;
    int32_t edi10;
    int32_t esi11;
    void* esp12;
    int32_t edi13;
    void* esp14;
    int32_t ebp15;
    void* esp16;
    void* esp17;
    int32_t esi18;
    int32_t eax19;
    void* esp20;
    uint32_t ebx21;
    uint32_t v22;
    int32_t ebp23;
    uint32_t eax24;
    void* esp25;
    int32_t eax26;
    uint32_t edi27;
    uint32_t esi28;
    uint32_t v29;
    uint32_t v30;
    uint32_t v31;
    int32_t ebp32;
    uint32_t ecx33;
    uint32_t eax34;
    uint32_t edx35;
    uint32_t eax36;
    int32_t edx37;
    uint32_t eax38;
    uint32_t edx39;
    uint32_t eax40;
    uint32_t* esp41;
    void* esp42;

    ecx1 = Player_3PAV_Player_A;
    ecx2 = reinterpret_cast<struct s21*>(&ecx1->f12);
    v3 = ebx4;
    eax5 = ecx2->f8;
    edx6 = ecx2->f4;
    ecx7 = ecx2->f0;
    esp8 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 36 - 4 - 4 - 4 - 4 - 4 - 4 - 4);
    CreateFightGroup_YI_AVFightGroup_V_Player_Z(esp8 + 8, ecx7, edx6, eax5, ebp9, edi10, esi11);
    esp12 = reinterpret_cast<void*>(esp8 - 1 + 1);
    edi13 = 0;
    DoAttackEnemy_FightGroup_QAEXXZ(reinterpret_cast<int32_t>(esp12) + 20, ecx7, edx6, eax5, ebp9, edi10, esi11);
    esp14 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp12) - 4 + 4);
    ebp15 = SetRect_FightGroup_QAEXAAUMAP_RECT_Z;
    ebp15(reinterpret_cast<int32_t>(esp14) + 20);
    esp16 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp14) - 4 - 4 + 4);
    0PlayerVehicleEnum_QAE_H_Z(reinterpret_cast<int32_t>(esp16) + 40);
    esp17 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp16) - 4 - 4 + 4);
    esi18 = GetNext_PlayerVehicleEnum_QAEHAAVUnit_Z;
    eax19 = reinterpret_cast<int32_t>(esi18(reinterpret_cast<int32_t>(esp17) + 40));
    esp20 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp17) - 4 - 4 + 4);
    if (!eax19) {
        ebx21 = v22;
    } else {
        ebp23 = GetType_Unit_QBE_AW4map_id_XZ;
        do {
            eax24 = reinterpret_cast<uint32_t>(ebp23(reinterpret_cast<int32_t>(esp20) + 16));
            esp25 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp20) - 4 + 4);
            ebx21 = eax24;
            if (eax24 == 5 || (ebx21 == 6 || (ebx21 == 7 || ebx21 == 4))) {
                ++edi13;
            }
            eax26 = reinterpret_cast<int32_t>(esi18(reinterpret_cast<int32_t>(esp25) + 40, reinterpret_cast<int32_t>(esp25) + 16));
            esp20 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp25) - 4 - 4 + 4);
        } while (eax26);
    }
    edi27 = reinterpret_cast<uint32_t>(edi13 >> 1);
    esi28 = 0;
    v29 = 0;
    v30 = 0;
    v31 = 0;
    if (!(reinterpret_cast<uint1_t>(reinterpret_cast<int32_t>(edi27) < reinterpret_cast<int32_t>(0)) | reinterpret_cast<uint1_t>(edi27 == 0))) {
        ebp32 = v3;
        do {
            ecx33 = esi28 + 0x86;
            __asm__("cdq ");
            switch (((esi28 ^ edx6) - edx6 & 3 ^ edx6) - edx6) {
            case 0:
            case 2:
                ebx21 = 5;
                eax34 = v29;
                edx35 = eax34 + 1;
                v29 = edx35;
                __asm__("cdq ");
                switch (((eax34 ^ edx35) - edx35 & 3 ^ edx35) - edx35) {
                case 0:
                case 2:
                    ebp32 = 62;
                    break;
                    addr_0x11004244_15:
                case 1:
                    ebp32 = 60;
                    break;
                case 3:
                    ebp32 = 71;
                    break;
                    ebp32 = 64;
                    break;
                    ebp32 = 65;
                    break;
                    ebp32 = 64;
                    break;
                    ebp32 = 71;
                }
                break;
            case 1:
                ebx21 = 6;
                eax36 = v30;
                v30 = eax36 + 1;
                __asm__("cdq ");
                edx37 = reinterpret_cast<int32_t>(eax36) % 3;
                if (!edx37) {
                    ebp32 = 64;
                    break;
                } else {
                    if (edx37 == 1) 
                        goto addr_0x11004244_15;
                    if (edx37 == 2) {
                        ebp32 = 62;
                        break;
                    } else {
                        break;
                    }
                }
            case 3:
                ebx21 = 7;
                eax38 = v31;
                edx39 = eax38 + 1;
                v31 = edx39;
                __asm__("cdq ");
                eax40 = ((eax38 ^ edx39) - edx39 & 7 ^ edx39) - edx39;
                if (eax40 <= 7) {
                    goto *reinterpret_cast<int32_t*>(eax40 * 4 + 0x110042c0);
                }
            }
            edx6 = ebx21;
            ++esi28;
            esp41 = reinterpret_cast<uint32_t*>(reinterpret_cast<int32_t>(esp20) - 4 - 4 - 4 - 4 - 4);
            CreateUnit_TethysGame_SIHAAVUnit_W4map_id_ULOCATION_H1H_Z(esp41 + 9, ecx33, 0xff, 1, ebp32);
            esp42 = reinterpret_cast<void*>(esp41 - 1 + 1 - 1);
            TakeUnit_ScGroup_QAEXVUnit_Z(reinterpret_cast<int32_t>(esp42) + 24, 0, ecx33, 0xff, 1, ebp32);
            esp20 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp42) - 4 + 4);
        } while (reinterpret_cast<int32_t>(edi27) > reinterpret_cast<int32_t>(esi28));
    }
    SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp20) + 20);
    1ScStub_QAE_XZ(reinterpret_cast<int32_t>(esp20) - 4 - 4 + 4 + 20);
    goto 0xff;
}

int32_t g1100cbd8;

int32_t g1100cbdc;

/*
 * ?IsInitialized@ScStub@@QAEHXZ
 * public: int __thiscall ScStub::IsInitialized(void)
 */
int32_t IsInitialized_ScStub_QAEHXZ = 0xda7a;

int32_t g1100cbe8;

struct s22 {
    int32_t f0;
    int32_t f4;
};

int32_t g1100cc00;

int32_t g1100cc04;

int32_t g1100cc08;

int32_t g1100cc0c;

int32_t g1100cc10;

void Annoyance() {
    struct s0* ecx1;
    int32_t v2;
    int32_t ebx3;
    int32_t v4;
    int32_t edi5;
    int32_t eax6;
    void* esp7;
    int32_t eax8;
    int32_t eax9;
    int32_t eax10;
    int32_t eax11;
    int32_t v12;
    int32_t eax13;
    int32_t eax14;
    int32_t eax15;
    void* esp16;
    struct s0* ecx17;
    uint32_t edx18;
    int32_t v19;
    int32_t* esp20;
    int32_t v21;
    int32_t* eax22;
    void* esp23;
    int32_t ebp24;
    int32_t eax25;
    void* esp26;
    struct s22* v27;
    int32_t v28;
    int32_t ebx29;
    int32_t v30;
    int32_t ebp31;
    int32_t v32;
    int32_t edi33;
    int32_t esi34;
    uint32_t v35;
    int32_t eax36;
    uint32_t eax37;
    uint32_t eax38;
    int32_t eax39;
    uint32_t eax40;
    int32_t* esp41;
    int32_t ecx42;
    int32_t eax43;
    int32_t eax44;
    int32_t eax45;
    int32_t eax46;
    int32_t eax47;
    struct s0* ecx48;
    int32_t eax49;
    void* esp50;
    int32_t* esp51;
    int32_t* esp52;
    int32_t* esp53;
    int32_t* esp54;
    int32_t* esp55;
    int32_t* esp56;
    int32_t* esp57;
    int32_t* esp58;
    int32_t* esp59;
    int32_t* esp60;
    void* esp61;
    struct s0* ecx62;
    int32_t eax63;
    void* esp64;
    int32_t* esp65;
    void* esp66;
    int32_t* esp67;
    int32_t* esp68;
    int32_t* esp69;
    int32_t* esp70;
    int32_t* esp71;
    int32_t* esp72;
    void* esp73;
    struct s0* ecx74;
    int32_t eax75;
    void* esp76;
    int32_t* esp77;
    int32_t* esp78;
    int32_t* esp79;
    int32_t* esp80;
    int32_t* esp81;
    int32_t* esp82;
    int32_t* esp83;
    void* esp84;
    int32_t* esp85;
    int32_t* esp86;
    int32_t* esp87;
    int32_t* esp88;
    int32_t* esp89;
    int32_t* esp90;
    int32_t* esp91;
    int32_t* esp92;
    void* esp93;
    struct s0* ecx94;
    int32_t eax95;
    void* esp96;
    int32_t* esp97;
    int32_t* esp98;
    int32_t* esp99;
    int32_t* esp100;
    int32_t* esp101;
    int32_t* esp102;
    int32_t* esp103;
    void* esp104;
    int32_t* esp105;
    int32_t* esp106;
    int32_t* esp107;
    int32_t* esp108;
    int32_t* esp109;
    int32_t* esp110;
    void* esp111;
    int32_t* esp112;
    int32_t* esp113;
    void* esp114;

    ecx1 = Player_3PAV_Player_A;
    v2 = ebx3;
    v4 = edi5;
    eax6 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx1));
    esp7 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 32 - 4 - 4 - 4 - 4 - 4 + 4);
    if (!eax6) {
        eax8 = reinterpret_cast<int32_t>(GetRand_TethysGame_SIHH_Z(2));
        esp7 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp7) - 4 + 4);
        eax9 = eax8 + 1;
    } else {
        if (eax6 == 1) {
            eax10 = reinterpret_cast<int32_t>(GetRand_TethysGame_SIHH_Z(3));
            esp7 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp7) - 4 + 4);
            eax9 = eax10 + 2;
        } else {
            if (eax6 == 2) {
                eax11 = reinterpret_cast<int32_t>(GetRand_TethysGame_SIHH_Z(4));
                esp7 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp7) - 4 + 4);
                eax9 = eax11 + 3;
            } else {
                goto addr_0x11004333_8;
            }
        }
    }
    v12 = eax9;
    addr_0x11004333_8:
    eax13 = g1100cbd8;
    if (eax13) {
        v12 = v12 + 2;
    }
    eax14 = g1100cbdc;
    if (eax14) {
        ++v12;
    }
    eax15 = reinterpret_cast<int32_t>(IsInitialized_ScStub_QAEHXZ(0x1100cbe8));
    esp16 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp7) - 4 + 4);
    if (!eax15) {
        ecx17 = Player_3PAV_Player_A;
        edx18 = ecx17->f16;
        v19 = ecx17->f20;
        esp20 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp16) - 4 - 4 - 4);
        v21 = ecx17->f12;
        eax22 = reinterpret_cast<int32_t*>(CreateFightGroup_YI_AVFightGroup_V_Player_Z(esp20 + 7, v21, edx18, v19));
        esp23 = reinterpret_cast<void*>(esp20 - 1 + 1);
        g1100cbe8 = *eax22;
        1ScStub_QAE_XZ(reinterpret_cast<int32_t>(esp23) + 16, v21, edx18, v19);
        ebp24 = SetRect_FightGroup_QAEXAAUMAP_RECT_Z;
        ebp24(0x1100cbe8, 0x1100cbc8, v21, edx18, v19);
        SetLights_ScGroup_QAEXH_Z(0x1100cbe8, 1, 0x1100cbc8, v21, edx18, v19);
        esp16 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp23) - 4 + 4 - 4 - 4 + 4 - 4 - 4 + 4);
    }
    eax25 = reinterpret_cast<int32_t>(GetRand_TethysGame_SIHH_Z(4));
    esp26 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp16) - 4 + 4);
    switch (eax25) {
    case 0:
        v27 = reinterpret_cast<struct s22*>(0x1100cb00);
        break;
    case 1:
        v27 = reinterpret_cast<struct s22*>(0x1100cb10);
        break;
    case 2:
        v27 = reinterpret_cast<struct s22*>(0x1100cb20);
        break;
    case 3:
        v27 = reinterpret_cast<struct s22*>(0x1100cbb8);
    }
    v28 = 0;
    if (reinterpret_cast<uint1_t>(v12 < 0) | reinterpret_cast<uint1_t>(v12 == 0)) {
        ebx29 = v30;
        ebp31 = v32;
        edi33 = CreateUnit_TethysGame_SIHAAVUnit_W4map_id_ULOCATION_H1H_Z;
        esi34 = TakeUnit_ScGroup_QAEXVUnit_Z;
    } else {
        edi33 = CreateUnit_TethysGame_SIHAAVUnit_W4map_id_ULOCATION_H1H_Z;
        esi34 = TakeUnit_ScGroup_QAEXVUnit_Z;
        do {
            ebx29 = v27->f0;
            ebp31 = v27->f4;
            __asm__("cdq ");
            if (!((edx18 - edx18 & 1 ^ edx18) - edx18)) {
                v35 = 5;
                eax36 = g1100cbd8;
                eax37 = 62;
                if (eax36) {
                    eax38 = reinterpret_cast<uint32_t>(GetRand_TethysGame_SIHH_Z(2));
                    esp26 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp26) - 4 + 4);
                    eax37 = (eax38 - (eax38 + reinterpret_cast<uint1_t>(eax38 < eax38 + reinterpret_cast<uint1_t>(eax38 < 1))) & 3) + 62;
                }
            } else {
                v35 = 6;
                if (!v28) {
                    v28 = 1;
                    eax37 = 60;
                } else {
                    eax39 = g1100cbdc;
                    if (!eax39) {
                        eax37 = 64;
                    } else {
                        eax40 = reinterpret_cast<uint32_t>(GetRand_TethysGame_SIHH_Z(2));
                        esp26 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp26) - 4 + 4);
                        eax37 = (eax40 - (eax40 + reinterpret_cast<uint1_t>(eax40 < eax40 + reinterpret_cast<uint1_t>(eax40 < 1))) & 2) + 64;
                    }
                }
            }
            edx18 = v35;
            esp41 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp26) - 4 - 4 - 4 - 4 - 4);
            edi33(esp41 + 11, ebx29, ebp31, 1, eax37, 0);
            esi34(0x1100cbe8, v4, ebx29, ebp31, 1, eax37, 0);
            esp26 = reinterpret_cast<void*>(esp41 - 1 + 1 - 1 - 1 + 1);
            ecx42 = v2 + 1;
            v2 = ecx42;
        } while (v4 > ecx42);
    }
    eax43 = g1100cc00;
    if (!eax43) {
        eax44 = g1100cc04;
        if (!eax44) {
            eax45 = g1100cc08;
            if (!eax45) {
                eax46 = g1100cc0c;
                if (!eax46) {
                    eax47 = g1100cc10;
                    if (eax47) {
                        g1100cc10 = 0;
                        ecx48 = Player_3PAV_Player_A;
                        eax49 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx48));
                        esp50 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp26) - 4 + 4);
                        if (eax49 != 2) {
                            esp51 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp50) - 4 - 4 - 4 - 4 - 4);
                            edi33(esp51 + 11);
                            esi34(0x1100cbe8, v4);
                            esp52 = esp51 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                            edi33(esp52 + 11);
                            esi34(0x1100cbe8, ebx29);
                            esp53 = esp52 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                            edi33(esp53 + 11);
                            esi34(0x1100cbe8, ebx29);
                            esp54 = esp53 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                            edi33(esp54 + 11);
                            esi34(0x1100cbe8, ebx29);
                            esp55 = esp54 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                            edi33(esp55 + 11);
                            esi34(0x1100cbe8, ebx29);
                            esp56 = esp55 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                            edi33(esp56 + 11);
                            esi34(0x1100cbe8, ebx29);
                            esp57 = esp56 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                            edi33(esp57 + 11);
                            esi34(0x1100cbe8, ebx29);
                            edi33(esp57 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 + 10, ebx29, ebp31, 1, 64, 0, ebx29);
                            esi34(0x1100cbe8, ebx29, ebx29, ebp31, 1, 64, 0, ebx29);
                        } else {
                            esp58 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp50) - 4 - 4 - 4 - 4 - 4);
                            edi33(esp58 + 11);
                            esi34(0x1100cbe8, v4);
                            esp59 = esp58 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                            edi33(esp59 + 11);
                            esi34(0x1100cbe8, ebx29);
                            esp60 = esp59 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                            edi33(esp60 + 11);
                            esi34(0x1100cbe8);
                            esp61 = reinterpret_cast<void*>(esp60 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1);
                            edi33(reinterpret_cast<int32_t>(esp61) + 44);
                            esi34(0x1100cbe8, ebx29);
                            edi33(reinterpret_cast<int32_t>(esp61) - 4 + 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4 + 44);
                            esi34(0x1100cbe8);
                            goto ebx29;
                        }
                    }
                    return;
                } else {
                    g1100cc0c = 0;
                    ecx62 = Player_3PAV_Player_A;
                    eax63 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx62));
                    esp64 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp26) - 4 + 4);
                    if (eax63 != 2) {
                        esp65 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp64) - 4 - 4 - 4 - 4 - 4);
                        edi33(esp65 + 11);
                        esi34(0x1100cbe8);
                        esp66 = reinterpret_cast<void*>(esp65 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1);
                        edi33(reinterpret_cast<int32_t>(esp66) + 44);
                        esi34(0x1100cbe8, ebx29);
                        edi33(reinterpret_cast<int32_t>(esp66) - 4 + 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4 + 44);
                        esi34(0x1100cbe8);
                        goto v4;
                    } else {
                        esp67 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp64) - 4 - 4 - 4 - 4 - 4);
                        edi33(esp67 + 11);
                        esi34(0x1100cbe8, v4);
                        esp68 = esp67 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                        edi33(esp68 + 11);
                        esi34(0x1100cbe8, ebx29);
                        esp69 = esp68 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                        edi33(esp69 + 11);
                        esi34(0x1100cbe8, ebx29);
                        esp70 = esp69 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                        edi33(esp70 + 11);
                        esi34(0x1100cbe8, ebx29);
                        esp71 = esp70 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                        edi33(esp71 + 11);
                        esi34(0x1100cbe8, ebx29);
                        esp72 = esp71 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                        edi33(esp72 + 11);
                        esi34(0x1100cbe8);
                        esp73 = reinterpret_cast<void*>(esp72 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1);
                        edi33(reinterpret_cast<int32_t>(esp73) + 44);
                        esi34(0x1100cbe8, ebx29);
                        edi33(reinterpret_cast<int32_t>(esp73) - 4 + 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4 + 40);
                        esi34(0x1100cbe8);
                        goto ebx29;
                    }
                }
            } else {
                g1100cc08 = 0;
                ecx74 = Player_3PAV_Player_A;
                eax75 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx74));
                esp76 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp26) - 4 + 4);
                if (eax75 != 2) {
                    esp77 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp76) - 4 - 4 - 4 - 4 - 4);
                    edi33(esp77 + 11);
                    esi34(0x1100cbe8, v4);
                    esp78 = esp77 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp78 + 11);
                    esi34(0x1100cbe8, ebx29);
                    esp79 = esp78 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp79 + 11);
                    esi34(0x1100cbe8, ebx29);
                    esp80 = esp79 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp80 + 11);
                    esi34(0x1100cbe8, ebx29);
                    esp81 = esp80 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp81 + 11);
                    esi34(0x1100cbe8, ebx29);
                    esp82 = esp81 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp82 + 11);
                    esi34(0x1100cbe8, ebx29);
                    esp83 = esp82 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp83 + 11);
                    esi34(0x1100cbe8);
                    esp84 = reinterpret_cast<void*>(esp83 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1);
                    edi33(reinterpret_cast<int32_t>(esp84) + 44);
                    esi34(0x1100cbe8, ebx29);
                    edi33(reinterpret_cast<int32_t>(esp84) - 4 + 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4 + 44);
                    esi34(0x1100cbe8);
                    goto ebx29;
                } else {
                    esp85 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp76) - 4 - 4 - 4 - 4 - 4);
                    edi33(esp85 + 11);
                    esi34(0x1100cbe8, v4);
                    esp86 = esp85 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp86 + 11);
                    esi34(0x1100cbe8, ebx29);
                    esp87 = esp86 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp87 + 11);
                    esi34(0x1100cbe8, ebx29);
                    esp88 = esp87 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp88 + 11);
                    esi34(0x1100cbe8, ebx29);
                    esp89 = esp88 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp89 + 11);
                    esi34(0x1100cbe8, ebx29);
                    esp90 = esp89 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp90 + 11);
                    esi34(0x1100cbe8, ebx29);
                    esp91 = esp90 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp91 + 11);
                    esi34(0x1100cbe8, ebx29);
                    esp92 = esp91 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                    edi33(esp92 + 11);
                    esi34(0x1100cbe8);
                    esp93 = reinterpret_cast<void*>(esp92 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1);
                    edi33(reinterpret_cast<int32_t>(esp93) + 44);
                    esi34(0x1100cbe8, ebx29);
                    edi33(reinterpret_cast<int32_t>(esp93) - 4 + 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4 + 44);
                    esi34(0x1100cbe8);
                    goto ebx29;
                }
            }
        } else {
            g1100cc04 = 0;
            ecx94 = Player_3PAV_Player_A;
            eax95 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx94));
            esp96 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp26) - 4 + 4);
            if (eax95 != 2) {
                esp97 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp96) - 4 - 4 - 4 - 4 - 4);
                edi33(esp97 + 11);
                esi34(0x1100cbe8, v4);
                esp98 = esp97 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                edi33(esp98 + 11);
                esi34(0x1100cbe8, ebx29);
                esp99 = esp98 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                edi33(esp99 + 11);
                esi34(0x1100cbe8, ebx29);
                esp100 = esp99 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                edi33(esp100 + 11);
                esi34(0x1100cbe8, ebx29);
                esp101 = esp100 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                edi33(esp101 + 11);
                esi34(0x1100cbe8, ebx29);
                esp102 = esp101 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                edi33(esp102 + 11);
                esi34(0x1100cbe8, ebx29);
                esp103 = esp102 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                edi33(esp103 + 11);
                esi34(0x1100cbe8);
                esp104 = reinterpret_cast<void*>(esp103 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1);
                edi33(reinterpret_cast<int32_t>(esp104) + 44);
                esi34(0x1100cbe8, ebx29);
                edi33(reinterpret_cast<int32_t>(esp104) - 4 + 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4 + 44);
                esi34(0x1100cbe8);
                goto ebx29;
            } else {
                esp105 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp96) - 4 - 4 - 4 - 4 - 4);
                edi33(esp105 + 11);
                esi34(0x1100cbe8, v4);
                esp106 = esp105 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                edi33(esp106 + 11);
                esi34(0x1100cbe8, ebx29);
                esp107 = esp106 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                edi33(esp107 + 11);
                esi34(0x1100cbe8, ebx29);
                esp108 = esp107 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                edi33(esp108 + 11);
                esi34(0x1100cbe8, ebx29);
                esp109 = esp108 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                edi33(esp109 + 11);
                esi34(0x1100cbe8, ebx29);
                esp110 = esp109 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
                edi33(esp110 + 11);
                esi34(0x1100cbe8);
                esp111 = reinterpret_cast<void*>(esp110 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1);
                edi33(reinterpret_cast<int32_t>(esp111) + 44);
                esi34(0x1100cbe8, ebx29);
                edi33(reinterpret_cast<int32_t>(esp111) - 4 + 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4 + 40);
                esi34(0x1100cbe8);
                goto ebx29;
            }
        }
    } else {
        g1100cc00 = 0;
        esp112 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp26) - 4 - 4 - 4 - 4 - 4);
        edi33(esp112 + 11);
        esi34(0x1100cbe8, v4);
        esp113 = esp112 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1;
        edi33(esp113 + 11);
        esi34(0x1100cbe8);
        esp114 = reinterpret_cast<void*>(esp113 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1);
        edi33(reinterpret_cast<int32_t>(esp114) + 44);
        esi34(0x1100cbe8, ebx29);
        edi33(reinterpret_cast<int32_t>(esp114) - 4 + 4 - 4 - 4 + 4 - 4 - 4 - 4 - 4 - 4 + 44);
        esi34(0x1100cbe8);
        goto ebx29;
    }
}

int32_t g1100c510;

int32_t g1100c514;

int32_t g1100c518;

int32_t g1100c51c;

void fun_110051a0() {
    g1100c510 = 0x90;
    g1100c514 = 0;
    g1100c518 = 0x96;
    g1100c51c = 1;
    return;
}

void fun_11006b2c() {
    int32_t eax1;
    int32_t eax2;
    signed char al3;

    *reinterpret_cast<signed char*>(reinterpret_cast<int32_t>(__zero_stack_offset()) + eax1) = reinterpret_cast<signed char>(*reinterpret_cast<signed char*>(reinterpret_cast<int32_t>(__zero_stack_offset()) + eax2) + al3);
}

/*
 * ??0ScStub@@QAE@XZ
 * public: __thiscall ScStub::ScStub(void)
 */
int32_t 0ScStub_QAE_XZ = 0xd35c;

void fun_11001050();

uint32_t fun_11001010() {
    int32_t esi1;
    uint32_t eax2;

    esi1 = 0ScStub_QAE_XZ;
    esi1(0x1100cbe0);
    esi1(0x1100cbe4);
    esi1(0x1100cbe8);
    esi1(0x1100cbf8);
    esi1(0x1100cbfc);
    eax2 = fun_11005c40(0x1100cbfc, fun_11001050);
    return eax2;
}

void ResearchedWeapons() {
    struct s0* ecx1;
    int32_t eax2;
    void* esp3;

    ecx1 = Player_3PAV_Player_A;
    eax2 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx1));
    esp3 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 4 - 4 + 4);
    if (eax2) {
        CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z(esp3, 1, 0x4b0, 0x1770, "FirstAttack");
        1ScStub_QAE_XZ(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4, 1, 0x4b0, 0x1770, "FirstAttack");
    }
    return;
}

void ResearchedMed() {
    struct s0* ecx1;
    int32_t eax2;
    void* esp3;

    ecx1 = Player_3PAV_Player_A;
    g1100cbd8 = 1;
    eax2 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx1));
    esp3 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 4 - 4 + 4);
    if (eax2) {
        CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z(esp3, 1, 0x4b0, 0x1770, "MedWave");
        1ScStub_QAE_XZ(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4, 1, 0x4b0, 0x1770, "MedWave");
    }
    return;
}

void ResearchedBig() {
    struct s0* ecx1;
    int32_t eax2;
    void* esp3;

    ecx1 = Player_3PAV_Player_A;
    g1100cbdc = 1;
    eax2 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx1));
    esp3 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 4 - 4 + 4);
    if (eax2) {
        CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z(esp3, 1, 0x4b0, 0x1770, "BigWave");
        1ScStub_QAE_XZ(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4, 1, 0x4b0, 0x1770, "BigWave");
    }
    return;
}

/*
 * ?AddUnits@ScGroup@@QAEXAAVUnitBlock@@@Z
 * public: void __thiscall ScGroup::AddUnits(class UnitBlock &)
 */
int32_t AddUnits_ScGroup_QAEXAAVUnitBlock_Z = 0xd83c;

void FirstAttack() {
    struct s0* ecx1;
    int32_t* esp2;
    int32_t v3;
    void* esp4;
    void* esp5;
    int32_t ebp6;
    struct s0* ecx7;
    int32_t eax8;
    void* esp9;
    int32_t* esp10;
    int32_t v11;
    void* esp12;
    void* esp13;
    int32_t esi14;

    ecx1 = Player_3PAV_Player_A;
    esp2 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 8 - 4 - 4 - 4 - 4 - 4 - 4);
    v3 = ecx1->f12;
    CreateFightGroup_YI_AVFightGroup_V_Player_Z(esp2 + 6);
    esp4 = reinterpret_cast<void*>(esp2 - 1 + 1);
    DoAttackEnemy_FightGroup_QAEXXZ(reinterpret_cast<int32_t>(esp4) + 12);
    esp5 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp4) - 4 + 4);
    ebp6 = SetRect_FightGroup_QAEXAAUMAP_RECT_Z;
    ebp6(reinterpret_cast<int32_t>(esp5) + 12, 0x1100cbc8);
    ecx7 = Player_3PAV_Player_A;
    eax8 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx7, 0x1100cbc8));
    esp9 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp5) - 4 - 4 + 4 - 4 + 4);
    if (!eax8) {
        esp10 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp9) - 4);
        v11 = 0x1100c1e0;
    } else {
        if (eax8 == 1) {
            esp10 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp9) - 4);
            v11 = 0x1100cb30;
        } else {
            if (eax8 == 2) {
                esp10 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp9) - 4);
                v11 = 0x1100c7c8;
            } else {
                goto addr_0x11003679_8;
            }
        }
    }
    AddUnits_ScGroup_QAEXAAVUnitBlock_Z(esp10 + 4, v11, 0x1100cbc8);
    esp9 = reinterpret_cast<void*>(esp10 - 1 + 1);
    addr_0x11003679_8:
    SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp9) + 12, 1, 0x1100cbc8);
    esp12 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp9) - 4 - 4 + 4);
    CreateTimeTrigger_YI_AVTrigger_HHHPBD_Z(reinterpret_cast<int32_t>(esp12) + 16);
    esp13 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp12) - 4 - 4 - 4 - 4 + 4);
    esi14 = 1ScStub_QAE_XZ;
    esi14(reinterpret_cast<int32_t>(esp13) + 16);
    esi14(reinterpret_cast<int32_t>(esp13) - 4 + 4 + 12);
    goto v3;
}

/*
 * ?CreateCountTrigger@@YI?AVTrigger@@HHHW4map_id@@0HW4compare_mode@@PBD@Z
 * class Trigger __fastcall CreateCountTrigger(int,int,int,enum map_id,enum map_id,int,enum compare_mode,char const *)
 */
int32_t CreateCountTrigger_YI_AVTrigger_HHHW4map_id_0HW4compare_mode_PBD_Z = 0xd926;

void WaitForMore() {
    void* esp1;

    esp1 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 4 - 4 - 4);
    CreateCountTrigger_YI_AVTrigger_HHHW4map_id_0HW4compare_mode_PBD_Z(reinterpret_cast<int32_t>(esp1) + 8, 1);
    1ScStub_QAE_XZ(reinterpret_cast<int32_t>(esp1) - 4 - 4 - 4 - 4 - 4 - 4 + 4, 1);
    goto 0;
}

void BigWave2() {
    struct s0* ecx1;
    struct s21* ecx2;
    int32_t v3;
    int32_t ebx4;
    int32_t eax5;
    uint32_t edx6;
    int32_t ecx7;
    int32_t* esp8;
    int32_t ebp9;
    int32_t edi10;
    int32_t esi11;
    void* esp12;
    uint32_t esi13;
    void* esp14;
    int32_t ebp15;
    void* esp16;
    void* esp17;
    int32_t edi18;
    int32_t eax19;
    void* esp20;
    uint32_t ebx21;
    uint32_t v22;
    int32_t ebp23;
    uint32_t eax24;
    void* esp25;
    int32_t eax26;
    struct s0* ecx27;
    int32_t eax28;
    void* esp29;
    uint32_t edi30;
    uint32_t v31;
    uint32_t v32;
    uint32_t v33;
    int32_t ebp34;
    uint32_t ecx35;
    uint32_t eax36;
    uint32_t edx37;
    uint32_t eax38;
    int32_t edx39;
    uint32_t eax40;
    uint32_t edx41;
    uint32_t eax42;
    uint32_t* esp43;
    void* esp44;

    ecx1 = Player_3PAV_Player_A;
    ecx2 = reinterpret_cast<struct s21*>(&ecx1->f12);
    v3 = ebx4;
    eax5 = ecx2->f8;
    edx6 = ecx2->f4;
    ecx7 = ecx2->f0;
    esp8 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 36 - 4 - 4 - 4 - 4 - 4 - 4 - 4);
    CreateFightGroup_YI_AVFightGroup_V_Player_Z(esp8 + 8, ecx7, edx6, eax5, ebp9, edi10, esi11);
    esp12 = reinterpret_cast<void*>(esp8 - 1 + 1);
    esi13 = 0;
    DoAttackEnemy_FightGroup_QAEXXZ(reinterpret_cast<int32_t>(esp12) + 20, ecx7, edx6, eax5, ebp9, edi10, esi11);
    esp14 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp12) - 4 + 4);
    ebp15 = SetRect_FightGroup_QAEXAAUMAP_RECT_Z;
    ebp15(reinterpret_cast<int32_t>(esp14) + 20);
    esp16 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp14) - 4 - 4 + 4);
    0PlayerVehicleEnum_QAE_H_Z(reinterpret_cast<int32_t>(esp16) + 40);
    esp17 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp16) - 4 - 4 + 4);
    edi18 = GetNext_PlayerVehicleEnum_QAEHAAVUnit_Z;
    eax19 = reinterpret_cast<int32_t>(edi18(reinterpret_cast<int32_t>(esp17) + 40));
    esp20 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp17) - 4 - 4 + 4);
    if (!eax19) {
        ebx21 = v22;
    } else {
        ebp23 = GetType_Unit_QBE_AW4map_id_XZ;
        do {
            eax24 = reinterpret_cast<uint32_t>(ebp23(reinterpret_cast<int32_t>(esp20) + 16));
            esp25 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp20) - 4 + 4);
            ebx21 = eax24;
            if (eax24 == 5 || (ebx21 == 6 || (ebx21 == 7 || ebx21 == 4))) {
                ++esi13;
            }
            eax26 = reinterpret_cast<int32_t>(edi18(reinterpret_cast<int32_t>(esp25) + 40, reinterpret_cast<int32_t>(esp25) + 16));
            esp20 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp25) - 4 - 4 + 4);
        } while (eax26);
    }
    ecx27 = Player_3PAV_Player_A;
    eax28 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx27));
    esp29 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp20) - 4 + 4);
    if (!eax28) {
        esi13 = reinterpret_cast<uint32_t>(reinterpret_cast<int32_t>(esi13) >> 1);
    } else {
        if (eax28 == 1) {
            esi13 = reinterpret_cast<uint32_t>(reinterpret_cast<int32_t>(esi13 + esi13 * 2) >> 2);
        }
    }
    edi30 = 0;
    v31 = 0;
    v32 = 0;
    v33 = 0;
    if (!(reinterpret_cast<uint1_t>(reinterpret_cast<int32_t>(esi13) < reinterpret_cast<int32_t>(0)) | reinterpret_cast<uint1_t>(esi13 == 0))) {
        ebp34 = v3;
        do {
            ecx35 = edi30 + 0x86;
            __asm__("cdq ");
            switch (((edi30 ^ edx6) - edx6 & 3 ^ edx6) - edx6) {
            case 0:
            case 2:
                ebx21 = 5;
                eax36 = v31;
                edx37 = eax36 + 1;
                v31 = edx37;
                __asm__("cdq ");
                switch (((eax36 ^ edx37) - edx37 & 3 ^ edx37) - edx37) {
                case 0:
                case 2:
                    ebp34 = 62;
                    break;
                    addr_0x11003ff7_20:
                case 1:
                    ebp34 = 60;
                    break;
                case 3:
                    ebp34 = 65;
                    break;
                    ebp34 = 64;
                    break;
                    ebp34 = 65;
                    break;
                    ebp34 = 65;
                    break;
                    addr_0x11003ff0_25:
                    ebp34 = 66;
                }
                break;
            case 1:
                ebx21 = 6;
                eax38 = v32;
                v32 = eax38 + 1;
                __asm__("cdq ");
                edx39 = reinterpret_cast<int32_t>(eax38) % 3;
                if (!edx39) 
                    goto addr_0x11003ff0_25;
                if (edx39 == 1) 
                    goto addr_0x11003ff7_20;
                if (edx39 == 2) {
                    ebp34 = 62;
                    break;
                }
            case 3:
                ebx21 = 7;
                eax40 = v33;
                edx41 = eax40 + 1;
                v33 = edx41;
                __asm__("cdq ");
                eax42 = ((eax40 ^ edx41) - edx41 & 7 ^ edx41) - edx41;
                if (eax42 <= 7) {
                    goto *reinterpret_cast<int32_t*>(eax42 * 4 + 0x11004074);
                }
            }
            edx6 = ebx21;
            ++edi30;
            esp43 = reinterpret_cast<uint32_t*>(reinterpret_cast<int32_t>(esp29) - 4 - 4 - 4 - 4 - 4);
            CreateUnit_TethysGame_SIHAAVUnit_W4map_id_ULOCATION_H1H_Z(esp43 + 9, ecx35, 0xff, 1, ebp34);
            esp44 = reinterpret_cast<void*>(esp43 - 1 + 1 - 1);
            TakeUnit_ScGroup_QAEXVUnit_Z(reinterpret_cast<int32_t>(esp44) + 24, 0, ecx35, 0xff, 1, ebp34);
            esp29 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp44) - 4 + 4);
        } while (reinterpret_cast<int32_t>(edi30) < reinterpret_cast<int32_t>(esi13));
    }
    SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp29) + 20);
    1ScStub_QAE_XZ(reinterpret_cast<int32_t>(esp29) - 4 - 4 + 4 + 20);
    goto 0xff;
}

void fun_11004051(int32_t ecx) {
}

void fun_1100429e() {
}

/*
 * ?DoExitMap@FightGroup@@QAEXXZ
 * public: void __thiscall FightGroup::DoExitMap(void)
 */
int32_t DoExitMap_FightGroup_QAEXXZ = 0xda9a;

void ScoutLeave() {
    DoExitMap_FightGroup_QAEXXZ(0x1100cbe4, __return_address());
    SetRect_FightGroup_QAEXAAUMAP_RECT_Z(0x1100cbe4);
    goto 0x1100c510;
}

void fun_11005f00(int32_t a1) {
    fun_11005f30(a1, 1, 0);
    return;
}

void fun_110079de() {
    signed char* eax1;
    signed char* eax2;
    signed char al3;
    signed char* eax4;
    signed char* eax5;
    signed char al6;
    signed char* eax7;
    signed char* eax8;
    signed char al9;
    signed char* eax10;
    signed char* eax11;
    signed char al12;
    signed char* eax13;
    signed char* eax14;
    signed char al15;
    signed char* eax16;
    signed char* eax17;
    signed char al18;
    signed char* eax19;
    signed char* eax20;
    signed char al21;
    signed char* eax22;
    signed char* eax23;
    signed char al24;
    signed char* eax25;
    signed char* eax26;
    signed char al27;
    signed char* eax28;
    signed char* eax29;
    signed char al30;
    signed char* eax31;
    signed char* eax32;
    signed char al33;
    signed char* eax34;
    signed char* eax35;
    signed char al36;
    signed char* eax37;
    signed char* eax38;
    signed char al39;
    signed char* eax40;
    signed char* eax41;
    signed char al42;
    signed char* eax43;
    signed char* eax44;
    signed char al45;
    signed char* eax46;
    signed char* eax47;
    signed char al48;
    signed char* eax49;
    signed char* eax50;
    signed char al51;

    *eax1 = reinterpret_cast<signed char>(*eax2 + al3);
    *eax4 = reinterpret_cast<signed char>(*eax5 + al6);
    *eax7 = reinterpret_cast<signed char>(*eax8 + al9);
    *eax10 = reinterpret_cast<signed char>(*eax11 + al12);
    *eax13 = reinterpret_cast<signed char>(*eax14 + al15);
    *eax16 = reinterpret_cast<signed char>(*eax17 + al18);
    *eax19 = reinterpret_cast<signed char>(*eax20 + al21);
    *eax22 = reinterpret_cast<signed char>(*eax23 + al24);
    *eax25 = reinterpret_cast<signed char>(*eax26 + al27);
    *eax28 = reinterpret_cast<signed char>(*eax29 + al30);
    *eax31 = reinterpret_cast<signed char>(*eax32 + al33);
    *eax34 = reinterpret_cast<signed char>(*eax35 + al36);
    *eax37 = reinterpret_cast<signed char>(*eax38 + al39);
    *eax40 = reinterpret_cast<signed char>(*eax41 + al42);
    *eax43 = reinterpret_cast<signed char>(*eax44 + al45);
    *eax46 = reinterpret_cast<signed char>(*eax47 + al48);
    *eax49 = reinterpret_cast<signed char>(*eax50 + al51);
}

void fun_11001050() {
    int32_t esi1;

    esi1 = 1ScStub_QAE_XZ;
    esi1(0x1100cbfc);
    esi1(0x1100cbf8);
    esi1(0x1100cbe8);
    esi1(0x1100cbe4);
    esi1(0x1100cbe0);
    return;
}

void fun_11001c32() {
}

void fun_11001fde() {
}

int32_t g1100cbcc;

int32_t g1100cbd0;

int32_t g1100cbc8;

int32_t g1100cbd4;

void fun_110027a0() {
    g1100cbcc = 38;
    g1100cbd0 = 82;
    g1100cbc8 = 53;
    g1100cbd4 = 53;
    return;
}

/*
 * ?SetLightning@TethysGame@@SIXHHHHH@Z
 * public: static void __fastcall TethysGame::SetLightning(int,int,int,int,int)
 */
int32_t SetLightning_TethysGame_SIXHHHHH_Z = 0xd736;

void Storm() {
    int32_t esi1;
    int32_t eax2;

    esi1 = GetRand_TethysGame_SIHH_Z;
    esi1(7);
    esi1(0xff);
    eax2 = reinterpret_cast<int32_t>(esi1(0xff));
    SetLightning_TethysGame_SIXHHHHH_Z(eax2 + 32);
    goto 0xff;
}

void TornadoRepeat() {
    struct s0* ecx1;
    int32_t eax2;
    void* esp3;
    int32_t edi4;
    void* esp5;
    int32_t esi6;
    void* esp7;
    int32_t edi8;
    void* esp9;
    int32_t esi10;
    void* esp11;

    ecx1 = Player_3PAV_Player_A;
    eax2 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx1));
    esp3 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 4 - 4 - 4 - 4 + 4);
    if (!eax2) {
        edi4 = CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z;
        edi4(reinterpret_cast<int32_t>(esp3) + 8, 0, 0x32c8, 0x4e20, "VortexOnBase");
        esp5 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4);
        esi6 = 1ScStub_QAE_XZ;
        esi6(reinterpret_cast<int32_t>(esp5) + 8, 0, 0x32c8, 0x4e20, "VortexOnBase");
        esp7 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp5) - 4 + 4);
        edi4(reinterpret_cast<int32_t>(esp7) + 8);
        esi6(reinterpret_cast<int32_t>(esp7) - 4 - 4 - 4 - 4 - 4 + 4 + 8);
        goto "Tornado";
    } else {
        if (eax2 == 1) {
            CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z(reinterpret_cast<int32_t>(esp3) + 8);
            1ScStub_QAE_XZ(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4 + 8);
            goto "Tornado";
        } else {
            if (eax2 == 2) {
                edi8 = CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z;
                edi8(reinterpret_cast<int32_t>(esp3) + 8, 0, 0x32c8, 0x4e20, "VortexOnBase");
                esp9 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4);
                esi10 = 1ScStub_QAE_XZ;
                esi10(reinterpret_cast<int32_t>(esp9) + 8, 0, 0x32c8, 0x4e20, "VortexOnBase");
                esp11 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp9) - 4 + 4);
                edi8(reinterpret_cast<int32_t>(esp11) + 8);
                esi10(reinterpret_cast<int32_t>(esp11) - 4 - 4 - 4 - 4 - 4 + 4 + 8);
                goto "Tornado";
            } else {
                return;
            }
        }
    }
}

/*
 * ?SetTornado@TethysGame@@SIXHHHHHH@Z
 * public: static void __fastcall TethysGame::SetTornado(int,int,int,int,int,int)
 */
int32_t SetTornado_TethysGame_SIXHHHHHH_Z = 0xd75e;

void Tornado() {
    int32_t esi1;
    int32_t eax2;

    esi1 = GetRand_TethysGame_SIHH_Z;
    esi1(7);
    esi1(0xff);
    eax2 = reinterpret_cast<int32_t>(esi1(0xf5));
    SetTornado_TethysGame_SIXHHHHHH_Z(eax2 + 42);
    goto 0xff;
}

/*
 * ?SetMeteor@TethysGame@@SIXHHH@Z
 * public: static void __fastcall TethysGame::SetMeteor(int,int,int)
 */
int32_t SetMeteor_TethysGame_SIXHHH_Z = 0xd784;

void Meteor() {
    struct s0* ecx1;
    int32_t eax2;
    int32_t edi3;
    int32_t eax4;
    int32_t eax5;
    int32_t eax6;
    int32_t esi7;
    int32_t eax8;

    ecx1 = Player_3PAV_Player_A;
    eax2 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx1));
    if (eax2) {
        edi3 = GetRand_TethysGame_SIHH_Z;
    } else {
        edi3 = GetRand_TethysGame_SIHH_Z;
        eax4 = reinterpret_cast<int32_t>(edi3(9));
        if (eax4) {
        }
    }
    eax5 = reinterpret_cast<int32_t>(edi3(2));
    if (!eax5) {
        edi3(70);
        eax6 = reinterpret_cast<int32_t>(edi3(0xaa));
        SetMeteor_TethysGame_SIXHHH_Z(eax6 + 0x77);
        goto esi7;
    } else {
        edi3(0xa8);
        eax8 = reinterpret_cast<int32_t>(edi3(89));
        SetMeteor_TethysGame_SIXHHH_Z(eax8 + 34);
        goto esi7;
    }
}

void Quake() {
    int32_t edi1;
    int32_t eax2;
    int32_t eax3;
    int32_t esi4;
    int32_t eax5;
    int32_t eax6;
    int32_t eax7;
    int32_t eax8;
    int32_t eax9;
    int32_t eax10;
    int32_t eax11;
    int32_t eax12;
    int32_t eax13;
    int32_t eax14;
    int32_t eax15;
    int32_t eax16;
    int32_t eax17;
    int32_t eax18;
    int32_t eax19;

    edi1 = GetRand_TethysGame_SIHH_Z;
    eax2 = reinterpret_cast<int32_t>(edi1(16));
    switch (eax2) {
        addr_0x11003498_3:
    default:
        return;
    case 0:
        edi1(3);
        eax3 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax3 + 0xce);
        goto esi4;
    case 1:
        edi1(3);
        eax5 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax5 + 0xc6);
        goto esi4;
    case 2:
        edi1(3);
        eax6 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax6 + 0xce);
        goto esi4;
    case 3:
        edi1(3);
        eax7 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax7 + 0x69);
        goto esi4;
    case 4:
        edi1(3);
        eax8 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax8 + 48);
        goto esi4;
    case 5:
        edi1(3);
        eax9 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax9 + 0xd7);
        goto esi4;
    case 6:
        edi1(3);
        eax10 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax10 + 0xe8);
        goto esi4;
    case 7:
        edi1(3);
        eax11 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax11 + 0xb6);
        goto esi4;
    case 8:
        edi1(3);
        eax12 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax12 + 0x10b);
        goto esi4;
    case 9:
        edi1(3);
        eax13 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax13 + 0xc5);
        goto esi4;
    case 10:
        edi1(3);
        eax14 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax14 + 82);
        goto esi4;
    case 11:
        edi1(3);
        eax15 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax15 + 0x70);
        goto esi4;
    case 12:
        edi1(3);
        eax16 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax16 + 0xb3);
        goto esi4;
    case 13:
        edi1(3);
        eax17 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax17 + 0xb8);
        goto esi4;
    case 14:
        edi1(3);
        eax18 = reinterpret_cast<int32_t>(edi1(3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax18 + 0x10d);
        goto esi4;
    case 15:
        edi1(3, 3);
        eax19 = reinterpret_cast<int32_t>(edi1(3, 3));
        SetEarthquake_TethysGame_SIXHHH_Z(eax19 + 0x104, 3);
        goto addr_0x11003498_3;
    }
}

/*
 * ?CreateDamagedTrigger@@YI?AVTrigger@@HHAAVScGroup@@HPBD@Z
 * class Trigger __fastcall CreateDamagedTrigger(int,int,class ScGroup &,int,char const *)
 */
int32_t CreateDamagedTrigger_YI_AVTrigger_HHAAVScGroup_HPBD_Z = 0xd8ea;

void SecondAttack() {
    struct s0* ecx1;
    int32_t ecx2;
    int32_t* esp3;
    void* esp4;
    void* esp5;
    int32_t ebp6;
    struct s0* ecx7;
    int32_t esi8;
    int32_t eax9;
    void* esp10;
    int32_t* esp11;
    int32_t v12;
    void* esp13;
    void* esp14;
    int32_t edi15;
    struct s0* ecx16;
    int32_t eax17;
    void* esp18;
    void* esp19;
    void* esp20;

    ecx1 = Player_3PAV_Player_A;
    ecx2 = ecx1->f12;
    esp3 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 8 - 4 - 4 - 4 - 4 - 4 - 4 - 4);
    CreateFightGroup_YI_AVFightGroup_V_Player_Z(esp3 + 7);
    esp4 = reinterpret_cast<void*>(esp3 - 1 + 1);
    DoAttackEnemy_FightGroup_QAEXXZ(reinterpret_cast<int32_t>(esp4) + 16);
    esp5 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp4) - 4 + 4);
    ebp6 = SetRect_FightGroup_QAEXAAUMAP_RECT_Z;
    ebp6(reinterpret_cast<int32_t>(esp5) + 16, 0x1100cbc8);
    ecx7 = Player_3PAV_Player_A;
    esi8 = Difficulty__Player_QBEHXZ;
    eax9 = reinterpret_cast<int32_t>(esi8(ecx7, 0x1100cbc8));
    esp10 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp5) - 4 - 4 + 4 - 4 + 4);
    if (!eax9) {
        esp11 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp10) - 4);
        v12 = 0x1100c960;
    } else {
        if (eax9 == 1) {
            esp11 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp10) - 4);
            v12 = 0x1100cc18;
        } else {
            if (eax9 == 2) {
                esp11 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp10) - 4);
                v12 = 0x1100ca70;
            } else {
                goto addr_0x1100373c_8;
            }
        }
    }
    AddUnits_ScGroup_QAEXAAVUnitBlock_Z(esp11 + 5, v12, 0x1100cbc8);
    esp10 = reinterpret_cast<void*>(esp11 - 1 + 1);
    addr_0x1100373c_8:
    SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp10) + 16, 1, 0x1100cbc8);
    esp13 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp10) - 4 - 4 + 4);
    CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z(reinterpret_cast<int32_t>(esp13) + 20);
    esp14 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp13) - 4 - 4 - 4 - 4 - 4 + 4);
    edi15 = 1ScStub_QAE_XZ;
    edi15(reinterpret_cast<int32_t>(esp14) + 20);
    ecx16 = Player_3PAV_Player_A;
    eax17 = reinterpret_cast<int32_t>(esi8(ecx16));
    esp18 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp14) - 4 + 4 - 4 + 4);
    if (eax17 == 2) {
        esp19 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp18) - 4);
        CreateDamagedTrigger_YI_AVTrigger_HHAAVScGroup_HPBD_Z(reinterpret_cast<int32_t>(esp19) + 24, 1, reinterpret_cast<int32_t>(esp18) + 16, 1, "WaitForMore");
        esp20 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp19) - 4 - 4 - 4 - 4 + 4);
        edi15(reinterpret_cast<int32_t>(esp20) + 20, 1, reinterpret_cast<int32_t>(esp18) + 16, 1, "WaitForMore");
        esp18 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp20) - 4 + 4);
    }
    edi15(reinterpret_cast<int32_t>(esp18) + 16);
    goto ecx2;
}

int32_t g1100cbe0;

/*
 * ?CreateVehicleCountTrigger@@YI?AVTrigger@@HHHHW4compare_mode@@PBD@Z
 * class Trigger __fastcall CreateVehicleCountTrigger(int,int,int,int,enum compare_mode,char const *)
 */
int32_t CreateVehicleCountTrigger_YI_AVTrigger_HHHHW4compare_mode_PBD_Z = 0xd970;

void NextWave() {
    struct s0* ecx1;
    struct s21* ecx2;
    int32_t eax3;
    uint32_t edx4;
    int32_t ecx5;
    int32_t ebx6;
    int32_t* esp7;
    int32_t ebp8;
    int32_t edi9;
    int32_t esi10;
    int32_t ebx11;
    void* esp12;
    void* esp13;
    int32_t ebp14;
    struct s0* ecx15;
    int32_t eax16;
    void* esp17;
    int32_t esi18;
    struct s0* ecx19;
    uint32_t edx20;
    int32_t v21;
    int32_t* esp22;
    int32_t v23;
    int32_t* eax24;
    void* esp25;
    int32_t v26;
    int32_t edi27;
    void* esp28;
    void* esp29;
    struct s0* ecx30;
    int32_t eax31;
    void* esp32;
    int32_t* esp33;
    int32_t v34;
    struct s0* ecx35;
    uint32_t edx36;
    int32_t v37;
    int32_t* esp38;
    int32_t v39;
    int32_t* eax40;
    void* esp41;
    struct s0* ecx42;
    int32_t eax43;
    void* esp44;
    void* esp45;
    void* esp46;
    void* esp47;
    void* esp48;

    ecx1 = Player_3PAV_Player_A;
    ecx2 = reinterpret_cast<struct s21*>(&ecx1->f12);
    eax3 = ecx2->f8;
    edx4 = ecx2->f4;
    ecx5 = ecx2->f0;
    ebx6 = CreateFightGroup_YI_AVFightGroup_V_Player_Z;
    esp7 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 8 - 4 - 4 - 4 - 4 - 4 - 4 - 4);
    ebx6(esp7 + 7, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp12 = reinterpret_cast<void*>(esp7 - 1 + 1);
    DoAttackEnemy_FightGroup_QAEXXZ(reinterpret_cast<int32_t>(esp12) + 16, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp13 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp12) - 4 + 4);
    ebp14 = SetRect_FightGroup_QAEXAAUMAP_RECT_Z;
    ebp14(reinterpret_cast<int32_t>(esp13) + 16, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    ecx15 = Player_3PAV_Player_A;
    eax16 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx15, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11));
    esp17 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp13) - 4 - 4 + 4 - 4 + 4);
    if (!eax16) {
        esi18 = AddUnits_ScGroup_QAEXAAVUnitBlock_Z;
        esi18(reinterpret_cast<int32_t>(esp17) + 16, 0x1100cca0, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
        esp17 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp17) - 4 - 4 + 4);
    } else {
        if (eax16 == 1) {
            esi18 = AddUnits_ScGroup_QAEXAAVUnitBlock_Z;
            esi18(reinterpret_cast<int32_t>(esp17) + 16, 0x1100c158, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
            esp17 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp17) - 4 - 4 + 4);
        } else {
            if (eax16 == 2) {
                esi18 = AddUnits_ScGroup_QAEXAAVUnitBlock_Z;
                esi18(reinterpret_cast<int32_t>(esp17) + 16, 0x1100bfc0, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
                esp17 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp17) - 4 - 4 + 4);
            } else {
                esi18 = AddUnits_ScGroup_QAEXAAVUnitBlock_Z;
            }
        }
    }
    SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp17) + 16, 1, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    ecx19 = Player_3PAV_Player_A;
    edx20 = ecx19->f16;
    v21 = ecx19->f20;
    esp22 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp17) - 4 - 4 + 4 - 4 - 4 - 4);
    v23 = ecx19->f12;
    eax24 = reinterpret_cast<int32_t*>(ebx6(esp22 + 8, v23, edx20, v21, 1, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11));
    esp25 = reinterpret_cast<void*>(esp22 - 1 + 1);
    v26 = *eax24;
    edi27 = 1ScStub_QAE_XZ;
    edi27(reinterpret_cast<int32_t>(esp25) + 20, v23, edx20, v21, 1, v26, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp28 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp25) - 4 + 4);
    DoAttackEnemy_FightGroup_QAEXXZ(reinterpret_cast<int32_t>(esp28) + 16, v23, edx20, v21, 1, v26, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp29 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp28) - 4 + 4);
    ebp14(reinterpret_cast<int32_t>(esp29) + 16);
    ecx30 = Player_3PAV_Player_A;
    eax31 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx30));
    esp32 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp29) - 4 - 4 + 4 - 4 + 4);
    if (!eax31) {
        esp33 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp32) - 4);
        v34 = 0x1100c0d0;
    } else {
        if (eax31 == 1) {
            esp33 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp32) - 4);
            v34 = 0x1100c268;
        } else {
            if (eax31 == 2) {
                esp33 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp32) - 4);
                v34 = 0x1100c740;
            } else {
                goto addr_0x11003930_15;
            }
        }
    }
    esi18(esp33 + 5, v34);
    esp32 = reinterpret_cast<void*>(esp33 - 1 + 1);
    addr_0x11003930_15:
    SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp32) + 16, 1);
    ecx35 = Player_3PAV_Player_A;
    edx36 = ecx35->f16;
    v37 = ecx35->f20;
    esp38 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp32) - 4 - 4 + 4 - 4 - 4 - 4);
    v39 = ecx35->f12;
    eax40 = reinterpret_cast<int32_t*>(ebx6(esp38 + 8, v39, edx36, v37, 1));
    esp41 = reinterpret_cast<void*>(esp38 - 1 + 1);
    g1100cbe0 = *eax40;
    edi27(reinterpret_cast<int32_t>(esp41) + 20, v39, edx36, v37, 1);
    ebp14(0x1100cbe0, 0x1100cbc8, v39, edx36, v37, 1);
    ecx42 = Player_3PAV_Player_A;
    eax43 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx42, 0x1100cbc8, v39, edx36, v37, 1));
    esp44 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp41) - 4 + 4 - 4 - 4 + 4 - 4 + 4);
    if (!eax43) {
        esi18(0x1100cbe0, 0x1100c850, 0x1100cbc8, v39, edx36, v37, 1);
        esp44 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp44) - 4 - 4 + 4);
    } else {
        if (eax43 == 1) {
            esi18(0x1100cbe0, 0x1100c6b8, 0x1100cbc8, v39, edx36, v37, 1);
            esp44 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp44) - 4 - 4 + 4);
            goto addr_0x1100399a_20;
        } else {
            if (eax43 == 2) {
                esi18(0x1100cbe0, 0x1100c9e8, 0x1100cbc8, v39, edx36, v37, 1);
                esp44 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp44) - 4 - 4 + 4);
                goto addr_0x1100399a_20;
            }
        }
    }
    addr_0x1100399a_20:
    SetLights_ScGroup_QAEXH_Z(0x1100cbe0, 1, 0x1100cbc8, v39, edx36, v37, 1);
    esp45 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp44) - 4 - 4 + 4);
    CreateDamagedTrigger_YI_AVTrigger_HHAAVScGroup_HPBD_Z(reinterpret_cast<int32_t>(esp45) + 20, 1);
    esp46 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp45) - 4 - 4 - 4 - 4 - 4 + 4);
    edi27(reinterpret_cast<int32_t>(esp46) + 20, 1);
    esp47 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp46) - 4 + 4);
    CreateVehicleCountTrigger_YI_AVTrigger_HHHHW4compare_mode_PBD_Z(reinterpret_cast<int32_t>(esp47) + 20);
    esp48 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp47) - 4 - 4 - 4 - 4 - 4 - 4 + 4);
    edi27(reinterpret_cast<int32_t>(esp48) + 20);
    edi27(reinterpret_cast<int32_t>(esp48) - 4 + 4 + 16);
    goto 0x1100cbe0;
}

void Reinforce() {
    struct s0* ecx1;
    int32_t ecx2;
    int32_t* esp3;
    void* esp4;
    void* esp5;
    int32_t ebp6;
    void* esp7;
    void* esp8;

    ecx1 = Player_3PAV_Player_A;
    ecx2 = ecx1->f12;
    esp3 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 4 - 4 - 4 - 4 - 4 - 4);
    CreateFightGroup_YI_AVFightGroup_V_Player_Z(esp3 + 5);
    esp4 = reinterpret_cast<void*>(esp3 - 1 + 1);
    DoAttackEnemy_FightGroup_QAEXXZ(reinterpret_cast<int32_t>(esp4) + 8);
    esp5 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp4) - 4 + 4);
    ebp6 = SetRect_FightGroup_QAEXAAUMAP_RECT_Z;
    ebp6(reinterpret_cast<int32_t>(esp5) + 8, 0x1100cbc8);
    esp7 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp5) - 4 - 4 + 4);
    AddUnits_ScGroup_QAEXAAVUnitBlock_Z(reinterpret_cast<int32_t>(esp7) + 8);
    esp8 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp7) - 4 - 4 + 4);
    SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp8) + 8);
    1ScStub_QAE_XZ(reinterpret_cast<int32_t>(esp8) - 4 - 4 + 4 + 8);
    goto ecx2;
}

void MedWave2() {
    struct s0* ecx1;
    int32_t ecx2;
    int32_t* esp3;
    void* esp4;
    void* esp5;
    int32_t ebp6;
    struct s0* ecx7;
    int32_t eax8;
    void* esp9;
    void* esp10;
    void* esp11;

    ecx1 = Player_3PAV_Player_A;
    ecx2 = ecx1->f12;
    esp3 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 4 - 4 - 4 - 4 - 4 - 4);
    CreateFightGroup_YI_AVFightGroup_V_Player_Z(esp3 + 5);
    esp4 = reinterpret_cast<void*>(esp3 - 1 + 1);
    DoAttackEnemy_FightGroup_QAEXXZ(reinterpret_cast<int32_t>(esp4) + 8);
    esp5 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp4) - 4 + 4);
    ebp6 = SetRect_FightGroup_QAEXAAUMAP_RECT_Z;
    ebp6(reinterpret_cast<int32_t>(esp5) + 8, 0x1100cbc8);
    ecx7 = Player_3PAV_Player_A;
    eax8 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx7, 0x1100cbc8));
    esp9 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp5) - 4 - 4 + 4 - 4 + 4);
    if (eax8 != 2) {
        esp10 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp9) - 4);
    } else {
        esp10 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp9) - 4);
    }
    AddUnits_ScGroup_QAEXAAVUnitBlock_Z(reinterpret_cast<int32_t>(esp10) + 12);
    esp11 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp10) - 4 + 4);
    SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp11) + 8);
    1ScStub_QAE_XZ(reinterpret_cast<int32_t>(esp11) - 4 - 4 + 4 + 8);
    goto ecx2;
}

void NoResponseToTrigger() {
    return;
}

int32_t g1100cbe4;

/*
 * ?DoPatrolOnly@FightGroup@@QAEXXZ
 * public: void __thiscall FightGroup::DoPatrolOnly(void)
 */
int32_t DoPatrolOnly_FightGroup_QAEXXZ = 0xdaee;

/*
 * ?SetPatrolMode@FightGroup@@QAEXAAUPatrolRoute@@@Z
 * public: void __thiscall FightGroup::SetPatrolMode(struct PatrolRoute &)
 */
int32_t SetPatrolMode_FightGroup_QAEXAAUPatrolRoute_Z = 0xdaba;

void ScoutArrive() {
    void* esp1;
    int32_t ebp2;
    int32_t esi3;
    int32_t ebx4;
    void* esp5;
    int32_t esi6;
    struct s0* ecx7;
    uint32_t edx8;
    int32_t* esp9;
    int32_t v10;
    int32_t* eax11;
    int32_t ebp12;

    esp1 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 4);
    CreateTimeTrigger_YI_AVTrigger_HHHPBD_Z(esp1, 1, 0x2710, "ScoutLeave", ebp2, esi3, ebx4);
    esp5 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp1) - 4 - 4 - 4 - 4 - 4 - 4 - 4 + 4);
    esi6 = 1ScStub_QAE_XZ;
    esi6(reinterpret_cast<int32_t>(esp5) + 12, 1, 0x2710, "ScoutLeave", ebp2, esi3, ebx4);
    ecx7 = Player_3PAV_Player_A;
    edx8 = ecx7->f16;
    esp9 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp5) - 4 + 4 - 4 - 4 - 4);
    v10 = ecx7->f12;
    eax11 = reinterpret_cast<int32_t*>(CreateFightGroup_YI_AVFightGroup_V_Player_Z(esp9 + 6, v10));
    g1100cbe4 = *eax11;
    esi6(esp9 - 1 + 1 + 3, v10);
    DoPatrolOnly_FightGroup_QAEXXZ(0x1100cbe4, v10);
    ebp12 = SetPatrolMode_FightGroup_QAEXAAUPatrolRoute_Z;
    ebp12(0x1100cbe4);
    SetRect_FightGroup_QAEXAAUMAP_RECT_Z(0x1100cbe4);
    AddUnits_ScGroup_QAEXAAVUnitBlock_Z(0x1100cbe4);
    goto edx8;
}

/*
 * ?FreeMoraleLevel@TethysGame@@SIXH@Z
 * public: static void __fastcall TethysGame::FreeMoraleLevel(int)
 */
int32_t FreeMoraleLevel_TethysGame_SIXH_Z = 0xdd28;

void ReleaseMorale() {
    goto FreeMoraleLevel_TethysGame_SIXH_Z;
}

int16_t fun_11005dd0(int32_t a1, int32_t a2, int32_t a3) {
    int32_t eax4;
    int1_t zf5;
    int32_t ecx6;
    int32_t esi7;
    int32_t edi8;
    int32_t ebp9;
    int32_t eax10;
    int32_t eax11;
    int32_t eax12;

    eax4 = 1;
    if (a2 || (zf5 = g1100b44c == 0, !zf5)) {
        if (a2 == 1 || a2 == 2) {
            ecx6 = g1100cfd8;
            if (!ecx6) {
                esi7 = a1;
                edi8 = a3;
            } else {
                edi8 = a3;
                esi7 = a1;
                eax4 = reinterpret_cast<int32_t>(ecx6(esi7, a2, edi8));
            }
            if (!eax4 || (*reinterpret_cast<int16_t*>(&eax4) = fun_11005ca0(esi7, a2, edi8), !eax4)) {
                return 0;
            }
        } else {
            esi7 = a1;
            edi8 = a3;
        }
        *reinterpret_cast<int16_t*>(&eax4) = fun_11006d20(esi7, a2, edi8);
        ebp9 = eax4;
        if (a2 == 1 && !ebp9) {
            fun_11005ca0(esi7, 0, edi8);
        }
        if (!a2 || a2 == 3) {
            *reinterpret_cast<int16_t*>(&eax4) = fun_11005ca0(esi7, a2, edi8);
            if (!eax4) {
                ebp9 = 0;
            }
            if (ebp9 && (eax10 = g1100cfd8, !!eax10)) {
                eax11 = reinterpret_cast<int32_t>(eax10(esi7, a2, edi8));
                ebp9 = eax11;
            }
        }
        eax12 = ebp9;
        return *reinterpret_cast<int16_t*>(&eax12);
    } else {
        return 0;
    }
}

void fun_11005c60() {
    struct s1* eax1;
    struct s1* eax2;
    struct s1* eax3;

    eax1 = fun_11006200(0x80);
    g1100cfcc = eax1;
    if (!eax1) {
        fun_11005e90(24);
    }
    eax2 = g1100cfcc;
    *reinterpret_cast<struct s1**>(&eax2->f0) = reinterpret_cast<struct s1*>(0);
    eax3 = g1100cfcc;
    g1100cfc8 = eax3;
    return;
}

struct s23 {
    int32_t f0;
    int32_t f4;
};

void GetSaveRegions(struct s23* a1) {
    a1->f4 = 60;
    a1->f0 = 0x1100cbd8;
    return;
}

int32_t g1100cb00;

int32_t g1100cb04;

int32_t g1100cb08;

int32_t g1100cb0c;

void fun_110027d0() {
    g1100cb00 = 32;
    g1100cb04 = 0x84;
    g1100cb08 = 0;
    g1100cb0c = 0;
    return;
}

void StormOnBase() {
    int32_t esi1;
    int32_t eax2;

    esi1 = GetRand_TethysGame_SIHH_Z;
    esi1(7);
    esi1(64);
    eax2 = reinterpret_cast<int32_t>(esi1(64));
    SetLightning_TethysGame_SIXHHHHH_Z(eax2 + 32);
    goto 0xff;
}

/*
 * ?SetEruption@TethysGame@@SIXHHH@Z
 * public: static void __fastcall TethysGame::SetEruption(int,int,int)
 */
int32_t SetEruption_TethysGame_SIXHHH_Z = 0xd7a6;

void Lava() {
    int32_t v1;
    int32_t esi2;
    int32_t v3;
    int32_t edi4;
    int32_t esi5;
    int32_t eax6;
    int32_t esi7;

    v1 = esi2;
    v3 = edi4;
    esi5 = GetRand_TethysGame_SIHH_Z;
    eax6 = reinterpret_cast<int32_t>(esi5(3));
    if (*reinterpret_cast<int32_t*>(eax6 * 4 + 0x1100cbec)) {
        do {
            eax6 = reinterpret_cast<int32_t>(esi5(3));
        } while (*reinterpret_cast<int32_t*>(eax6 * 4 + 0x1100cbec));
    }
    *reinterpret_cast<int32_t*>(eax6 * 4 + 0x1100cbec) = 1;
    if (!eax6) {
        SetEruption_TethysGame_SIXHHH_Z(0xce);
        goto v1;
    } else {
        if (eax6 == 1) {
            SetEruption_TethysGame_SIXHHH_Z(0xce);
            goto v1;
        } else {
            if (eax6 == 2) {
                esi7 = SetEruption_TethysGame_SIXHHH_Z;
                esi7(0xc2);
                esi7(0xcb);
                goto v3;
            } else {
                return;
            }
        }
    }
}

void MeteorRepeat() {
    struct s0* ecx1;
    int32_t eax2;
    void* esp3;
    int32_t edi4;
    void* esp5;
    int32_t esi6;
    void* esp7;
    int32_t edi8;
    void* esp9;
    int32_t esi10;
    void* esp11;
    int32_t edi12;
    void* esp13;
    int32_t esi14;
    void* esp15;

    ecx1 = Player_3PAV_Player_A;
    eax2 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx1));
    esp3 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 4 - 4 - 4 - 4 + 4);
    if (!eax2) {
        edi4 = CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z;
        edi4(reinterpret_cast<int32_t>(esp3) + 8, 0, 0xbb8, 0xfa0, "MeteorOnBase");
        esp5 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4);
        esi6 = 1ScStub_QAE_XZ;
        esi6(reinterpret_cast<int32_t>(esp5) + 8, 0, 0xbb8, 0xfa0, "MeteorOnBase");
        esp7 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp5) - 4 + 4);
        edi4(reinterpret_cast<int32_t>(esp7) + 8);
        esi6(reinterpret_cast<int32_t>(esp7) - 4 - 4 - 4 - 4 - 4 + 4 + 8);
        goto "Meteor";
    } else {
        if (eax2 == 1) {
            edi8 = CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z;
            edi8(reinterpret_cast<int32_t>(esp3) + 8, 0, 0xfa0, 0x1770, "MeteorOnBase");
            esp9 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4);
            esi10 = 1ScStub_QAE_XZ;
            esi10(reinterpret_cast<int32_t>(esp9) + 8, 0, 0xfa0, 0x1770, "MeteorOnBase");
            esp11 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp9) - 4 + 4);
            edi8(reinterpret_cast<int32_t>(esp11) + 8);
            esi10(reinterpret_cast<int32_t>(esp11) - 4 - 4 - 4 - 4 - 4 + 4 + 8);
            goto "Meteor";
        } else {
            if (eax2 == 2) {
                edi12 = CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z;
                edi12(reinterpret_cast<int32_t>(esp3) + 8, 0, 0xbb8, 0xfa0, "MeteorOnBase");
                esp13 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4);
                esi14 = 1ScStub_QAE_XZ;
                esi14(reinterpret_cast<int32_t>(esp13) + 8, 0, 0xbb8, 0xfa0, "MeteorOnBase");
                esp15 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp13) - 4 + 4);
                edi12(reinterpret_cast<int32_t>(esp15) + 8);
                esi14(reinterpret_cast<int32_t>(esp15) - 4 - 4 - 4 - 4 - 4 + 4 + 8);
                goto "Meteor";
            } else {
                return;
            }
        }
    }
}

/*
 * ?SetAttackType@FightGroup@@QAEXW4map_id@@@Z
 * public: void __thiscall FightGroup::SetAttackType(enum map_id)
 */
int32_t SetAttackType_FightGroup_QAEXW4map_id_Z = 0xd9b6;

void ChangeTarget() {
    SetAttackType_FightGroup_QAEXW4map_id_Z(0x1100cbe0);
    goto 21;
}

void BigWave() {
    struct s0* ecx1;
    struct s21* ecx2;
    int32_t eax3;
    uint32_t edx4;
    int32_t ecx5;
    int32_t ebp6;
    int32_t* esp7;
    int32_t ebp8;
    int32_t edi9;
    int32_t esi10;
    int32_t ebx11;
    void* esp12;
    int32_t edi13;
    void* esp14;
    void* esp15;
    int32_t v16;
    int32_t esi17;
    void* esp18;
    struct s0* ecx19;
    int32_t eax20;
    void* esp21;
    int32_t ebx22;
    struct s0* ecx23;
    uint32_t edx24;
    int32_t v25;
    int32_t* esp26;
    int32_t v27;
    int32_t* eax28;
    void* esp29;
    void* esp30;
    void* esp31;
    void* esp32;
    void* esp33;
    struct s0* ecx34;
    uint32_t edx35;
    int32_t v36;
    int32_t* esp37;
    int32_t v38;
    int32_t* eax39;
    void* esp40;
    int32_t v41;
    void* esp42;
    void* esp43;
    void* esp44;
    void* esp45;
    struct s0* ecx46;
    int32_t eax47;
    void* esp48;
    struct s0* ecx49;
    uint32_t edx50;
    int32_t v51;
    int32_t* esp52;
    int32_t v53;
    int32_t* eax54;
    void* esp55;
    int32_t v56;
    void* esp57;
    void* esp58;
    void* esp59;
    void* esp60;
    void* esp61;

    ecx1 = Player_3PAV_Player_A;
    ecx2 = reinterpret_cast<struct s21*>(&ecx1->f12);
    eax3 = ecx2->f8;
    edx4 = ecx2->f4;
    ecx5 = ecx2->f0;
    ebp6 = CreateFightGroup_YI_AVFightGroup_V_Player_Z;
    esp7 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 8 - 4 - 4 - 4 - 4 - 4 - 4 - 4);
    ebp6(esp7 + 7, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp12 = reinterpret_cast<void*>(esp7 - 1 + 1);
    edi13 = DoAttackEnemy_FightGroup_QAEXXZ;
    edi13(reinterpret_cast<int32_t>(esp12) + 16, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp14 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp12) - 4 + 4);
    SetRect_FightGroup_QAEXAAUMAP_RECT_Z(reinterpret_cast<int32_t>(esp14) + 16, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp15 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp14) - 4 - 4 + 4);
    v16 = 0x1100c2f0;
    esi17 = AddUnits_ScGroup_QAEXAAVUnitBlock_Z;
    esi17(reinterpret_cast<int32_t>(esp15) + 16, 0x1100c2f0, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp18 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp15) - 4 - 4 + 4);
    SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp18) + 16, 1, 0x1100c2f0, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    ecx19 = Player_3PAV_Player_A;
    eax20 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx19, 1, 0x1100c2f0, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11));
    esp21 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp18) - 4 - 4 + 4 - 4 + 4);
    if (eax20 != 2) {
        ebx22 = 1ScStub_QAE_XZ;
    } else {
        ecx23 = Player_3PAV_Player_A;
        edx24 = ecx23->f16;
        v25 = ecx23->f20;
        esp26 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp21) - 4 - 4 - 4);
        v27 = ecx23->f12;
        eax28 = reinterpret_cast<int32_t*>(ebp6(esp26 + 8, v27, edx24, v25, 1, 0x1100c2f0, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11));
        esp29 = reinterpret_cast<void*>(esp26 - 1 + 1);
        ebx22 = 1ScStub_QAE_XZ;
        v16 = *eax28;
        ebx22(reinterpret_cast<int32_t>(esp29) + 20, v27, edx24, v25, 1, v16, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
        esp30 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp29) - 4 + 4);
        edi13(reinterpret_cast<int32_t>(esp30) + 16, v27, edx24, v25, 1, v16, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
        esp31 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp30) - 4 + 4);
        SetRect_FightGroup_QAEXAAUMAP_RECT_Z(reinterpret_cast<int32_t>(esp31) + 16, 0x1100cbc8, v27, edx24, v25, 1, v16, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
        esp32 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp31) - 4 - 4 + 4);
        esi17(reinterpret_cast<int32_t>(esp32) + 16, 0x1100c378, 0x1100cbc8, v27, edx24, v25, 1, v16, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
        esp33 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp32) - 4 - 4 + 4);
        SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp33) + 16, 1, 0x1100c378, 0x1100cbc8, v27, edx24, v25, 1, v16, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
        esp21 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp33) - 4 - 4 + 4);
    }
    ecx34 = Player_3PAV_Player_A;
    edx35 = ecx34->f16;
    v36 = ecx34->f20;
    esp37 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp21) - 4 - 4 - 4);
    v38 = ecx34->f12;
    eax39 = reinterpret_cast<int32_t*>(ebp6(esp37 + 8, v38, edx35, v36, 1, v16, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11));
    esp40 = reinterpret_cast<void*>(esp37 - 1 + 1);
    v41 = *eax39;
    ebx22(reinterpret_cast<int32_t>(esp40) + 20, v38, edx35, v36, 1, v41, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp42 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp40) - 4 + 4);
    edi13(reinterpret_cast<int32_t>(esp42) + 16, v38, edx35, v36, 1, v41, 0x1100cbc8, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp43 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp42) - 4 + 4);
    SetRect_FightGroup_QAEXAAUMAP_RECT_Z(reinterpret_cast<int32_t>(esp43) + 16);
    esp44 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp43) - 4 - 4 + 4);
    esi17(reinterpret_cast<int32_t>(esp44) + 16, 0x1100c400);
    esp45 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp44) - 4 - 4 + 4);
    SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp45) + 16, 1, 0x1100c400);
    ecx46 = Player_3PAV_Player_A;
    eax47 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx46, 1, 0x1100c400));
    esp48 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp45) - 4 - 4 + 4 - 4 + 4);
    if (eax47) {
        ecx49 = Player_3PAV_Player_A;
        edx50 = ecx49->f16;
        v51 = ecx49->f20;
        esp52 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp48) - 4 - 4 - 4);
        v53 = ecx49->f12;
        eax54 = reinterpret_cast<int32_t*>(ebp6(esp52 + 8, v53, edx50, v51, 1, 0x1100c400));
        esp55 = reinterpret_cast<void*>(esp52 - 1 + 1);
        v56 = *eax54;
        ebx22(reinterpret_cast<int32_t>(esp55) + 20, v53, edx50, v51, 1, v56);
        esp57 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp55) - 4 + 4);
        edi13(reinterpret_cast<int32_t>(esp57) + 16, v53, edx50, v51, 1, v56);
        esp58 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp57) - 4 + 4);
        SetRect_FightGroup_QAEXAAUMAP_RECT_Z(reinterpret_cast<int32_t>(esp58) + 16, 0x1100cbc8, v53, edx50, v51, 1, v56);
        esp59 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp58) - 4 - 4 + 4);
        esi17(reinterpret_cast<int32_t>(esp59) + 16, 0x1100c488, 0x1100cbc8, v53, edx50, v51, 1, v56);
        esp60 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp59) - 4 - 4 + 4);
        SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp60) + 16, 1, 0x1100c488, 0x1100cbc8, v53, edx50, v51, 1, v56);
        esp48 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp60) - 4 - 4 + 4);
    }
    CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z(reinterpret_cast<int32_t>(esp48) + 20);
    esp61 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp48) - 4 - 4 - 4 - 4 - 4 + 4);
    ebx22(reinterpret_cast<int32_t>(esp61) + 20);
    ebx22(reinterpret_cast<int32_t>(esp61) - 4 + 4 + 16);
    goto 0x1100cbc8;
}

/*
 * ?resetChecks@_Player@@QAEXXZ
 * public: void __thiscall _Player::resetChecks(void)
 */
int32_t resetChecks__Player_QAEXXZ = 0xdc02;

/*
 * ?Workers@_Player@@QBEHXZ
 * public: int __thiscall _Player::Workers(void)const
 */
int32_t Workers__Player_QBEHXZ = 0xdbe6;

/*
 * ?Scientists@_Player@@QBEHXZ
 * public: int __thiscall _Player::Scientists(void)const
 */
int32_t Scientists__Player_QBEHXZ = 0xdbc8;

/*
 * ??0PlayerBuildingEnum@@QAE@HW4map_id@@@Z
 * public: __thiscall PlayerBuildingEnum::PlayerBuildingEnum(int,enum map_id)
 */
int32_t 0PlayerBuildingEnum_QAE_HW4map_id_Z = 0xdb9c;

/*
 * ?GetNext@PlayerBuildingEnum@@QAEHAAVUnit@@@Z
 * public: int __thiscall PlayerBuildingEnum::GetNext(class Unit &)
 */
int32_t GetNext_PlayerBuildingEnum_QAEHAAVUnit_Z = 0xdb6c;

/*
 * ?canBuildBuilding@_Player@@QAEHXZ
 * public: int __thiscall _Player::canBuildBuilding(void)
 */
int32_t canBuildBuilding__Player_QAEHXZ = 0xdb48;

void CheckForFail() {
    struct s0* ecx1;
    int32_t esi2;
    int32_t edi3;
    int32_t esi4;
    int32_t ebx5;
    struct s0* ecx6;
    int32_t eax7;
    struct s0* ecx8;
    int32_t eax9;
    void* esp10;
    int32_t edi11;
    void* esp12;
    int32_t ebx13;
    int32_t eax14;
    void* esp15;
    void* esp16;
    int32_t eax17;
    struct s0* ecx18;
    int32_t eax19;
    void* esp20;
    void* esp21;
    void* esp22;
    int32_t esi23;
    int32_t v24;

    ecx1 = Player_3PAV_Player_A;
    esi2 = 0;
    resetChecks__Player_QAEXXZ(ecx1, edi3, esi4, ebx5);
    ecx6 = Player_3PAV_Player_A;
    eax7 = reinterpret_cast<int32_t>(Workers__Player_QBEHXZ(ecx6, edi3, esi4, ebx5));
    if (eax7 < 8) {
        esi2 = 1;
    }
    ecx8 = Player_3PAV_Player_A;
    eax9 = reinterpret_cast<int32_t>(Scientists__Player_QBEHXZ(ecx8, edi3, esi4, ebx5));
    esp10 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 24 - 4 - 4 - 4 - 4 + 4 - 4 + 4 - 4 + 4);
    if (eax9 < 3) {
        esi2 = 1;
    }
    edi11 = 0PlayerBuildingEnum_QAE_HW4map_id_Z;
    edi11(reinterpret_cast<int32_t>(esp10) + 28);
    esp12 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp10) - 4 - 4 - 4 + 4);
    ebx13 = GetNext_PlayerBuildingEnum_QAEHAAVUnit_Z;
    eax14 = reinterpret_cast<int32_t>(ebx13(reinterpret_cast<int32_t>(esp12) + 28));
    esp15 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp12) - 4 - 4 + 4);
    if (!eax14 && ((edi11(reinterpret_cast<int32_t>(esp15) + 20, 0, 38), esp16 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp15) - 4 - 4 - 4 + 4), eax17 = reinterpret_cast<int32_t>(ebx13(reinterpret_cast<int32_t>(esp16) + 20, reinterpret_cast<int32_t>(esp16) + 12, 0, 38)), esp15 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp16) - 4 - 4 + 4), !eax17) && (ecx18 = Player_3PAV_Player_A, eax19 = reinterpret_cast<int32_t>(canBuildBuilding__Player_QAEHXZ(ecx18, reinterpret_cast<int32_t>(esp16) + 12, 0, 38)), esp15 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp15) - 4 + 4), !eax19))) {
        esi2 = 1;
    }
    if (esi2) {
        CreateTimeTrigger_YI_AVTrigger_HHHPBD_Z(reinterpret_cast<int32_t>(esp15) + 16, 1, 1, "NoResponseToTrigger");
        esp20 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp15) - 4 - 4 - 4 - 4 + 4);
        esp21 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp20) - 4);
        CreateFailureCondition_YI_AVTrigger_HHAAV1_PBD_Z(reinterpret_cast<int32_t>(esp21) + 24, 1, reinterpret_cast<int32_t>(esp20) + 16, 0x1100b2d4, 1, 1, "NoResponseToTrigger");
        esp22 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp21) - 4 - 4 - 4 + 4);
        esi23 = 1ScStub_QAE_XZ;
        esi23(reinterpret_cast<int32_t>(esp22) + 20, 1, reinterpret_cast<int32_t>(esp20) + 16, 0x1100b2d4, 1, 1, "NoResponseToTrigger");
        esi23(reinterpret_cast<int32_t>(esp22) - 4 + 4 + 16, 1, reinterpret_cast<int32_t>(esp20) + 16, 0x1100b2d4, 1, 1, "NoResponseToTrigger");
    }
    goto v24;
}

/*
 * ?GoEden@_Player@@QAEXXZ
 * public: void __thiscall _Player::GoEden(void)
 */
int32_t GoEden__Player_QAEXXZ = 0xd53e;

/*
 * ?SetColorNumber@_Player@@QAEXH@Z
 * public: void __thiscall _Player::SetColorNumber(int)
 */
int32_t SetColorNumber__Player_QAEXH_Z = 0xd51a;

/*
 * ?GoPlymouth@_Player@@QAEXXZ
 * public: void __thiscall _Player::GoPlymouth(void)
 */
int32_t GoPlymouth__Player_QAEXXZ = 0xd4fc;

/*
 * ?SetDaylightMoves@TethysGame@@SIXH@Z
 * public: static void __fastcall TethysGame::SetDaylightMoves(int)
 */
int32_t SetDaylightMoves_TethysGame_SIXH_Z = 0xd4d4;

/*
 * ?CenterViewOn@_Player@@QAEXHH@Z
 * public: void __thiscall _Player::CenterViewOn(int,int)
 */
int32_t CenterViewOn__Player_QAEXHH_Z = 0xd498;

/*
 * ?SetDaylightEverywhere@TethysGame@@SIXH@Z
 * public: static void __fastcall TethysGame::SetDaylightEverywhere(int)
 */
int32_t SetDaylightEverywhere_TethysGame_SIXH_Z = 0xd46c;

/*
 * ?SetCheatFastUnits@TethysGame@@SIXH@Z
 * public: static void __fastcall TethysGame::SetCheatFastUnits(int)
 */
int32_t SetCheatFastUnits_TethysGame_SIXH_Z = 0xd444;

/*
 * ?SetCheatFastProduction@TethysGame@@SIXH@Z
 * public: static void __fastcall TethysGame::SetCheatFastProduction(int)
 */
int32_t SetCheatFastProduction_TethysGame_SIXH_Z = 0xd416;

/*
 * ?SetCheatUnlimitedResources@TethysGame@@SIXH@Z
 * public: static void __fastcall TethysGame::SetCheatUnlimitedResources(int)
 */
int32_t SetCheatUnlimitedResources_TethysGame_SIXH_Z = 0xd3e4;

/*
 * ?SetCheatProduceAll@TethysGame@@SIXH@Z
 * public: static void __fastcall TethysGame::SetCheatProduceAll(int)
 */
int32_t SetCheatProduceAll_TethysGame_SIXH_Z = 0xd3ba;

/*
 * ?SetMusicPlayList@TethysGame@@SIXHHPAW4SongIds@@@Z
 * public: static void __fastcall TethysGame::SetMusicPlayList(int,int,enum SongIds *)
 */
int32_t SetMusicPlayList_TethysGame_SIXHHPAW4SongIds_Z = 0xd384;

void InitProc() {
    struct s0* ecx1;
    int32_t edi2;
    struct s0* ecx3;
    int32_t edi4;
    struct s0* ecx5;

    ecx1 = Player_3PAV_Player_A;
    GoEden__Player_QAEXXZ(ecx1, edi2, __return_address());
    ecx3 = Player_3PAV_Player_A;
    edi4 = SetColorNumber__Player_QAEXH_Z;
    edi4(ecx3, 0, edi2, __return_address());
    GoPlymouth__Player_QAEXXZ(0, edi2, __return_address());
    edi4(1, 0, edi2, __return_address());
    fun_11001230(1, 0, edi2, __return_address());
    fun_11001190(1, 0, edi2, __return_address());
    fun_11002290(1, 0, edi2, __return_address());
    fun_11005a40(1, 0, edi2, __return_address());
    SetDaylightMoves_TethysGame_SIXH_Z(1, 1, 0, edi2, __return_address());
    ecx5 = Player_3PAV_Player_A;
    CenterViewOn__Player_QAEXHH_Z(ecx5);
    SetDaylightEverywhere_TethysGame_SIXH_Z();
    SetCheatFastUnits_TethysGame_SIXH_Z();
    SetCheatFastProduction_TethysGame_SIXH_Z();
    SetCheatUnlimitedResources_TethysGame_SIXH_Z();
    SetCheatProduceAll_TethysGame_SIXH_Z();
    g1100cbd8 = 0;
    g1100cbdc = 0;
    fun_11005380();
    SetMusicPlayList_TethysGame_SIXHHPAW4SongIds_Z(18);
    goto 69;
}

int32_t g1100cb10;

int32_t g1100cb14;

int32_t g1100cb18;

int32_t g1100cb1c;

void fun_11002800() {
    g1100cb10 = 43;
    g1100cb14 = 0xff;
    g1100cb18 = 0;
    g1100cb1c = 0;
    return;
}

void VortexOnBase() {
    int32_t esi1;
    int32_t eax2;

    esi1 = GetRand_TethysGame_SIHH_Z;
    esi1(7);
    esi1(64);
    eax2 = reinterpret_cast<int32_t>(esi1(64));
    SetTornado_TethysGame_SIXHHHHHH_Z(eax2 + 32);
    goto 0xff;
}

void MedWave() {
    struct s0* ecx1;
    struct s21* ecx2;
    int32_t eax3;
    uint32_t edx4;
    int32_t ecx5;
    int32_t ebx6;
    int32_t* esp7;
    int32_t ebp8;
    int32_t edi9;
    int32_t esi10;
    int32_t ebx11;
    void* esp12;
    int32_t edi13;
    void* esp14;
    int32_t ebp15;
    void* esp16;
    int32_t esi17;
    void* esp18;
    struct s0* ecx19;
    int32_t eax20;
    void* esp21;
    int32_t ebx22;
    struct s0* ecx23;
    uint32_t edx24;
    int32_t v25;
    int32_t* esp26;
    int32_t v27;
    int32_t* eax28;
    void* esp29;
    int32_t v30;
    void* esp31;
    void* esp32;
    void* esp33;
    void* esp34;
    void* esp35;

    ecx1 = Player_3PAV_Player_A;
    ecx2 = reinterpret_cast<struct s21*>(&ecx1->f12);
    eax3 = ecx2->f8;
    edx4 = ecx2->f4;
    ecx5 = ecx2->f0;
    ebx6 = CreateFightGroup_YI_AVFightGroup_V_Player_Z;
    esp7 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 8 - 4 - 4 - 4 - 4 - 4 - 4 - 4);
    ebx6(esp7 + 7, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp12 = reinterpret_cast<void*>(esp7 - 1 + 1);
    edi13 = DoAttackEnemy_FightGroup_QAEXXZ;
    edi13(reinterpret_cast<int32_t>(esp12) + 16, ecx5, edx4, eax3, ebp8, edi9, esi10, ebx11);
    esp14 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp12) - 4 + 4);
    ebp15 = SetRect_FightGroup_QAEXAAUMAP_RECT_Z;
    ebp15(reinterpret_cast<int32_t>(esp14) + 16);
    esp16 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp14) - 4 - 4 + 4);
    esi17 = AddUnits_ScGroup_QAEXAAVUnitBlock_Z;
    esi17(reinterpret_cast<int32_t>(esp16) + 16, 0x1100c520);
    esp18 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp16) - 4 - 4 + 4);
    SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp18) + 16, 1, 0x1100c520);
    ecx19 = Player_3PAV_Player_A;
    eax20 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx19, 1, 0x1100c520));
    esp21 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp18) - 4 - 4 + 4 - 4 + 4);
    if (eax20 != 2) {
        ebx22 = 1ScStub_QAE_XZ;
    } else {
        ecx23 = Player_3PAV_Player_A;
        edx24 = ecx23->f16;
        v25 = ecx23->f20;
        esp26 = reinterpret_cast<int32_t*>(reinterpret_cast<int32_t>(esp21) - 4 - 4 - 4);
        v27 = ecx23->f12;
        eax28 = reinterpret_cast<int32_t*>(ebx6(esp26 + 8, v27, edx24, v25, 1, 0x1100c520));
        esp29 = reinterpret_cast<void*>(esp26 - 1 + 1);
        ebx22 = 1ScStub_QAE_XZ;
        v30 = *eax28;
        ebx22(reinterpret_cast<int32_t>(esp29) + 20, v27, edx24, v25, 1, v30);
        esp31 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp29) - 4 + 4);
        edi13(reinterpret_cast<int32_t>(esp31) + 16, v27, edx24, v25, 1, v30);
        esp32 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp31) - 4 + 4);
        ebp15(reinterpret_cast<int32_t>(esp32) + 16, 0x1100cbc8, v27, edx24, v25, 1, v30);
        esp33 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp32) - 4 - 4 + 4);
        esi17(reinterpret_cast<int32_t>(esp33) + 16, 0x1100c5a8, 0x1100cbc8, v27, edx24, v25, 1, v30);
        esp34 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp33) - 4 - 4 + 4);
        SetLights_ScGroup_QAEXH_Z(reinterpret_cast<int32_t>(esp34) + 16, 1, 0x1100c5a8, 0x1100cbc8, v27, edx24, v25, 1, v30);
        esp21 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp34) - 4 - 4 + 4);
    }
    CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z(reinterpret_cast<int32_t>(esp21) + 20);
    esp35 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp21) - 4 - 4 - 4 - 4 - 4 + 4);
    ebx22(reinterpret_cast<int32_t>(esp35) + 20);
    ebx22(reinterpret_cast<int32_t>(esp35) - 4 + 4 + 16);
    goto 0x1100cbc8;
}

void AIProc() {
    return;
}

int32_t g1100cb20;

int32_t g1100cb24;

int32_t g1100cb28;

int32_t g1100cb2c;

void fun_11002830() {
    g1100cb20 = 0x8e;
    g1100cb24 = 1;
    g1100cb28 = 0;
    g1100cb2c = 0;
    return;
}

void MeteorOnBase() {
    struct s0* ecx1;
    int32_t eax2;
    int32_t edi3;
    int32_t eax4;
    int32_t esi5;
    int32_t edi6;
    int32_t eax7;
    int32_t eax8;

    ecx1 = Player_3PAV_Player_A;
    eax2 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx1));
    if (eax2) {
        edi3 = GetRand_TethysGame_SIHH_Z;
        edi3(64);
        eax4 = reinterpret_cast<int32_t>(edi3(60));
        SetMeteor_TethysGame_SIXHHH_Z(eax4 + 32);
        goto esi5;
    } else {
        edi6 = GetRand_TethysGame_SIHH_Z;
        eax7 = reinterpret_cast<int32_t>(edi6(9));
        if (!eax7) {
        }
        edi6(60);
        eax8 = reinterpret_cast<int32_t>(edi6(56));
        SetMeteor_TethysGame_SIXHHH_Z(eax8 + 32);
        goto esi5;
    }
}

int32_t StatusProc() {
    return 0;
}

int32_t g1100cbb8;

int32_t g1100cbbc;

int32_t g1100cbc0;

int32_t g1100cbc4;

void fun_11002860() {
    g1100cbb8 = 0xa7;
    g1100cbbc = 1;
    g1100cbc0 = 0;
    g1100cbc4 = 0;
    return;
}

/*
 * ??0UnitBlock@@QAE@PAUUnitRecord@@@Z
 * public: __thiscall UnitBlock::UnitBlock(struct UnitRecord *)
 */
int32_t 0UnitBlock_QAE_PAUUnitRecord_Z = 0xd6e2;

void fun_11002890() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c7c8);
    goto 0x11009fb8;
}

void fun_110028b0() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100cb30);
    goto 0x1100a058;
}

void fun_110028d0() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c1e0);
    goto 0x1100a0d8;
}

void fun_110028f0() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100ca70);
    goto 0x1100a138;
}

void fun_11002910() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100cc18);
    goto 0x1100a1d8;
}

void fun_11002930() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c960);
    goto 0x1100a258;
}

void fun_11002950() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100bfc0);
    goto 0x1100a2b8;
}

void fun_11002970() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c158);
    goto 0x1100a3f8;
}

void fun_11002990() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100cca0);
    goto 0x1100a4d8;
}

void fun_110029b0() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c740);
    goto 0x1100a598;
}

void fun_110029d0() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c268);
    goto 0x1100a658;
}

void fun_110029f0() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c0d0);
    goto 0x1100a6f8;
}

void fun_11002a10() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c9e8);
    goto 0x1100a778;
}

void fun_11002a30() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c6b8);
    goto 0x1100a8d8;
}

void fun_11002a50() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c850);
    goto 0x1100a9d8;
}

void fun_11002a70() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c8d8);
    goto 0x1100aab8;
}

void fun_11002a90() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c520);
    goto 0x1100ab78;
}

void fun_11002ab0() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c5a8);
    goto 0x1100acd8;
}

void fun_11002ad0() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100cd28);
    goto 0x1100ad78;
}

void fun_11002af0() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c630);
    goto 0x1100ae18;
}

void fun_11002b10() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c2f0);
    goto 0x1100aeb8;
}

void fun_11002b30() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c378);
    goto 0x1100af78;
}

void fun_11002b50() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c400);
    goto 0x1100aff8;
}

void fun_11002b70() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c488);
    goto 0x1100b0d8;
}

void fun_11002b90() {
    0UnitBlock_QAE_PAUUnitRecord_Z(0x1100c048);
    goto 0x1100b178;
}

void ResStarflare() {
    g1100cc00 = 1;
    return;
}

void ResRailGun() {
    g1100cc04 = 1;
    return;
}

void ResEMP() {
    g1100cc08 = 1;
    return;
}

void ResAcid() {
    g1100cc0c = 1;
    return;
}

void ResThor() {
    g1100cc10 = 1;
    return;
}

int32_t g1100cbf8;

void StormRepeat() {
    struct s0* ecx1;
    int32_t eax2;
    void* esp3;
    int32_t edi4;
    void* esp5;
    int32_t esi6;
    void* esp7;
    int32_t* eax8;
    int32_t edi9;
    void* esp10;
    int32_t esi11;
    void* esp12;
    int32_t* eax13;
    int32_t edi14;
    void* esp15;
    int32_t esi16;
    void* esp17;
    int32_t* eax18;

    ecx1 = Player_3PAV_Player_A;
    eax2 = reinterpret_cast<int32_t>(Difficulty__Player_QBEHXZ(ecx1));
    esp3 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(__zero_stack_offset()) - 4 - 4 - 4 - 4 + 4);
    if (!eax2) {
        edi4 = CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z;
        edi4(reinterpret_cast<int32_t>(esp3) + 8, 0, 0x1f40, 0x2ee0, "StormOnBase");
        esp5 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4);
        esi6 = 1ScStub_QAE_XZ;
        esi6(reinterpret_cast<int32_t>(esp5) + 8, 0, 0x1f40, 0x2ee0, "StormOnBase");
        esp7 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp5) - 4 + 4);
        eax8 = reinterpret_cast<int32_t*>(edi4(reinterpret_cast<int32_t>(esp7) + 8));
        g1100cbf8 = *eax8;
        esi6(reinterpret_cast<int32_t>(esp7) - 4 - 4 - 4 - 4 - 4 + 4 + 8);
        goto "Storm";
    } else {
        if (eax2 == 1) {
            edi9 = CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z;
            edi9(reinterpret_cast<int32_t>(esp3) + 8, 0, 0x2328, 0x32c8, "StormOnBase");
            esp10 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4);
            esi11 = 1ScStub_QAE_XZ;
            esi11(reinterpret_cast<int32_t>(esp10) + 8, 0, 0x2328, 0x32c8, "StormOnBase");
            esp12 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp10) - 4 + 4);
            eax13 = reinterpret_cast<int32_t*>(edi9(reinterpret_cast<int32_t>(esp12) + 8));
            g1100cbf8 = *eax13;
            esi11(reinterpret_cast<int32_t>(esp12) - 4 - 4 - 4 - 4 - 4 + 4 + 8);
            goto "Storm";
        } else {
            if (eax2 == 2) {
                edi14 = CreateTimeTrigger_YI_AVTrigger_HHHHPBD_Z;
                edi14(reinterpret_cast<int32_t>(esp3) + 8, 0, 0x1f40, 0x2ee0, "StormOnBase");
                esp15 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp3) - 4 - 4 - 4 - 4 - 4 + 4);
                esi16 = 1ScStub_QAE_XZ;
                esi16(reinterpret_cast<int32_t>(esp15) + 8, 0, 0x1f40, 0x2ee0, "StormOnBase");
                esp17 = reinterpret_cast<void*>(reinterpret_cast<int32_t>(esp15) - 4 + 4);
                eax18 = reinterpret_cast<int32_t*>(edi14(reinterpret_cast<int32_t>(esp17) + 8));
                g1100cbf8 = *eax18;
                esi16(reinterpret_cast<int32_t>(esp17) - 4 - 4 - 4 - 4 - 4 + 4 + 8);
                goto "Storm";
            } else {
                return;
            }
        }
    }
}
