// File: /workspace/github_c_makefile_star2_O2/buptlxb[P]xRay/disasm/Routines_Disasm.c
// Function: BuildCompleteInstructionATSyntax
void __bea_callspec__ BuildCompleteInstructionATSyntax(PDISASM pMyDisasm)
{
    size_t i = 0;
    /* =============== Copy Instruction Mnemonic */
    (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr, (char*) &(*pMyDisasm).Instruction.Mnemonic);
    i = strlen((char*) &(*pMyDisasm).CompleteInstr);

    /* =============== suffix the mnemonic */
    if (GV.MemDecoration != 0) {
        if (GV.MemDecoration > 99) GV.MemDecoration -= 100;
        (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[GV.MemDecoration-1]);
        i = strlen((char*) &(*pMyDisasm).CompleteInstr);
    }
    else {
        if ((*pMyDisasm).Argument1.ArgType != NO_ARGUMENT) {
            if ((*pMyDisasm).Argument1.ArgSize == 8) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[0]);
            }
            else if ((*pMyDisasm).Argument1.ArgSize == 16) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[1]);
            }
            else if ((*pMyDisasm).Argument1.ArgSize == 32) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[2]);
            }
            else if ((*pMyDisasm).Argument1.ArgSize == 64) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[3]);
            }
            i = strlen((char*) &(*pMyDisasm).CompleteInstr);
        }
        else if ((*pMyDisasm).Argument1.ArgType != NO_ARGUMENT) {
            if ((*pMyDisasm).Argument1.ArgSize == 8) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[0]);
            }
            else if ((*pMyDisasm).Argument1.ArgSize == 16) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[1]);
            }
            else if ((*pMyDisasm).Argument1.ArgSize == 32) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[2]);
            }
            else if ((*pMyDisasm).Argument1.ArgSize == 64) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[3]);
            }
            i = strlen((char*) &(*pMyDisasm).CompleteInstr);
        }
    }
    /* =============== if TAB = 1, add tabulation */
    if (GV.TAB_ == 1) {
       (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, space_tab[i>10 ? 0 : 10-i]);
        i = strlen((char*) &(*pMyDisasm).CompleteInstr);
    }

    /* =============== if Arg3.Exists, display it */
    if (GV.third_arg != 0) {
        if ((*pMyDisasm).Argument3.ArgType & REGISTER_TYPE) {
            (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%");
            i++;
        }
        else if ((*pMyDisasm).Argument3.ArgType & CONSTANT_TYPE) {
            (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24");
            i++;
        }
        (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument3.ArgMnemonic);
        i = strlen((char*) &(*pMyDisasm).CompleteInstr);
    }

    /* =============== if Arg3.Exists and Arg2.Exists , display " , " */
    if ((GV.third_arg != 0) && (*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0)) {
        (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", ");
        i += 2;
    }

    /* =============== if Arg2 exists, display it */
    if (*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0) {
        if ((*pMyDisasm).Argument2.ArgType & CONSTANT_TYPE) {
            (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24");
            i++;
        }
        else {
            if ((*pMyDisasm).Instruction.BranchType != 0) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "*");
                i++;
            }
            if ((*pMyDisasm).Argument2.ArgType & REGISTER_TYPE) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%");
                i++;
            }
            else if ((*pMyDisasm).Argument2.ArgType & CONSTANT_TYPE) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24");
                i++;
            }
            else {
                if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){
                    (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%");
                    i++;
                    if (GV.SEGMENTREGS != 0) {
                        (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument2.SegmentReg]);
                    }
                    else {
                        (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]);
                    }
                    i = strlen((char*) &(*pMyDisasm).CompleteInstr);
                }
            }
        }
        (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument2.ArgMnemonic);
        i = strlen((char*) &(*pMyDisasm).CompleteInstr);
    }

    /* =============== if Arg2.Exists and Arg1.Exists , display " , " */
    if (((UInt8)*((UInt8*) &(*pMyDisasm).Argument1.ArgMnemonic) != 0) && ((UInt8)*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0)) {
        (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", ");
        i += 2;
    }

    /* =============== if Arg1 exists, display it */
    if (*((UInt8*) &(*pMyDisasm).Argument1.ArgMnemonic) != 0) {
        if ((*pMyDisasm).Argument1.ArgType & CONSTANT_TYPE) {
            (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24");
            i++;
        }
        else {
            if ((*pMyDisasm).Instruction.BranchType != 0) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "*");
                i++;
            }
            if ((*pMyDisasm).Argument1.ArgType & REGISTER_TYPE) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%");
                i++;
            }
            else if ((*pMyDisasm).Argument1.ArgType & CONSTANT_TYPE) {
                (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24");
                i++;
            }
            else {
                if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){
                    (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%");
                    i++;
                    if (GV.SEGMENTREGS != 0) {
                        (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument1.SegmentReg]);
                    }
                    else {
                        (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]);
                    }
                    i = strlen((char*) &(*pMyDisasm).CompleteInstr);
                }
            }
        }
        (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument1.ArgMnemonic);
        i = strlen((char*) &(*pMyDisasm).CompleteInstr);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x14(%rdi), %rbx
leaq 0x68(%rdi), %rsi
movq %rbx, %rdi
callq 0x8170
movq %rbx, %rdi
callq 0x8090
movl 0x210(%r14), %ecx
testl %ecx, %ecx
je 0x2984d
cmpl $0x64, %ecx
jl 0x296f3
addl $-0x64, %ecx
movl %ecx, 0x210(%r14)
leaq (%rbx,%rax), %rdi
decq %rdi
movslq %ecx, %rax
leaq 0xd13c(%rip), %rcx      # 0x36840
leaq (%rcx,%rax,4), %rsi
addq $-0x4, %rsi
callq 0x8170
movq %rbx, %rdi
callq 0x8090
cmpl $0x1, 0x27c(%r14)
jne 0x2974d
xorl %ecx, %ecx
pushq $0xa
popq %rdx
subq %rax, %rdx
cmovaeq %rdx, %rcx
leaq (%rbx,%rax), %rdi
shll $0x4, %ecx
leaq 0xd033(%rip), %rsi      # 0x36770
addq %rcx, %rsi
callq 0x8170
movq %rbx, %rdi
callq 0x8090
cmpl $0x0, 0x278(%r14)
je 0x297b4
leaq 0x16c(%r14), %rsi
movl 0x1ac(%r14), %edx
movw $0x25, %cx
btl $0x1d, %edx
jb 0x29777
testl %edx, %edx
jns 0x2977e
movw $0x24, %cx
movw %cx, (%rbx,%rax)
incq %rax
addq %rbx, %rax
movq %rax, %rdi
callq 0x8170
movq %rbx, %rdi
callq 0x8090
cmpl $0x0, 0x278(%r14)
je 0x297b4
cmpb $0x0, 0x104(%r14)
je 0x297b4
movb $0x0, 0x2(%rbx,%rax)
movw $0x202c, (%rbx,%rax)    # imm = 0x202C
addq $0x2, %rax
leaq 0x104(%r14), %r15
cmpb $0x0, 0x104(%r14)
je 0x298c2
movl 0x144(%r14), %ecx
testl %ecx, %ecx
js 0x2989b
cmpl $0x0, 0x78(%r14)
je 0x297f1
movw $0x2a, 0x14(%r14,%rax)
incq %rax
movl 0x144(%r14), %ecx
btl $0x1d, %ecx
jb 0x298a3
testl %ecx, %ecx
js 0x2989b
cmpl $0x0, 0x270(%r14)
jne 0x2981b
cmpl $0x0, 0x274(%r14)
je 0x298ac
movw $0x25, 0x14(%r14,%rax)
cmpl $0x0, 0x270(%r14)
leaq 0x1(%rbx,%rax), %rdi
je 0x29996
movl 0x168(%r14), %eax
leaq 0xcfdc(%rip), %rcx      # 0x36820
leaq (%rcx,%rax,4), %rsi
jmp 0x2999d
cmpl $0x10000000, 0xdc(%r14) # imm = 0x10000000
je 0x29719
movl 0xe0(%r14), %ecx
addl $-0x8, %ecx
roll $0x1d, %ecx
cmpl $0x7, %ecx
ja 0x29711
movl $0x8b, %edx
btl %ecx, %edx
jae 0x29711
movl %ecx, %ecx
leaq 0xc4e5(%rip), %rdx      # 0x35d70
movq (%rdx,%rcx,8), %rsi
leaq (%rbx,%rax), %rdi
decq %rdi
jmp 0x2970c
movw $0x24, (%rbx,%rax)
jmp 0x298a9
movw $0x25, (%rbx,%rax)
incq %rax
addq %rbx, %rax
movq %rax, %rdi
movq %r15, %rsi
callq 0x8170
movq %rbx, %rdi
callq 0x8090
cmpb $0x0, 0x9c(%r14)
je 0x29960
leaq 0x9c(%r14), %r12
cmpb $0x0, (%r15)
je 0x298f3
movb $0x0, 0x2(%rbx,%rax)
movw $0x202c, (%rbx,%rax)    # imm = 0x202C
cmpb $0x0, (%r12)
je 0x29960
addq $0x2, %rax
movl 0xdc(%r14), %ecx
testl %ecx, %ecx
js 0x2996c
cmpl $0x0, 0x78(%r14)
je 0x29917
movw $0x2a, 0x14(%r14,%rax)
incq %rax
movl 0xdc(%r14), %ecx
btl $0x1d, %ecx
jb 0x29974
testl %ecx, %ecx
js 0x2996c
cmpl $0x0, 0x270(%r14)
jne 0x29935
cmpl $0x0, 0x274(%r14)
je 0x2997d
movw $0x25, 0x14(%r14,%rax)
cmpl $0x0, 0x270(%r14)
leaq 0x1(%rbx,%rax), %rdi
je 0x299af
movl 0x100(%r14), %eax
leaq 0xcec6(%rip), %rcx      # 0x36820
leaq (%rcx,%rax,4), %rsi
jmp 0x299b6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movw $0x24, (%rbx,%rax)
jmp 0x2997a
movw $0x25, (%rbx,%rax)
incq %rax
addq %rax, %rbx
movq %rbx, %rdi
movq %r12, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x8170
leaq 0xce8f(%rip), %rsi      # 0x3682c
callq 0x8170
movq %rbx, %rdi
callq 0x8090
jmp 0x298ac
leaq 0xce76(%rip), %rsi      # 0x3682c
callq 0x8170
movq %rbx, %rdi
callq 0x8090
jmp 0x2997d