// File: /workspace/github_c_makefile_star2_O2/Oric4ever[P]lcc65/6502/build/../src/sym.c
// Function: constant
Symbol constant(ty, v) Type ty; Value v; {
	struct entry *p;
	unsigned h = v.u&(HASHSIZE-1);

	ty = unqual(ty);
	for (p = constants->buckets[h]; p; p = p->link)
		if (eqtype(ty, p->sym.type, 1))
			switch (ty->op) {
			case CHAR:     if (v.uc == p->sym.u.c.v.uc) return &p->sym; break;
			case SHORT:    if (v.ss == p->sym.u.c.v.ss) return &p->sym; break;
			case INT:      if (v.i  == p->sym.u.c.v.i)  return &p->sym; break;
			case UNSIGNED: if (v.u  == p->sym.u.c.v.u)  return &p->sym; break;
			case FLOAT:    if (v.f  == p->sym.u.c.v.f)  return &p->sym; break;
			case DOUBLE:   if (v.d  == p->sym.u.c.v.d)  return &p->sym; break;
			case ARRAY: case FUNCTION:
			case POINTER:  if (v.p  == p->sym.u.c.v.p)  return &p->sym; break;
			default: assert(0);
			}
	p = (struct entry *) alloc(sizeof *p);
	BZERO(&p->sym, struct symbol);
	p->sym.name = vtoa(ty, v);
	p->sym.scope = CONSTANTS;
	p->sym.type = ty;
	p->sym.sclass = STATIC;
	p->sym.u.c.v = v;
	p->link = constants->buckets[h];
	p->sym.up = constants->list;
	constants->list = &p->sym;
	constants->buckets[h] = p;
	p->refs = 0;	/* (omit) */
	defsymbol(&p->sym);
	return &p->sym;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movl %r14d, %r12d
andl $0x7f, %r12d
cmpl $0xf, (%rdi)
jb 0x15a45
movq 0x10(%r15), %r15
movq %r14, (%rsp)
movq 0x13058(%rip), %rax     # 0x28aa8
leaq (%rax,%r12,8), %rbx
addq $0x18, %rbx
pushq $0x1
popq %rbp
leaq 0x90be(%rip), %r13      # 0x1eb20
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x15adc
movq 0x20(%rbx), %rsi
movq %r15, %rdi
movl %ebp, %edx
callq 0x17b46
testl %eax, %eax
je 0x15ad3
movl (%r15), %eax
decl %eax
cmpl $0xb, %eax
ja 0x15ba2
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
cmpq %r14, 0x48(%rbx)
jne 0x15ad3
jmp 0x15b90
cmpl %r14d, 0x48(%rbx)
jne 0x15ad3
jmp 0x15b90
movsd 0x48(%rbx), %xmm0
ucomisd (%rsp), %xmm0
jne 0x15ad3
jp 0x15ad3
jmp 0x15b90
cmpb %r14b, 0x48(%rbx)
jne 0x15ad3
jmp 0x15b90
cmpw %r14w, 0x48(%rbx)
je 0x15b90
addq $0x90, %rbx
jmp 0x15a62
leaq 0x13c8d(%rip), %rax     # 0x29770
movq (%rax), %rax
movl $0x98, (%rax)
movq 0x8(%rax), %rbx
leaq 0x98(%rbx), %rcx
cmpq 0x10(%rax), %rcx
jae 0x15b03
movq %rcx, 0x8(%rax)
jmp 0x15b17
leaq 0x13c66(%rip), %rsi     # 0x29770
movl $0x98, %edi
callq 0x16438
movq %rax, %rbx
xorl %eax, %eax
xorpd %xmm0, %xmm0
cmpq $0x7f, %rax
ja 0x15b36
leaq (%rbx,%rax), %rcx
addq $0x20, %rax
movupd %xmm0, 0x10(%rcx)
movupd %xmm0, (%rcx)
jmp 0x15b1d
andq $0x0, (%rbx,%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0x13a68
movq %rax, 0x10(%rbx)
movw $0x1, 0x18(%rbx)
movq %r15, 0x20(%rbx)
movb $0x51, 0x1a(%rbx)
movq %r14, 0x48(%rbx)
movq 0x12f45(%rip), %rax     # 0x28aa8
movq 0x18(%rax,%r12,8), %rcx
movq %rcx, 0x90(%rbx)
movq 0x10(%rax), %rcx
movq %rcx, 0x40(%rbx)
movq %rbx, 0x10(%rax)
movq %rbx, 0x18(%rax,%r12,8)
andq $0x0, 0x88(%rbx)
movq %rbx, %rdi
callq 0x18f6d
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x65f2(%rip), %rdi      # 0x1c19b
leaq 0x8fa0(%rip), %rsi      # 0x1eb50
leaq 0x8fa6(%rip), %rcx      # 0x1eb5d
pushq $0x37
popq %rdx
callq 0x30d0