// File: /workspace/github_c_makefile_star2_O0/Nico01[P]obj2asm/odisasm.c
// Function: mod0
int mod0( 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;
    PUB_T           *pub_rec;
    STRUC_T         *pub_struct;
    int             ref_seg;
    char            this_member[NAMESIZE+1+1];  /* 1 for ., 1 for \0 */
    char            temp[16];

    this_member[0] = '\0';

    if ( (r_m == 6 && !addr_large) || (r_m == 5 && addr_large) ) {
        if ( over_seg != -1 ) {
            ref_seg = 17+over_seg;
        } else {
            ref_seg = DS;
        }
        switch( data_check( 2+sib_offset ) ) {
            case BAD:
                result = -1;
                return( result );
            case LABEL:
                result = -1;
                return( result );
            case FIXUP:
                if ( fix_rec->word_sized && fix_rec->extended == addr_large ) {
                    get_fix( text, 0, FALSE, size_bytes, 
                                            type, TRUE, size_known, ref_seg );
                    if ( strlen(sib_text) ) {
                        strcat( text, "[" );
                        strcat( text, sib_text );
                        strcat( text, "]" );
                    }
                    result = addr_bytes+sib_offset;
                } else {
                    result = -1;
                }
                return( result );
            case NORMAL:
                if ( check_getv( &offset, size_large ) ) {
                    result = -1;
                    return( result );
                }
                if ( add_labels ) {
                    pub_rec = check_public( 0, 0, offset, 'S' );
                } else {
                    pub_rec = NULL;
                }
                if ( pub_rec ) {
                    offset -= pub_rec->offset;
                    pub_struct = pub_rec->structure;
                    if ( pub_struct ) {
                        find_member( this_member, pub_struct, &offset );
                    }
                    if ( offset != 0 ) {
                        out_hexize( offset, temp, size_bytes );
                        sprintf( text, "%s%s + %s",
                                 pub_rec->name, this_member, temp );
                    } else {
                        sprintf( text, "%s%s", pub_rec->name, this_member );
                    }
                } else {
                    out_hexize( offset, temp, size_bytes );
                    if ( compatibility == 2 ) {
                        sprintf( text, " .%s", temp );
                    } else {
                        if ( over_seg == -1 ) {
                            sprintf( text, "ds:[%s", temp );
                        } else {
                            sprintf( text, "[%s", temp );
                        }
                        if ( strlen( sib_text ) ) {
                            strcat( text, "+" );
                            strcat( text, sib_text );
                        }
                        strcat( text, "]" );
                    }
                }
                result = addr_bytes+sib_offset;
                *size_known = FALSE;
                return( result );
        }
    }
    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, "]" );
    result = sib_offset;
    *size_known = TRUE;
    return( result );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %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)
movb $0x0, -0x80(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x6, %eax
jne 0xaf0d
cmpl $0x0, 0x15155(%rip)     # 0x20060
je 0xaf27
movzbl -0x21(%rbp), %eax
cmpl $0x5, %eax
jne 0xb224
cmpl $0x0, 0x1513f(%rip)     # 0x20060
je 0xb224
cmpl $-0x1, 0x11b4a(%rip)    # 0x1ca78
je 0xaf3e
movl 0x11b42(%rip), %eax     # 0x1ca78
addl $0x11, %eax
movl %eax, -0x4c(%rbp)
jmp 0xaf45
movl $0x14, -0x4c(%rbp)
movl -0xc(%rbp), %edi
addl $0x2, %edi
callq 0xe580
movl %eax, %ecx
movq %rcx, -0x98(%rbp)
subl $0x3, %eax
ja 0xb222
movq -0x98(%rbp), %rax
leaq 0xc104(%rip), %rcx      # 0x17074
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xb2b5
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xb2b5
leaq 0x15344(%rip), %rax     # 0x202e8
movq (%rax), %rax
cmpl $0x0, 0x3c(%rax)
je 0xb03c
leaq 0x15330(%rip), %rax     # 0x202e8
movq (%rax), %rax
movl 0x38(%rax), %eax
cmpl 0x1509c(%rip), %eax     # 0x20060
jne 0xb03c
movq -0x20(%rbp), %rdi
movl 0x11aac(%rip), %ecx     # 0x1ca7c
movl -0x28(%rbp), %r8d
movq 0x10(%rbp), %r10
movl -0x4c(%rbp), %eax
xorl %edx, %edx
movl $0x1, %r9d
movl %edx, %esi
movq %r10, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x13210
movq -0x18(%rbp), %rdi
callq 0x90a0
cmpq $0x0, %rax
je 0xb02e
movq -0x20(%rbp), %rdi
leaq 0xc3ae(%rip), %rsi      # 0x173ba
callq 0x9180
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9180
movq -0x20(%rbp), %rdi
leaq 0xd4d7(%rip), %rsi      # 0x18500
callq 0x9180
movl 0x11a4c(%rip), %eax     # 0x1ca80
addl -0xc(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0xb043
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xb2b5
movl 0x15008(%rip), %esi     # 0x2005c
leaq -0x30(%rbp), %rdi
callq 0x95e0
cmpl $0x0, %eax
je 0xb074
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xb2b5
leaq 0x15051(%rip), %rax     # 0x200cc
cmpl $0x0, (%rax)
je 0xb098
movq -0x30(%rbp), %rdx
xorl %esi, %esi
movl $0x53, %ecx
movl %esi, %edi
callq 0x12720
movq %rax, -0x40(%rbp)
jmp 0xb0a0
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xb149
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0xb0e2
leaq -0x80(%rbp), %rdi
movq -0x48(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x12c10
cmpq $0x0, -0x30(%rbp)
je 0xb126
movq -0x30(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl 0x11982(%rip), %edx     # 0x1ca7c
callq 0xe320
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rdx
addq $0x10, %rdx
leaq -0x80(%rbp), %rcx
leaq -0x90(%rbp), %r8
leaq 0xc29f(%rip), %rsi      # 0x173bc
movb $0x0, %al
callq 0x9190
jmp 0xb144
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rdx
addq $0x10, %rdx
leaq -0x80(%rbp), %rcx
leaq 0xd3de(%rip), %rsi      # 0x1851b
movb $0x0, %al
callq 0x9190
jmp 0xb201
movq -0x30(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl 0x11922(%rip), %edx     # 0x1ca7c
callq 0xe320
leaq 0x14f62(%rip), %rax     # 0x200c8
cmpl $0x2, (%rax)
jne 0xb186
movq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rdx
leaq 0xc1a8(%rip), %rsi      # 0x17325
movb $0x0, %al
callq 0x9190
jmp 0xb1ff
cmpl $-0x1, 0x118eb(%rip)    # 0x1ca78
jne 0xb1aa
movq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rdx
leaq 0xc225(%rip), %rsi      # 0x173c6
movb $0x0, %al
callq 0x9190
jmp 0xb1c3
movq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rdx
leaq 0xc20d(%rip), %rsi      # 0x173c9
movb $0x0, %al
callq 0x9190
movq -0x18(%rbp), %rdi
callq 0x90a0
cmpq $0x0, %rax
je 0xb1ef
movq -0x20(%rbp), %rdi
leaq 0xc1f0(%rip), %rsi      # 0x173cd
callq 0x9180
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9180
movq -0x20(%rbp), %rdi
leaq 0xd306(%rip), %rsi      # 0x18500
callq 0x9180
jmp 0xb201
movl 0x11879(%rip), %eax     # 0x1ca80
addl -0xc(%rbp), %eax
movl %eax, -0x34(%rbp)
movq 0x10(%rbp), %rax
movl $0x0, (%rax)
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xb2b5
jmp 0xb224
cmpl $0x0, 0x14e35(%rip)     # 0x20060
je 0xb249
movq -0x20(%rbp), %rdi
movzbl -0x21(%rbp), %eax
movl %eax, %ecx
leaq 0x11122(%rip), %rax     # 0x1c360
movq (%rax,%rcx,8), %rsi
callq 0x9060
jmp 0xb263
movq -0x20(%rbp), %rdi
movzbl -0x21(%rbp), %eax
movl %eax, %ecx
leaq 0x110c6(%rip), %rax     # 0x1c320
movq (%rax,%rcx,8), %rsi
callq 0x9060
movq -0x18(%rbp), %rdi
callq 0x90a0
cmpq $0x0, %rax
je 0xb28f
movq -0x20(%rbp), %rdi
leaq 0xc150(%rip), %rsi      # 0x173cd
callq 0x9180
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9180
movq -0x20(%rbp), %rdi
leaq 0xd266(%rip), %rsi      # 0x18500
callq 0x9180
movl -0xc(%rbp), %eax
movl %eax, -0x34(%rbp)
movq 0x10(%rbp), %rax
movl $0x1, (%rax)
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)