#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA067_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_P20JB_A31E_A31M_A33M_A35E_A35M_X31J
#ifndef NOCOPYPROTECTION

#ifdef MEDIA458_P20JA_P20JB
BOOLEAN F0210_CPSE_ProcessEvent22_IsFuzzySectorValid_NormalBytes(
REGISTER unsigned char* P0431_puc_SectorBuffer FINAL_SEPARATOR
{
        int16_t L2324_i_;


        L2324_i_ = 0;
        if (L2324_i_ != L2324_i_) { /* Never executed */
                return L2324_i_;
        } else {
                G0240_i_Graphic559_State_CPSD += 4; /* This variable has no effect on PC-9801 */
                return 4;
        }
}
#endif
#ifdef MEDIA607_X30J_X31J
BOOLEAN F0210_CPSE_ProcessEvent22_IsFuzzySectorValid_NormalBytes(
REGISTER unsigned char* P0431_puc_SectorBuffer FINAL_SEPARATOR
{
        G0240_i_Graphic559_State_CPSD += 4; /* This variable has no effect on X68000 */
        return 4;
}
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
segment "dunman"

BOOLEAN F0210_CPSE_ProcessEvent22_IsFuzzySectorValid_NormalBytes(
P0431_puc_SectorBuffer)
REGISTER unsigned char* P0431_puc_SectorBuffer FINAL_SEPARATOR
{
        unsigned int16_t L6208_ui_ByteIndex;


        if ((P0431_puc_SectorBuffer[0] != 0xd5) ||
            (P0431_puc_SectorBuffer[1] != 0xaa) ||
            (P0431_puc_SectorBuffer[2] != 0xad) ||
            (P0431_puc_SectorBuffer[9] != 0xff) ||
            (P0431_puc_SectorBuffer[10] != 0xff) ||
            (P0431_puc_SectorBuffer[11] != 0xff) ||
            (P0431_puc_SectorBuffer[12] != 0xff) ||
            (P0431_puc_SectorBuffer[703] != 0xff) ||
            (P0431_puc_SectorBuffer[704] != 0xff) ||
            (P0431_puc_SectorBuffer[705] != 0xff) ||
            (P0431_puc_SectorBuffer[706] != 0xff) ||
            (P0431_puc_SectorBuffer[707] != 0xde) ||
            (P0431_puc_SectorBuffer[708] != 0xaa)) {
                return C0_FALSE;
        }
        for (L6208_ui_ByteIndex = 13; L6208_ui_ByteIndex < 703; L6208_ui_ByteIndex++) {
                if (L6208_ui_ByteIndex & 1) { /* Odd bytes contain fuzzy bits */
                        if ((P0431_puc_SectorBuffer[L6208_ui_ByteIndex] != 0xa9) &&
                            (P0431_puc_SectorBuffer[L6208_ui_ByteIndex] != 0xaa) &&
                            (P0431_puc_SectorBuffer[L6208_ui_ByteIndex] != 0xb2)) {
                                /* a9      1010 1001
                                   aa      1010 1010
                                   b2      1011 0010

                                   1b      0001 1011 (mask to get fuzzy bits on 4 possible bit positions) */
                                return C0_FALSE;
                        }
                } else { /* Even bytes contain 0xef */
                        if (P0431_puc_SectorBuffer[L6208_ui_ByteIndex] != 0xef) {
                                return C0_FALSE;
                        }
                }
        }
        G0240_i_Graphic559_State_CPSD += 4; /* This variable has no effect on Apple IIGS */
        return 4;
}
#endif
#ifdef MEDIA153_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
overlay "dunman"

BOOLEAN F0210_CPSE_ProcessEvent22_IsFuzzySectorValid_NormalBytes(
P0431_puc_SectorBuffer)
REGISTER unsigned char* P0431_puc_SectorBuffer FINAL_SEPARATOR
{
        if ((*P0431_puc_SectorBuffer++ != 0x07) ||
            (*P0431_puc_SectorBuffer++ != 'P') ||
            (*P0431_puc_SectorBuffer++ != 'A') ||
            (*P0431_puc_SectorBuffer++ != 'C') ||
            (*P0431_puc_SectorBuffer++ != 'E') ||
            (*P0431_puc_SectorBuffer++ != '/') ||
            (*P0431_puc_SectorBuffer++ != 'F') ||
            (*P0431_puc_SectorBuffer != 'B') ||
            (P0431_puc_SectorBuffer[503] != 'F') ||
            (P0431_puc_SectorBuffer[504] != 'B')) {
#endif
#ifdef MEDIA423_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
BOOLEAN F0210_CPSE_ProcessEvent22_IsFuzzySectorValid_NormalBytes(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0431_pui_SectorBuffer)
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
REGISTER unsigned int16_t* P0431_pui_SectorBuffer FINAL_SEPARATOR
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
unsigned int16_t* P0431_pui_SectorBuffer FINAL_SEPARATOR
#endif
{
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
        register unsigned int16_t* L2325_pui_SectorBuffer;
#endif
        REGISTER unsigned int16_t* L1636_pui_SectorBuffer;


#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
        L2325_pui_SectorBuffer = P0431_pui_SectorBuffer;
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        L1636_pui_SectorBuffer = P0431_pui_SectorBuffer; /* Buffer contains an MFM encoded reading of the copy protection sector with both data and clock bits. Size = 1024 bytes */
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
        L1636_pui_SectorBuffer = P0431_pui_SectorBuffer + 615; /* Buffer contains an MFM encoded reading of the copy protection sector with both data and clock bits. */
#endif
        if ((M007_GET(*L1636_pui_SectorBuffer++, MASK0x5555_MFM_DATA_BITS) != 0x0015) || /* 0x07 */
            (M007_GET(*L1636_pui_SectorBuffer++, MASK0x5555_MFM_DATA_BITS) != 0x1100) || /* 'P' */
            (M007_GET(*L1636_pui_SectorBuffer++, MASK0x5555_MFM_DATA_BITS) != 0x1001) || /* 'A' */
            (M007_GET(*L1636_pui_SectorBuffer++, MASK0x5555_MFM_DATA_BITS) != 0x1005) || /* 'C' */
            (M007_GET(*L1636_pui_SectorBuffer++, MASK0x5555_MFM_DATA_BITS) != 0x1011) || /* 'E' */
            (M007_GET(*L1636_pui_SectorBuffer++, MASK0x5555_MFM_DATA_BITS) != 0x0455) || /* '/' */
            (M007_GET(*L1636_pui_SectorBuffer++, MASK0x5555_MFM_DATA_BITS) != 0x1014) || /* 'F' */
            (M007_GET(*L1636_pui_SectorBuffer++, MASK0x5555_MFM_DATA_BITS) != 0x1004)) { /* 'B' */
                return C0_FALSE;
        }
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        if ((M007_GET(P0431_pui_SectorBuffer[510], MASK0x5555_MFM_DATA_BITS) != 0x1014) || /* 'F' */
            (M007_GET(P0431_pui_SectorBuffer[511], MASK0x5555_MFM_DATA_BITS) != 0x1004)) { /* 'B' */
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
        if ((M007_GET(L2325_pui_SectorBuffer[1125], MASK0x5555_MFM_DATA_BITS) != 0x1014) || /* 'F' */
            (M007_GET(L2325_pui_SectorBuffer[1126], MASK0x5555_MFM_DATA_BITS) != 0x1004)) { /* 'B' */
#endif
#endif
                return C0_FALSE;
        }
        G0240_i_Graphic559_State_CPSD += 4; /* The effect of this variable is based on whether the value is odd or even. Adding 4 has no actual effect: an odd value remains odd, an even value remains even */
        return 4;
}

void (*F0211_CPSDF_GetSubroutineAbsoluteAddress(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0432_pfv_Function))()
void (*P0432_pfv_Function)();
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
void (*P0432_pfv_Function)()))()
#endif
{
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        asm {
                        movea.l P0432_pfv_Function(A6),A0
                        cmpi.w  #0x4EF9,(A0)
                        bne.s   T0211001                        /* If A0 is not the address of a jmp instruction ($4EF9) from the jumptable */
                        movea.l 2(A0),A0                        /* Replace A0 by the target address of the jmp */
                T0211001:
                        move.l  A0,D0
        }
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        AztecCDirective_asm
                        movea.l 8(A5),A0        ; P0432_pfv_Function
                        cmpi.w  #$4EF9,(A0)
                        bne.s   T0211001
                        movea.l 2(A0),A0
                T0211001:
                        move.l  A0,D0
        AztecCDirective_endasm
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
        asm {
                        movea.l 8(A6),A0        /* P0432_pfv_Function */
                        cmpi.w  #0x4EF9,(A0)
                        bne.s   @T0211001
                        movea.l 2(A0),A0
                @T0211001:
                        move.l  A0,D0
        }
#endif
}
#endif
#endif
#endif
