// File: /workspace/github_c_makefile_star2_O0/Nico01[P]obj2asm/odisasm.c
// Function: mod2
int mod2( ref_mode, sib_offset, sib_text, text, r_m, type, size_known )
    int             ref_mode;
    int             sib_offset;
    char            *sib_text;
    char            *text;
    uchar   r_m;
    int             type;
    int             *size_known;
{
    dword   offset;
    int             result;
    char            temp[50];
    char            *sign;
    int             ref_seg;

    if ( r_m == 2 || r_m == 3 ) {
        ref_seg = SS;               /* SS relative addressing modes */
    } else {
        ref_seg = DS;
    }
    if ( over_seg != -1 ) {
        ref_seg = 17+over_seg;
    }

    switch( data_check(2+sib_offset) ) {
        case BAD:
            result = -1;
            break;
        case LABEL:
            result = -1;
            break;
        case FIXUP:
            if ( fix_rec->word_sized && fix_rec->extended == addr_large ) {
                get_fix( temp, 0, FALSE, addr_bytes,
                                            type, TRUE, size_known, ref_seg );
                if ( compatibility == 2 ) {
                    strcpy( text, temp );
                    strcat( text, addr_mode[r_m] );
                } else {
                    if ( addr_large ) {
                        strcpy( text, addr_386m[r_m] );
                    } else {
                        strcpy( text, addr_mode[r_m] );
                    }
                    if ( strlen(sib_text) ) {
                        strcat( text, "+" );
                        strcat( text, sib_text );
                    }
                    strcat( text, "+" );
                    strcat( text, temp );
                }
                strcat( text, "]" );
                result = addr_bytes+sib_offset;
            } else {
                result = -1;
            }
            break;
        case NORMAL:
            if ( check_getv( &offset, addr_large ) ) {
                result = -1;
            } else {
                if ( offset == 0x00000000L ) { 
                    return( -1 );       /* Assembler should have optimized */
                }
                if ( addr_large ) {
                    strcpy( text, addr_386m[r_m] );
                } else {
                    strcpy( text, addr_mode[r_m] );
                }
                if ( strlen(sib_text) ) {
                    strcat( text, "+" );
                    strcat( text, sib_text );
                }
                if ( offset > 0x80000000L ) {
                    offset = -offset;
                    sign = "-";
                } else {
                    sign = "+";
                }
                out_hexize( offset, temp, addr_bytes );
                if ( compatibility == 2 ) {
                    strcat( text, "]" );
                    strcat( text, sign );
                    strcat( text, temp );
                } else {
                    strcat( text, sign );
                    strcat( text, temp );
                    strcat( text, "]" );
                }
                result = addr_bytes+sib_offset;
                *size_known = TRUE;
            }
            break;
    }
    return( result );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movb %r8b, %al
movq 0x10(%rbp), %r8
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movb %al, -0x21(%rbp)
movl %r9d, -0x28(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x2, %eax
je 0xb479
movzbl -0x21(%rbp), %eax
cmpl $0x3, %eax
jne 0xb482
movl $0x13, -0x7c(%rbp)
jmp 0xb489
movl $0x14, -0x7c(%rbp)
cmpl $-0x1, 0x115e8(%rip)    # 0x1ca78
je 0xb49e
movl 0x115e0(%rip), %eax     # 0x1ca78
addl $0x11, %eax
movl %eax, -0x7c(%rbp)
movl -0xc(%rbp), %edi
addl $0x2, %edi
callq 0xe580
movl %eax, %ecx
movq %rcx, -0x88(%rbp)
subl $0x3, %eax
ja 0xb785
movq -0x88(%rbp), %rax
leaq 0xbbbb(%rip), %rcx      # 0x17084
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
jmp 0xb785
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
jmp 0xb785
leaq 0x14df7(%rip), %rax     # 0x202e8
movq (%rax), %rax
cmpl $0x0, 0x3c(%rax)
je 0xb621
leaq 0x14de3(%rip), %rax     # 0x202e8
movq (%rax), %rax
movl 0x38(%rax), %eax
cmpl 0x14b4f(%rip), %eax     # 0x20060
jne 0xb621
leaq -0x70(%rbp), %rdi
movl 0x1155f(%rip), %ecx     # 0x1ca80
movl -0x28(%rbp), %r8d
movq 0x10(%rbp), %r10
movl -0x7c(%rbp), %eax
xorl %edx, %edx
movl $0x1, %r9d
movl %edx, %esi
movq %r10, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x13210
leaq 0x14b7e(%rip), %rax     # 0x200c8
cmpl $0x2, (%rax)
jne 0xb57b
movq -0x20(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x9060
movq -0x20(%rbp), %rdi
movzbl -0x21(%rbp), %eax
movl %eax, %ecx
leaq 0x10db3(%rip), %rax     # 0x1c320
movq (%rax,%rcx,8), %rsi
callq 0x9180
jmp 0xb603
cmpl $0x0, 0x14ade(%rip)     # 0x20060
je 0xb5a0
movq -0x20(%rbp), %rdi
movzbl -0x21(%rbp), %eax
movl %eax, %ecx
leaq 0x10dcb(%rip), %rax     # 0x1c360
movq (%rax,%rcx,8), %rsi
callq 0x9060
jmp 0xb5ba
movq -0x20(%rbp), %rdi
movzbl -0x21(%rbp), %eax
movl %eax, %ecx
leaq 0x10d6f(%rip), %rax     # 0x1c320
movq (%rax,%rcx,8), %rsi
callq 0x9060
movq -0x18(%rbp), %rdi
callq 0x90a0
cmpq $0x0, %rax
je 0xb5e6
movq -0x20(%rbp), %rdi
leaq 0xbdf9(%rip), %rsi      # 0x173cd
callq 0x9180
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9180
movq -0x20(%rbp), %rdi
leaq 0xbddc(%rip), %rsi      # 0x173cd
callq 0x9180
movq -0x20(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x9180
movq -0x20(%rbp), %rdi
leaq 0xcef2(%rip), %rsi      # 0x18500
callq 0x9180
movl 0x11467(%rip), %eax     # 0x1ca80
addl -0xc(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0xb628
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
jmp 0xb785
movl 0x14a2d(%rip), %esi     # 0x20060
leaq -0x30(%rbp), %rdi
callq 0x95e0
cmpl $0x0, %eax
je 0xb64d
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
jmp 0xb783
cmpq $0x0, -0x30(%rbp)
jne 0xb660
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb78b
cmpl $0x0, 0x149f9(%rip)     # 0x20060
je 0xb685
movq -0x20(%rbp), %rdi
movzbl -0x21(%rbp), %eax
movl %eax, %ecx
leaq 0x10ce6(%rip), %rax     # 0x1c360
movq (%rax,%rcx,8), %rsi
callq 0x9060
jmp 0xb69f
movq -0x20(%rbp), %rdi
movzbl -0x21(%rbp), %eax
movl %eax, %ecx
leaq 0x10c8a(%rip), %rax     # 0x1c320
movq (%rax,%rcx,8), %rsi
callq 0x9060
movq -0x18(%rbp), %rdi
callq 0x90a0
cmpq $0x0, %rax
je 0xb6cb
movq -0x20(%rbp), %rdi
leaq 0xbd14(%rip), %rsi      # 0x173cd
callq 0x9180
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9180
movl $0x80000000, %eax       # imm = 0x80000000
cmpq %rax, -0x30(%rbp)
jbe 0xb6ed
xorl %eax, %eax
subq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq 0xbce8(%rip), %rax      # 0x173cf
movq %rax, -0x78(%rbp)
jmp 0xb6f8
leaq 0xbcd9(%rip), %rax      # 0x173cd
movq %rax, -0x78(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl 0x1137a(%rip), %edx     # 0x1ca80
callq 0xe320
leaq 0x149b6(%rip), %rax     # 0x200c8
cmpl $0x2, (%rax)
jne 0xb743
movq -0x20(%rbp), %rdi
leaq 0xcdde(%rip), %rsi      # 0x18500
callq 0x9180
movq -0x20(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x9180
movq -0x20(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x9180
jmp 0xb76d
movq -0x20(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x9180
movq -0x20(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x9180
movq -0x20(%rbp), %rdi
leaq 0xcd98(%rip), %rsi      # 0x18500
callq 0x9180
movl 0x1130d(%rip), %eax     # 0x1ca80
addl -0xc(%rbp), %eax
movl %eax, -0x34(%rbp)
movq 0x10(%rbp), %rax
movl $0x1, (%rax)
jmp 0xb785
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)