// File: /workspace/github_c_makefile_star2_O1/Nico01[P]obj2asm/odisasm.c
// Function: do_mod_rm
int do_mod_rm( line, mod, r_m, type, size_needed, ref_mode )
    char            *line;
    uchar   mod;
    uchar   r_m;
    int             type;
    int             size_needed;
    int             ref_mode;
{
    int             size_known;
    int             sib_offset;
    char            sib_text[50];
    char            temp2[50];
    int             result;
    
    size_known = FALSE;

    strcpy( sib_text, "" );
    sib_offset = 0;

    if ( addr_large ) {
        if ( r_m == 4 && mod != 3 ) {
            /* Get result and new r_m */
            sib_offset = do_sib( sib_text, &r_m );
            if ( sib_offset == -1 ) {
                return( -1 );
            }
        }
    }
    switch( mod ) {
        case 0: result = mod0( ref_mode, sib_offset, sib_text, temp2,
                                            r_m, type, &size_known );
                break;
        case 1: result = mod1( ref_mode, sib_offset, sib_text, temp2, r_m );
                size_known = TRUE;
                break;
        case 2: result = mod2( ref_mode, sib_offset, sib_text, temp2,
                                            r_m, type, &size_known );
                break;
        case 3: result = mod3( ref_mode, temp2, r_m, type, &size_known );
                size_needed = FALSE;
                break;
    }

    if ( result != -1 ) {
        if ( compatibility == 2 ) {
            if ( over_seg != -1 ) {         /* Any previous segment overide? */
                strcat( line, sregsc[over_seg] );
                strcat( line, " " );
            }
            if ( !size_known || size_needed ) {
                strcat( line, type_to_text(type) );
            }
        } else {
            /*
            ** If the size is already known, then we don't need 'xxxx' ptr text
            */
            if ( !size_known || size_needed ) {
                strcat( line, type_to_text(type) );
            }
            if ( over_seg != -1 ) {         /* Any previous segment overide? */
                strcat( line, sregsc[over_seg] );
            }
        }
        strcat( line, temp2 );
    }
    return( result );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl %r8d, %r14d
movl %ecx, %ebp
movl %esi, %r15d
movq %rdi, %rbx
movb %dl, 0xb(%rsp)
movl $0x0, 0xc(%rsp)
movb $0x0, 0x50(%rsp)
xorl %esi, %esi
cmpl $0x0, 0x11f29(%rip)     # 0x1ce88
je 0xaf8c
cmpb $0x4, %dl
setne %al
cmpb $0x3, %r15b
sete %cl
orb %al, %cl
jne 0xaf8c
leaq 0x50(%rsp), %rdi
leaq 0xb(%rsp), %rsi
callq 0xae96
movl %eax, %esi
cmpl $-0x1, %eax
je 0xb0eb
cmpb $0x3, %r15b
ja 0xb033
movzbl %r15b, %eax
leaq 0x8093(%rip), %rcx      # 0x13034
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl 0xb(%rsp), %r8d
leaq 0xc(%rsp), %rax
movq %rax, (%rsp)
leaq 0x50(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movl %ebp, %r9d
callq 0xa792
jmp 0xafee
movzbl 0xb(%rsp), %r8d
leaq 0xc(%rsp), %rax
movq %rax, (%rsp)
leaq 0x50(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movl %ebp, %r9d
callq 0xabbf
movl %eax, %r15d
jmp 0xb033
movzbl 0xb(%rsp), %edx
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %r8
movl %ebp, %ecx
callq 0xae5b
xorl %r14d, %r14d
xorl %r15d, %r15d
jmp 0xb033
movzbl 0xb(%rsp), %r8d
leaq 0x50(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0xaa92
movl %eax, %r15d
movl $0x1, 0xc(%rsp)
jmp 0xb033
cmpl $-0x1, %r15d
je 0xb0da
leaq 0x11eb4(%rip), %rax     # 0x1cef8
cmpl $0x2, (%rax)
jne 0xb08f
movslq 0xea38(%rip), %rax      # 0x19a88
cmpq $-0x1, %rax
je 0xb077
leaq 0xe1e3(%rip), %rcx      # 0x19240
movq (%rcx,%rax,8), %rsi
movq %rbx, %rdi
callq 0x91a0
movq %rbx, %rdi
callq 0x90b0
movw $0x20, (%rbx,%rax)
testl %r14d, %r14d
jne 0xb083
cmpl $0x0, 0xc(%rsp)
jne 0xb0cd
movl %ebp, %edi
callq 0xf641
movq %rax, %rsi
jmp 0xb0c5
testl %r14d, %r14d
jne 0xb09b
cmpl $0x0, 0xc(%rsp)
jne 0xb0ad
movl %ebp, %edi
callq 0xf641
movq %rbx, %rdi
movq %rax, %rsi
callq 0x91a0
movslq 0xe9d4(%rip), %rax      # 0x19a88
cmpq $-0x1, %rax
je 0xb0cd
leaq 0xe17f(%rip), %rcx      # 0x19240
movq (%rcx,%rax,8), %rsi
movq %rbx, %rdi
callq 0x91a0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x91a0
movl %r15d, %eax
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0xb0da