#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA678_F31E_F31J_X31J_P31J_SU1E_AU1E_AU2E_AU3E
static UTM_BLOCK_PREFIX* F7220_(unsigned long P3965_ul_RequestedByteCount, unsigned int16_t P3966_ui_Requirements, MEMORY_REGION* P3967_ps_MemoryRegion);
static MEMORY_REGION* F7219_(MEMORY_REQUEST* P3964_ps_);
static void F7222_RemoveBlock(unsigned char* P3969_puc_, MEMORY_REGION* P3970_ps_);
extern void F7317_MAIN_CopyBytes_Alt();
extern long F1770_();
#ifdef MEDIA773_SU1E_AU1E
extern long F7233_(register unsigned char** P3984_ppuc_);
#endif
#ifdef MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E
#ifdef MEDIA767_AU2E
#if EXETYPE == C07_HINT
extern long F7233_(register unsigned char** P3984_ppuc_);
#else
extern int16_t F7233_(register unsigned char HUGE** P3984_ppuc_);
#endif
#else
extern int16_t F7233_(register unsigned char HUGE** P3984_ppuc_);
#endif
#endif


#ifdef MEDIA667_P31J
extern UDSTRUCTB G4189_;
#endif

#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
unsigned char* G3559_puc_MemoryHeap;
#endif
#if (defined(MEDIA768_AU2E_AU3E) && (EXETYPE == C06_CEDT))
int16_t G3931_i_Unreferenced;
#endif
#ifdef MEDIA682_F31E_F31J_X31J_SU1E_AU1E_AU2E_AU3E
UDSTRUCTB G4189_;
#endif
#if (defined(MEDIA681_F31E_F31J_X31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
MEMORY_REGION* G7155_pc_FirstMemoryArea;
MEMORY_REGION* G7156_pc_LastMemoryArea;
#endif
#ifdef MEDIA682_F31E_F31J_X31J_SU1E_AU1E_AU2E_AU3E
unsigned int16_t G7157_MemoryAreaCount;
#endif
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
MEMORY_REGION G3561_as_MemoryRegions[2];
#endif


#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
unsigned long F7202_GetEvenMemoryBlockSize(unsigned long P3934_ul_)
{
#ifdef MEDIA695_X31J_P31J_AU2E_AU3E
        unsigned long L4392_ul_;
#endif
#ifdef MEDIA670_F31E_F31J
        register unsigned long L4392_ul_;
#endif


        if (P3934_ul_ < 12)
                P3934_ul_ = 12; /* Minimum size for a memory block */
#ifdef MEDIA695_X31J_P31J_AU2E_AU3E
        if ((L4392_ul_ = P3934_ul_ & 1) != 0) {
                P3934_ul_ += 1 - L4392_ul_ + 1;
        }
#endif
#ifdef MEDIA670_F31E_F31J
        if (L4392_ul_ != 0);
#endif
        return P3934_ul_;
}
#endif

unsigned char HUGE* F7203_(unsigned char HUGE** P3935_ppuc_)
{
        register unsigned char HUGE* L4393_puc_;


        L4393_puc_ = *P3935_ppuc_ - sizeof(unsigned int16_t);
        L4393_puc_ -= (long)(*((unsigned int16_t*)L4393_puc_)) + 12;
        return L4393_puc_;
}

MEMORY_REGION* F7204_GetMemoryAreaContainingAddress(register unsigned char HUGE* P3936_puc_)
{
        register MEMORY_REGION* L4394_ps_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        register unsigned int16_t L5323_;


        L5323_ = 0;
        L4394_ps_ = G3561_as_MemoryRegions;
        while (L5323_ < G7157_MemoryAreaCount) {
                if ((P3936_puc_ >= L4394_ps_->ps_00) && (P3936_puc_ <= ((unsigned char*)L4394_ps_->ps_00 + L4394_ps_->MR_l_02__MR2_l_06_TotalByteCount))) {
                        break;
                }
                L5323_++;
                L4394_ps_++;
        }
        if (L5323_ == G7157_MemoryAreaCount) {
                L4394_ps_ = NULL;
        }
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        register long L6018_l_Unreferenced;


        L4394_ps_ = G7155_pc_FirstMemoryArea;
        do {
                if ((P3936_puc_ >= (unsigned char HUGE*)L4394_ps_) && (P3936_puc_ <= ((unsigned char HUGE*)L4394_ps_ + L4394_ps_->MR_l_02__MR2_l_06_TotalByteCount + sizeof(MEMORY_REGION) + sizeof(long)))) {
                        break;
                }
                L4394_ps_ = L4394_ps_->pc_0E_NextMemoryArea;
        } while (L4394_ps_ != NULL);
#endif
        return L4394_ps_;
}

void F7205_RemoveUDSTRUCT66FromLinkedList(register UDSTRUCT66* P3937_ps_, MEMORY_REGION* P3938_ps_MemoryRegion)
{
        register UDSTRUCT66* L4395_ps_NextBlock;
        register UDSTRUCT66* L4396_ps_PreviousBlock;


        L4396_ps_PreviousBlock = P3937_ps_->ps_04_PreviousBlock;
        L4395_ps_NextBlock = P3937_ps_->ps_08_NextBlock;
        if (L4396_ps_PreviousBlock) {
                L4396_ps_PreviousBlock->ps_08_NextBlock = L4395_ps_NextBlock;
        } else {
                P3938_ps_MemoryRegion->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66 = L4395_ps_NextBlock;
        }
        if (L4395_ps_NextBlock) {
                L4395_ps_NextBlock->ps_04_PreviousBlock = L4396_ps_PreviousBlock;
        }
}

void F7206_InsertUDSTRUCT66InLinkedList(REGISTER UDSTRUCT66* P3939_ps_, MEMORY_REGION* P3940_ps_MemoryRegion)
{
        REGISTER UDSTRUCT66* L4397_ps_InsertBefore;
        REGISTER UDSTRUCT66* L4398_ps_InsertAfter;
        REGISTER unsigned long L4399_ul_BlockSize;


        L4397_ps_InsertBefore = P3940_ps_MemoryRegion->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66;
        L4398_ps_InsertAfter = NULL;
        L4399_ul_BlockSize = M007_GET(P3939_ps_->l_BlockSize, MASK0x7FFFFFFF_USED_BLOCK);
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        while (L4397_ps_InsertBefore) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        while (L4397_ps_InsertBefore != NULL) { /* Loop to find the insertion position in the linked list */
#endif
                if (L4399_ul_BlockSize > M007_GET(L4397_ps_InsertBefore->l_BlockSize, MASK0x7FFFFFFF_USED_BLOCK)) {
                        break;
                }
                L4398_ps_InsertAfter = L4397_ps_InsertBefore;
                L4397_ps_InsertBefore = L4397_ps_InsertBefore->ps_08_NextBlock;
        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        if (L4398_ps_InsertAfter) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        if (L4398_ps_InsertAfter != NULL) {
#endif
                L4398_ps_InsertAfter->ps_08_NextBlock = P3939_ps_;
        } else {
                P3940_ps_MemoryRegion->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66 = P3939_ps_;
        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        if (L4397_ps_InsertBefore) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        if (L4397_ps_InsertBefore != NULL) {
#endif
                L4397_ps_InsertBefore->ps_04_PreviousBlock = P3939_ps_;
        }
        P3939_ps_->ps_08_NextBlock = L4397_ps_InsertBefore;
        P3939_ps_->ps_04_PreviousBlock = L4398_ps_InsertAfter;
}

void F7207_AddUsedBlockToList(REGISTER unsigned char HUGE* P3941_puc_Address, REGISTER long P3942_l_ByteCount, REGISTER MEMORY_REGION* P3943_ps_MemoryArea)
{
        REGISTER long L4400_l_;


        L4400_l_ = P3942_l_ByteCount | MASK0x80000000_USED_BLOCK;
        M202_BLOCK_SIZE(P3941_puc_Address) = L4400_l_;
        M201_PREVIOUS_BLOCK_SIZE(P3941_puc_Address + P3942_l_ByteCount) = L4400_l_;
        F7206_InsertUDSTRUCT66InLinkedList((UDSTRUCT66*)P3941_puc_Address, P3943_ps_MemoryArea);
}

void F7208_RemoveBlockFromLinkedList(REGISTER unsigned char HUGE* P3944_puc_BlockAddress, REGISTER long P3945_l_BlockSize, REGISTER MEMORY_REGION* P3946_ps_MemoryRegion) /* Merge removed block with previous block */
{
        REGISTER long L4401_l_;


        L4401_l_ = M201_PREVIOUS_BLOCK_SIZE(P3944_puc_BlockAddress);
        if (M007_GET(L4401_l_, MASK0x80000000_USED_BLOCK)) {
                M009_CLEAR(L4401_l_, MASK0x80000000_USED_BLOCK);
                P3944_puc_BlockAddress -= L4401_l_;
                F7205_RemoveUDSTRUCT66FromLinkedList((UDSTRUCT66*)P3944_puc_BlockAddress, P3946_ps_MemoryRegion);
                P3945_l_BlockSize += L4401_l_;
        }
        L4401_l_ = M202_BLOCK_SIZE(P3944_puc_BlockAddress + P3945_l_BlockSize);
        if (M007_GET(L4401_l_, MASK0x80000000_USED_BLOCK)) {
                M009_CLEAR(L4401_l_, MASK0x80000000_USED_BLOCK);
                F7205_RemoveUDSTRUCT66FromLinkedList((UDSTRUCT66*)(P3944_puc_BlockAddress + P3945_l_BlockSize), P3946_ps_MemoryRegion);
                P3945_l_BlockSize += L4401_l_;
        }
        F7207_AddUsedBlockToList(P3944_puc_BlockAddress, P3945_l_BlockSize, P3946_ps_MemoryRegion);
}

UDSTRUCT66* F7209_(REGISTER unsigned long P3947_ul_, REGISTER MEMORY_REGION* P3948_ps_MemoryRegion, BOOLEAN* P3949_pB_)
{
        REGISTER UDSTRUCT66* L4402_ps_;
        REGISTER UDSTRUCT66* L4403_ps_;
        REGISTER unsigned long L4404_ul_;


        M008_SET(P3947_ul_, MASK0x80000000_USED_BLOCK);
        L4402_ps_ = P3948_ps_MemoryRegion->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66;
        L4403_ps_ = NULL;
        while (L4402_ps_) {
                L4404_ul_ = L4402_ps_->l_BlockSize;
                if (L4404_ul_ < P3947_ul_) {
                        break;
                }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                if (L4404_ul_ - P3947_ul_ <= 34) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                if (L4404_ul_ - P3947_ul_ <= 30) {
#endif
                        L4403_ps_ = L4402_ps_;
                }
                L4402_ps_ = L4402_ps_->ps_08_NextBlock;
        }
        if (L4403_ps_ == NULL) {
                L4402_ps_ = P3948_ps_MemoryRegion->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66;
                if (L4402_ps_->l_BlockSize >= P3947_ul_) {
                        L4403_ps_ = L4402_ps_;
                        *P3949_pB_ = C0_FALSE;
                }
        } else {
                *P3949_pB_ = C1_TRUE;
        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        if (L4403_ps_ == NULL); /* Useless code */
#endif
        return L4403_ps_;
}

void F7210_(REGISTER UTM_BLOCK_PREFIX HUGE* P3950_ps_, REGISTER UTM_BLOCK_PREFIX HUGE* P3951_ps_)
{
        REGISTER long L4405_l_;
        REGISTER UTM_BLOCK_PREFIX* L4406_ps_;


        L4405_l_ = M007_GET(P3950_ps_->l_00, MASK0x7FFFFFFF_USED_BLOCK) - 8;
        F7317_MAIN_CopyBytes_Alt((char HUGE*)P3950_ps_ + 4, (char HUGE*)P3951_ps_ + 4, MASK0x07F8_MEMREQ, MASK0x07F8_MEMREQ, L4405_l_);
        L4406_ps_ = P3951_ps_->ps_06_Next;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        L4405_l_ = ((char*)L4406_ps_->l_00 - (char*)P3950_ps_);
        L4406_ps_->l_00 = (long)((char*)P3951_ps_ + L4405_l_);
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        L4406_ps_->l_00 = (long)((char HUGE*)P3951_ps_ + ((char HUGE*)L4406_ps_->l_00 - (char HUGE*)P3950_ps_));
#endif
}

UTM_BLOCK_PREFIX* F7211_(REGISTER MEMORY_REGION HUGE* P3952_ps_, REGISTER unsigned long P3953_ul_)
{
        REGISTER char HUGE* L4407_ps_;
        REGISTER UTM_BLOCK_PREFIX* L4408_ps_;
        REGISTER unsigned long L4409_ul_;
        REGISTER long L4410_l_;


#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        L4407_ps_ = P3952_ps_->ps_00;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        L4407_ps_ = (char HUGE*)P3952_ps_ + sizeof(MEMORY_REGION) + sizeof(long);
#endif
        L4408_ps_ = NULL;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        while ((L4409_ul_ = ((UTM_BLOCK_PREFIX*)L4407_ps_)->l_00) != 0) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        L4410_l_ = 0;
        while ((L4409_ul_ = ((UTM_BLOCK_PREFIX HUGE*)L4407_ps_)->l_00) != 0) {
#endif
                if (M007_GET(L4409_ul_, MASK0x80000000_USED_BLOCK) == 0) {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                        if ((L4409_ul_ <= P3953_ul_) && (((UTM_BLOCK_PREFIX*)L4407_ps_)->c_04 == 0) && (((UTM_BLOCK_PREFIX*)L4407_ps_)->c_05 & 1) && (L4409_ul_ >= L4410_l_)) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                        if ((L4409_ul_ <= P3953_ul_) && (((UTM_BLOCK_PREFIX HUGE*)L4407_ps_)->c_04 == 0) && (((UTM_BLOCK_PREFIX HUGE*)L4407_ps_)->c_05 & 1) && (L4409_ul_ >= L4410_l_)) {
#endif
                                L4410_l_ = L4409_ul_;
                                L4408_ps_ = M783_CAST_UTM_BLOCK_PREFIX(L4407_ps_);
                                if (L4409_ul_ == P3953_ul_) {
                                        break;
                                }
                        }
                } else {
                        M009_CLEAR(L4409_ul_, MASK0x80000000_USED_BLOCK);
                }
                L4407_ps_ += L4409_ul_;
        }
        while (L4409_ul_); /* Useless code */
        return L4408_ps_;
}

char* F7212_(REGISTER int16_t P3954_i_, REGISTER long P3955_l_, REGISTER char* P3956_pc_)
{
        REGISTER MEMORY_REGION* L4411_ps_;
        REGISTER UDSTRUCT66* L4412_ps_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        register unsigned int16_t L5447_ = 0;
#endif


#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        L4411_ps_ = G3561_as_MemoryRegions;
        while (L5447_ < G7157_MemoryAreaCount) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        L4411_ps_ = G7155_pc_FirstMemoryArea;
        do {
#endif
                if (M772_CAST_PC(L4411_ps_) != P3956_pc_) {
                        if ((L4411_ps_->MR_i_00__MR2_i_04_Flags & P3954_i_) == P3954_i_) {
                                if (L4412_ps_ = L4411_ps_->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66) {
                                        if (M007_GET(L4412_ps_->l_BlockSize, MASK0x7FFFFFFF_USED_BLOCK) >= P3955_l_) {
                                                break;
                                        }
                                }
                        }
                }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                L5447_++;
                L4411_ps_++;
        }
        if (L5447_ == G7157_MemoryAreaCount) {
                L4411_ps_ = NULL;
        }
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                L4411_ps_ = L4411_ps_->pc_0E_NextMemoryArea;
        } while (L4411_ps_ != NULL);
#endif
        return M772_CAST_PC(L4411_ps_);
}

BOOLEAN F7213_(REGISTER MEMORY_REGION HUGE* P3957_ps_)
{
        REGISTER unsigned char HUGE* L4413_puc_;
        REGISTER UTM_BLOCK_PREFIX* L4414_ps_;
        UTM_BLOCK_PREFIX* L4415_ps_;
        REGISTER long L4416_l_;
        BOOLEAN L4417_B_;


        L4417_B_ = C0_FALSE;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        L4413_puc_ = P3957_ps_->ps_00;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        L4413_puc_ = (unsigned char HUGE*)P3957_ps_ + sizeof(MEMORY_REGION) + sizeof(long);
#endif
        while ((L4416_l_ = ((UTM_BLOCK_PREFIX HUGE*)L4413_puc_)->l_00) != 0) {
                if (M007_GET(L4416_l_, MASK0x80000000_USED_BLOCK)) {
                        M009_CLEAR(L4416_l_, MASK0x80000000_USED_BLOCK);
                } else {
                        if ((((UTM_BLOCK_PREFIX HUGE*)L4413_puc_)->c_05 & 4) && (((UTM_BLOCK_PREFIX HUGE*)L4413_puc_)->c_04 == 0)) {
                                ((UTM_BLOCK_PREFIX HUGE*)L4413_puc_)->ps_06_Next->l_00 = -1;
                                F7222_RemoveBlock(L4413_puc_, P3957_ps_);
                                L4417_B_ = C1_TRUE;
                                break;
                        }
                        if ((((UTM_BLOCK_PREFIX HUGE*)L4413_puc_)->c_05 & 0x80) && (((UTM_BLOCK_PREFIX HUGE*)L4413_puc_)->i_0C == 0)) {
                                L4415_ps_ = L4414_ps_ = G4189_.udb_ps_2_FirstUTM_BLOCK_PREFIX;
                                while (L4414_ps_) {
                                        if ((unsigned char*)(L4414_ps_->ps_06_Next) == L4413_puc_) {
                                                L4414_ps_->ps_06_Next = ((UTM_BLOCK_PREFIX HUGE*)L4413_puc_)->ps_06_Next;
                                                F7222_RemoveBlock(L4413_puc_, P3957_ps_);
                                                L4417_B_ = C1_TRUE;
                                                break;
                                        }
                                        L4414_ps_ = L4414_ps_->ps_06_Next;
                                }
                                if (L4417_B_) {
                                        break;
                                }
                        }
                }
                L4413_puc_ += L4416_l_;
        }
        return L4417_B_;
}

long F7214_(MEMORY_REGION HUGE* P3958_ps_)
{
        REGISTER unsigned char HUGE* L4418_puc_;
        REGISTER unsigned char HUGE* L4419_puc_;
        REGISTER unsigned char HUGE* L4420_puc_;
        REGISTER long L4421_l_;
        REGISTER long L4422_l_;
        BOOLEAN L4423_B_;


        P3958_ps_->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66 = NULL;
        L4419_puc_ = NULL;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        for (L4418_puc_ = P3958_ps_->ps_00; (L4421_l_ = ((UTM_BLOCK_PREFIX*)L4418_puc_)->l_00) != 0; L4418_puc_ += L4421_l_) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        for (L4418_puc_ = (unsigned char HUGE*)P3958_ps_ + sizeof(MEMORY_REGION) + sizeof(long); (L4421_l_ = ((UTM_BLOCK_PREFIX HUGE*)L4418_puc_)->l_00) != 0; L4418_puc_ += L4421_l_) {
#endif
                if (M007_GET(L4421_l_, MASK0x80000000_USED_BLOCK)) {
                        M009_CLEAR(L4421_l_, MASK0x80000000_USED_BLOCK);
                        if (L4419_puc_ == NULL) {
                                L4419_puc_ = L4418_puc_;
                        } else {
                                L4422_l_ = ((UTM_BLOCK_PREFIX HUGE*)L4419_puc_)->l_00 + L4421_l_;
                                ((UTM_BLOCK_PREFIX HUGE*)L4419_puc_)->l_00 = L4422_l_;
                                M201_PREVIOUS_BLOCK_SIZE(L4418_puc_ + L4421_l_) = L4422_l_;
                        }
                        continue;
                }
                if (L4421_l_ == 0) {
                        continue;
                }
                if ((((UTM_BLOCK_PREFIX HUGE*)L4418_puc_)->c_04 != 0) || !(((UTM_BLOCK_PREFIX HUGE*)L4418_puc_)->c_05 & 1)) {
                        if (L4419_puc_ == NULL) {
                                continue;
                        }
                        F7206_InsertUDSTRUCT66InLinkedList(M782_CAST_UDSTRUCT66(L4419_puc_), P3958_ps_);
                        L4419_puc_ = NULL;
                        continue;
                }
                if (P3958_ps_->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66 != NULL) {
                        L4420_puc_ = (unsigned char*)(F7209_(L4421_l_, P3958_ps_, &L4423_B_));
                        if (L4420_puc_) {
                                F7205_RemoveUDSTRUCT66FromLinkedList(M782_CAST_UDSTRUCT66(L4420_puc_), P3958_ps_);
                                L4422_l_ = M007_GET(((UTM_BLOCK_PREFIX HUGE*)L4420_puc_)->l_00, MASK0x7FFFFFFF_USED_BLOCK);
                                if (!L4423_B_) {
                                        L4422_l_ -= L4421_l_;
                                        F7207_AddUsedBlockToList(L4420_puc_, L4422_l_, P3958_ps_);
                                        L4420_puc_ += L4422_l_;
                                        L4422_l_ = L4421_l_;
                                } else {
                                        P3958_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount -= L4422_l_ - L4421_l_;
                                }
                                ((UTM_BLOCK_PREFIX HUGE*)L4420_puc_)->l_00 = L4422_l_;
                                M201_PREVIOUS_BLOCK_SIZE(L4420_puc_ + L4422_l_) = L4422_l_;
                                F7210_(M783_CAST_UTM_BLOCK_PREFIX(L4418_puc_), M783_CAST_UTM_BLOCK_PREFIX(L4420_puc_));
                                if (L4419_puc_ == NULL) {
                                        L4419_puc_ = L4418_puc_;
                                        M008_SET(((UTM_BLOCK_PREFIX HUGE*)L4418_puc_)->l_00, MASK0x80000000_USED_BLOCK);
                                        M008_SET(M201_PREVIOUS_BLOCK_SIZE(L4418_puc_ + L4421_l_), MASK0x80000000_USED_BLOCK);
                                        continue;
                                } else {
                                        L4422_l_ = ((UTM_BLOCK_PREFIX HUGE*)L4419_puc_)->l_00 + L4421_l_;
                                        ((UTM_BLOCK_PREFIX HUGE*)L4419_puc_)->l_00 = L4422_l_;
                                        M201_PREVIOUS_BLOCK_SIZE(L4418_puc_ + L4421_l_) = L4422_l_;
                                        continue;
                                }
                        }
                }
                if (L4419_puc_ == NULL) {
                        continue;
                }
                L4422_l_ = ((UTM_BLOCK_PREFIX HUGE*)L4419_puc_)->l_00;
                F7210_(M783_CAST_UTM_BLOCK_PREFIX(L4418_puc_), M783_CAST_UTM_BLOCK_PREFIX(L4419_puc_));
                ((UTM_BLOCK_PREFIX HUGE*)L4419_puc_)->l_00 = L4421_l_;
                L4419_puc_ += L4421_l_;
                M201_PREVIOUS_BLOCK_SIZE(L4419_puc_) = L4421_l_;
                ((UTM_BLOCK_PREFIX HUGE*)L4419_puc_)->l_00 = L4422_l_;
                M201_PREVIOUS_BLOCK_SIZE(L4419_puc_ + M007_GET(L4422_l_, MASK0x7FFFFFFF_USED_BLOCK)) = L4422_l_;
        }
        if (L4419_puc_ != NULL) {
                F7206_InsertUDSTRUCT66InLinkedList(M782_CAST_UDSTRUCT66(L4419_puc_), P3958_ps_);
        }
        return M007_GET(P3958_ps_->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66->l_BlockSize, MASK0x7FFFFFFF_USED_BLOCK);
}

BOOLEAN F7215_(REGISTER MEMORY_REGION* P3959_ps_, REGISTER unsigned long P3960_ul_)
{
        REGISTER unsigned long L4424_ul_;
        REGISTER unsigned long L4425_ul_;
        REGISTER BOOLEAN L4429_B_;
        REGISTER BOOLEAN L4430_B_;
        REGISTER UTM_BLOCK_PREFIX HUGE* L4426_pc_;
        REGISTER MEMORY_REGION* L4427_ps_;
        UTM_BLOCK_PREFIX* L4428_ps_;


        L4430_B_ = C0_FALSE;
        L4424_ul_ = (P3959_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount < P3960_ul_) ? P3960_ul_ : P3959_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount + 2;
        L4429_B_ = C1_TRUE;
        loc_1C86B:
        while ((P3959_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount < L4424_ul_) && L4429_B_) {
                L4429_B_ = F7213_(P3959_ps_);
        }
        if ((L4425_ul_ = F7214_(P3959_ps_)) >= P3960_ul_) {
                L4430_B_ = C1_TRUE;
        } else {
                L4424_ul_ = P3959_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount + (P3960_ul_ - L4425_ul_);
                if (L4429_B_) {
                        goto loc_1C86B;
                }
        }
        if (!L4430_B_ && (G7157_MemoryAreaCount > 1)) {
                do {
                        L4425_ul_ = -1;
                        do {
                                L4426_pc_ = F7211_(P3959_ps_, L4425_ul_);
                                if (L4426_pc_ == NULL) {
                                        L4429_B_ = C0_FALSE;
                                        break;
                                }
                                L4425_ul_ = L4426_pc_->l_00;
                                L4427_ps_ = M784_CAST_MEMORY_REGION(F7212_(L4426_pc_->c_05, L4425_ul_, M772_CAST_PC(P3959_ps_)));
                                if (L4427_ps_ == NULL) {
                                        L4425_ul_ -= 2;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                        if (L4425_ul_ < 34) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                        if (L4425_ul_ < 30) {
#endif
                                                L4429_B_ = C0_FALSE;
                                                break;
                                        }
                                } else {
                                        L4428_ps_ = F7220_(L4425_ul_, L4426_pc_->c_05, L4427_ps_);
                                        F7210_(L4426_pc_, L4428_ps_);
                                        F7222_RemoveBlock((unsigned char*)(L4426_pc_), P3959_ps_);
                                }
                        } while ((P3959_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount < L4424_ul_) && L4429_B_);
                        if ((L4425_ul_ = F7214_(P3959_ps_)) >= P3960_ul_) {
                                L4430_B_ = C1_TRUE;
                                break;
                        }
                        L4424_ul_ = P3959_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount + (P3960_ul_ - L4425_ul_);
                } while (L4429_B_);
        }
        return L4430_B_;
}

/* Block contains UTM_BLOCK_PREFIX prefix (16 bytes, actual data X bytes, 4 bytes: block size) = 20 bytes overhead */
UTM_BLOCK_PREFIX* F7216_AllocateFirstHandleBlock(REGISTER unsigned int16_t P3961_ui_)
{
        REGISTER UTM_BLOCK_PREFIX* L4431_ps_;
        REGISTER UTM_BLOCK_PREFIX* L4432_ps_;
        REGISTER MEMORY_REGION* L4433_ps_MemoryRegion;
        REGISTER unsigned long L4434_ul_RequestedByteCount;
        MEMORY_REQUEST L4435_s_MemoryRequest;


        L4431_ps_ = NULL;
        L4434_ul_RequestedByteCount = ((long)P3961_ui_ * 4) + sizeof(UTM_BLOCK_PREFIX) + 4;
        L4432_ps_ = G4189_.udb_ps_2_FirstUTM_BLOCK_PREFIX;
        L4435_s_MemoryRequest.MemReqFlags = MASK0x0400_MEMREQ;
        L4435_s_MemoryRequest.ul_00_RequestedByteCount = L4434_ul_RequestedByteCount;
        if ((L4433_ps_MemoryRegion = F7219_(&L4435_s_MemoryRequest)) != NULL) {
                if (L4431_ps_ = F7220_(L4434_ul_RequestedByteCount, MASK0x0400_MEMREQ, L4433_ps_MemoryRegion)) {
                        L4431_ps_->c_04 = 0xFF;
                        L4431_ps_->c_05 = 0x80;
                        L4431_ps_->ps_06_Next = NULL;
                        L4431_ps_->i_0A = P3961_ui_;
                        L4431_ps_->i_0C = 0;
                        L4431_ps_->i_0E = 0;
                        F0008_MAIN_ClearBytes((char*)L4431_ps_ + sizeof(UTM_BLOCK_PREFIX), L4434_ul_RequestedByteCount - (sizeof(UTM_BLOCK_PREFIX) + 4));
                        if (L4432_ps_) {
                                while (L4432_ps_->ps_06_Next) {
                                        L4432_ps_ = L4432_ps_->ps_06_Next;
                                }
                                L4432_ps_->ps_06_Next = L4431_ps_;
                        } else {
                                G4189_.udb_ps_2_FirstUTM_BLOCK_PREFIX = L4431_ps_;
                        }
                }
        }
        return L4431_ps_;
}

unsigned char** F7217_(REGISTER unsigned char** P3962_ppuc_)
{
        REGISTER unsigned char HUGE** L4436_ppuc_;
        REGISTER UTM_BLOCK_PREFIX* L4437_ps_;
        REGISTER int16_t L4438_i_;
        REGISTER unsigned int16_t L4439_ui_;
        REGISTER int16_t L4440_i_ = 0;


        for (L4437_ps_ = G4189_.udb_ps_2_FirstUTM_BLOCK_PREFIX; L4437_ps_; L4437_ps_ = L4437_ps_->ps_06_Next) {
                if (L4437_ps_->i_0C < L4437_ps_->i_0A) {
                        L4439_ui_ = L4437_ps_->i_0E;
                        L4436_ppuc_ = (unsigned char**)(((char HUGE*)((char*)L4437_ps_ + 16)) + (L4439_ui_ * 4));
                        L4438_i_ = L4437_ps_->i_0A;
                        while (L4438_i_--) {
                                if (L4437_ps_->i_0A == L4439_ui_) {
                                        L4439_ui_ = 0;
                                        L4436_ppuc_ = (unsigned char**)((char*)L4437_ps_ + 16);
                                }
                                if (*L4436_ppuc_ == NULL) {
                                        L4437_ps_->i_0E = L4439_ui_;
                                        L4437_ps_->i_0C++;
                                        L4440_i_ = 1;
                                        break;
                                }
                                L4439_ui_++;
                                L4436_ppuc_++;
                        }
                        if (L4440_i_) {
                                break;
                        }
                }
        }
        if (!L4440_i_) {
                if ((L4437_ps_ = F7216_AllocateFirstHandleBlock(G4189_.udb_i_6_UTMBlockCount)) != NULL) {
                        L4436_ppuc_ = (unsigned char**)((char*)L4437_ps_ + 16);
                        L4437_ps_->i_0C++;
                        L4440_i_ = 1;
                }
        }
        if (!L4440_i_) {
                L4436_ppuc_ = NULL;
        }
        *P3962_ppuc_ = (unsigned char*)L4437_ps_;
        return L4436_ppuc_;
}

void F7218_(REGISTER unsigned char HUGE** P3963_ppuc_)
{
        REGISTER unsigned char HUGE* L4441_puc_;
        REGISTER long L5373_l_Unreferenced;


        for (L4441_puc_ = (unsigned char*)G4189_.udb_ps_2_FirstUTM_BLOCK_PREFIX; (unsigned char*)L4441_puc_; L4441_puc_ = (unsigned char*)(((UTM_BLOCK_PREFIX*)L4441_puc_)->ps_06_Next)) {
                if ((L4441_puc_ <= (unsigned char*)P3963_ppuc_) && ((L4441_puc_ + (((unsigned long)((UTM_BLOCK_PREFIX*)L4441_puc_)->i_0A * 4) + 20)) > (unsigned char*)P3963_ppuc_)) {
                        *P3963_ppuc_ = NULL;
                        ((UTM_BLOCK_PREFIX*)L4441_puc_)->i_0C--;
                        ((UTM_BLOCK_PREFIX*)L4441_puc_)->i_0E = (unsigned long)((unsigned char HUGE*)P3963_ppuc_ - ((unsigned char*)L4441_puc_ + 16)) >> 2;
                        break;
                }
        }
}

MEMORY_REGION* F7219_(REGISTER MEMORY_REQUEST* P3964_ps_)
{
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        register int16_t L4447_i_;
        register int16_t L5446_;
        register unsigned long L4442_ul_RequestedByteCount;
        register BOOLEAN L4443_B_;
        register BOOLEAN L4444_B_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        REGISTER long L6020_l_Unreferenced;
        REGISTER unsigned long L4442_ul_RequestedByteCount;
        REGISTER BOOLEAN L4443_B_;
        REGISTER int16_t L4447_i_;
        REGISTER BOOLEAN L4444_B_;
#endif
        REGISTER MEMORY_REGION* L4445_ps_;
        REGISTER MEMORY_REGION* L4446_ps_;


        if (M007_GET(P3964_ps_->MemReqFlags, MASK0x0001_MEMREQ)) {
                L4447_i_ = 1;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                L4445_ps_ = &G3561_as_MemoryRegions[0];
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                L4445_ps_ = G7155_pc_FirstMemoryArea;
#endif
        } else {
                L4447_i_ = -1;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                L4445_ps_ = &G3561_as_MemoryRegions[G7157_MemoryAreaCount - 1];
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                L4445_ps_ = G7156_pc_LastMemoryArea;
#endif
        }
        L4442_ul_RequestedByteCount = P3964_ps_->ul_00_RequestedByteCount;
        L4446_ps_ = L4445_ps_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        loc_344E:
#endif
        L4443_B_ = C0_FALSE;
        L4444_B_ = C0_FALSE;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        L5446_ = 0;
        while (L5446_ < G7157_MemoryAreaCount) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        while (L4445_ps_ != NULL) {
#endif
                if ((L4445_ps_->MR_i_00__MR2_i_04_Flags & P3964_ps_->MemReqFlags) == M007_GET(P3964_ps_->MemReqFlags, MASK0x07F8_MEMREQ)) {
                        L4443_B_ = C1_TRUE;
/* #if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT))) */
                        if (M007_GET(L4445_ps_->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66->l_BlockSize, MASK0x7FFFFFFF_USED_BLOCK) >= L4442_ul_RequestedByteCount) {
/* #endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                        if (M007_GET(((UDSTRUCT66*)(L4445_ps_->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66))->l_BlockSize, MASK0x7FFFFFFF_USED_BLOCK) >= L4442_ul_RequestedByteCount) {
#endif */
                                L4444_B_ = C1_TRUE;
                                break;
                        }
                }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                L5446_++;
                L4445_ps_ += L4447_i_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                L4445_ps_ = (L4447_i_ == 1) ? L4445_ps_->pc_0E_NextMemoryArea : L4445_ps_->pc_12_PreviousMemoryArea;
#endif
        }
        if (!L4443_B_) {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                F1770_(C1_TRUE, 0x010D0005, (long)P3964_ps_->MemReqFlags);
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                F7112_FallbackToLastProgramState(C1_TRUE, 104, (long)P3964_ps_->MemReqFlags);
#endif
        }
        if (!L4444_B_) {
                L4445_ps_ = L4446_ps_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                L5446_ = 0;
                while (L5446_ < G7157_MemoryAreaCount) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                while (L4445_ps_ != NULL) {
#endif
                        if (((L4445_ps_->MR_i_00__MR2_i_04_Flags & P3964_ps_->MemReqFlags) == M007_GET(P3964_ps_->MemReqFlags, MASK0x07F8_MEMREQ)) && F7215_(L4445_ps_, L4442_ul_RequestedByteCount)) {
                                break;
                        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                        L5446_++;
                        L4445_ps_ += L4447_i_;
                }
                if (L5446_ == G7157_MemoryAreaCount) {
                        if (F1770_(C0_FALSE, 0x010D0001, (long)P3964_ps_->MemReqFlags) == 0x0102FFFE) {
                                L4445_ps_ = L4446_ps_;
                                goto loc_344E;
                        }
                        L4445_ps_ = NULL;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                        L4445_ps_ = (L4447_i_ == 1) ? L4445_ps_->pc_0E_NextMemoryArea : L4445_ps_->pc_12_PreviousMemoryArea;
#endif
                }
        }
        return L4445_ps_;
}

UTM_BLOCK_PREFIX* F7220_(
REGISTER unsigned long P3965_ul_RequestedByteCount,
REGISTER unsigned int16_t P3966_ui_Requirements,
REGISTER MEMORY_REGION* P3967_ps_MemoryRegion)
{
        REGISTER unsigned long L4448_ul_ByteCount;
        REGISTER unsigned char HUGE* L4449_puc_;
        REGISTER unsigned char* L4450_puc_;
        BOOLEAN L4451_B_;


        if (L4449_puc_ = (unsigned char*)(F7209_(P3965_ul_RequestedByteCount, P3967_ps_MemoryRegion, &L4451_B_))) {
                F7205_RemoveUDSTRUCT66FromLinkedList(M782_CAST_UDSTRUCT66(L4449_puc_), P3967_ps_MemoryRegion);
                L4448_ul_ByteCount = M007_GET(((UTM_BLOCK_PREFIX HUGE*)L4449_puc_)->l_00, MASK0x7FFFFFFF_USED_BLOCK);
                if (L4451_B_) {
                        P3965_ul_RequestedByteCount = L4448_ul_ByteCount;
                } else {
                        L4448_ul_ByteCount -= P3965_ul_RequestedByteCount;
                        if (P3966_ui_Requirements & MASK0x0001_MEMREQ) {
                                L4450_puc_ = L4449_puc_ + P3965_ul_RequestedByteCount;
                        } else {
                                L4450_puc_ = L4449_puc_;
                                L4449_puc_ += L4448_ul_ByteCount;
                        }
                        F7207_AddUsedBlockToList(L4450_puc_, L4448_ul_ByteCount, P3967_ps_MemoryRegion);
                }
                P3967_ps_MemoryRegion->MR_l_0A__MR2_l_0E_AvailableByteCount -= P3965_ul_RequestedByteCount;
                ((UTM_BLOCK_PREFIX HUGE*)L4449_puc_)->l_00 = P3965_ul_RequestedByteCount;
                M201_PREVIOUS_BLOCK_SIZE(L4449_puc_ + P3965_ul_RequestedByteCount) = P3965_ul_RequestedByteCount;
        }
        return M783_CAST_UTM_BLOCK_PREFIX(L4449_puc_);
}

unsigned char** F7221_(REGISTER MEMORY_REQUEST* P3968_ps_MemoryRequest)
{
        REGISTER char HUGE* L4452_ps_;
        REGISTER unsigned char** L4453_ppuc_MemoryHandle;
        MEMORY_REGION* L4454_ps_MemoryRegion;
        REGISTER unsigned long L4455_ul_ByteCount;
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        int16_t L6055_i_Unreferenced;
#endif
        UTM_BLOCK_PREFIX* L4456_ps_;


#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        L4455_ul_ByteCount = P3968_ps_MemoryRequest->ul_00_RequestedByteCount + P3968_ps_MemoryRequest->umr_i_06_AdditionalBytes_Always0 + 18;
        if (L4455_ul_ByteCount & 1) {
                L4455_ul_ByteCount++;
        }
        P3968_ps_MemoryRequest->ul_00_RequestedByteCount = L4455_ul_ByteCount;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        P3968_ps_MemoryRequest->ul_00_RequestedByteCount = (L4455_ul_ByteCount = F7202_GetEvenMemoryBlockSize(P3968_ps_MemoryRequest->ul_00_RequestedByteCount + 18 + P3968_ps_MemoryRequest->umr_i_06_AdditionalBytes_Always0));
        for (;;) {
#endif
                if ((L4453_ppuc_MemoryHandle = F7217_((unsigned char**)&L4456_ps_)) != NULL) {
                        if ((L4454_ps_MemoryRegion = F7219_(P3968_ps_MemoryRequest)) != NULL) {
                                if (L4452_ps_ = M772_CAST_PC(F7220_(L4455_ul_ByteCount, P3968_ps_MemoryRequest->MemReqFlags, L4454_ps_MemoryRegion))) {
                                        *L4453_ppuc_MemoryHandle = (unsigned char*)(L4452_ps_ + P3968_ps_MemoryRequest->umr_i_06_AdditionalBytes_Always0 + 14);
                                        ((UTM_BLOCK_PREFIX HUGE*)L4452_ps_)->c_04 = 0;
                                        ((UTM_BLOCK_PREFIX HUGE*)L4452_ps_)->c_05 = P3968_ps_MemoryRequest->MemReqFlags & 0x07;
                                        ((UTM_BLOCK_PREFIX HUGE*)L4452_ps_)->i_0A = P3968_ps_MemoryRequest->MemReqFlags;
                                        ((UTM_BLOCK_PREFIX HUGE*)L4452_ps_)->ps_06_Next = M785_CAST_structutmblockprefix(L4453_ppuc_MemoryHandle);
                                        L4452_ps_ += 12;
                                        if ((P3968_ps_MemoryRequest->pfv_08_InitAdditionalBytes_AlwaysNULL) && (P3968_ps_MemoryRequest->umr_i_06_AdditionalBytes_Always0)) {
                                                (P3968_ps_MemoryRequest->pfv_08_InitAdditionalBytes_AlwaysNULL)(L4452_ps_);
                                        }
                                        *((int16_t*)(L4452_ps_ + P3968_ps_MemoryRequest->umr_i_06_AdditionalBytes_Always0)) = P3968_ps_MemoryRequest->umr_i_06_AdditionalBytes_Always0;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                        loc_365C:
#endif
                                        return L4453_ppuc_MemoryHandle;
                                }
                        }
                        L4456_ps_->i_0C--;
                }
                L4453_ppuc_MemoryHandle = NULL;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        goto loc_365C;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                F7112_FallbackToLastProgramState(C0_FALSE, 100, (long)P3968_ps_MemoryRequest->MemReqFlags);
        }
#endif
}

void F7222_RemoveBlock(REGISTER unsigned char* P3969_puc_, REGISTER MEMORY_REGION* P3970_ps_)
{
        REGISTER long L4457_l_;


        L4457_l_ = M202_BLOCK_SIZE(P3969_puc_);
        P3970_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount += L4457_l_;
        F7208_RemoveBlockFromLinkedList(P3969_puc_, L4457_l_, P3970_ps_);
}

#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
int16_t F1824_AllocateMemoryHeap(int16_t P5582_i_UTMHandleCount, int16_t P5583_i_UTMHandleCount)
{
        REGISTER unsigned char* L5391_;
        REGISTER MEMORY_REGION* L5392_;
#ifdef MEDIA772_SU1E
        register unsigned long L5393_;
        register int16_t L5394_;
        register int16_t L5395_;
        long L5396_l_Unreferenced;
#endif
#ifdef MEDIA763_AU1E_AU2E
        unsigned long L5393_;
        register long L5395_;
#endif


#ifdef MEDIA772_SU1E
        if ((L5393_ = Malloc(-1L)) < 120000) {
                F1770_(C1_TRUE, 0x010D000B, (long)"ERR, not enuf ram to malloc");
        }
        L5393_ = (L5393_ & 0xFFFFFFFE) - 4000;
        if ((L5391_ = (unsigned char*)Malloc(L5393_)) == NULL) {
                F1770_(C1_TRUE, 0x010D000B, (long)"ERR, System Malloc failed");
        }
#endif
#ifdef MEDIA763_AU1E_AU2E
        if ((L5393_ = AvailMem(MEMF_LARGEST | MEMF_CHIP)) < 131072) {
#ifdef MEDIA762_AU1E
                F1770_(C1_TRUE, 0x010D000B, (long)"Error: Insufficient CHIP RAM available.");
#endif
#ifdef MEDIA767_AU2E
                F1770_(C1_TRUE, 0x010D000B, NULL);
#endif
        }
        L5393_ = (L5393_ - 16384) & 0xFFFFFFFE;
        if ((L5391_ = (unsigned char*)AllocMem(L5393_, MEMF_CHIP)) == NULL) {
#ifdef MEDIA762_AU1E
                F1770_(C1_TRUE, 0x010D000B, (long)"Error: Couldn't allocate CHIP RAM.");
#endif
#ifdef MEDIA767_AU2E
                F1770_(C1_TRUE, 0x010D000B, NULL);
#endif
        }
#endif
        G3559_puc_MemoryHeap = L5391_;
#ifdef MEDIA772_SU1E
        if ((long)L5391_ & 1) {
                L5391_++;
                L5393_--;
        }
        L5393_ &= 0xFFFFFFFE;
#endif
        G7157_MemoryAreaCount = 1;
        G3561_as_MemoryRegions[0].ps_00 = L5391_;
        G3561_as_MemoryRegions[0].MR_l_02__MR2_l_06_TotalByteCount = L5393_;
        G3561_as_MemoryRegions[0].MR_i_00__MR2_i_04_Flags = MASK0x07F8_MEMREQ;
#ifdef MEDIA763_AU1E_AU2E
        G3561_as_MemoryRegions[0].ps_12 = L5391_;
        G3561_as_MemoryRegions[0].l_16_AvailableByteCount = L5393_;
        if ((L5393_ = AvailMem(MEMF_LARGEST | MEMF_FAST)) >= 131072) {
                L5393_ = (L5393_ - 4096) & 0xFFFFFFFE;
                if ((L5391_ = (unsigned char*)AllocMem(L5393_, MEMF_FAST)) == NULL) {
#ifdef MEDIA762_AU1E
                        F1770_(C1_TRUE, 0x010D000B, (long)"Error: Couldn't allocate FAST RAM.");
#endif
#ifdef MEDIA767_AU2E
                        F1770_(C1_TRUE, 0x010D000B, NULL);
#endif
                }
                G7157_MemoryAreaCount++;
                G3561_as_MemoryRegions[1].ps_00 = L5391_;
                G3561_as_MemoryRegions[1].MR_l_02__MR2_l_06_TotalByteCount = L5393_;
                G3561_as_MemoryRegions[1].MR_i_00__MR2_i_04_Flags = MASK0x0700_MEMREQ;
                G3561_as_MemoryRegions[1].ps_12 = L5391_;
                G3561_as_MemoryRegions[1].l_16_AvailableByteCount = L5393_;
        }
#endif
        L5395_ = 0;
        L5392_ = &G3561_as_MemoryRegions[0];
        while (L5395_ < G7157_MemoryAreaCount) {
                L5391_ = L5392_->ps_00;
                M202_BLOCK_SIZE(L5391_) = 0;
                M201_PREVIOUS_BLOCK_SIZE((char*)L5391_ + L5392_->MR_l_02__MR2_l_06_TotalByteCount) = 0;
                L5391_ += 4;
                L5392_->ps_00 = L5391_;
                L5392_->MR_l_02__MR2_l_06_TotalByteCount -= 8;
                L5392_->MR_l_0A__MR2_l_0E_AvailableByteCount = L5392_->MR_l_02__MR2_l_06_TotalByteCount;
                L5392_->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66 = NULL;
                F7207_AddUsedBlockToList(L5391_, L5392_->MR_l_0A__MR2_l_0E_AvailableByteCount, L5392_);
                L5395_++;
                L5392_++;
        }
        G4189_.udb_i_6_UTMBlockCount = P5583_i_UTMHandleCount;
        G4189_.udb_ps_2_FirstUTM_BLOCK_PREFIX = NULL;
        if (F7216_AllocateFirstHandleBlock(P5582_i_UTMHandleCount) == NULL) {
#ifdef MEDIA772_SU1E
                F1770_(C1_TRUE, 0x010D000B, (long)"ERR, Can't alloc 1st handle block");
#endif
#ifdef MEDIA762_AU1E
                F1770_(C1_TRUE, 0x010D000B, (long)"Error: Couldn't allocate 1st handle block.");
#endif
#ifdef MEDIA767_AU2E
                F1770_(C1_TRUE, 0x010D000B, NULL);
#endif
        }
        return 0;
}

void F1825_FreeMemoryHeap(
)
{
#ifdef MEDIA772_SU1E
        Mfree(G3559_puc_MemoryHeap);
#endif
#ifdef MEDIA763_AU1E_AU2E
        register MEMORY_REGION* L5868_;
        register long L5869_;


        L5869_ = 0;
        L5868_ = &G3561_as_MemoryRegions[0];
        while (L5869_ < G7157_MemoryAreaCount) {
                if (L5868_->ps_12) {
                        FreeMem(L5868_->ps_12, L5868_->l_16_AvailableByteCount);
                        L5868_->ps_12 = NULL;
                }
                L5869_++;
                L5868_++;
        }
#endif
}
#endif

#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
void F7223_InitMemoryVariables(
)
{
        G7157_MemoryAreaCount = 0;
        G4189_.udb_ps_2_FirstUTM_BLOCK_PREFIX = NULL;
        G7155_pc_FirstMemoryArea = G7156_pc_LastMemoryArea = NULL;
}

void F7224_AddMemoryArea(REGISTER unsigned char HUGE* P3971_puc_Address, long P3972_l_Size, int16_t P3973_i_MemoryTypeFlags)
{
        REGISTER MEMORY_REGION* L4458_ps_;


        L4458_ps_ = M784_CAST_MEMORY_REGION(P3971_puc_Address);
        P3971_puc_Address += sizeof(MEMORY_REGION);
        M202_BLOCK_SIZE(P3971_puc_Address) = 0;
        M201_PREVIOUS_BLOCK_SIZE(P3971_puc_Address + P3972_l_Size - sizeof(MEMORY_REGION)) = 0;
        P3972_l_Size -= (sizeof(MEMORY_REGION) + sizeof(long) + sizeof(long));
        L4458_ps_->MR_i_00__MR2_i_04_Flags = P3973_i_MemoryTypeFlags; /* Defines which type of memory allocations are allowed */
        L4458_ps_->MR_l_02__MR2_l_06_TotalByteCount = L4458_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount = P3972_l_Size;
        L4458_ps_->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66 = NULL;
        F7207_AddUsedBlockToList(P3971_puc_Address + sizeof(long), P3972_l_Size, L4458_ps_);
        L4458_ps_->pc_0E_NextMemoryArea = NULL;
        L4458_ps_->pc_12_PreviousMemoryArea = G7156_pc_LastMemoryArea;
        if (G7156_pc_LastMemoryArea) {
                G7156_pc_LastMemoryArea->pc_0E_NextMemoryArea = L4458_ps_;
        }
        G7156_pc_LastMemoryArea = L4458_ps_;
        G7157_MemoryAreaCount++;
        if (G7155_pc_FirstMemoryArea == NULL) {
                G7155_pc_FirstMemoryArea = L4458_ps_;
        }
}

void F7225_(int16_t P3974_i_UTMHandleCount, int16_t P3975_i_UTMHandleCount) /* To merge with F1824_AllocateMemoryHeap. Merge local variables. */
{
        REGISTER char* L6021_pc_Unreferenced;
        REGISTER char* L6022_pc_Unreferenced;
        REGISTER long L6023_l_Unreferenced;
        REGISTER long L6024_l_Unreferenced;
        REGISTER long L6025_l_Unreferenced;
        int16_t L6026_i_Unreferenced;


        G4189_.udb_i_6_UTMBlockCount = P3975_i_UTMHandleCount;
        if (F7216_AllocateFirstHandleBlock(P3974_i_UTMHandleCount) == NULL) {
                F7112_FallbackToLastProgramState(C1_TRUE, 110, (long)"ERR, Can't alloc 1st handle block");
        }
}

void F7226_Unreferenced(
)
{
}
#endif

/* Returns a memory handle (a pointer to a pointer). Allows to move the memory buffer after it has been allocated. The returned address is never changed and is the address of the second pointer whose address may be updated for example to defragment memory */
unsigned char** F7227_RequestMemoryHandle(unsigned long P3976_ul_RequestedByteCount, int16_t P3977_i_Requirements)
{
        MEMORY_REQUEST L4459_s_MemoryRequest;
        unsigned char** L4460_pps_MemoryHandle;


        L4459_s_MemoryRequest.ul_00_RequestedByteCount = P3976_ul_RequestedByteCount;
        L4459_s_MemoryRequest.MemReqFlags = P3977_i_Requirements;
        L4459_s_MemoryRequest.umr_i_06_AdditionalBytes_Always0 = 0;
        L4459_s_MemoryRequest.pfv_08_InitAdditionalBytes_AlwaysNULL = (void (*)())NULL;
        L4460_pps_MemoryHandle = F7221_(&L4459_s_MemoryRequest);
        return L4460_pps_MemoryHandle;
}

#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
long F7228_FreeMemory(register unsigned char** P3978_ppuc_)
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
void F7228_FreeMemory(REGISTER unsigned char** P3978_ppuc_)
#endif
{
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        REGISTER long L4462_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        REGISTER int16_t L4462_;
#endif
        REGISTER unsigned char* L4461_puc_;


        L4462_ = F7233_(P3978_ppuc_);
        if (!L4462_) {
                L4461_puc_ = F7203_(P3978_ppuc_);
                F7222_RemoveBlock(L4461_puc_, F7204_GetMemoryAreaContainingAddress(L4461_puc_));
        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        if ((L4462_ == 0) || (L4462_ == 0x010D0003)) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        if (!L4462_ || (L4462_ == 0x66)) {
#endif
                F7218_(P3978_ppuc_);
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                L4462_ = 0;
#endif
        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        return L4462_;
#endif
}

unsigned char* F7229_(REGISTER unsigned char** P3979_ppuc_)
{
        register UTM_BLOCK_PREFIX* L4463_ps_;
        REGISTER unsigned char* L4464_puc_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        register long L4465_l_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        register int16_t L4465_i_;
#endif


        L4464_puc_ = NULL;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        L4465_l_ = F7233_(P3979_ppuc_);
        if (L4465_l_ == 0) {
                L4463_ps_ = F7203_(P3979_ppuc_);
                L4463_ps_->c_04++;
                L4464_puc_ = *P3979_ppuc_;
        }
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        if ((L4465_i_ = F7233_(P3979_ppuc_)) != 0) {
                F7112_FallbackToLastProgramState(C0_FALSE, L4465_i_, (long)P3979_ppuc_);
        }
        L4463_ps_ = M783_CAST_UTM_BLOCK_PREFIX(F7203_(P3979_ppuc_));
        L4463_ps_->c_04++;
        L4464_puc_ = *P3979_ppuc_;
#endif
        return L4464_puc_;
}

void F7230_(REGISTER unsigned char** P3980_ppuc_)
{
        REGISTER UTM_BLOCK_PREFIX* L4466_ps_;
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        int16_t L4467_i_;
#endif


#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        if ((L4467_i_ = F7233_(P3980_ppuc_)) != 0) {
                F7112_FallbackToLastProgramState(C0_FALSE, L4467_i_, (long)P3980_ppuc_);
        }
#endif
        L4466_ps_ = M783_CAST_UTM_BLOCK_PREFIX(F7203_(P3980_ppuc_));
        L4466_ps_->c_04--;
}

int16_t F7231_Unreferenced(unsigned char** P3981_ppuc_)
{
        REGISTER UTM_BLOCK_PREFIX* L4468_ps_;
        REGISTER int16_t L4469_i_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        register long L4470_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        REGISTER int16_t L4470_;
#endif


        if ((L4470_ = F7233_(P3981_ppuc_)) == 0) {
                L4468_ps_ = M783_CAST_UTM_BLOCK_PREFIX(F7203_(P3981_ppuc_));
                L4469_i_ = L4468_ps_->i_0A;
        } else {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                F1770_(C0_FALSE, L4470_, (long)NULL);
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                F7112_FallbackToLastProgramState(C0_FALSE, L4470_, (long)P3981_ppuc_);
#endif
        }
        return L4469_i_;
}

int16_t F7232_Unreferenced(REGISTER unsigned char** P3982_ppuc_, REGISTER int16_t P3983_i_)
{
        REGISTER UTM_BLOCK_PREFIX* L4471_ps_;
        REGISTER int16_t L4472_i_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        register long L4473_i_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        REGISTER int16_t L4473_i_;
#endif


        if ((L4473_i_ = F7233_(P3982_ppuc_)) == 0) {
                L4471_ps_ = M783_CAST_UTM_BLOCK_PREFIX(F7203_(P3982_ppuc_));
                L4472_i_ = L4471_ps_->i_0A;
                L4471_ps_->i_0A = P3983_i_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                L4471_ps_->c_05 = (L4471_ps_->c_05 & 0xFFF8) | (P3983_i_ & 7);
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                L4471_ps_->c_05 = (L4471_ps_->c_05 & 0xFFF8) | (P3983_i_ & 0x7);
#endif
        } else {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                F1770_(C0_FALSE, L4473_i_, (long)NULL);
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                F7112_FallbackToLastProgramState(C0_FALSE, L4473_i_, (long)P3982_ppuc_);
#endif
        }
        return L4472_i_;
}

#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
long F7233_(register unsigned char** P3984_ppuc_)
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
int16_t F7233_(REGISTER unsigned char HUGE** P3984_ppuc_)
#endif
{
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        register long L4475_;
        register UTM_BLOCK_PREFIX* L4474_puc_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        REGISTER int16_t L4475_;
        REGISTER unsigned char* L4474_puc_;
#endif


        if (!P3984_ppuc_ || (*P3984_ppuc_ == NULL)) {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                F1770_(C1_TRUE, 0x010D0002, (long)P3984_ppuc_);
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                F7112_FallbackToLastProgramState(C1_TRUE, 101, (long)P3984_ppuc_);
#endif
        } else {
                if (((long)*P3984_ppuc_) == -1) {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                        L4475_ = 0x010D0003;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                        L4475_ = 102;
#endif
                } else {
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                        L4475_ = 0;
#endif
                        L4474_puc_ = F7203_(P3984_ppuc_);
                        if (F7204_GetMemoryAreaContainingAddress(L4474_puc_) == NULL) {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                L4475_ = 0x010D0002;
                        } else {
                                L4475_ = 0;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                F7112_FallbackToLastProgramState(C1_TRUE, 101, (long)P3984_ppuc_);
#endif
                        }
                }
        }
        return L4475_;
}

#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
long F7234_(register unsigned char** P3985_ppuc_, register unsigned long P3986_ul_)
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
void F7234_(REGISTER unsigned char HUGE** P3985_ppuc_, register unsigned long P3986_ul_)
#endif
{
        register unsigned char HUGE* L4476_puc_;
        REGISTER MEMORY_REGION* L4477_ps_;
        UTM_BLOCK_PREFIX HUGE* L4478_ps_;
        register unsigned long L4479_ul_;
        REGISTER unsigned long L4480_ul_;
        REGISTER long L4481_l_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        long L4485_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        int16_t L4485_;
#endif
        int16_t L4484_i_;
        MEMORY_REGION* L4482_ps_;
        MEMORY_REQUEST L4483_s_;


        if (!(L4485_ = F7233_(P3985_ppuc_))) {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                if (P3986_ul_ & 1) {
                        P3986_ul_++;
                }
                if (P3986_ul_ < 34) {
                        P3986_ul_ = 34;
                }
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                P3986_ul_ = F7202_GetEvenMemoryBlockSize(P3986_ul_);
#endif
                L4480_ul_ = (long)(*(unsigned int16_t*)(*P3985_ppuc_ - 2)) + 18;
                L4481_l_ = L4480_ul_ - 4;
                L4476_puc_ = *P3985_ppuc_ - L4481_l_;
                L4477_ps_ = F7204_GetMemoryAreaContainingAddress(L4476_puc_);
                L4479_ul_ = ((UTM_BLOCK_PREFIX HUGE*)L4476_puc_)->l_00;
                P3986_ul_ += L4480_ul_;
                if ((((UTM_BLOCK_PREFIX HUGE*)L4476_puc_)->c_04 != 0) || !(((UTM_BLOCK_PREFIX HUGE*)L4476_puc_)->c_05 & 1)) {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                        L4485_ = 0x010D000A;
                } else {
                        if ((L4479_ul_ > P3986_ul_) && (L4479_ul_ - P3986_ul_ >= 34)) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                        F7112_FallbackToLastProgramState(C0_FALSE, 109, (long)P3985_ppuc_);
                }
                        if ((L4479_ul_ > P3986_ul_) && (L4479_ul_ - P3986_ul_ >= 30)) {
#endif
                                ((UTM_BLOCK_PREFIX HUGE*)L4476_puc_)->l_00 = P3986_ul_;
                                M201_PREVIOUS_BLOCK_SIZE(L4476_puc_ + P3986_ul_) = P3986_ul_;
                                L4479_ul_ -= P3986_ul_;
                                L4477_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount += L4479_ul_;
                                F7208_RemoveBlockFromLinkedList(L4476_puc_ + P3986_ul_, L4479_ul_, L4477_ps_);
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                        } else {
                                if (L4479_ul_ < P3986_ul_) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                return;
                        }
                                if (L4479_ul_ >= P3986_ul_) {
                                        return;
                                }
#endif
                                        L4478_ps_ = M783_CAST_UTM_BLOCK_PREFIX(L4476_puc_);
                                        L4484_i_ = 0;
                                        P3986_ul_ -= L4479_ul_;
                                        L4476_puc_ += L4479_ul_;
                                        L4480_ul_ = ((UTM_BLOCK_PREFIX HUGE*)L4476_puc_)->l_00;
                                        if (M007_GET(L4480_ul_, MASK0x80000000_USED_BLOCK)) {
                                                M009_CLEAR(L4480_ul_, MASK0x80000000_USED_BLOCK);
                                                if (L4480_ul_ >= P3986_ul_) {
                                                        F7205_RemoveUDSTRUCT66FromLinkedList(M782_CAST_UDSTRUCT66(L4476_puc_), L4477_ps_);
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                                        if (L4480_ul_ - P3986_ul_ < 34) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                                        if (L4480_ul_ - P3986_ul_ < 30) {
#endif
                                                                P3986_ul_ = L4480_ul_;
                                                        } else {
                                                                F7207_AddUsedBlockToList(L4476_puc_ + P3986_ul_, L4480_ul_ - P3986_ul_, L4477_ps_);
                                                        }
                                                        L4477_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount -= P3986_ul_;
                                                        L4476_puc_ = (unsigned char*)(L4478_ps_);
                                                        L4479_ul_ += P3986_ul_;
                                                        ((UTM_BLOCK_PREFIX HUGE*)L4476_puc_)->l_00 = L4479_ul_;
                                                        M201_PREVIOUS_BLOCK_SIZE(L4476_puc_ + L4479_ul_) = L4479_ul_;
                                                        L4484_i_ = 1;
                                                }
                                        }
                                        L4476_puc_ = (unsigned char HUGE*)L4478_ps_ - 4;
                                        L4480_ul_ = ((UTM_BLOCK_PREFIX HUGE*)L4476_puc_)->l_00;
                                        if (!L4484_i_) {
                                                if (M007_GET(L4480_ul_, MASK0x80000000_USED_BLOCK)) {
                                                        M009_CLEAR(L4480_ul_, MASK0x80000000_USED_BLOCK);
                                                        if (L4480_ul_ >= P3986_ul_) {
                                                                L4476_puc_ -= L4480_ul_ - 4;
                                                                F7205_RemoveUDSTRUCT66FromLinkedList(M782_CAST_UDSTRUCT66(L4476_puc_), L4477_ps_);
                                                                F7210_(L4478_ps_, M783_CAST_UTM_BLOCK_PREFIX(L4476_puc_));
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                                                if (L4480_ul_ - P3986_ul_ < 34) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                                                if (L4480_ul_ - P3986_ul_ < 30) {
#endif
                                                                        P3986_ul_ = L4480_ul_;
                                                                } else {
                                                                        F7207_AddUsedBlockToList(L4476_puc_ + P3986_ul_ + L4479_ul_, L4480_ul_ - P3986_ul_, L4477_ps_);
                                                                }
                                                                L4477_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount -= P3986_ul_;
                                                                L4479_ul_ += P3986_ul_;
                                                                ((UTM_BLOCK_PREFIX HUGE*)L4476_puc_)->l_00 = L4479_ul_;
                                                                M201_PREVIOUS_BLOCK_SIZE(L4476_puc_ + L4479_ul_) = L4479_ul_;
                                                                L4484_i_ = 1;
                                                        }
                                                }
                                        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                        if (!L4484_i_) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                        if (L4484_i_) {
                                                return;
                                        }
#endif
                                                L4483_s_.ul_00_RequestedByteCount = P3986_ul_ + L4479_ul_;
                                                L4483_s_.MemReqFlags = ((UTM_BLOCK_PREFIX HUGE*)L4476_puc_)->c_05;
                                                L4483_s_.umr_i_06_AdditionalBytes_Always0 = 0;
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                        for (;;) {
#endif
                                                L4478_ps_->c_04 = 1;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                                if (((L4482_ps_ = F7219_(&L4483_s_)) != NULL) && ((L4476_puc_ = (unsigned char*)F7220_(L4483_s_.ul_00_RequestedByteCount, L4483_s_.MemReqFlags, L4482_ps_)) != NULL)) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                                if ((L4482_ps_ = F7219_(&L4483_s_)) != NULL) {
                                                        if (L4476_puc_ = (unsigned char*)(F7220_(L4483_s_.ul_00_RequestedByteCount, L4483_s_.MemReqFlags, L4482_ps_))) {
#endif
                                                                F7210_(L4478_ps_, M783_CAST_UTM_BLOCK_PREFIX(L4476_puc_));
                                                                ((UTM_BLOCK_PREFIX HUGE*)L4476_puc_)->c_04 = 0;
                                                                F7222_RemoveBlock((unsigned char*)(L4478_ps_), L4477_ps_);
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                                } else {
                                                        L4478_ps_->c_04 = 0;
                                                        L4485_ = F1769_GetLastErrorCode();
                                                }
                                        }
                                } else {
                                        L4485_ = 0;
                                }
                        }
                }
        }
        return L4485_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                                                return;
                                                        }
                                                }
                                                L4478_ps_->c_04 = 0;
                                                F7112_FallbackToLastProgramState(C0_FALSE, 100, (long)L4483_s_.MemReqFlags);
                                        }
        }
        F7112_FallbackToLastProgramState(C0_FALSE, L4485_, (long)P3985_ppuc_);
#endif
}

#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
long F7235_Unreferenced(register unsigned char* P3987_puc_)
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
void F7235_Unreferenced(REGISTER unsigned char* P3987_puc_)
#endif
{
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        register long L4486_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        int16_t L4486_;
#endif
        REGISTER UTM_BLOCK_PREFIX* L4487_ps_;


        if ((L4486_ = F7233_((unsigned char**)P3987_puc_)) == 0) {
                L4487_ps_ = M783_CAST_UTM_BLOCK_PREFIX(F7203_((unsigned char**)P3987_puc_));
                F7222_RemoveBlock((unsigned char*)L4487_ps_, F7204_GetMemoryAreaContainingAddress((unsigned char*)(L4487_ps_)));
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        }
        if (L4486_ == 0) {
#endif
                M202_BLOCK_SIZE(P3987_puc_) = -1;
        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        return L4486_;
#endif
}

#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
long F7236_Unreferenced(register unsigned char** P3988_ppuc_, register unsigned long P3989_ul_, unsigned int16_t P3990_ui_)
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
void F7236_Unreferenced(REGISTER unsigned char** P3988_ppuc_, REGISTER unsigned long P3989_ul_, unsigned int16_t P3990_ui_)
#endif
{
        REGISTER UTM_BLOCK_PREFIX* L4488_ps_;
        REGISTER MEMORY_REGION* L4489_ps_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        long L4491_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        int16_t L4491_;
#endif
        MEMORY_REQUEST L4490_s_;


#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        if ((L4491_ = F7233_(P3988_ppuc_)) == 0x010D0003) {
                P3989_ul_ += 18;
                if (P3989_ul_ & 1) {
                        P3989_ul_++;
                }
                L4490_s_.ul_00_RequestedByteCount = P3989_ul_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        if ((L4491_ = F7233_(P3988_ppuc_)) == 0x66) {
                L4490_s_.ul_00_RequestedByteCount = P3989_ul_ = F7202_GetEvenMemoryBlockSize(P3989_ul_) + 18;
#endif
                L4490_s_.umr_i_06_AdditionalBytes_Always0 = 0;
                L4490_s_.pfv_08_InitAdditionalBytes_AlwaysNULL = (void (*)())NULL;
                L4490_s_.MemReqFlags = P3990_ui_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                if (((L4489_ps_ = F7219_(&L4490_s_)) != NULL) && ((L4488_ps_ = F7220_(P3989_ul_, P3990_ui_, L4489_ps_)) != NULL)) {
                                        L4491_ = 0;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                for (;;) {
                        if ((L4489_ps_ = F7219_(&L4490_s_)) != NULL) {
                                if ((L4488_ps_ = F7220_(P3989_ul_, P3990_ui_, L4489_ps_)) != NULL) {
#endif
                                        *P3988_ppuc_ = (unsigned char HUGE*)L4488_ps_ + 14;
                                        L4488_ps_->c_05 = P3990_ui_ & 7;
                                        L4488_ps_->i_0A = P3990_ui_;
                                        L4488_ps_->c_04 = 0;
                                        L4488_ps_->ps_06_Next = (UTM_BLOCK_PREFIX*)P3988_ppuc_;
                                        L4488_ps_->i_0C = 0;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                } else {
                                        L4491_ = F1769_GetLastErrorCode();
                                }
        } else {
                if (L4491_ == 0) {
                        L4491_ = 0x010D0009;
                }
        }
        return L4491_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                        return;
                                }
                        }
                        F7112_FallbackToLastProgramState(C0_FALSE, 100, (long)P3990_ui_);
                }
        }
        if (L4491_ == 0) {
                F7112_FallbackToLastProgramState(C0_FALSE, 108, (long)P3988_ppuc_);
        }
#endif
}

long F7237_Unreferenced(unsigned char** P3991_ppuc_)
{
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        long L4492_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        int16_t L4492_;
#endif
        unsigned char HUGE* L4493_puc_;
        long L4494_l_;


        if ((L4492_ = F7233_(P3991_ppuc_)) != 0) {
                L4494_l_ = -1;
        } else {
                L4494_l_ = M202_BLOCK_SIZE(F7203_(P3991_ppuc_));
                L4493_puc_ = *P3991_ppuc_;
                L4494_l_ -= (long)(*((unsigned int16_t*)(L4493_puc_ - 2)) + 18);
        }
        return L4494_l_;
}

unsigned long F7238_Unreferenced(int16_t P3992_i_, unsigned int16_t P3993_ui_)
{
        REGISTER unsigned long L4495_ul_;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        register int16_t L5442_;
#endif
        REGISTER unsigned long L4496_ul_;
        REGISTER MEMORY_REGION* L4497_ps_;


        P3992_i_ &= MASK0x07F8_MEMREQ;
        if (P3993_ui_ & 0x0E) {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                for (L4497_ps_ = G3561_as_MemoryRegions, L5442_ = 0; L5442_ < G7157_MemoryAreaCount; L4497_ps_++, L5442_++) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                for (L4497_ps_ = G7155_pc_FirstMemoryArea; L4497_ps_ != NULL; L4497_ps_ = L4497_ps_->pc_0E_NextMemoryArea) {
#endif
                        if ((L4497_ps_->MR_i_00__MR2_i_04_Flags & P3992_i_) == P3992_i_) {
                                if (P3993_ui_ & 0x0C) {
                                        while (F7213_(L4497_ps_));
                                }
                                if (P3993_ui_ & 0x0A) {
                                        F7214_(L4497_ps_);
                                }
                        }
                }
        }
        L4495_ul_ = 0;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        for (L4497_ps_ = G3561_as_MemoryRegions, L5442_ = 0; L5442_ < G7157_MemoryAreaCount; L4497_ps_++, L5442_++) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        for (L4497_ps_ = G7155_pc_FirstMemoryArea; L4497_ps_ != NULL; L4497_ps_ = L4497_ps_->pc_0E_NextMemoryArea) {
#endif
                if ((L4497_ps_->MR_i_00__MR2_i_04_Flags & P3992_i_) == P3992_i_) {
                        if (P3993_ui_ & 1) {
                                L4496_ul_ = M007_GET(L4497_ps_->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66->l_BlockSize, MASK0x7FFFFFFF_USED_BLOCK);
                                if (L4496_ul_ > L4495_ul_) {
                                        L4495_ul_ = L4496_ul_;
                                }
                        } else {
                                L4495_ul_ += L4497_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount;
                        }
                }
        }
        return L4495_ul_;
}

#if (defined(MEDIA772_SU1E) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)))
#include "CPCLRBYT.C"
#endif

#if ((defined(MEDIA676_F31E_F31J_X31J_P31J_AU1E_AU2E_AU3E) && (EXETYPE == C06_CEDT)) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)))
/* #if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT))) */
/* extern unsigned char HUGE* F7203_(); */
/* #endif */

BOOLEAN F7239_Unreferenced(
unsigned int16_t P3994_ui_MemoryAreaIndex,
int16_t (*P3995_pfi_)())
{
        REGISTER char HUGE* L4498_pc_;
        REGISTER MEMORY_REGION HUGE* L4499_ps_;
        REGISTER char* L4500_pc_Useless;
        REGISTER long L4501_l_;
        REGISTER int16_t L4503_i_Useless;
        REGISTER int16_t L4504_i_;
        BOOLEAN L4502_B_;


        L4502_B_ = (P3994_ui_MemoryAreaIndex < G7157_MemoryAreaCount);
        if (L4502_B_) {
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
                L4499_ps_ = &G3561_as_MemoryRegions[P3994_ui_MemoryAreaIndex];
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                L4499_ps_ = G7155_pc_FirstMemoryArea;
                L4503_i_Useless = P3994_ui_MemoryAreaIndex;
                while (L4503_i_Useless--) {
                        L4499_ps_ = L4499_ps_->pc_0E_NextMemoryArea;
                }
#endif
                L4503_i_Useless = 0;
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
                for (L4498_pc_ = L4499_ps_->ps_00; L4501_l_ = M202_BLOCK_SIZE(L4498_pc_); L4498_pc_ += L4501_l_) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                for (L4498_pc_ = (char HUGE*)L4499_ps_ + sizeof(MEMORY_REGION) + sizeof(long); (L4501_l_ = M202_BLOCK_SIZE(L4498_pc_)) != 0; L4498_pc_ += L4501_l_) {
#endif
                        L4504_i_ = (M007_GET(L4501_l_, MASK0x80000000_USED_BLOCK) > 0);
                        M009_CLEAR(L4501_l_, MASK0x80000000_USED_BLOCK);
                        if (L4504_i_ == 0) {
                                L4500_pc_Useless = L4498_pc_;
                        }
                        if (P3995_pfi_) {
                                if (!P3995_pfi_(L4498_pc_)) {
                                        break;
                                }
                        }
                        L4503_i_Useless++;
                }
        }
        return L4502_B_;
}

BOOLEAN F7240_(
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
UTM_BLOCK_PREFIX* P3996_ps_,
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
UDSTRUCT66* P3996_ps_,
#endif
MEMORY_REGION* P3997_ps_)
{
        REGISTER UDSTRUCT66* L4505_ps_;
        REGISTER unsigned long L4506_ul_;
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
        REGISTER long L5886_;
#endif
        BOOLEAN L4507_i_ = C0_FALSE;


#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
        L5886_ = M007_GET(L4505_ps_->l_BlockSize, MASK0x7FFFFFFF_USED_BLOCK);
        L4506_ul_ = 0;
        L4505_ps_ = P3997_ps_->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66;
        if (!L4505_ps_) {
                goto loc_B128;
        }
        while (L4505_ps_) {
                if (L4506_ul_ && (M007_GET(L4505_ps_->l_BlockSize, MASK0x7FFFFFFF_USED_BLOCK) > L4506_ul_)) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        if ((L4505_ps_ = P3997_ps_->MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66) == NULL) {
                goto loc_B128;
        }
        L4506_ul_ = 0;
        while (L4505_ps_ != NULL) {
                if ((L4506_ul_ != 0) && (M007_GET(L4505_ps_->l_BlockSize, MASK0x7FFFFFFF_USED_BLOCK) > L4506_ul_)) {
#endif
                        goto loc_B128;
                }
                if (L4505_ps_ == P3996_ps_) {
                        L4507_i_ = C1_TRUE;
                        break;
                }
                L4506_ul_ = M007_GET(L4505_ps_->l_BlockSize, MASK0x7FFFFFFF_USED_BLOCK);
                L4505_ps_ = L4505_ps_->ps_08_NextBlock;
        }
        if (L4507_i_);
        loc_B128:
        return L4507_i_;
}

BOOLEAN F7241_Unreferenced(
)
{
        REGISTER unsigned char HUGE* L4508_puc_;
        REGISTER MEMORY_REGION HUGE* L4509_ps_;
        REGISTER UTM_BLOCK_PREFIX* L4510_ps_;
        REGISTER long L4511_l_;
#ifdef MEDIA697_X31J_AU1E_AU2E_AU3E
        register int16_t L4515_i_MemoryAreaIndex;
#endif
#ifdef MEDIA671_F31E_F31J_P31J
        unsigned int16_t L4515_i_MemoryAreaIndex;
#endif
        BOOLEAN L4512_B_;
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
        int16_t L5894_i_Useless;
#endif
        BOOLEAN L4514_B_IsBlockUsed;
        long L4513_l_;
        char L6056_ac_Unreferenced[4];


        L4512_B_ = C0_FALSE;
        L4515_i_MemoryAreaIndex = 0;
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
        L4509_ps_ = G3561_as_MemoryRegions;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        L4509_ps_ = G7155_pc_FirstMemoryArea;
#endif
        while (L4515_i_MemoryAreaIndex < G7157_MemoryAreaCount) {
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
                L4508_puc_ = L4509_ps_->ps_00;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                L4508_puc_ = (unsigned char HUGE*)L4509_ps_ + sizeof(MEMORY_REGION) + sizeof(long);
#endif
                L4513_l_ = 0;
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
                while (L4511_l_ = ((UTM_BLOCK_PREFIX HUGE*)L4508_puc_)->l_00) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                while ((L4511_l_ = ((UTM_BLOCK_PREFIX HUGE*)L4508_puc_)->l_00) != 0) {
#endif
                        L4514_B_IsBlockUsed = (M007_GET(L4511_l_, MASK0x80000000_USED_BLOCK) > 0);
                        M009_CLEAR(L4511_l_, MASK0x80000000_USED_BLOCK);
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
                        if ((L4508_puc_ + L4511_l_) > (((unsigned char HUGE*)(L4509_ps_->ps_00) + L4509_ps_->MR_l_02__MR2_l_06_TotalByteCount) + 4)) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                        if ((L4508_puc_ + L4511_l_) > ((unsigned char HUGE*)L4509_ps_ + L4509_ps_->MR_l_02__MR2_l_06_TotalByteCount + 30)) {
#endif
                                goto loc_1DF8B;
                        }
                        if (L4514_B_IsBlockUsed) {
                                L4513_l_ += L4511_l_;
                                if (!F7240_(M782_CAST_UDSTRUCT66(L4508_puc_), L4509_ps_))
                                        goto loc_1DF8B;
                        } else {
                                if (!(((UTM_BLOCK_PREFIX HUGE*)L4508_puc_)->c_05 & 0x80)) {
                                        L4510_ps_ = ((UTM_BLOCK_PREFIX HUGE*)L4508_puc_)->ps_06_Next;
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
                                        if (L4510_ps_ < G3559_puc_MemoryHeap) {
                                                goto loc_1DF8B;
                                        }
                                        if ((long)L4510_ps_ > 0x1000000) { /* 16 MB */
                                                goto loc_1DF8B;
                                        }
#endif
                                        if (F7203_((unsigned char**)(L4510_ps_)) != L4508_puc_) {
                                                goto loc_1DF8B;
                                        }
                                }
                        }
                        L4508_puc_ += L4511_l_;
                        if (M007_GET(M201_PREVIOUS_BLOCK_SIZE(L4508_puc_), MASK0x7FFFFFFF_USED_BLOCK) != L4511_l_) {
                                goto loc_1DF8B;
                        }
                }
                if (L4513_l_ != L4509_ps_->MR_l_0A__MR2_l_0E_AvailableByteCount) {
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
                        L5894_i_Useless = 1;
#endif
                }
                L4515_i_MemoryAreaIndex++;
#if ((defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
                L4509_ps_++;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                L4509_ps_ = L4509_ps_->pc_0E_NextMemoryArea;
#endif
        }
        L4512_B_ = C1_TRUE;
        loc_1DF8B:
        return L4512_B_;
}
#endif
#endif
