// File: /workspace/github_c_makefile_star2_O1/AK6DN[P]dec-utilities-for-pdp/palbart/palbart.c
// Function: lookup
SYM_T *lookup( char *name )
{
  int     ix;                   /* Insertion index                            */
  int     lx;                   /* Left index                                 */
  int     rx;                   /* Right index                                */

  /* First search the permanent symbols.                                      */
  lx = 0;
  ix = binarySearch( name, lx, number_of_fixed_symbols );

  /* If symbol not in permanent symbol table.                                 */
  if( ix < 0 )
  {
    /* Now try the user symbol table.                                         */
    ix = binarySearch( name, number_of_fixed_symbols, symbol_top );

    /* If symbol not in user symbol table.                                    */
    if( ix < 0 )
    {
      /* Must put symbol in table if index is negative.                       */
      ix = ~ix;
      if( symbol_top + 1 >= SYMBOL_TABLE_SIZE )
      {
        errorSymbol( &symbol_table_full, name, lexstart );
        exit( 1 );
      }

      for( rx = symbol_top; rx >= ix; rx-- )
      {
        symtab[rx + 1] = symtab[rx];
      }
      symbol_top++;

      /* Enter the symbol as UNDEFINED with a value of zero.                  */
      strcpy( symtab[ix].name, name );
      symtab[ix].type = UNDEFINED;
      symtab[ix].val  = 0;
      symtab[ix].xref_count = 0;
      if( xref && pass == 2 )
      {
        xreftab[symtab[ix].xref_index] = 0;
      }
    }
  }

  return( &symtab[ix] );        /* Return the location of the symbol.         */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movl 0x7214(%rip), %r15d     # 0xb404
xorl %esi, %esi
movl %r15d, %edx
callq 0x6a69
testl %eax, %eax
js 0x4205
movl %eax, %ebx
jmp 0x42d4
movl 0x71f5(%rip), %ebp      # 0xb400
movq %r14, %rdi
movl %r15d, %esi
movl %ebp, %edx
callq 0x6a69
movl %eax, %ebx
testl %eax, %eax
jns 0x42d4
cmpl $0xffe, %ebp            # imm = 0xFFE
jg 0x42ee
notl %ebx
movl %ebx, %r15d
cmpl %ebx, %ebp
jl 0x4267
movslq %ebp, %rax
leaq (%rax,%rax,2), %rcx
incq %rax
shlq $0x3, %rcx
addq 0x71ac(%rip), %rcx      # 0xb3f8
movq 0x10(%rcx), %rdx
movq %rdx, 0x28(%rcx)
movups (%rcx), %xmm0
movups %xmm0, 0x18(%rcx)
decq %rax
addq $-0x18, %rcx
cmpq %r15, %rax
jg 0x424c
incl %ebp
movl %ebp, 0x7191(%rip)      # 0xb400
movq 0x7182(%rip), %rax      # 0xb3f8
leaq (,%r15,8), %rcx
leaq (%rcx,%rcx,2), %r12
leaq (%rax,%r12), %rdi
addq $0x4, %rdi
movq %r14, %rsi
callq 0x2070
movq 0x715f(%rip), %rax      # 0xb3f8
xorl %ecx, %ecx
movl %ecx, (%rax,%r12)
movw $0x0, 0xc(%rax,%r12)
movl %ecx, 0x14(%rax,%r12)
cmpb $0x0, 0x709e(%rip)      # 0xb351
je 0x42d4
cmpl $0x2, 0x7134(%rip)      # 0xb3f0
jne 0x42d4
movq 0x728b(%rip), %rcx      # 0xb550
leaq (%r15,%r15,2), %rdx
movslq 0x10(%rax,%rdx,8), %rax
movw $0x0, (%rcx,%rax,2)
movl %ebx, %eax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x7113(%rip), %rax      # 0xb3f8
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl 0x9520(%rip), %edx      # 0xd814
leaq 0x6fdd(%rip), %rdi      # 0xb2d8
movq %r14, %rsi
callq 0x4382
movl $0x1, %edi
callq 0x2190