#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA081_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
#ifndef NOCOPYPROTECTION
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
overlay "user"
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
segment "user"
#endif

#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
void F1151_(
)
{
        return;
        asm {
                dc.b "JFLdH"            /* JFL: Initials of the programmer "Joseph F. Linhoff" (Joe Linhoff) */
                dc.b 0x14
                dc.b 0
                dc.b 4
                dc.b 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC, 0xC           /* 20 bytes with value 0x0C */
        }
}

int16_t F0413_CPSC_GetChecksumEor(
void (*P0796_pfv_StartFunction)() SEPARATOR
void (*P2845_pfv_EndFunction)()   FINAL_SEPARATOR
{
        asm {
                        movea.l P0796_pfv_StartFunction(a6),a0
                        movea.l P2845_pfv_EndFunction(a6),a1
                        moveq   #0,d0
                        moveq   #0,d1
                        bra.s   @Tloc_1E6EE
                @Tloc_1E6E8:
                        add.b   (a0)+,d0
                        move.b  (a0)+,d2
                        eor.b   d2,d1
                @Tloc_1E6EE:
                        cmpa.l  a1,a0
                        bcs.s   @Tloc_1E6E8
                        lsl.w   #8,d0
                        or.b    d1,d0
        }
}
#endif

#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t F0413_CPSC_GetChecksumEor(
P0796_pfv_Function)
void (*P0796_pfv_Function)() FINAL_SEPARATOR
{
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        asm {
                        moveq   #10,D1
                        movea.l P0796_pfv_Function(A6),A0
                        move.l  #0x4E5E4E75,D2                  /* These are the bytes for instructions unlk A6 / rts which mark the end of the function */
                        cmpi.w  #0x4EF9,(A0)
                        bne.s   T0413001                        /* 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 */
                T0413001:
                        moveq   #0,D0
                T0413002_Loop:
                        add.w   (A0)+,D1                        /* Add words from start of the function */
                        eor.w   D1,D0
                        cmp.l   (A0),D2
                        bne.s   T0413002_Loop
        }
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        #asm
                        moveq   #10,D1
                        movea.l 8(A5),A0        ; P0796_pfv_Function
                        move.l  #$4E5D4E75,D2
                        cmpi.w  #$4EF9,(A0)
                        bne.s   T0413001
                        movea.l 2(A0),A0
                T0413001:
                        moveq   #0,D0
                T0413002_Loop:
                        add.w   (A0)+,D1
                        eor.w   D1,D0
                        cmp.l   (A0),D2
                        bne.s   T0413002_Loop
        #endasm
#endif
}
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
int16_t F0413_CPSC_GetChecksumEor(
P0796_pfv_Function, P6049_pui_BytesToSkip)
unsigned char*    P0796_pfv_Function    SEPARATOR
unsigned int16_t* P6049_pui_BytesToSkip FINAL_SEPARATOR
{
        unsigned int16_t L6220_;
        unsigned int16_t L6221_ui_Checksum;
        unsigned int16_t L6222_;


        L6220_ = *P6049_pui_BytesToSkip++;
        L6221_ui_Checksum = L6222_ = 0;
        do {
                if (*P6049_pui_BytesToSkip == L6222_) {
                        P6049_pui_BytesToSkip++;
                        L6222_ += *P6049_pui_BytesToSkip++;
                } else {
                        L6221_ui_Checksum += P0796_pfv_Function[L6222_++];
                        L6221_ui_Checksum ^= L6222_;
                }
        } while (L6222_ < L6220_);
        return L6221_ui_Checksum;
}
#endif
#endif
#endif
