#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
void F0007_MAIN_CopyBytes(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0005_pc_Source, P0006_pc_Destination, P0007_i_ByteCount)
#endif
char*   P0005_pc_Source      SEPARATOR
char*   P0006_pc_Destination SEPARATOR
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t P0007_i_ByteCount    FINAL_SEPARATOR
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
long    P0007_l_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  P0007_i_ByteCount(A6),D7
                        movea.l P0005_pc_Source(A6),A3
                        movea.l P0006_pc_Destination(A6),A2
                        move.l  A3,D0
                        move.l  A2,D1
                        andi.w  #0x0001,D0
                        beq.s   T0007001                        /* Branch if P0005_pc_Source is even */
                        andi.w  #0x0001,D1
                        bne.s   T0007004                        /* Branch if P0006_pc_Destination is even */
                        bra.s   T0007003_LoopExpression
                T0007001:
                        andi.w  #0x0001,D1
                        beq.s   T0007005                        /* Branch if P0006_pc_Destination is even */
                        bra.s   T0007003_LoopExpression
                T0007002_Loop:
                        move.b  (A3)+,(A2)+                     /* Copy one byte from source to destination and increment A2 and A3 */
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                T0007003_LoopExpression:
                        subq.w  #8,D7                           /* There are 8 bytes less to copy */
                        bpl.s   T0007002_Loop                   /* Branch if D7 >= 0 */
                        addq.w  #8,D7                           /* Restore D7 to its previous value (there are less than 8 bytes left to copy) */
                        bra.s   T0007013
                T0007004:
                        subq.w  #1,D7
                        bmi.s   T0007014_Return
                        move.b  (A3)+,(A2)+                     /* Copy one byte from source to destination and increment A2 and A3 */
                T0007005:
                        cmpa.l  A2,A3
                        bpl.s   T0007011_LoopExpression
                        adda.w  D7,A3                           /* Bytes will be read from the end */
                        adda.w  D7,A2                           /* Bytes will be written from the end */
                        moveq   #1,D6
                        and.w   D7,D6
                        beq.s   T0007007_LoopExpression
                        subq.w  #1,D7
                        bmi.s   T0007014_Return
                        move.b  -(A3),-(A2)                     /* Copy one byte from source to destination and decrement A2 and A3 */
                        bra.s   T0007007_LoopExpression
                T0007006_Loop:
                        lea     -48(A3),A3                      /* A3 = A3 - 48 */
                        movem.l (A3),D0-D6/A0-A1/A4-A6          /* Copy 48 bytes from source to 12 registers */
                        movem.l D0-D6/A0-A1/A4-A6,-(A2)         /* Copy 48 bytes from 12 registers to destination and decrement A2 */
                T0007007_LoopExpression:
                        subi.w  #48,D7                          /* There are 48 byte less to copy */
                        bpl.s   T0007006_Loop                   /* Branch if D7 >= 0 */
                        addi.w  #48,D7                          /* Restore D7 to its previous value (there are less than 48 bytes left to copy) */
                        bra.s   T0007009
                T0007008:
                        move.b  -(A3),-(A2)                     /* Copy one byte from source to destination and decrement A2 and A3 */
                T0007009:
                        dbf     D7,T0007008                     /* Decrement D7 and branch if D7 >= 0 */
                        bra.s   T0007014_Return
                T0007010_Loop:
                        movem.l (A3)+,D0-D6/A0-A1/A4-A6         /* Copy 48 bytes from source to 12 registers */
                        movem.l D0-D6/A0-A1/A4-A6,(A2)          /* Copy 48 bytes from 12 registers to destination */
                        lea     48(A2),A2                       /* A2 = A2 + 48 */
                T0007011_LoopExpression:
                        subi.w  #48,D7                          /* There are 48 byte less to copy */
                        bpl.s   T0007010_Loop                   /* Branch if D7 >= 0 */
                        addi.w  #48,D7                          /* Restore D7 to its previous value (there are less than 48 bytes left to copy) */
                        bra.s   T0007013
                T0007012:
                        move.b  (A3)+,(A2)+                     /* Copy one byte from source to destination and increment A2 and A3 */
                T0007013:
                        dbf     D7,T0007012                     /* Decrement D7 and branch if D7 >= 0 */
                T0007014_Return:
                        movem.l (A7)+,D4-D7/A2-A6
        }
#endif
#ifdef MEDIA349_G14ED
        if (P0007_i_ByteCount == 0) {
                return;
        }
        asm {
                        LDA     P0007_i_ByteCount
                        BPL     L0202C2
                        BRL     L020353
                L0202C2:
                        CLC
                        LDA     P0005_pc_Source
                        ADC     P0007_i_ByteCount
                        BCS     L020353
                        CLC
                        LDA     P0006_pc_Destination
                        ADC     P0007_i_ByteCount
                        BCS     L020353
                        LDA     P0007_i_ByteCount
                        DEC     A
                        STA     >L0C00BB
                        LDA     P0005_pc_Source
                        STA     >L0C00B3
                        LDA     P0005_pc_Source+2
                        STA     >L0C00B5
                        LDA     P0006_pc_Destination
                        STA     >L0C00B7
                        LDA     P0006_pc_Destination+2
                        STA     >L0C00B9
                        CMP     P0005_pc_Source+2
                        BCC     L010360
                        BEQ     L010352
                        BCS     L01035A
                L010352:
                        LDA     P0006_pc_Destination
                        CMP     P0005_pc_Source
                        BCC     L010360
                        BEQ     L020373
                L01035A:
                        JSL     >F0007_sub1_
                        BRA     L020373
                L010360:
                        JSL     >F0007_sub2_
                        BRA     L020373
                L020353:
                        LDA        P0005_pc_Source+2
                        PHA
                        LDA        P0005_pc_Source
                        PHA
                        LDA        P0006_pc_Destination+2
                        PHA
                        LDA        P0006_pc_Destination
                        PHA
                        LDA        #0x00
                        PHA
                        LDA        P0007_i_ByteCount
                        PHA
                        LDX        #0x2b02         /* BlockMove */
                        JSL        0xe10000
                        BCC        L020373
                        STA        >_toolErr
                L020373:
        }
#endif
#ifdef MEDIA388_G20E_G21E
        void (*L6205_)();


        asm {
                        LDA        P0007_i_ByteCount
                        BNE        L0202BD
                        BRL        L020373
                L0202BD:
                        BPL        L0202C2
                        BRL        L020353
                L0202C2:
                        CLC
                        LDA        P0005_pc_Source
                        ADC        P0007_i_ByteCount
                        BCC        L0202CC
                        BRL        L020353
                L0202CC:
                        CLC
                        LDA        P0006_pc_Destination
                        ADC        P0007_i_ByteCount
                        BCC        L0202D6
                        BRL        L020353
                L0202D6:
                        DEC        P0007_i_ByteCount
                        LDA        P0006_pc_Destination+2
                        CMP        P0005_pc_Source+2
                        BCC        L02032A
                        BEQ        L0202E2
                        BCS        L0202ED
                L0202E2:
                        LDA        P0006_pc_Destination
                        CMP        P0005_pc_Source
                        BCC        L02032A
                        BNE        L0202ED
                        BRL        L020373
                L0202ED:
                        LDA        #F2145_sub_F0007_1
                        STA        L6205_
                        LDA        #^F2145_sub_F0007_1
                        STA        L6205_+2
                        CLC
                        LDA        P0005_pc_Source
                        ADC        P0007_i_ByteCount
                        STA        P0005_pc_Source
                        BCC        L020302
                        INC        P0005_pc_Source+2
                L020302:
                        CLC
                        LDA        P0006_pc_Destination
                        ADC        P0007_i_ByteCount
                        STA        P0006_pc_Destination
                        BCC        L02030D
                        INC        P0006_pc_Destination+2
                L02030D:
                        SEP        #0x30
                        LDY        #0x02
                        LDA        P0005_pc_Source+2
                        STA        [L6205_],Y
                        DEY
                        LDA        P0006_pc_Destination+2
                        STA        [L6205_],Y
                        REP        #0x30
                        LDX        P0005_pc_Source
                        LDY        P0006_pc_Destination
                        LDA        P0007_i_ByteCount
                        PHB
                        JSL        >F2145_sub_F0007_1
                        PLB
                        BRA        L020373
                L02032A:
                        REP        #0x30
                        LDA        #F2146_sub_F0007_2
                        STA        L6205_
                        LDA        #^F2146_sub_F0007_2
                        STA        L6205_+2
                        SEP        #0x30
                        LDY        #0x02
                        LDA        P0005_pc_Source+2
                        STA        [L6205_],Y
                        DEY
                        LDA        P0006_pc_Destination+2
                        STA        [L6205_],Y
                        REP        #0x30
                        LDX        P0005_pc_Source
                        LDY        P0006_pc_Destination
                        LDA        P0007_i_ByteCount
                        PHB
                        JSL        >F2146_sub_F0007_2
                        PLB
                        BRA        L020373
                L020353:
                        LDA        P0005_pc_Source+2
                        PHA
                        LDA        P0005_pc_Source
                        PHA
                        LDA        P0006_pc_Destination+2
                        PHA
                        LDA        P0006_pc_Destination
                        PHA
                        LDA        #0x00
                        PHA
                        LDA        P0007_i_ByteCount
                        PHA
                        LDX        #0x2b02         /* BlockMove */
                        JSL        0xe10000
                        BCC        L020373
                        STA        >_toolErr
                L020373:
        }
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        AztecCDirective_asm
                        movem.l D4-D7/A2-A6,-(A7)
                        move.w  16(A5),D7               ; P0007_i_ByteCount
                        movea.l 8(A5),A3                ; P0005_pc_Source
                        movea.l 12(A5),A2               ; P0006_pc_Destination
                        move.l  A3,D0
                        move.l  A2,D1
                        andi.w  #$0001,D0
                        beq.s   T0007001
                        andi.w  #$0001,D1
                        bne.s   T0007004
                        bra.s   T0007003_LoopExpression
                T0007001:
                        andi.w  #$0001,D1
                        beq.s   T0007005
                        bra.s   T0007003_LoopExpression
                T0007002_Loop:
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                        move.b  (A3)+,(A2)+
                T0007003_LoopExpression:
                        subq.w  #8,D7
                        bpl.s   T0007002_Loop
                        addq.w  #8,D7
                        bra.s   T0007013
                T0007004:
                        subq.w  #1,D7
                        bmi.s   T0007014_Return
                        move.b  (A3)+,(A2)+
                T0007005:
                        cmpa.l  A2,A3
                        bpl.s   T0007011_LoopExpression
                        adda.w  D7,A3
                        adda.w  D7,A2
                        moveq   #1,D6
                        and.w   D7,D6
                        beq.s   T0007007_LoopExpression
                        subq.w  #1,D7
                        bmi.s   T0007014_Return
                        move.b  -(A3),-(A2)
                        bra.s   T0007007_LoopExpression
                T0007006_Loop:
                        lea     -48(A3),A3
                        movem.l (A3),D0-D6/A0-A1/A4-A6
                        movem.l D0-D6/A0-A1/A4-A6,-(A2)
                T0007007_LoopExpression:
                        subi.w  #48,D7
                        bpl.s   T0007006_Loop
                        addi.w  #48,D7
                        bra.s   T0007009
                T0007008:
                        move.b  -(A3),-(A2)
                T0007009:
                        dbf     D7,T0007008
                        bra.s   T0007014_Return
                T0007010_Loop:
                        movem.l (A3)+,D0-D6/A0-A1/A4-A6
                        movem.l D0-D6/A0-A1/A4-A6,(A2)
                        lea     48(A2),A2
                T0007011_LoopExpression:
                        subi.w  #48,D7
                        bpl.s   T0007010_Loop
                        addi.w  #48,D7
                        bra.s   T0007013
                T0007012:
                        move.b  (A3)+,(A2)+
                T0007013:
                        dbf     D7,T0007012
                T0007014_Return:
                        movem.l (A7)+,D4-D7/A2-A6
        AztecCDirective_endasm
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        if ((unsigned char huge*)P0005_pc_Source > (unsigned char huge*)P0006_pc_Destination) {
                asm     cld
                asm     push    ds
                asm     lds     si, P0005_pc_Source
                asm     les     di, P0006_pc_Destination
                asm     mov     cx, P0007_l_ByteCount
                asm     shr     cx, 1
                asm     pushf
                asm     rep movsw
                asm     popf
                asm     jnb     loc_16BB5
                asm     movsb
                loc_16BB5:
                asm     pop     ds
        } else {
                P0005_pc_Source += P0007_l_ByteCount - 1;
                P0006_pc_Destination += P0007_l_ByteCount - 1;
                asm     std
                asm     push    ds
                asm     lds     si, P0005_pc_Source
                asm     les     di, P0006_pc_Destination
                asm     mov     cx, P0007_l_ByteCount
                asm     rep movsb
                asm     pop     ds
        }
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        if ((unsigned char*)P0005_pc_Source > (unsigned char*)P0006_pc_Destination) {
                _move(P0005_pc_Source, P0006_pc_Destination, P0007_l_ByteCount); /* Intrinsic High C compiler function call: generates inline machine code */
        } else {
                _move_right(P0005_pc_Source, P0006_pc_Destination, P0007_l_ByteCount); /* 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  P0007_l_ByteCount(a6),d7
                        movea.l P0005_pc_Source(a6),a3
                        movea.l P0006_pc_Destination(a6),a2
                        move.l  a3,d0
                        move.l  a2,d1
                        andi.w  #1,d0
                        beq.s   @Tloc_12CEC
                        andi.w  #1,d1
                        bne.s   @Tloc_12D30
                        bra.s   @Tloc_12CF2
                @Tloc_12CEC:
                        andi.w  #1,d1
                        beq.s   @Tloc_12D54
                @Tloc_12CF2:
                        cmpa.l  a2,a3
                        bpl.s   @Tloc_12D26
                        adda.l  d7,a3
                        adda.l  d7,a2
                        bra.s   @Tloc_12D0C
                @Tloc_12CFC:
                        move.b  -(a3),-(a2)
                        move.b  -(a3),-(a2)
                        move.b  -(a3),-(a2)
                        move.b  -(a3),-(a2)
                        move.b  -(a3),-(a2)
                        move.b  -(a3),-(a2)
                        move.b  -(a3),-(a2)
                        move.b  -(a3),-(a2)
                @Tloc_12D0C:
                        subq.l  #8,d7
                        bpl.s   @Tloc_12CFC
                        addq.l  #8,d7
                        bra     @Tloc_12D8A
                @Tloc_12D16:
                        move.b  (a3)+,(a2)+
                        move.b  (a3)+,(a2)+
                        move.b  (a3)+,(a2)+
                        move.b  (a3)+,(a2)+
                        move.b  (a3)+,(a2)+
                        move.b  (a3)+,(a2)+
                        move.b  (a3)+,(a2)+
                        move.b  (a3)+,(a2)+
                @Tloc_12D26:
                        subq.l  #8,d7
                        bpl.s   @Tloc_12D16
                        addq.l  #8,d7
                        bra     @Tloc_12DAE
                @Tloc_12D30:
                        cmpa.l  a2,a3
                        bpl.s   @Tloc_12D48
                        adda.l  d7,a3
                        adda.l  d7,a2
                        moveq   #1,d6
                        and.l   d7,d6
                        bne.s   @Tloc_12D78
                        subq.l  #1,d7
                        bmi     @Tloc_12DB2
                        move.b  -(a3),-(a2)
                        bra.s   @Tloc_12D78
                @Tloc_12D48:
                        subq.l  #1,d7
                        bmi     @Tloc_12DB2
                        move.b  (a3)+,(a2)+
                        bra     @Tloc_12D9C
                @Tloc_12D54:
                        cmpa.l  a2,a3
                        bpl.s   @Tloc_12D9C
                        adda.l  d7,a3
                        adda.l  d7,a2
                        moveq   #1,d6
                        and.l   d7,d6
                        beq.s   @Tloc_12D78
                        subq.l  #1,d7
                        bmi     @Tloc_12DB2
                        move.b  -(a3),-(a2)
                        bra.s   @Tloc_12D78
                @Tloc_12D6C:
                        lea     -0x30(a3),a3
                        movem.l (a3),d0-d6/a0-a1/a4-a6
                        movem.l d0-d6/a0-a1/a4-a6,-(a2)
                @Tloc_12D78:
                        subi.l  #0x30,d7
                        bpl.s   @Tloc_12D6C
                        addi.l  #0x30,d7
                        bra.s   @Tloc_12D8A
                @Tloc_12D88:
                        move.b  -(a3),-(a2)
                @Tloc_12D8A:
                        subq.l  #1,d7
                        bpl.s   @Tloc_12D88
                        bra.s   @Tloc_12DB2
                @Tloc_12D90:
                        movem.l (a3)+,d0-d6/a0-a1/a4-a6
                        movem.l d0-d6/a0-a1/a4-a6,(a2)
                        lea     0x30(a2),a2
                @Tloc_12D9C:
                        subi.l  #0x30,d7
                        bpl.s   @Tloc_12D90
                        addi.l  #0x30,d7
                        bra.s   @Tloc_12DAE
                @Tloc_12DAC:
                        move.b  (a3)+,(a2)+
                @Tloc_12DAE:
                        subq.l  #1,d7
                        bpl.s   @Tloc_12DAC
                @Tloc_12DB2:
                        movem.l (sp)+,d0-d7/a0-a6
        }
#endif
}

#ifdef MEDIA388_G20E_G21E
asm(F2145_sub_F0007_1) {
        MVP        #0xff,#0xff
        RTL
}

asm(F2146_sub_F0007_2) {
        MVN        #0xff,#0xff
        RTL
}
#endif
#endif
