// File: /workspace/github_c_makefile_star2_O2/Nico01[P]obj2asm/oprocess.c
// Function: data_check
int data_check( offset )
    word    offset;
{
    int             direct;

    /*
    ** Are we at a public symbol?
    */
    pub_search.seg_idx = segment;
    pub_search.offset  = inst_offset + offset;
    direct = RIGHT;
    while ( pub_node != public_tree
            && (direct = pub_compare( &pub_search, pub_rec )) == LEFT ) {
        lone_public();
        pub_advance();
    }
    if ( direct == EQUAL ) {
        return( LABEL );
    }

    /*
    ** Are we at a fix-up position?
    */
    fix_search.seg_idx    = segment;
    fix_search.dat_offset = data_offset;
    fix_search.offset     = (int)(inst_offset - data_offset) + offset;
    direct = RIGHT;
    while ( fix_node != fix_tree 
            && (direct = fix_compare( &fix_search, fix_rec )) == LEFT ) {
        fix_advance();
    }
    /* Are we on a fixup that is in the right position?  We can't just test
    ** whether the "direct==EQUAL" because we could have fixups from the
    ** next data record showing up.
    */
    if ( fix_rec->seg_idx == segment
      && fix_rec->dat_offset + fix_rec->offset == inst_offset + offset ) {
        return( FIXUP );
    }
    /*
    ** Are we close to a public symbol? (prevents 2 byte operands)
    */
    if ( pub_node != public_tree 
            && pub_rec->seg_idx == pub_search.seg_idx 
            && pub_rec->offset  == pub_search.offset + 1 ) {
        return( BAD );
    }
    /*
    ** Are we close to a fix-up? (prevents 2 byte operands)
    */
    if ( fix_node != fix_tree
      && fix_rec->seg_idx == segment
      && fix_rec->dat_offset + fix_rec->offset == inst_offset + offset + 1 ) {
        return( BAD );
    }
    return( 0 );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebp
leaq 0xfa2e(%rip), %rax      # 0x1c190
movl (%rax), %eax
leaq 0xf92d(%rip), %r14      # 0x1c098
movl %eax, (%r14)
leaq 0xfa23(%rip), %r13      # 0x1c198
movl %edi, %ebx
movq (%r13), %rax
addq %rbx, %rax
movq %rax, 0x8(%r14)
leaq 0xf8f7(%rip), %r15      # 0x1c080
leaq 0xf818(%rip), %r12      # 0x1bfa8
movq (%r15), %rax
cmpq (%r12), %rax
je 0xc7c7
leaq 0xf8e8(%rip), %rax      # 0x1c088
movq (%rax), %rsi
movq %r14, %rdi
callq 0x113c0
testl %eax, %eax
jne 0xc7bb
callq 0xc6c6
callq 0xc654
jmp 0xc790
cmpl $0x2, %eax
jne 0xc7c7
pushq $0x1
jmp 0xc85f
movq %rbx, (%rsp)
leaq 0xf9be(%rip), %rax      # 0x1c190
movl (%rax), %eax
leaq 0xf945(%rip), %r14      # 0x1c120
movl %eax, (%r14)
leaq 0x10eab(%rip), %rax     # 0x1d690
movq (%rax), %rax
movq %rax, 0x8(%r14)
movl (%r13), %ecx
subl %eax, %ecx
addl %ebp, %ecx
movl %ecx, 0x10(%r14)
leaq 0xf911(%rip), %rbp      # 0x1c110
leaq 0xf7ca(%rip), %r13      # 0x1bfd0
leaq 0xf90b(%rip), %rbx      # 0x1c118
movq (%rbp), %rax
cmpq (%r13), %rax
je 0xc82d
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x109f0
testl %eax, %eax
jne 0xc82d
callq 0xc67a
jmp 0xc80d
movq (%rbx), %rcx
movl (%rcx), %edx
leaq 0xf957(%rip), %rax      # 0x1c190
movl (%rax), %esi
cmpl %esi, %edx
movq (%rsp), %r9
jne 0xc862
movslq 0x10(%rcx), %rax
addq 0x8(%rcx), %rax
leaq 0xf946(%rip), %rdi      # 0x1c198
movq (%rdi), %rdi
addq %r9, %rdi
cmpq %rdi, %rax
jne 0xc862
pushq $0x2
popq %rax
jmp 0xc8c1
movq (%r15), %rdi
pushq $0x3
popq %rax
cmpq (%r12), %rdi
leaq 0xf825(%rip), %r10      # 0x1c098
je 0xc894
leaq 0xf80c(%rip), %rdi      # 0x1c088
movq (%rdi), %rdi
movl (%rdi), %r8d
cmpl (%r10), %r8d
jne 0xc894
movq 0x8(%r10), %r8
incq %r8
cmpq %r8, 0x8(%rdi)
je 0xc8c1
cmpl %esi, %edx
jne 0xc8bf
movq (%r13), %rdx
cmpq %rdx, (%rbp)
je 0xc8bf
movslq 0x10(%rcx), %rdx
addq 0x8(%rcx), %rdx
leaq 0xf8e7(%rip), %rcx      # 0x1c198
movq (%rcx), %rcx
addq %r9, %rcx
incq %rcx
cmpq %rcx, %rdx
je 0xc8c1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq