// File: /workspace/github_c_makefile_star2_O0/Oric4ever[P]lcc65/6502/build/../src/decl.c
// Function: dclglobal
static Symbol dclglobal(int sclass, char *id, Type ty, Coordinate *pos) {
	Symbol p, q;

	if (sclass == 0 || sclass == REGISTER)
		sclass = AUTO;
	if ((p = lookup(id, identifiers)) && p->scope == GLOBAL) {
		if (p->sclass != TYPEDEF && eqtype(ty, p->type, 1))
			ty = composite(ty, p->type);
		else
			error("redeclaration of `%s' previously declared at %w\n",
				p->name, &p->src);
		if (!isfunc(ty) && p->defined && t == '=')
			error("redefinition of `%s' previously defined at %w\n",
				p->name, &p->src);
		if (p->sclass == STATIC && sclass == AUTO
		||  p->sclass != STATIC && sclass == STATIC)
			warning("inconsistent linkage for `%s' previously declared at %w\n",
				p->name, &p->src);
	} else if (sclass == STATIC && !isfunc(ty) && ty->size == 0 && t != '=')
		warning("undefined size for static `%t %s'\n", ty, id);
	if (p == 0 || p->scope != GLOBAL)
		p = install(id, &globals, 1);
	p->type = ty;
	if (p->sclass == 0 || sclass != EXTERN && p->sclass != STATIC)
		p->sclass = sclass;
	if (p->sclass != STATIC) {
		nglobals++;
		if (Aflag >= 2 && nglobals == 512)
			warning("more than 511 external identifiers\n");
	}
	p->src = *pos;
	if (!p->defined)
		defsymbol(p);
	if (q = lookup(p->name, externals)) {
		if ((p->sclass == AUTO ? EXTERN : p->sclass) != q->sclass
		|| !eqtype(p->type, q->type, 1))
			warning("declaration of `%s' does not match previous declaration at %w\n",
				p->name, &q->src);
		p->ref += q->ref;
	}
	if (!isfunc(p->type))
		initglobal(p, 0);
	else if (t == '=') {
		error("illegal initialization for `%s'\n", p->name);
		t = gettok();
		initializer(p->type, 0);
	}
	return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x7ac3
cmpl $0x4e, -0x4(%rbp)
jne 0x7aca
movl $0x43, -0x4(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x33663(%rip), %rax     # 0x3b138
movq (%rax), %rsi
callq 0x24670
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x7c02
movq -0x28(%rbp), %rax
movzwl 0x18(%rax), %eax
cmpl $0x3, %eax
jne 0x7c02
movq -0x28(%rbp), %rax
movzbl 0x1a(%rax), %eax
cmpl $0x53, %eax
je 0x7b3b
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x1, %edx
callq 0x27f80
cmpl $0x0, %eax
je 0x7b3b
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x27620
movq %rax, -0x18(%rbp)
jmp 0x7b59
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x28(%rbp), %rdx
addq $0x28, %rdx
leaq 0x279b8(%rip), %rdi     # 0x2f50a
movb $0x0, %al
callq 0xd530
movq -0x18(%rbp), %rax
cmpl $0xf, (%rax)
jb 0x7b70
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x7b78
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0xb, (%rax)
je 0x7bbc
movq -0x28(%rbp), %rax
movb 0x1b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x7bbc
leaq 0x35fe7(%rip), %rax     # 0x3db80
cmpl $0x3d, (%rax)
jne 0x7bbc
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x28(%rbp), %rdx
addq $0x28, %rdx
leaq 0x27b22(%rip), %rdi     # 0x2f6d7
movb $0x0, %al
callq 0xd530
movq -0x28(%rbp), %rax
movzbl 0x1a(%rax), %eax
cmpl $0x51, %eax
jne 0x7bcf
cmpl $0x43, -0x4(%rbp)
je 0x7be2
movq -0x28(%rbp), %rax
movzbl 0x1a(%rax), %eax
cmpl $0x51, %eax
je 0x7c00
cmpl $0x51, -0x4(%rbp)
jne 0x7c00
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x28(%rbp), %rdx
addq $0x28, %rdx
leaq 0x27c63(%rip), %rdi     # 0x2f85c
movb $0x0, %al
callq 0xdba0
jmp 0x7c5e
cmpl $0x51, -0x4(%rbp)
jne 0x7c5c
movq -0x18(%rbp), %rax
cmpl $0xf, (%rax)
jb 0x7c1f
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x7c27
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpl $0xb, (%rax)
je 0x7c5c
movq -0x18(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x7c5c
leaq 0x35f3f(%rip), %rax     # 0x3db80
cmpl $0x3d, (%rax)
je 0x7c5c
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq 0x27c40(%rip), %rdi     # 0x2f895
movb $0x0, %al
callq 0xdba0
jmp 0x7c5e
cmpq $0x0, -0x28(%rbp)
je 0x7c72
movq -0x28(%rbp), %rax
movzwl 0x18(%rax), %eax
cmpl $0x3, %eax
je 0x7c8b
movq -0x10(%rbp), %rdi
leaq 0x334c3(%rip), %rsi     # 0x3b140
movl $0x1, %edx
callq 0x24720
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x28(%rbp), %rax
movzbl 0x1a(%rax), %eax
cmpl $0x0, %eax
je 0x7cb7
cmpl $0x4a, -0x4(%rbp)
je 0x7cc3
movq -0x28(%rbp), %rax
movzbl 0x1a(%rax), %eax
cmpl $0x51, %eax
je 0x7cc3
movl -0x4(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x1a(%rax)
movq -0x28(%rbp), %rax
movzbl 0x1a(%rax), %eax
cmpl $0x51, %eax
je 0x7d07
movl 0x33d62(%rip), %eax     # 0x3ba38
addl $0x1, %eax
movl %eax, 0x33d59(%rip)     # 0x3ba38
leaq 0x35f42(%rip), %rax     # 0x3dc28
cmpl $0x2, (%rax)
jl 0x7d05
cmpl $0x200, 0x33d43(%rip)   # imm = 0x200
jne 0x7d05
leaq 0x27bba(%rip), %rdi     # 0x2f8b8
movb $0x0, %al
callq 0xdba0
jmp 0x7d07
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, 0x28(%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x30(%rax)
movq -0x28(%rbp), %rax
movb 0x1b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x7d38
movq -0x28(%rbp), %rdi
callq 0x2a470
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x32fd1(%rip), %rax     # 0x3ad18
movq (%rax), %rsi
callq 0x24670
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x7dd8
movq -0x28(%rbp), %rax
movzbl 0x1a(%rax), %eax
cmpl $0x43, %eax
jne 0x7d70
movl $0x4a, %eax
movl %eax, -0x44(%rbp)
jmp 0x7d7b
movq -0x28(%rbp), %rax
movzbl 0x1a(%rax), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x30(%rbp), %rcx
movzbl 0x1a(%rcx), %ecx
cmpl %ecx, %eax
jne 0x7da9
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x1, %edx
callq 0x27f80
cmpl $0x0, %eax
jne 0x7dc7
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x30(%rbp), %rdx
addq $0x28, %rdx
leaq 0x277c9(%rip), %rdi     # 0x2f589
movb $0x0, %al
callq 0xdba0
movq -0x30(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x28(%rbp), %rax
addl 0x1c(%rax), %ecx
movl %ecx, 0x1c(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
cmpl $0xf, (%rax)
jb 0x7df7
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x7e03
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpl $0xb, (%rax)
je 0x7e19
movq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0x12e50
jmp 0x7e5c
leaq 0x35d60(%rip), %rax     # 0x3db80
cmpl $0x3d, (%rax)
jne 0x7e5a
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
leaq 0x27aa8(%rip), %rdi     # 0x2f8dc
movb $0x0, %al
callq 0xd530
callq 0x15170
movl %eax, %ecx
leaq 0x35d37(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x12fe0
jmp 0x7e5c
movq -0x28(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)