#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA042_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
long G3086_al_BlankData[13];
#endif

void F0008_MAIN_ClearBytes(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0008_pc_Buffer, P0009_i_ByteCount)
#endif
char HUGE*    P0008_pc_Buffer   SEPARATOR
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t       P0009_i_ByteCount FINAL_SEPARATOR
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned long P0009_i_ByteCount FINAL_SEPARATOR
#endif
/*#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
long P0009_i_ByteCount FINAL_SEPARATOR
*//*#endif
/*#ifdef MEDIA548_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J
int16_t P0009_i_ByteCount FINAL_SEPARATOR
*//*#endif*/
{
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        asm {
                        movem.l D4-D7/A2-A6,-(A7)
                        move.w P0009_i_ByteCount(A6),D0
                        movea.l P0008_pc_Buffer(A6),A0
                        adda.w D0,A0                                    /* Address of the last byte to clear (start clearing from the end) */
                        subi.w #52,D0                                   /* 52 bytes is the total size of all 13 registers used in the operation */
                        bmi.s T0008002                                  /* Branch if there are less than 52 bytes left to clear */
                        movem.l G0345_aui_BlankBuffer(A4),D1-D7/A1-A6   /* Initialize all registers to 0 except A0 and D0 (the function parameters) and A7 (stack pointer) */
                T0008001:
                        movem.l D1-D7/A1-A6,-(A0)                       /* Decrement A0 and save all registers at A0, effectively clearing 52 bytes of data at A0 in one instruction */
                        subi.w #52,D0                                   /* The number of bytes left to clear */
                        bpl.s T0008001
                T0008002:
                        addi.w #52,D0                                   /* The number of bytes left to clear (now less than 52) */
                        bra.s T0008004
                T0008003:
                        clr.b -(A0)                                     /* Decrement address in A0 and clear byte at A0 */
                T0008004:
                        dbf D0,T0008003
                        movem.l (A7)+,D4-D7/A2-A6
        }
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        asm {
                        LDX        P0009_i_ByteCount
                        LDA        #0x00
                L020242:
                        SEP        #0x20
                        STA        [P0008_pc_Buffer]
                        REP        #0x20
                        INC        P0008_pc_Buffer
                        BNE        L02024E
                        INC        P0008_pc_Buffer+2
                L02024E:
                        DEX
                        BNE        L020242
        }
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        AztecCDirective_asm
                        movem.l D4-D7/A2-A6,-(A7)
                        move.w 12(A5),D0                ; P0009_i_ByteCount
                        movea.l 8(A5),A0                ; P0008_pc_Buffer
                        adda.w D0,A0
                        subi.w #52,D0
                        bmi.s T0008002
                        movem.l _G0345_aui_BlankBuffer,D1-D7/A1-A6
                T0008001:
                        movem.l D1-D7/A1-A6,-(A0)
                        subi.w #52,D0
                        bpl.s T0008001
                T0008002:
                        addi.w #52,D0
                        bra.s T0008004
                T0008003:
                        clr.b -(A0)
                T0008004:
                        dbf D0,T0008003
                        movem.l (A7)+,D4-D7/A2-A6
        AztecCDirective_endasm
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        asm     cld
        asm     les     di, P0008_pc_Buffer
        asm     mov     cx, P0009_i_ByteCount
        asm     shr     cx, 1
        asm     pushf
        asm     mov     ax, 0
        asm     rep stosw
        asm     popf
        asm     jnb     loc_16BEF
        asm     stosb
        loc_16BEF: ;
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        _fill_char(P0008_pc_Buffer, P0009_i_ByteCount, 0); /* Intrinsic High C compiler function call: generates inline machine code */
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        asm {
                        movem.l d0-d7/a0-a6,-(sp)
                        move.l  P0009_i_ByteCount(a6),d0
                        beq.s   @Tloc_1DD8E
                        move.l  P0008_pc_Buffer(a6),d1
                        add.l   d0,d1
                        movea.l d1,a0
                        andi.b  #1,d1
                        beq.s   @Tloc_1DD68
                        clr.b   -(a0)
                        subq.l  #1,d0
                @Tloc_1DD68:
                        subi.l  #0x34,d0
                        bmi.s   @Tloc_1DD82
                        movem.l G3086_al_BlankData(a5),d1-d7/a1-a6
                @Tloc_1DD76:
                        movem.l d1-d7/a1-a6,-(a0)
                        subi.l  #0x34,d0
                        bpl.s   @Tloc_1DD76
                @Tloc_1DD82:
                        addi.w  #0x34,d0
                        bra.s   @Tloc_1DD8A
                @Tloc_1DD88:
                        clr.b   -(a0)
                @Tloc_1DD8A:
                        dbf     d0,@Tloc_1DD88
                @Tloc_1DD8E:
                        movem.l (sp)+,d0-d7/a0-a6
        }
#endif
}
#endif
