// File: /workspace/github_c_makefile_star2_O0/AK6DN[P]dec-utilities-for-pdp/macro8x/macro8x.c
// Function: defineSymbol
SYM_T *defineSymbol( char *name, WORD32 val, SYMTYP type, WORD32 start )
{
  SYM_T  *sym;
  WORD32  xref_count;

  val = val & 07777;
  if( strlen( name ) < 1 )
  {
    return( &sym_undefined );   /* Protect against non-existent names.        */
  }
  sym = lookup( name );
  xref_count = 0;               /* Set concordance for normal defintion.      */

  if( M_DEFINED( sym->type ) && sym->val != val && M_NOTRDEF( sym -> type ))
  {
    if( pass == 2 )
    {
      errorSymbol( &redefined_symbol, sym->name, start );
      type = type | REDEFINED;
      sym->xref_count++;      /* Referenced symbol, count it.                */
      xref_count = sym->xref_count;
    }
  return ( sym );
  }
  if( M_FIXED( sym->type ))
  {
  return ( sym );
  }

  if( pass == 2 && xref )
  {
    /* Put the definition line number in the concordance table.               */
    /* Defined symbols are not counted as references.                         */
    xreftab[sym->xref_index] = lineno;
    /* Put the line number in the concordance table.                          */
    xreftab[sym->xref_index + xref_count] = lineno;
  }

  /* Now set the value and the type.                                          */
  sym->val = val;
  sym->type = ( pass == 1 ) ? ( type | CONDITION ) : type;
  return( sym );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rax
andq $0xfff, %rax            # imm = 0xFFF
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20b0
cmpq $0x1, %rax
jae 0x2e24
leaq 0xbedd(%rip), %rax      # 0xecf8
movq %rax, -0x8(%rbp)
jmp 0x2f5c
movq -0x10(%rbp), %rdi
callq 0x4ee0
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x2eb9
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x18(%rbp), %rax
je 0x2eb9
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0x14e, %eax            # imm = 0x14E
cmpl $0x0, %eax
je 0x2eb9
cmpq $0x2, 0xdf63(%rip)      # 0x10dd0
jne 0x2eac
movq -0x30(%rbp), %rsi
addq $0x4, %rsi
movq -0x28(%rbp), %rdx
leaq 0xbbbe(%rip), %rdi      # 0xea40
callq 0x5140
movl -0x1c(%rbp), %eax
orl $0x11, %eax
movl %eax, -0x1c(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2f5c
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x2, %eax
jne 0x2ed4
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2f5c
cmpq $0x2, 0xdef4(%rip)      # 0x10dd0
jne 0x2f22
movzbl 0xbe51(%rip), %eax      # 0xed36
cmpl $0x0, %eax
je 0x2f22
movslq 0x179ab(%rip), %rdx     # 0x1a89c
movq 0x16038(%rip), %rax     # 0x18f30
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
movslq 0x17991(%rip), %rdx     # 0x1a89c
movq 0x1601e(%rip), %rax     # 0x18f30
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
addq -0x38(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
cmpq $0x1, 0xde9a(%rip)      # 0x10dd0
jne 0x2f45
movl -0x1c(%rbp), %eax
orl $0x80, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2f4b
movl -0x1c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)