// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xd0, %rsp
movb %dl, %al
movb %sil, %dl
movq %rdi, -0x10(%rbp)
movb %dl, -0x11(%rbp)
movb %al, -0x12(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0x60(%rbp), %rdi
leaq 0xc809(%rip), %rsi      # 0x181c0
callq 0x9060
movl $0x0, -0x28(%rbp)
cmpl $0x0, 0x14696(%rip)     # 0x20060
je 0xba04
movzbl -0x12(%rbp), %eax
cmpl $0x4, %eax
jne 0xba02
movzbl -0x11(%rbp), %eax
cmpl $0x3, %eax
je 0xba02
leaq -0x60(%rbp), %rdi
leaq -0x12(%rbp), %rsi
callq 0xb870
movl %eax, -0x28(%rbp)
cmpl $-0x1, -0x28(%rbp)
jne 0xba00
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xbbd4
jmp 0xba02
jmp 0xba04
movzbl -0x11(%rbp), %eax
movq %rax, -0xb0(%rbp)
subq $0x3, %rax
ja 0xbaea
movq -0xb0(%rbp), %rax
leaq 0xb67d(%rip), %rcx      # 0x170a4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x20(%rbp), %edi
movl -0x28(%rbp), %esi
leaq -0x60(%rbp), %rdx
leaq -0xa0(%rbp), %rcx
movb -0x12(%rbp), %r8b
movl -0x18(%rbp), %r9d
leaq -0x24(%rbp), %rax
movzbl %r8b, %r8d
movq %rax, (%rsp)
callq 0xaed0
movl %eax, -0xa4(%rbp)
jmp 0xbaea
movl -0x20(%rbp), %edi
movl -0x28(%rbp), %esi
leaq -0x60(%rbp), %rdx
leaq -0xa0(%rbp), %rcx
movzbl -0x12(%rbp), %r8d
callq 0xb2d0
movl %eax, -0xa4(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0xbaea
movl -0x20(%rbp), %edi
movl -0x28(%rbp), %esi
leaq -0x60(%rbp), %rdx
leaq -0xa0(%rbp), %rcx
movb -0x12(%rbp), %r8b
movl -0x18(%rbp), %r9d
leaq -0x24(%rbp), %rax
movzbl %r8b, %r8d
movq %rax, (%rsp)
callq 0xb440
movl %eax, -0xa4(%rbp)
jmp 0xbaea
movl -0x20(%rbp), %edi
leaq -0xa0(%rbp), %rsi
movb -0x12(%rbp), %al
movl -0x18(%rbp), %ecx
leaq -0x24(%rbp), %r8
movzbl %al, %edx
callq 0xb7a0
movl %eax, -0xa4(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $-0x1, -0xa4(%rbp)
je 0xbbcb
leaq 0x145ca(%rip), %rax     # 0x200c8
cmpl $0x2, (%rax)
jne 0xbb67
cmpl $-0x1, 0x10f6e(%rip)    # 0x1ca78
je 0xbb37
movq -0x10(%rbp), %rdi
movslq 0x10f61(%rip), %rcx     # 0x1ca78
leaq 0x10712(%rip), %rax     # 0x1c230
movq (%rax,%rcx,8), %rsi
callq 0x9180
movq -0x10(%rbp), %rdi
leaq 0xc489(%rip), %rsi      # 0x17fbb
callq 0x9180
cmpl $0x0, -0x24(%rbp)
je 0xbb43
cmpl $0x0, -0x1c(%rbp)
je 0xbb65
movq -0x10(%rbp), %rax
movq %rax, -0xb8(%rbp)
movl -0x18(%rbp), %edi
callq 0x11f20
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
callq 0x9180
jmp 0xbbbb
cmpl $0x0, -0x24(%rbp)
je 0xbb73
cmpl $0x0, -0x1c(%rbp)
je 0xbb95
movq -0x10(%rbp), %rax
movq %rax, -0xc0(%rbp)
movl -0x18(%rbp), %edi
callq 0x11f20
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0x9180
cmpl $-0x1, 0x10edc(%rip)    # 0x1ca78
je 0xbbb9
movq -0x10(%rbp), %rdi
movslq 0x10ecf(%rip), %rcx     # 0x1ca78
leaq 0x10680(%rip), %rax     # 0x1c230
movq (%rax,%rcx,8), %rsi
callq 0x9180
jmp 0xbbbb
movq -0x10(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x9180
movl -0xa4(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq