#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#if EXETYPE == C03_GAME
int16_t F0090_strlen(
REGISTER char* P2296_pc_String FINAL_SEPARATOR
{
        REGISTER char* L3111_pc_Character = P2296_pc_String;


        while (*P2296_pc_String++ != 0);
        return (int16_t)(P2296_pc_String - L3111_pc_Character) - 1;
}

char* F0086_strcat(
REGISTER char* P2297_pc_StringA SEPARATOR
REGISTER char* P2298_pc_StringB FINAL_SEPARATOR
{
        REGISTER char* L3112_pc_Character = P2297_pc_StringA;


        while (*P2297_pc_StringA++);
        P2297_pc_StringA--;
        while (*P2297_pc_StringA++ = *P2298_pc_StringB++);
        return L3112_pc_Character;
}

int16_t F0087_strcmp(
REGISTER char* P2299_pc_StringA SEPARATOR
REGISTER char* P2300_pc_StringB FINAL_SEPARATOR
{
        while (*P2299_pc_StringA && (*P2299_pc_StringA == *P2300_pc_StringB)) {
                P2299_pc_StringA++;
                P2300_pc_StringB++;
        }
        return *P2299_pc_StringA - *P2300_pc_StringB;
}

char* F0088_strcpy(
REGISTER char* P2301_pc_StringA SEPARATOR
REGISTER char* P2302_pc_StringB FINAL_SEPARATOR
{
        REGISTER char* L3113_pc_Character = P2301_pc_StringA;


        while (*P2301_pc_StringA++ = *P2302_pc_StringB++);
        return L3113_pc_Character;
}

char* F0089_strncpy(
REGISTER char*   P2303_pc_StringA SEPARATOR
REGISTER char*   P2304_pc_StringB SEPARATOR
REGISTER int16_t P2305_i_Count    FINAL_SEPARATOR
{
        REGISTER char* L3114_pc_Character = P2303_pc_StringA;


        while ((P2305_i_Count--) && (*P2303_pc_StringA++ = *P2304_pc_StringB++));
        return L3114_pc_Character;
}

char* F0091_strchr(
REGISTER char* P2306_pc_String   SEPARATOR
REGISTER char  P2307_c_Character FINAL_SEPARATOR
{
        REGISTER char L3115_c_Character;


        while ((L3115_c_Character = *P2306_pc_String) && (L3115_c_Character != P2307_c_Character)) {
                P2306_pc_String++;
        }
        return (L3115_c_Character) ? P2306_pc_String : NULL;
}

#ifdef MEDIA629_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
char* F0816_strstr( /* Returns a pointer to the first occurence of string P2309_pc_StringNeedle in string P2308_pc_StringHaystack */
REGISTER char* P2308_pc_StringHaystack SEPARATOR
char*          P2309_pc_StringNeedle   FINAL_SEPARATOR
{
        REGISTER char* L3116_pc_;
        REGISTER char* L3117_pc_;
        REGISTER char L3118_c_;
        REGISTER char L3119_c_;


        if ((L3119_c_ = *P2309_pc_StringNeedle) != '\0') {
                while ((L3118_c_ = *P2308_pc_StringHaystack) != 0) {
                        if (L3118_c_ == L3119_c_) {
                                L3116_pc_ = P2308_pc_StringHaystack + 1;
                                L3117_pc_ = P2309_pc_StringNeedle + 1;
                                while ((*L3117_pc_ != '\0') && (*L3116_pc_ == *L3117_pc_)) {
                                        L3116_pc_++;
                                        L3117_pc_++;
                                }
                                if (*L3117_pc_ == '\0') {
                                        return P2308_pc_StringHaystack;
                                }
                        }
                        P2308_pc_StringHaystack++;
                }
        }
        return NULL;
}

int16_t F0817_SubstituteFirstCharactersByString( /* Substitutes the first P2311_i_CharacterCount characters in P2310_pc_String by P2312_pc_ReplacementString */
REGISTER char*   P2310_pc_String            SEPARATOR
REGISTER int16_t P2311_i_CharacterCount     SEPARATOR
REGISTER char*   P2312_pc_ReplacementString FINAL_SEPARATOR
{
        REGISTER char* L3120_pc_CopySource;
        char* L3121_pc_CopyDestination;
        REGISTER int16_t L3122_i_RemainingCharacterCount;


        while ((P2311_i_CharacterCount > 0) && (*P2312_pc_ReplacementString != '\0')) {
                *P2310_pc_String++ = *P2312_pc_ReplacementString++;
                P2311_i_CharacterCount--;
        }
        if (*P2312_pc_ReplacementString != '\0') {
                P2311_i_CharacterCount = F0090_strlen(P2312_pc_ReplacementString);
                L3122_i_RemainingCharacterCount = F0090_strlen(P2310_pc_String);
                L3120_pc_CopySource = P2310_pc_String + L3122_i_RemainingCharacterCount;
                L3121_pc_CopyDestination = L3120_pc_CopySource + P2311_i_CharacterCount;
                while (L3122_i_RemainingCharacterCount-- >= 0) {
                        *L3121_pc_CopyDestination-- = *L3120_pc_CopySource--;
                }
                while (*P2312_pc_ReplacementString != '\0') {
                        *P2310_pc_String++ = *P2312_pc_ReplacementString++;
                }
        } else {
                if (P2311_i_CharacterCount > 0) {
                        P2312_pc_ReplacementString = P2310_pc_String + P2311_i_CharacterCount;
                        while ((*P2310_pc_String++ = *P2312_pc_ReplacementString++));
                        P2311_i_CharacterCount = -P2311_i_CharacterCount;
                }
        }
        return P2311_i_CharacterCount;
}
#endif

#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
BOOLEAN F0670_ReplaceCharacterByString(
REGISTER char* P2313_pc_SourceString      SEPARATOR
char*          P2314_pc_ReplacementString SEPARATOR
REGISTER char  P2315_c_Character          SEPARATOR
REGISTER char* P2316_pc_DestinationString FINAL_SEPARATOR
{
        REGISTER char* L1278_pc_TildeCharacter;
        REGISTER unsigned int16_t L1279_ui_TildeCharacterPosition;


        if ((L1278_pc_TildeCharacter = M549_STRCHR(P2313_pc_SourceString, P2315_c_Character)) == NULL) {
                F0088_strcpy(P2316_pc_DestinationString, P2313_pc_SourceString);
        } else {
                F0089_strncpy(P2316_pc_DestinationString, P2313_pc_SourceString, L1279_ui_TildeCharacterPosition = L1278_pc_TildeCharacter - P2313_pc_SourceString);
                P2316_pc_DestinationString[L1279_ui_TildeCharacterPosition] = '\0';
                F0086_strcat(P2316_pc_DestinationString, P2314_pc_ReplacementString);
                F0086_strcat(P2316_pc_DestinationString, L1278_pc_TildeCharacter + 1);
        }
        return (L1278_pc_TildeCharacter != NULL);
}

void F0671_ConvertLongToString(
REGISTER long P2317_l_Value   SEPARATOR
char*         P2318_pc_String FINAL_SEPARATOR
{
        char L3123_ac_String[14];
        REGISTER unsigned int16_t L3124_i_CharacterIndex;
        REGISTER BOOLEAN L3125_B_IsNegative;


        L3124_i_CharacterIndex = 13;
        if ((L3125_B_IsNegative = P2317_l_Value < 0) != 0) {
                P2317_l_Value = -P2317_l_Value;
        }
        L3123_ac_String[L3124_i_CharacterIndex] = 0;
        do {
                L3123_ac_String[--L3124_i_CharacterIndex] = '0' + (P2317_l_Value % 10);
        } while (P2317_l_Value /= 10);
        if (L3125_B_IsNegative) {
                L3123_ac_String[--L3124_i_CharacterIndex] = '-';
        }
        F0088_strcpy(P2318_pc_String, &L3123_ac_String[L3124_i_CharacterIndex]);
}
#endif
#endif
#endif
#ifdef MEDIA642_A31E_F31E_F31J_X31J_P31J_SU1E_AU1E_AU2E_AU3E
#ifdef ANSI_COMPILER
#if EXETYPE != C03_GAME
extern unsigned int16_t F0090_strlen();

#if ((EXETYPE == C04_SWITCH) || (EXETYPE == C07_HINT) || (EXETYPE == C06_CEDT))
char G2295_IntegerToHexDigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
#endif


#ifdef MEDIA678_F31E_F31J_X31J_P31J_SU1E_AU1E_AU2E_AU3E
char* F7093_GetPointerToLastCharacter(
REGISTER char* P3768_pc_)
{
        while (*P3768_pc_) {
                P3768_pc_++;
        }
        return P3768_pc_;
}
#endif

#if ((EXETYPE == C04_SWITCH) || (EXETYPE == C07_HINT) || (EXETYPE == C06_CEDT))
static char* F7094_ConvertLongToString(
REGISTER char* P3769_pc_String,
REGISTER unsigned long P3770_ul_Value,
BOOLEAN P3771_B_PrintAsHexadecimal)
{
#ifdef MEDIA671_F31E_F31J_P31J
        REGISTER unsigned int16_t L4061_ui_;
#endif
        REGISTER char* L4059_pc_;
#ifdef MEDIA670_F31E_F31J
        REGISTER int16_t L4062_i_DigitCount = 0;
#endif
        char L4060_c_LocalString[12];
#ifdef MEDIA696_X31J_P31J_SU1E_AU1E_AU2E_AU3E
        REGISTER int16_t L4062_i_DigitCount = 0;
#endif
#ifdef MEDIA700_X31J_SU1E_AU1E_AU2E_AU3E
        register unsigned int16_t L4061_ui_;
#endif


        L4059_pc_ = L4060_c_LocalString;
        if (P3771_B_PrintAsHexadecimal) {
                L4061_ui_ = 16;
        } else {
                L4061_ui_ = 10;
        }
        do {
                *L4059_pc_++ = G2295_IntegerToHexDigit[P3770_ul_Value % L4061_ui_];
                P3770_ul_Value /= L4061_ui_;
                L4062_i_DigitCount++;
        } while (P3770_ul_Value > 0);
        while (L4062_i_DigitCount--) {
                *P3769_pc_String++ = *--L4059_pc_;
        }
        return P3769_pc_String;
}
#endif

#ifdef MEDIA678_F31E_F31J_X31J_P31J_SU1E_AU1E_AU2E_AU3E
char* F0088_strcpy(
REGISTER char* P2301_pc_StringA,
REGISTER char* P2302_pc_StringB)
{
        REGISTER char* L3113_pc_Character;


        L3113_pc_Character = P2301_pc_StringA;
        while (*P2302_pc_StringB) {
                *P2301_pc_StringA++ = *P2302_pc_StringB++;
        }
        *P2301_pc_StringA = '\0';
        return L3113_pc_Character;
}

#if ((defined(MEDIA772_SU1E) && (EXETYPE == C04_SWITCH)) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (EXETYPE == C06_CEDT) || (EXETYPE == C12_FIO1))
int16_t F0087_strcmp(
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT))) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
REGISTER char* P2299_pc_StringA,
REGISTER char* P2300_pc_StringB)
{
        while (*P2299_pc_StringA) {
                if (*P2299_pc_StringA != *P2300_pc_StringB) {
                        break;
                }
                P2299_pc_StringA++;
                P2300_pc_StringB++;
        }
        if (*P2299_pc_StringA == *P2300_pc_StringB) {
                return 0;
        } else {
                if (*P2299_pc_StringA < *P2300_pc_StringB) {
                        return -1;
                } else {
                        return 1;
                }
        }
#endif
#if ((defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT)) || (EXETYPE == C12_FIO1))
REGISTER unsigned char* P2299_pc_StringA,
REGISTER unsigned char* P2300_pc_StringB)
{
        while (*P2299_pc_StringA == *P2300_pc_StringB) {
                if (*P2299_pc_StringA == '\0') {
                        return 0;
                }
                P2299_pc_StringA++;
                P2300_pc_StringB++;
        }
        return *P2299_pc_StringA - *P2300_pc_StringB;
#endif
}
#endif
#endif

#if (EXETYPE == C09_CNFG)
int16_t F1302_strncmp(
register char* P4392_,
register char* P4393_,
register int16_t P4394_) {
        register int16_t L4795_;


        L4795_ = 0;
        while (P4394_--) {
                if (L4795_ = *P4392_++ - *P4393_++) {
                        break;
                }
        }
        return L4795_;
}
#endif

#if ((defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT)) || (EXETYPE == C12_FIO1))
int16_t F7097_strstr(
REGISTER char* P2308_pc_StringHaystack,
REGISTER char* P2309_pc_StringNeedle)
{ /* Returns the index of the first occurrence of P2308_pc_StringHaystack in P2309_pc_StringNeedle */
        unsigned int16_t L4069_i_;
        unsigned int16_t L4068_ui_;
        unsigned int16_t L4064_ui_String1Length;
        unsigned int16_t L4065_ui_String2Length;
        char L4066_c_CharacterBackup;
        int16_t L4067_i_;


        L4064_ui_String1Length = F0090_strlen(P2308_pc_StringHaystack);
        L4065_ui_String2Length = F0090_strlen(P2309_pc_StringNeedle);
        L4069_i_ = 0;
        L4068_ui_ = L4069_i_ + L4064_ui_String1Length;
        L4067_i_ = 1;
        while (L4068_ui_ <= L4065_ui_String2Length) {
                L4066_c_CharacterBackup = P2309_pc_StringNeedle[L4068_ui_];
                P2309_pc_StringNeedle[L4068_ui_] = '\0';
                L4067_i_ = F0087_strcmp(M774_CAST_PUC(P2308_pc_StringHaystack), M774_CAST_PUC(P2309_pc_StringNeedle + L4069_i_));
                P2309_pc_StringNeedle[L4068_ui_] = L4066_c_CharacterBackup;
                if (L4067_i_ == 0) {
                        break;
                }
                L4069_i_++;
                L4068_ui_++;
        }
        return L4067_i_ ? -1 : L4069_i_;
}

int16_t F7098_SubstituteString(
char* P3776_pc_SourceString,
char* P3777_pc_StringToReplace,
char* P3778_pc_ReplacementString,
char* P3779_pc_OutputString,
unsigned int16_t P3780_ui_OutputStringMaximumLength)
{
        int16_t L4070_i_;
        int16_t L4071_i_;
        unsigned int16_t L4072_ui_;
        unsigned int16_t L4073_ui_;
        unsigned int16_t L4074_ui_;


#ifdef MEDIA671_F31E_F31J_P31J
        P3780_ui_OutputStringMaximumLength--;
        *P3779_pc_OutputString = 0;
#endif
        L4071_i_ = F7097_strstr(P3777_pc_StringToReplace, P3776_pc_SourceString);
        if (L4071_i_ < 0) {
                L4070_i_ = -1;
        } else {
                L4072_ui_ = F0090_strlen(P3777_pc_StringToReplace) + L4071_i_;
                L4073_ui_ = 0;
                while ((L4073_ui_ < L4071_i_) && (L4073_ui_ < P3780_ui_OutputStringMaximumLength)) {
#if ((EXETYPE == C04_SWITCH) || (EXETYPE == C07_HINT) || (EXETYPE == C06_CEDT))
                        P3779_pc_OutputString[L4073_ui_] = P3776_pc_SourceString[L4073_ui_];
                        L4073_ui_++;
#endif
#if (EXETYPE == C12_FIO1)
                        P3779_pc_OutputString[L4073_ui_] = P3776_pc_SourceString[L4073_ui_++];
#endif
#ifdef MEDIA671_F31E_F31J_P31J
                        P3779_pc_OutputString[L4073_ui_] = 0;
#endif
                }
                L4074_ui_ = 0;
                while ((L4074_ui_ < F0090_strlen(P3778_pc_ReplacementString)) && (L4073_ui_ < P3780_ui_OutputStringMaximumLength)) {
                        P3779_pc_OutputString[L4073_ui_++] = P3778_pc_ReplacementString[L4074_ui_++];
#ifdef MEDIA671_F31E_F31J_P31J
                        P3779_pc_OutputString[L4073_ui_] = 0;
#endif
                }
                L4074_ui_ = L4072_ui_;
                while ((L4074_ui_ < F0090_strlen(P3776_pc_SourceString)) && (L4073_ui_ < P3780_ui_OutputStringMaximumLength)) {
                        P3779_pc_OutputString[L4073_ui_++] = P3776_pc_SourceString[L4074_ui_++];
#ifdef MEDIA671_F31E_F31J_P31J
                        P3779_pc_OutputString[L4073_ui_] = 0;
#endif
                }
                if (L4073_ui_ < P3780_ui_OutputStringMaximumLength) {
                        P3779_pc_OutputString[L4073_ui_] = 0;
                } else {
                        P3779_pc_OutputString[0] = 0;
                        L4070_i_ = -2;
                        goto loc_64FE;
                }
                L4070_i_ = 0;
        }
        loc_64FE:
        return L4070_i_;
}
#endif

#ifdef MEDIA678_F31E_F31J_X31J_P31J_SU1E_AU1E_AU2E_AU3E
char* F0086_strcat(
REGISTER char* P2297_pc_StringA,
REGISTER char* P2298_pc_StringB)
{
        REGISTER char* L3112_pc_Character;


        L3112_pc_Character = P2297_pc_StringA;
        P2297_pc_StringA = F7093_GetPointerToLastCharacter(P2297_pc_StringA);
        F0088_strcpy(P2297_pc_StringA, P2298_pc_StringB);
        return L3112_pc_Character;
}
#endif

unsigned int16_t F0090_strlen(
REGISTER char* P2296_pc_String)
{
        REGISTER unsigned int16_t L4076_ui_CharacterCount = 0;


        while (*P2296_pc_String++) {
                L4076_ui_CharacterCount++;
        }
        return L4076_ui_CharacterCount;
}

#if ((EXETYPE == C04_SWITCH) || (EXETYPE == C07_HINT) || (EXETYPE == C06_CEDT))
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
long
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
void
#endif
F7101_sprintf(
REGISTER char* P3784_pc_,
char* P3785_pc_, ...)
{
        va_list L4077_p_NextParameterAddress;
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
        REGISTER char* L4078_p_;
        char* L5225_pc_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        REGISTER unsigned char* L4078_p_;
#endif
        REGISTER char* L4079_pc_;
        REGISTER int16_t L4080_i_IsLong;
        REGISTER int16_t L4084_i_IsSigned;
        REGISTER unsigned long L4081_ul_;
        REGISTER unsigned int16_t L4083_ui_;
        REGISTER unsigned int16_t L4082_ui_PrintAsDecimal;


        L4080_i_IsLong = C0_FALSE;
        L4084_i_IsSigned = C1_TRUE;
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
        L5225_pc_ = P3784_pc_;
        L4078_p_ = P3785_pc_;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        L4078_p_ = M774_CAST_PUC(P3785_pc_);
#endif
        va_start(L4077_p_NextParameterAddress, P3785_pc_);
        while (*L4078_p_) {
                if (*L4078_p_ != '%') {
                        *P3784_pc_++ = *L4078_p_;
                } else {
                        loc_170F0:
                        L4078_p_++;
                        switch (*L4078_p_) {
                                case 'l': /* long */
                                        L4080_i_IsLong = C1_TRUE;
                                        goto loc_170F0;
                                case 'u': /* unsigned */
                                        L4084_i_IsSigned = C0_FALSE;
                                        goto loc_170F0;
                                case 'd': /* int16_t as decimal */
                                case 'x': /* int16_t as hexadecimal */
                                        L4082_ui_PrintAsDecimal = (*L4078_p_ == 'd');
                                        if (L4080_i_IsLong) {
                                                L4081_ul_ = va_arg(L4077_p_NextParameterAddress, unsigned long);
                                                if (L4084_i_IsSigned && L4082_ui_PrintAsDecimal && ((L4081_ul_ & 0x80000000) != 0)) {
                                                        *P3784_pc_++ = '-';
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
                                                        asm {
                                                                neg.l   L4081_ul_
                                                        }
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                                        L4081_ul_ = -L4081_ul_;
#endif
                                                }
                                        } else {
                                                L4083_ui_ = va_arg(L4077_p_NextParameterAddress, unsigned int16_t);
                                                if (L4084_i_IsSigned && L4082_ui_PrintAsDecimal && ((L4083_ui_ & 0x8000) != 0)) {
                                                        *P3784_pc_++ = '-';
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
                                                        asm {
                                                                neg.w   L4083_ui_
                                                        }
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                                        L4083_ui_ = -L4083_ui_;
#endif
                                                }
                                                L4081_ul_ = L4083_ui_;
                                        }
                                        P3784_pc_ = F7094_ConvertLongToString(P3784_pc_, L4081_ul_, !L4082_ui_PrintAsDecimal);
                                        break;
                                case 's': /* string */
                                        L4079_pc_ = va_arg(L4077_p_NextParameterAddress, char*);
                                        while (*L4079_pc_) {
                                                *P3784_pc_++ = *L4079_pc_;
                                                L4079_pc_++;
                                        }
                                        break;
                                default:
                                        *P3784_pc_++ = *L4078_p_;
                        }
                        L4080_i_IsLong = C0_FALSE;
                        L4084_i_IsSigned = C1_TRUE;
                }
                L4078_p_++;
        }
        *P3784_pc_++ = '\0';
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
        return P3784_pc_ - L5225_pc_;
#endif
}
#endif

#if ((defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT)) || (EXETYPE == C12_FIO1))
char F7102_DoesFileNameMatchPattern(
char* P3787_pc_FileName,
char* P3788_pc_FileNamePattern)
{ /* Pattern may contain wildcard character '*' */
        int16_t L4085_i_;
        REGISTER unsigned char* L4086_puc_;
        REGISTER unsigned char* L4087_puc_;
        REGISTER unsigned char L4088_uc_;
        REGISTER unsigned char L4089_uc_;


        L4087_puc_ = M774_CAST_PUC(P3787_pc_FileName);
        L4086_puc_ = M774_CAST_PUC(P3788_pc_FileNamePattern);
        L4089_uc_ = *L4087_puc_++, L4088_uc_ = *L4086_puc_++;
        while (L4088_uc_ && L4089_uc_) {
                if (L4088_uc_ != L4089_uc_) {
                        T7102001: /* ANOMALY_FMT Label required to disable optimization */
                        if (L4088_uc_ != '*') {
                                break;
                        }
                        L4088_uc_ = *L4086_puc_++;
                        while ((L4088_uc_ != L4089_uc_) && L4089_uc_) {
                                L4089_uc_ = *L4087_puc_++;
                        }
                        if (!L4089_uc_) {
                                break;
                        }
                }
                L4089_uc_ = *L4087_puc_++;
                L4088_uc_ = *L4086_puc_++;
        }
        if (L4088_uc_ == L4089_uc_) {
                L4085_i_ = 1;
        } else {
                L4085_i_ = 0;
        }
        if (L4085_i_ < 0) {
                L4085_i_ = 0;
        }
        return L4085_i_;
}
#endif
#endif
#endif
#endif
#ifdef MEDIA692_X31J
#ifndef ANSI_COMPILER
static char G2295_IntegerToHexDigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; /* Probably static inside function */

static char* F0934_ConvertValueToHexDigits(P1033_pc_String, P1034_ul_Value)
register char* P1033_pc_String;
register unsigned long P1034_ul_Value;
{
        register char* L1830_pc_;
        register int16_t L1831_i_DigitCount;
        register int16_t L1832_i_Unreferenced;
        char L1833_ac_LocalString[12];


        L1831_i_DigitCount = 0;
        L1830_pc_ = L1833_ac_LocalString;
        do {
                *L1830_pc_++ = G2295_IntegerToHexDigit[P1034_ul_Value % 16];
                P1034_ul_Value >>= 4;
                L1831_i_DigitCount++;
        } while (P1034_ul_Value > 0);
        while (L1831_i_DigitCount--) {
                *P1033_pc_String++ = *(--L1830_pc_);
        }
        return P1033_pc_String;
}

void F0933_GetHexStringFromValue(P1032_pc_String, P1031_ul_)
char* P1032_pc_String;
unsigned long P1031_ul_;
{
        char* L1829_pc_;


        L1829_pc_ = F0934_ConvertValueToHexDigits(P1032_pc_String, P1031_ul_);
        *L1829_pc_++ = '\n';
        *L1829_pc_ = 0;
}

static char* F7094_ConvertLongToString(
P3769_pc_String, P3770_ul_Value, P3771_B_PrintAsHexadecimal)
REGISTER char* P3769_pc_String;
REGISTER unsigned long P3770_ul_Value;
BOOLEAN P3771_B_PrintAsHexadecimal;
{
        REGISTER char* L4059_pc_;
        char L4060_c_LocalString[12];
        REGISTER int16_t L4062_i_DigitCount = 0;
        register unsigned int16_t L4061_ui_;


        L4059_pc_ = L4060_c_LocalString;
        if (P3771_B_PrintAsHexadecimal) {
                L4061_ui_ = 16;
        } else {
                L4061_ui_ = 10;
        }
        do {
                *L4059_pc_++ = G2295_IntegerToHexDigit[P3770_ul_Value % L4061_ui_];
                P3770_ul_Value /= L4061_ui_;
                L4062_i_DigitCount++;
        } while (P3770_ul_Value > 0);
        while (L4062_i_DigitCount--) {
                *P3769_pc_String++ = *--L4059_pc_;
        }
        return P3769_pc_String;
}

int16_t F7101_sprintf(P3784_pc_, P3785_pc_) /* XC does not support variadic functions */
register char* P3784_pc_;
char* P3785_pc_;
{
        char* L4077_p_NextParameterAddress;
        char* L5225_pc_;
        register char* L4078_p_;
        register char* L4079_pc_;
        register long L4080_i_IsLong;
        register long L4084_i_IsSigned;
        register long L4081_ul_;
        register int16_t L4083_ui_;
        register BOOLEAN L4082_ui_PrintAsDecimal;


        L5225_pc_ = P3784_pc_;
        L4078_p_ = P3785_pc_;
        L4077_p_NextParameterAddress = ((char *)(&P3785_pc_) + sizeof(char *));
        while (*L4078_p_) {
                L4080_i_IsLong = C0_FALSE;
                L4084_i_IsSigned = C1_TRUE;
                if (*L4078_p_ != '%') {
                        *P3784_pc_++ = *L4078_p_;
                } else {
                        loc_170F0:
                        L4078_p_++;
                        switch (*L4078_p_) {
                                case 'l': /* long */
                                        L4080_i_IsLong = C1_TRUE;
                                        goto loc_170F0;
                                case 'u': /* unsigned */
                                        L4084_i_IsSigned = C0_FALSE;
                                        goto loc_170F0;
                                case 'd': /* int16_t as decimal */
                                case 'x': /* int16_t as hexadecimal */
                                        L4082_ui_PrintAsDecimal = (*L4078_p_ == 'd');
                                        if (L4080_i_IsLong) {
                                                L4081_ul_ = *((unsigned long*)L4077_p_NextParameterAddress);
                                                L4077_p_NextParameterAddress += sizeof(unsigned long);
                                                if (L4084_i_IsSigned && L4082_ui_PrintAsDecimal && (L4081_ul_ < 0)) {
                                                        *P3784_pc_++ = '-';
                                                        L4081_ul_ = -L4081_ul_;
                                                }
                                        } else {
                                                L4083_ui_ = *((unsigned int16_t*)L4077_p_NextParameterAddress);
                                                L4077_p_NextParameterAddress += sizeof(unsigned int16_t);
                                                if (L4084_i_IsSigned && L4082_ui_PrintAsDecimal && (L4083_ui_ < 0)) {
                                                        *P3784_pc_++ = '-';
                                                        L4083_ui_ = -L4083_ui_;
                                                }
                                                L4081_ul_ = L4083_ui_;
                                        }
                                        P3784_pc_ = F7094_ConvertLongToString(P3784_pc_, L4081_ul_, !L4082_ui_PrintAsDecimal);
                                        break;
                                case 's': /* string */
                                        L4079_pc_ = *((char**)L4077_p_NextParameterAddress);
                                        L4077_p_NextParameterAddress += sizeof(char*);
                                        while (*L4079_pc_) {
                                                *P3784_pc_ = *L4079_pc_;
                                                P3784_pc_++;
                                                L4079_pc_++;
                                        }
                                        break;
                                default:
                                        *P3784_pc_++ = *L4078_p_;
                                        break;
                        }
                }
                L4078_p_++;
        }
        *P3784_pc_++ = '\0';
        return P3784_pc_ - L5225_pc_;
}
#endif
#endif
