// File: /workspace/github_c_makefile_star2_O1/Nico01[P]obj2asm/odisasm.c
// Function: disp16
int disp16( byte, text, class )
    uchar   byte;
    char            *text;
    int             class;
{
    dword   offset;
    dword   dest;
    int             dummy;
#if 0
    int             bad_size;
#endif
    char            line[60];
    char            *short_text;
    PUB_T           *pub_rec;
    int             data_size;

    byte = byte;               /* Prevent unused variable warnings */
    class=class;              /* Prevent unused variable warnings */

    data_size = addr_bytes;

    if ( over_seg != -1 )               /* No segment overide allowed */
        return( 0 );

    switch( data_check( 1 ) ) {
    case BAD:
         return( 0 );
    case LABEL:
         return( 0 );
    case FIXUP:
         if ( fix_rec->word_sized && fix_rec->extended == addr_large
                                  && fix_rec->relate == 0 ) {
             get_fix( line, 1, FALSE, size_bytes, NEAR, TRUE, &dummy, CS );
             adjust_assumes();
             instr_opcode( text );
             instr_operand( line );
             return( 1 + data_size );
         } else {
             return( 0 );
         }
    case NORMAL:
         if ( check_getv( &offset, addr_large ) ) {
             return( 0 );
         }
         /* note: the next if actually checks for 1 byte too far in
         ** the negative direction. but this is ok, because it would be
         ** replaced by a short jmp
         */
         if ( offset < 0x80 || offset >= 0xFFFFFF7FL ) {
#if 0
             bad_size = TRUE;
#endif
             short_text = "near ptr ";
         } else {
             short_text = "";
#if 0
             bad_size = FALSE;
#endif
         }

         dest = inst_offset + offset + addr_bytes + 1;
         pub_rec = check_public( 1, segment, dest, 'L' );

         if ( pub_rec ) {
             offset = dest - pub_rec->offset;
             if ( offset > 0L ) {
                 if ( addr_large ) {
                     sprintf( line, "%s%s + 0%08lXh", short_text,
                              pub_rec->name, offset );
                 } else {
                     sprintf( line, "%s%s + 0%04lXh", short_text,
                              pub_rec->name, offset );
                 }
             } else {
                 sprintf( line, "%s%s", short_text, pub_rec->name );
             }
         } else {
             if ( compatibility == 2 ) {
                 if ( addr_large ) {
                     sprintf( line, "%s .0%08lXh", short_text, offset );
                 } else {
                     sprintf( line, "%s .0%04lXh", short_text, offset );
                 }
             } else {
                 if ( addr_large ) {
                     sprintf( line, "%s[%s:0%08lXh]", short_text,
                              cseg_name, offset );
                 } else {
                     sprintf( line, "%s[%s:0%04lXh]", short_text,
                              cseg_name, offset );
                 }
             }
         }

         instr_opcode( text );
         instr_operand( line );
#if 0
         if ( bad_size ) {
             if ( pass == 3 ) {
                 out_comment( "Large jump translated into short" );
             }
             instr_opcode( "nop" );
             if ( pass == 3 ) {
                 out_comment( "Nop inserted to retain proper length" );
             }
         }
#endif
         return( 1 + data_size );
    }
    return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
xorl %ebp, %ebp
cmpl $-0x1, 0xf512(%rip)     # 0x19a88
je 0xa589
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rbx
movl 0xf4fd(%rip), %r13d     # 0x19a90
movl $0x1, %edi
callq 0xcca8
testl %eax, %eax
je 0xa600
cmpl $0x2, %eax
jne 0xa578
leaq 0x12b6b(%rip), %rax     # 0x1d118
movq (%rax), %rax
cmpl $0x0, 0x3c(%rax)
je 0xa578
movl 0x38(%rax), %ecx
cmpl 0x128c9(%rip), %ecx     # 0x1ce88
jne 0xa578
cmpl $0x0, 0x14(%rax)
jne 0xa578
movl 0xf4bf(%rip), %ecx      # 0x19a8c
leaq 0x8(%rsp), %rax
leaq 0x10(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x12
pushq %rax
callq 0x10207
addq $0x10, %rsp
callq 0xf919
jmp 0xa748
cmpl $0x0, 0x12881(%rip)     # 0x1ce88
je 0xa615
leaq 0x8(%rsp), %rdi
callq 0x971c
jmp 0xa61f
leaq 0x8(%rsp), %rdi
callq 0x96e5
testl %eax, %eax
jne 0xa578
movq 0x8(%rsp), %r15
movabsq $-0xffffff7f, %rax      # imm = 0xFFFFFFFF00000081
leaq (%r15,%rax), %rcx
subq $-0x80, %rax
cmpq %rax, %rcx
leaq 0x8cb6(%rip), %rax      # 0x132fe
leaq 0x9abd(%rip), %r14      # 0x1410c
cmovbq %rax, %r14
leaq 0x12b3e(%rip), %rax     # 0x1d198
movslq 0xf42f(%rip), %rcx      # 0x19a90
movq (%rax), %rax
addq %r15, %rax
leaq (%rcx,%rax), %r12
incq %r12
leaq 0x12b1b(%rip), %rax     # 0x1d190
movl (%rax), %esi
movl $0x1, %edi
movq %r12, %rdx
movl $0x4c, %ecx
callq 0xfad5
testq %rax, %rax
je 0xa6b1
subq 0x8(%rax), %r12
movq %r12, 0x8(%rsp)
jne 0xa6d0
addq $0x10, %rax
leaq 0x9da7(%rip), %rsi      # 0x1444b
leaq 0x10(%rsp), %rdi
movq %r14, %rdx
movq %rax, %rcx
jmp 0xa726
leaq 0x12840(%rip), %rax     # 0x1cef8
cmpl $0x2, (%rax)
movl 0x127c7(%rip), %eax     # 0x1ce88
jne 0xa6e6
testl %eax, %eax
je 0xa714
leaq 0x8c49(%rip), %rsi      # 0x13317
jmp 0xa71b
addq $0x10, %rax
cmpl $0x0, 0x127ad(%rip)     # 0x1ce88
je 0xa6fd
leaq 0x8c24(%rip), %rsi      # 0x13308
jmp 0xa704
leaq 0x12abb(%rip), %rcx     # 0x1d1a8
movq (%rcx), %rcx
testl %eax, %eax
je 0xa72f
leaq 0x8c34(%rip), %rsi      # 0x1332f
jmp 0xa736
leaq 0x8bd0(%rip), %rsi      # 0x132d4
leaq 0x10(%rsp), %rdi
movq %r14, %rdx
movq %rax, %rcx
movq %r12, %r8
jmp 0xa741
leaq 0x8c08(%rip), %rsi      # 0x13323
leaq 0x10(%rsp), %rdi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x91b0
jmp 0xa748
leaq 0x8bb9(%rip), %rsi      # 0x132ef
leaq 0x10(%rsp), %rdi
movq %r14, %rdx
movq %r15, %r8
xorl %eax, %eax
callq 0x91b0
movq %rbx, %rdi
callq 0x97c1
leaq 0x12811(%rip), %rax     # 0x1cf68
cmpl $0x3, (%rax)
jne 0xa766
leaq 0x10(%rsp), %rdi
callq 0xc9d9
incl %r13d
movl %r13d, %ebp
jmp 0xa578