// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/symbol.c
// Function: bind_symbol_with_scope
void bind_symbol_with_scope(struct symbol *sym, struct ident *ident, enum namespace ns, struct scope *scope)
{
	if (sym->bound) {
		sparse_error(sym->pos, "internal error: symbol type already bound");
		return;
	}
	if (ident->reserved && (ns & (NS_TYPEDEF | NS_STRUCT | NS_LABEL | NS_SYMBOL))) {
		sparse_error(sym->pos, "Trying to use reserved word '%s' as identifier", show_ident(ident));
		return;
	}
	sym->namespace = ns;
	sym->next_id = ident->symbols;
	ident->symbols = sym;
	if (sym->ident && sym->ident != ident)
		warning(sym->pos, "Symbol '%s' already bound", show_ident(sym->ident));
	sym->ident = ident;
	sym->bound = 1;

	if (ns == NS_SYMBOL && toplevel(scope)) {
		unsigned mod = MOD_ADDRESSABLE | MOD_TOPLEVEL;

		inherit_static(sym);

		scope = global_scope;
		if (sym->ctype.modifiers & MOD_STATIC ||
		    is_extern_inline(sym)) {
			scope = file_scope;
			mod = MOD_TOPLEVEL;
		}
		sym->ctype.modifiers |= mod;
	}
	bind_scope(sym, scope);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x15, %eax
andl $0x1, %eax
cmpb $0x0, %al
je 0x40792
movq -0x8(%rbp), %rax
movq 0x4(%rax), %rdi
leaq 0x28cee(%rip), %rsi     # 0x69474
movb $0x0, %al
callq 0x16f90
jmp 0x40903
movq -0x10(%rbp), %rax
movb 0x11(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x407df
movl -0x14(%rbp), %eax
andl $0x1e, %eax
cmpl $0x0, %eax
je 0x407df
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x44150
movq %rax, %rdx
movq -0x30(%rbp), %rax
movq 0x4(%rax), %rdi
leaq 0x28ccb(%rip), %rsi     # 0x6949e
movb $0x0, %al
callq 0x16f90
jmp 0x40903
movl -0x14(%rbp), %edx
movq -0x8(%rbp), %rax
movl (%rax), %ecx
andl $0x1ff, %edx            # imm = 0x1FF
shll $0x8, %edx
andl $0xfffe00ff, %ecx       # imm = 0xFFFE00FF
orl %edx, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x4085e
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
cmpq -0x10(%rbp), %rax
je 0x4085e
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x44150
movq %rax, %rdx
movq -0x38(%rbp), %rax
movq 0x4(%rax), %rdi
leaq 0x28c76(%rip), %rsi     # 0x694cd
movb $0x0, %al
callq 0x16d80
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
andl $0xffdfffff, %ecx       # imm = 0xFFDFFFFF
orl $0x200000, %ecx         # imm = 0x200000
movl %ecx, (%rax)
cmpl $0x10, -0x14(%rbp)
jne 0x408f6
movq -0x20(%rbp), %rdi
callq 0x40910
cmpl $0x0, %eax
je 0x408f6
movl $0x110, -0x24(%rbp)     # imm = 0x110
movq -0x8(%rbp), %rdi
callq 0x40950
leaq 0x48817(%rip), %rax     # 0x890c0
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
andq $0x4, %rax
cmpq $0x0, %rax
jne 0x408d0
movq -0x8(%rbp), %rdi
callq 0x409e0
cmpl $0x0, %eax
je 0x408e5
leaq 0x487e1(%rip), %rax     # 0x890b8
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x10, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, %ecx
movq -0x8(%rbp), %rax
orq 0x68(%rax), %rcx
movq %rcx, 0x68(%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x31d90
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)