// File: /workspace/github_c_makefile_star2_O1/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, %ebx
leaq 0x104d4(%rip), %rax     # 0x1d190
movl (%rax), %eax
leaq 0x103d3(%rip), %rcx     # 0x1d098
movl %eax, (%rcx)
leaq 0x104ca(%rip), %rax     # 0x1d198
movl %edi, %r15d
movq (%rax), %rax
addq %r15, %rax
movq %rax, 0x8(%rcx)
leaq 0x1039e(%rip), %rbp     # 0x1d080
movq (%rbp), %rax
leaq 0x102bb(%rip), %r12     # 0x1cfa8
cmpq (%r12), %rax
je 0xcd4a
leaq 0x1038e(%rip), %r13     # 0x1d088
leaq 0x10397(%rip), %r14     # 0x1d098
movq (%r13), %rsi
movq %r14, %rdi
callq 0x11b60
testl %eax, %eax
jne 0xcd3a
callq 0xcc20
movq (%rbp), %rdi
movl $0x1, %esi
callq 0x127da
movq %rax, (%rbp)
movq 0x20(%rax), %rcx
movq %rcx, (%r13)
cmpq (%r12), %rax
jne 0xcd01
xorl %ecx, %ecx
jmp 0xcd3c
movl %eax, %ecx
movl $0x1, %eax
cmpl $0x2, %ecx
je 0xce78
movq %r15, (%rsp)
leaq 0x1043b(%rip), %rax     # 0x1d190
movl (%rax), %eax
leaq 0x103c2(%rip), %rcx     # 0x1d120
movl %eax, (%rcx)
leaq 0x11929(%rip), %rax     # 0x1e690
movq (%rax), %rax
movq %rax, 0x8(%rcx)
leaq 0x10423(%rip), %rdx     # 0x1d198
movl (%rdx), %edx
subl %eax, %edx
addl %ebx, %edx
movl %edx, 0x10(%rcx)
leaq 0x1038b(%rip), %r14     # 0x1d110
movq (%r14), %rax
leaq 0x10241(%rip), %r13     # 0x1cfd0
cmpq (%r13), %rax
je 0xcdcf
leaq 0x1037c(%rip), %r15     # 0x1d118
leaq 0x1037d(%rip), %rbx     # 0x1d120
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x11178
testl %eax, %eax
jne 0xcdcf
movq (%r14), %rdi
movl $0x1, %esi
callq 0x127da
movq %rax, (%r14)
movq 0x20(%rax), %rcx
movq %rcx, (%r15)
cmpq (%r13), %rax
jne 0xcda3
leaq 0x10342(%rip), %rax     # 0x1d118
movq (%rax), %rcx
movl (%rcx), %edx
leaq 0x103ae(%rip), %rax     # 0x1d190
movl (%rax), %esi
cmpl %esi, %edx
movq (%rsp), %r9
jne 0xce0b
movslq 0x10(%rcx), %rdi
addq 0x8(%rcx), %rdi
leaq 0x1039d(%rip), %rax     # 0x1d198
movq (%rax), %r8
addq %r9, %r8
movl $0x2, %eax
cmpq %r8, %rdi
je 0xce78
movq (%rbp), %rax
cmpq (%r12), %rax
je 0xce46
leaq 0x1026c(%rip), %rax     # 0x1d088
movq (%rax), %rdi
movl (%rdi), %eax
leaq 0x10270(%rip), %r8      # 0x1d098
cmpl (%r8), %eax
jne 0xce46
leaq 0x10264(%rip), %rax     # 0x1d098
movq 0x8(%rax), %r8
incq %r8
movl $0x3, %eax
cmpq %r8, 0x8(%rdi)
je 0xce78
cmpl %esi, %edx
jne 0xce76
movq (%r13), %rax
cmpq %rax, (%r14)
je 0xce76
movslq 0x10(%rcx), %rdx
addq 0x8(%rcx), %rdx
leaq 0x10336(%rip), %rax     # 0x1d198
movq (%rax), %rax
leaq (%r9,%rax), %rcx
incq %rcx
movl $0x3, %eax
cmpq %rcx, %rdx
je 0xce78
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq