#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA774_SU1E_AU1E_AU2E
#if (defined(MEDIA772_SU1E) && (EXETYPE == C07_HINT))
STRUCT10B* G3706_[23];
int16_t G3621_ai_XYZ_Screen[4] = { 0, 319, 0, 199 };
#endif
#if (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT))
int16_t G3938_i_Unreferenced;
int16_t G3545_i_Counter;
char G3937_ac_Unreferenced[238];
#endif
int16_t (*G3550_)();
long G3551_l_LastErrorCode;
unsigned int16_t G3552_;
STRUCT12B G3553_[24];
#if (defined(MEDIA772_SU1E) && (EXETYPE == C07_HINT))
char G3746_[] = "M"; /* Probably inline string in original code, but required here as fix to global variable order */
char G3747_[] = "%d"; /* Probably inline string in original code, but required here as fix to global variable order */
/* strings, border between two .C source files */
#endif


int16_t F1767_(long P5498_, long P5499_, BOOLEAN P5500_B_) {
        int16_t L5236_;


#ifdef MEDIA772_SU1E
        if (P5499_); /* Useless code */
#endif
        for (L5236_ = G3545_i_Counter - 1; L5236_ >= 0; L5236_--) {
#ifdef MEDIA772_SU1E
                if (L5236_ % 6); /* Useless code */
#endif
#ifdef MEDIA763_AU1E_AU2E
                if ((G3545_i_Counter - L5236_ - 1) % 4); /* Useless code */
#endif
        }
        while (P5500_B_) { /* Infinite loop if P5500_B_ is C1_TRUE */
                L5236_ = 0;
        }
        return 1;
}

void F1768_(
)
{
        int16_t L5237_i_Unreferenced;


        G3550_ = F1767_;
        G3551_l_LastErrorCode = 0;
        G3552_ = 0;
}

long F1769_GetLastErrorCode(
)
{
        return G3551_l_LastErrorCode;
}

long F1770_(BOOLEAN P5501_i_DataIsString, register unsigned long P5502_ul_ErrorCode, long P5503_l_Data) {
        register STRUCT12B* L5238_;
#ifdef MEDIA772_SU1E
        register long L5239_;
#endif
        register int16_t L5240_;
#ifdef MEDIA763_AU1E_AU2E
        register long L5239_;
#endif


        if (!P5502_ul_ErrorCode) {
                G3551_l_LastErrorCode = 0;
                L5239_ = 0;
        } else {
                L5240_ = G3552_;
                L5238_ = &G3553_[L5240_ - 1];
                do {
                        L5239_ = P5502_ul_ErrorCode;
                        while (L5240_) {
                                if ((P5502_ul_ErrorCode <= L5238_->_l_4) && (P5502_ul_ErrorCode >= L5238_->_l_0)) {
                                        L5239_ = (*L5238_->_pfv_8)(P5502_ul_ErrorCode, P5503_l_Data);
                                        L5240_--;
                                        L5238_--;
                                        break;
                                }
                                L5240_--;
                                L5238_--;
                        }
#ifdef MEDIA772_SU1E
                        switch (L5239_) {
                                case 0x0102FFFF:
                                        (*G3550_)(P5502_ul_ErrorCode, P5503_l_Data, C1_TRUE);
                                        break;
                                case 0x0102FFFE:
                                case 0:
                                case 0x0102FFFD:
                                        break;
                                default:
                                        G3551_l_LastErrorCode = L5239_;
                                        if (P5501_i_DataIsString) {
                                                (*G3550_)(L5239_, P5503_l_Data, C1_TRUE);
                                        }
                        }
#endif
#ifdef MEDIA763_AU1E_AU2E
                        if (L5239_ == 0x0102FFFF) {
                                (*G3550_)(P5502_ul_ErrorCode, P5503_l_Data, C1_TRUE);
                        } else {
                                if ((L5239_ == 0x0102FFFE) || (L5239_ == 0) || (L5239_ == 0x0102FFFD)) {
                                        continue;
                                }
                                G3551_l_LastErrorCode = L5239_;
                                if (P5501_i_DataIsString) {
                                        (*G3550_)(L5239_, P5503_l_Data, C1_TRUE);
                                }
                                break;
                        }
#endif
                } while (L5239_ == 0x102FFFD);
        }
        return L5239_;
}

int16_t F1771_(int16_t P5504_, register long P5505_, register long P5506_, register void (*P5507_)()) {
        register STRUCT12B* L5241_;
        register int16_t L5242_;
        register long L5243_;


        L5242_ = 0;
        L5241_ = &G3553_[G3552_];
        if (P5504_) {
                if (G3552_ == 24) {
                        L5243_ = 0x01020002;
                } else {
                        G3552_++;
                        L5241_->_l_0 = P5505_;
                        L5241_->_l_4 = P5506_;
                        L5241_->_pfv_8 = P5507_;
                        L5243_ = 0;
                }
        } else {
                L5243_ = 0x01020001;
                L5242_ = G3552_;
                L5241_--;
                while (L5242_) {
                        if ((P5505_ == L5241_->_l_0) && (P5506_ == L5241_->_l_4) && (P5507_ == L5241_->_pfv_8)) {
                                F7317_MAIN_CopyBytes_Alt(L5241_ + 1, L5241_, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, (long)((G3552_ - L5242_) * 12));
                                G3552_--;
                                L5243_ = 0;
                                break;
                        }
                        L5241_--;
                        L5242_--;
                }
        }
        return L5243_;
}

void (*F1772_(void (*P5508_)()))(
)
{
        register void (*L5244_)();


        L5244_ = G3550_;
        G3550_ = P5508_;
        return L5244_;
}
#endif
