// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/crossassemblers/macro1/macro1.c
// Function: defineSymbol
SYM_T *defineSymbol( char *name, WORD32 val, SYMTYP type, WORD32 start )
{
    SYM_T  *sym;
    WORD32  xref_count;

    if( strlen( name ) < 1 )
    {
	return( &sym_undefined );		/* Protect against non-existent names. */
    }
    sym = lookup( name, type );
    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;
	    /* moved inside "if pass2" -plb 10/2/03 allow redefinition
	     * of predefined symbols during pass1
	     */
	    return ( sym );
	}
    }

    if( pass == 2 && xref )
    {
	/* Put the definition line number in the concordance table. */
	/* Defined symbols are not counted as references. */
	if (sym->xref_index >= 0) {	/* beware macro dummies */
	    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 & 0777777;
    sym->type = type;
    return( sym );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2090
cmpq $0x1, %rax
jae 0x2774
leaq 0x95c5(%rip), %rax      # 0xbd30
movq %rax, -0x8(%rbp)
jmp 0x2878
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x4850
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x2801
movq -0x28(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x14(%rbp), %eax
je 0x2801
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0x14a, %eax            # imm = 0x14A
cmpl $0x0, %eax
je 0x2801
cmpl $0x2, 0x95c4(%rip)      # 0xbd80
jne 0x27ff
movq -0x28(%rbp), %rsi
addq $0x4, %rsi
movl -0x1c(%rbp), %edx
leaq 0x9370(%rip), %rdi      # 0xbb40
callq 0x4c10
movl -0x18(%rbp), %eax
orl $0x11, %eax
movl %eax, -0x18(%rbp)
movq -0x28(%rbp), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
movq -0x28(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2878
jmp 0x2801
cmpl $0x2, 0x9578(%rip)      # 0xbd80
jne 0x2857
movzbl 0x9558(%rip), %eax      # 0xbd69
cmpl $0x0, %eax
je 0x2857
movq -0x28(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jl 0x2855
movl 0xb936(%rip), %edx      # 0xe15c
movq 0x968b(%rip), %rax      # 0xbeb8
movq -0x28(%rbp), %rcx
movslq 0x10(%rcx), %rcx
movl %edx, (%rax,%rcx,4)
movl 0xb91e(%rip), %edx      # 0xe15c
movq 0x9673(%rip), %rax      # 0xbeb8
movq -0x28(%rbp), %rcx
movl 0x10(%rcx), %ecx
addl -0x2c(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x2857
movl -0x14(%rbp), %ecx
andl $0x3ffff, %ecx          # imm = 0x3FFFF
movq -0x28(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0x18(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)