// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
movl 0x8674(%rip), %edx      # 0xd464
callq 0x8300
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x4f6b
movq -0x8(%rbp), %rdi
movl 0x8658(%rip), %esi      # 0xd464
movl 0x864e(%rip), %edx      # 0xd460
callq 0x8300
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x4f69
movl -0xc(%rbp), %eax
xorl $-0x1, %eax
movl %eax, -0xc(%rbp)
movl 0x862d(%rip), %eax      # 0xd460
addl $0x1, %eax
cmpl $0x1000, %eax           # imm = 0x1000
jl 0x4e5d
movq -0x8(%rbp), %rsi
movl 0xaa2d(%rip), %edx      # 0xf874
leaq 0x847a(%rip), %rdi      # 0xd2c8
callq 0x5030
movl $0x1, %edi
callq 0x2190
movl 0x85fd(%rip), %eax      # 0xd460
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jl 0x4eb8
movq 0x85e3(%rip), %rax      # 0xd458
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x85cc(%rip), %rcx      # 0xd458
movslq -0x14(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x4e66
movl 0x85a2(%rip), %eax      # 0xd460
addl $0x1, %eax
movl %eax, 0x8599(%rip)      # 0xd460
movq 0x858a(%rip), %rdi      # 0xd458
movslq -0xc(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
movq -0x8(%rbp), %rsi
callq 0x2060
movq 0x856b(%rip), %rax      # 0xd458
movslq -0xc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x0, (%rax)
movq 0x8553(%rip), %rax      # 0xd458
movslq -0xc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw $0x0, 0xc(%rax)
movq 0x853b(%rip), %rax      # 0xd458
movslq -0xc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x14(%rax)
movzbl 0x847b(%rip), %eax      # 0xd3b1
cmpl $0x0, %eax
je 0x4f67
cmpl $0x2, 0x850e(%rip)      # 0xd450
jne 0x4f67
movq 0x8665(%rip), %rax      # 0xd5b0
movq 0x8506(%rip), %rcx      # 0xd458
movslq -0xc(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movslq 0x10(%rcx), %rcx
movw $0x0, (%rax,%rcx,2)
jmp 0x4f69
jmp 0x4f6b
movq 0x84e6(%rip), %rax      # 0xd458
movslq -0xc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)