// File: /workspace/github_c_makefile_star2_O0/Nico01[P]obj2asm/odisasm.c
// Function: esc
int esc( byte, text, class )
    uchar   byte;
    char            *text;
    int             class;
{
    int             size;
    int             dir;
    int             type;
    dword   mod_reg;
    uchar   mod;
    uchar   r_m;
    uchar   lll;        /* Described as LLL in 80386 Prog Ref Man. */
    uchar   ttt;        /* Described as TTT in 80386 Prog Ref Man. */
    uchar   esc_byte;
    uchar   mf;
    int             additional;
    int             size_needed;
    char            line[50];
    char            temp[50];
    int             ref_mode;

    text = text;               /* Prevent unused variable warnings */
    class=class;              /* Prevent unused variable warnings */

    size = (byte & 0x01);
    dir  = (byte & 0x02) >> 1;
    ref_mode = 0;

    if ( get_checkc( &mod_reg ) ) {
        return( 0 );
    }
    mod = (uchar)(((int)mod_reg & 0xC0) >> 6);
    lll = (uchar)(((int)mod_reg & 0x38) >> 3);
    r_m = (uchar)(((int)mod_reg & 0x07) >> 0);

    ttt = (uchar)(byte & 0x07);
    esc_byte = (uchar)(ttt << 3) + lll;

    if ( mod == 0x03 ) {
        esc_special( temp, line, esc_byte, r_m );
        additional = 0;
    } else {
        mf = (uchar)((esc_byte & 0x30) >> 4);

        size_needed = TRUE;

        switch( mf ) {
            case 0:     type = DWORD_PTR;   break;
            case 1:     type = DWORD_PTR;   break;
            case 2:     type = QWORD_PTR;   break;
            case 3:     type = WORD_PTR;    break;
        }

        /*
        ** There are always exceptions to the rule (Thank you, Intel)
        */
        if (    esc_byte == 0x1D || esc_byte == 0x1F 
             || esc_byte == 0x3C || esc_byte == 0x3E ) {
            type = TBYTE_PTR;
        }
        if ( esc_byte == 0x2F ) {
            type = WORD_PTR;
        }
        if ( esc_byte == 0x3D || esc_byte == 0x3F ) {
            type = DWORD_PTR;
        }

        if (    (esc_byte >= 0x0C && esc_byte <= 0x0F)
             || (esc_byte >= 0x2C && esc_byte <= 0x2E) ) {
            size_needed = FALSE;
        }
        sprintf( line, "" );
        additional = do_mod_rm( line, mod, r_m, type, size_needed, ref_mode );
        if ( additional == -1 ) {           /* Error in 'do_mod_rm' */
            return( 0 );
        }
        strcpy( temp, esc_inst[esc_byte] );
    }
    if ( strlen( temp ) ) {
        if ( temp[1] == 'n' && fp_wait ) {
            fp_opcode[0] = temp[0];             /* Remove the 'n' */
            strcpy( &fp_opcode[1], &temp[2] );
        } else {
            strcpy( fp_opcode, temp );
        }
        instr_opcode( fp_opcode );
        instr_operand( line );
    } else {
        sprintf( line, "0%02Xh,%s", esc_byte, regs[1][r_m] );
        instr_opcode( "esc" );
        instr_operand( line );
    }

    fp_wait = FALSE;                /* Reset always */
    dir = dir;
    size = size;
    return( 2+additional );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movb %dil, %al
movb %al, -0x5(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movzbl -0x5(%rbp), %eax
andl $0x1, %eax
movl %eax, -0x18(%rbp)
movzbl -0x5(%rbp), %eax
andl $0x2, %eax
sarl %eax
movl %eax, -0x1c(%rbp)
movl $0x0, -0xb4(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x9620
cmpl $0x0, %eax
je 0xc550
movl $0x0, -0x4(%rbp)
jmp 0xc7d9
movq -0x28(%rbp), %rax
andl $0xc0, %eax
sarl $0x6, %eax
movb %al, -0x29(%rbp)
movq -0x28(%rbp), %rax
andl $0x38, %eax
sarl $0x3, %eax
movb %al, -0x2b(%rbp)
movq -0x28(%rbp), %rax
andl $0x7, %eax
sarl $0x0, %eax
movb %al, -0x2a(%rbp)
movzbl -0x5(%rbp), %eax
andl $0x7, %eax
movb %al, -0x2c(%rbp)
movzbl -0x2c(%rbp), %eax
shll $0x3, %eax
movzbl %al, %eax
movzbl -0x2b(%rbp), %ecx
addl %ecx, %eax
movb %al, -0x2d(%rbp)
movzbl -0x29(%rbp), %eax
cmpl $0x3, %eax
jne 0xc5c3
leaq -0xb0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movzbl -0x2d(%rbp), %edx
movzbl -0x2a(%rbp), %ecx
callq 0xc7f0
movl $0x0, -0x34(%rbp)
jmp 0xc707
movzbl -0x2d(%rbp), %eax
andl $0x30, %eax
shrl $0x4, %eax
movb %al, -0x2e(%rbp)
movl $0x1, -0x38(%rbp)
movzbl -0x2e(%rbp), %eax
movq %rax, -0xc0(%rbp)
subq $0x3, %rax
ja 0xc621
movq -0xc0(%rbp), %rax
leaq 0xab16(%rip), %rcx      # 0x1710c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x5, -0x20(%rbp)
jmp 0xc621
movl $0x5, -0x20(%rbp)
jmp 0xc621
movl $0x7, -0x20(%rbp)
jmp 0xc621
movl $0x4, -0x20(%rbp)
movzbl -0x2d(%rbp), %eax
cmpl $0x1d, %eax
je 0xc645
movzbl -0x2d(%rbp), %eax
cmpl $0x1f, %eax
je 0xc645
movzbl -0x2d(%rbp), %eax
cmpl $0x3c, %eax
je 0xc645
movzbl -0x2d(%rbp), %eax
cmpl $0x3e, %eax
jne 0xc64c
movl $0x8, -0x20(%rbp)
movzbl -0x2d(%rbp), %eax
cmpl $0x2f, %eax
jne 0xc65c
movl $0x4, -0x20(%rbp)
movzbl -0x2d(%rbp), %eax
cmpl $0x3d, %eax
je 0xc66e
movzbl -0x2d(%rbp), %eax
cmpl $0x3f, %eax
jne 0xc675
movl $0x5, -0x20(%rbp)
movzbl -0x2d(%rbp), %eax
cmpl $0xc, %eax
jl 0xc687
movzbl -0x2d(%rbp), %eax
cmpl $0xf, %eax
jle 0xc699
movzbl -0x2d(%rbp), %eax
cmpl $0x2c, %eax
jl 0xc6a0
movzbl -0x2d(%rbp), %eax
cmpl $0x2e, %eax
jg 0xc6a0
movl $0x0, -0x38(%rbp)
leaq -0x70(%rbp), %rdi
leaq 0xbb15(%rip), %rsi      # 0x181c0
movb $0x0, %al
callq 0x9190
leaq -0x70(%rbp), %rdi
movb -0x29(%rbp), %dl
movb -0x2a(%rbp), %al
movl -0x20(%rbp), %ecx
movl -0x38(%rbp), %r8d
movl -0xb4(%rbp), %r9d
movzbl %dl, %esi
movzbl %al, %edx
callq 0xb980
movl %eax, -0x34(%rbp)
cmpl $-0x1, -0x34(%rbp)
jne 0xc6ea
movl $0x0, -0x4(%rbp)
jmp 0xc7d9
leaq -0xb0(%rbp), %rdi
movzbl -0x2d(%rbp), %eax
movl %eax, %ecx
leaq 0x11d92(%rip), %rax     # 0x1e490
movq (%rax,%rcx,8), %rsi
callq 0x9060
leaq -0xb0(%rbp), %rdi
callq 0x90a0
cmpq $0x0, %rax
je 0xc780
movsbl -0xaf(%rbp), %eax
cmpl $0x6e, %eax
jne 0xc756
movsbl 0x13940(%rip), %eax     # 0x2006c
cmpl $0x0, %eax
je 0xc756
movb -0xb0(%rbp), %al
movb %al, 0x13927(%rip)      # 0x20064
leaq -0xb0(%rbp), %rsi
addq $0x2, %rsi
leaq 0x13916(%rip), %rdi     # 0x20065
callq 0x9060
jmp 0xc769
leaq -0xb0(%rbp), %rsi
leaq 0x13900(%rip), %rdi     # 0x20064
callq 0x9060
leaq 0x138f4(%rip), %rdi     # 0x20064
callq 0x9670
leaq -0x70(%rbp), %rdi
callq 0x96b0
jmp 0xc7bd
leaq -0x70(%rbp), %rdi
movzbl -0x2d(%rbp), %edx
movzbl -0x2a(%rbp), %eax
movl %eax, %ecx
leaq 0xf96b(%rip), %rax      # 0x1c100
movq 0x40(%rax,%rcx,8), %rcx
leaq 0xac30(%rip), %rsi      # 0x173d1
movb $0x0, %al
callq 0x9190
leaq 0xac2c(%rip), %rdi      # 0x173db
callq 0x9670
leaq -0x70(%rbp), %rdi
callq 0x96b0
movb $0x0, 0x138a8(%rip)     # 0x2006c
movl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x34(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop