// File: /workspace/github_c_makefile_star2_O2/Nico01[P]obj2asm/odisfp.c
// Function: esc_special
void esc_special( opcode, operand, esc_byte, reg )
    char            *opcode;
    char            *operand;
    int             esc_byte;
    int             reg;
{
    int             element;

    strcpy( opcode, "" );
    strcpy( operand, "" );
    
    /*
    ** This routine is bad, but it would make no more sense if it listed
    ** out all of the possible esc_byte and register combinations!
    */
    if ( esc_byte == 0x0A ) {
        if ( reg == 0x00 ) {
            strcpy( opcode, "fnop" );
        }
        return;
    }
    if ( esc_byte == 0x0B ) {
        return;
    }
    if ( esc_byte >= 0x0C && esc_byte <= 0x0F ) {
        element = (esc_byte - 0x0C) * 8 + reg;
        strcpy( opcode, esc_0x0X[element] );
        return;
    }
    if ( esc_byte >= 0x10 && esc_byte <= 0x1F ) {
        if ( esc_byte == 0x15 && reg == 0x01 ) {
            strcpy( opcode, "fucompp" );
        }
        if ( esc_byte == 0x1C ) {
            strcpy( opcode, esc_0x1C[reg] );
        }
        return;
    }
    if ( esc_byte == 0x22 || esc_byte == 0x23 || esc_byte == 0x29 
         || (esc_byte >= 0x2C && esc_byte <= 0x2F) ) {
        return;
    }
    if ( esc_byte == 0x33 ) {
        if ( reg == 0x01 ) {
            strcpy( opcode, "fcompp" );
        }
        return;
    }   
    if ( esc_byte == 0x32 ) {
        return;
    }
    if ( esc_byte == 0x38 || esc_byte == 0x39
      || esc_byte == 0x3A || esc_byte == 0x3B ) {
        return;
    }
    if ( esc_byte == 0x3C ) {
        if ( reg == 0x00 ) {
            strcpy( opcode, "fstsw" );
            strcpy( operand, "ax" );
        }
        return;
    }
    if ( esc_byte == 0x3D || esc_byte == 0x3E || esc_byte == 0x3F ) {
        return;
    }
    element = esc_byte & 0x0F;
    if (    element == 0x02 || element == 0x03 || element == 0x08
         || element == 0x09 || element == 0x0A || element == 0x0B ) {
        sprintf( operand, "st(%d)", reg );
    } else {
        if ( esc_byte >= 0x10 ) {
            sprintf( operand, "st(%d),st", reg );
        } else {
            sprintf( operand, "st,st(%d)", reg );
        }
    }
    if (    esc_byte == 0x24 || esc_byte == 0x34
         || esc_byte == 0x26 || esc_byte == 0x36 ) {
        element++;
    }
    if (    esc_byte == 0x25 || esc_byte == 0x35
         || esc_byte == 0x27 || esc_byte == 0x37 ) {
        --element;
    }
    if ( esc_byte == 0x09 ) {
        strcpy( opcode, "fxch" );
    } else {
        strcpy( opcode, esc_inst[element] );
    }
    if ( esc_byte >= 0x30 ) {
        strcat( opcode, "p" );
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
xorl %eax, %eax
movb %al, (%rdi)
movb %al, (%rsi)
cmpl $0xb, %edx
je 0xb5ed
movl %edx, %r14d
movq %rdi, %rbx
cmpl $0xa, %edx
jne 0xb43d
testl %ecx, %ecx
jne 0xb5ed
movb $0x0, 0x4(%rbx)
movl $0x706f6e66, (%rbx)     # imm = 0x706F6E66
jmp 0xb5ed
movl %r14d, %eax
andl $-0x4, %eax
cmpl $0xc, %eax
jne 0xb46b
leal (%rcx,%r14,8), %eax
addl $-0x60, %eax
cltq
leaq 0x6f48(%rip), %rcx      # 0x123a0
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x9070
movl %r14d, %edx
andl $-0x10, %edx
cmpl $0x10, %edx
jne 0xb497
movl %r14d, %eax
xorl $0x15, %eax
movl %ecx, %edx
xorl $0x1, %edx
orl %eax, %edx
jne 0xb4f1
movabsq $0x70706d6f637566, %rax # imm = 0x70706D6F637566
movq %rax, (%rbx)
jmp 0xb5ed
cmpl $0x29, %r14d
ja 0xb4b4
movl %r14d, %edx
movabsq $0x20c00000000, %rdi    # imm = 0x20C00000000
btq %rdx, %rdi
jb 0xb5ed
cmpl $0x2c, %eax
je 0xb5ed
leal -0x32(%r14), %eax
cmpl $0xa, %eax
ja 0xb50a
leaq 0x6ea7(%rip), %rdx      # 0x12374
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
cmpl $0x1, %ecx
jne 0xb5ed
movl $0x70706d, 0x3(%rbx)    # imm = 0x70706D
movl $0x6d6f6366, (%rbx)     # imm = 0x6D6F6366
jmp 0xb5ed
cmpl $0x1c, %r14d
jne 0xb5ed
movslq %ecx, %rax
leaq 0x6f1b(%rip), %rcx      # 0x12420
jmp 0xb458
leal -0x3d(%r14), %eax
cmpl $0x3, %eax
jb 0xb5ed
movl %r14d, %eax
andl $0xe, %eax
cmpl $0xa, %eax
ja 0xb557
movl $0x504, %edx            # imm = 0x504
btl %eax, %edx
jae 0xb557
leaq 0x6f2c(%rip), %rax      # 0x1245f
jmp 0xb56d
testl %ecx, %ecx
jne 0xb5ed
movw $0x77, 0x4(%rbx)
movl $0x73747366, (%rbx)     # imm = 0x73747366
movb $0x0, 0x2(%rsi)
movw $0x7861, (%rsi)         # imm = 0x7861
jmp 0xb5ed
cmpl $0x10, %r14d
leaq 0x6ef0(%rip), %rdx      # 0x12452
leaq 0x6ef3(%rip), %rax      # 0x1245c
cmovgeq %rdx, %rax
movl %r14d, %ebp
andl $0xf, %ebp
movq %rsi, %rdi
movq %rax, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x91b0
leal -0x24(%r14), %eax
rorl %eax
cmpl $0x9, %eax
ja 0xb59a
movl $0x303, %ecx            # imm = 0x303
btl %eax, %ecx
jae 0xb59a
orl $0x1, %ebp
leal -0x25(%r14), %eax
rorl %eax
cmpl $0x9, %eax
ja 0xb5b1
movl $0x303, %ecx            # imm = 0x303
btl %eax, %ecx
jae 0xb5b1
decl %ebp
cmpl $0x9, %r14d
jne 0xb5c3
movb $0x0, 0x4(%rbx)
movl $0x68637866, (%rbx)     # imm = 0x68637866
jmp 0xb5ed
movslq %ebp, %rax
leaq 0xed93(%rip), %rcx      # 0x1a360
movq (%rcx,%rax,8), %rsi
movq %rbx, %rdi
callq 0x9070
cmpl $0x30, %r14d
jl 0xb5ed
movq %rbx, %rdi
callq 0x90b0
movw $0x70, (%rbx,%rax)
popq %rbx
popq %r14
popq %rbp
retq
nop