// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]cproc/decl.c
// Function: declarator
static struct qualtype
declarator(struct scope *s, struct qualtype base, char **name, struct scope **funcscope, bool allowabstract)
{
	struct type *t;
	enum typequal tq;
	struct expr *e;
	struct list result = {&result, &result}, *l, *prev;

	if (funcscope)
		*funcscope = NULL;
	declaratortypes(s, &result, name, funcscope, allowabstract);
	for (l = result.prev; l != &result; l = prev) {
		prev = l->prev;
		t = listelement(l, struct type, link);
		tq = t->qual;
		t->base = base.type;
		t->qual = base.qual;
		t->prop |= base.type->prop & PROPVM;
		switch (t->kind) {
		case TYPEFUNC:
			if (base.type->kind == TYPEFUNC)
				error(&tok.loc, "function declarator specifies function return type");
			if (base.type->kind == TYPEARRAY)
				error(&tok.loc, "function declarator specifies array return type");
			break;
		case TYPEARRAY:
			if (base.type->incomplete)
				error(&tok.loc, "array element has incomplete type");
			if (base.type->kind == TYPEFUNC)
				error(&tok.loc, "array element has function type");
			t->align = base.type->align;
			t->size = 0;
			if (t->u.array.length) {
				e = eval(t->u.array.length);
				if (e->kind == EXPRCONST && base.type->size) {
					if (e->type->u.basic.issigned && e->u.constant.u >> 63)
						error(&tok.loc, "array length must be non-negative");
					if (e->u.constant.u > ULLONG_MAX / base.type->size)
						error(&tok.loc, "array length is too large");
					t->size = base.type->size * e->u.constant.u;
				} else {
					t->prop |= PROPVM;
					t->u.array.length = e;
					t->u.array.size = NULL;
				}
			}
			break;
		}
		base.type = t;
		base.qual = tq;
	}

	return base;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x70(%rbp)
movb %r8b, %al
movq %rdi, -0x68(%rbp)
leaq 0x10(%rbp), %rdi
movq %rdi, -0x60(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
leaq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x4341
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movb -0x19(%rbp), %al
leaq -0x48(%rbp), %rsi
andb $0x1, %al
movzbl %al, %r8d
callq 0x6920
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rax
cmpq %rax, -0x50(%rbp)
je 0x45bb
movq -0x60(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, -0x58(%rbp)
movq -0x50(%rbp), %rcx
addq $-0x28, %rcx
movq %rcx, -0x28(%rbp)
movq -0x28(%rbp), %rcx
movl 0x38(%rcx), %ecx
movl %ecx, -0x2c(%rbp)
movq (%rax), %rdx
movq -0x28(%rbp), %rcx
movq %rdx, 0x20(%rcx)
movl 0x8(%rax), %edx
movq -0x28(%rbp), %rcx
movl %edx, 0x38(%rcx)
movq (%rax), %rax
movl 0x4(%rax), %edx
andl $0x40, %edx
movq -0x28(%rbp), %rax
movl 0x4(%rax), %ecx
orl %edx, %ecx
movl %ecx, 0x4(%rax)
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x74(%rbp)
subl $0xd, %eax
je 0x4431
jmp 0x43d4
movl -0x74(%rbp), %eax
subl $0xe, %eax
jne 0x459d
jmp 0x43e2
movq -0x60(%rbp), %rax
movq (%rax), %rax
cmpl $0xe, (%rax)
jne 0x4407
leaq 0x1ddb3(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x149b7(%rip), %rsi     # 0x18db7
movb $0x0, %al
callq 0x11190
movq -0x60(%rbp), %rax
movq (%rax), %rax
cmpl $0xd, (%rax)
jne 0x442c
leaq 0x1dd8e(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x149c5(%rip), %rsi     # 0x18dea
movb $0x0, %al
callq 0x11190
jmp 0x459d
movq -0x60(%rbp), %rax
movq (%rax), %rax
testb $0x1, 0x3c(%rax)
je 0x4457
leaq 0x1dd63(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x149ca(%rip), %rsi     # 0x18e1a
movb $0x0, %al
callq 0x11190
movq -0x60(%rbp), %rax
movq (%rax), %rax
cmpl $0xe, (%rax)
jne 0x447c
leaq 0x1dd3e(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x149c7(%rip), %rsi     # 0x18e3c
movb $0x0, %al
callq 0x11190
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x459b
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x7010
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x4574
movq -0x60(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x10(%rax)
je 0x4574
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
testb $0x1, 0x40(%rax)
je 0x4511
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
shrq $0x3f, %rax
cmpq $0x0, %rax
je 0x4511
leaq 0x1dca9(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x14952(%rip), %rsi     # 0x18e5c
movb $0x0, %al
callq 0x11190
movq -0x60(%rbp), %rax
movq -0x38(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq %rcx, -0x80(%rbp)
movq (%rax), %rcx
movq $-0x1, %rax
xorl %edx, %edx
divq 0x10(%rcx)
movq %rax, %rcx
movq -0x80(%rbp), %rax
cmpq %rcx, %rax
jbe 0x4556
leaq 0x1dc64(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x1492f(%rip), %rsi     # 0x18e7e
movb $0x0, %al
callq 0x11190
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rcx
movq -0x38(%rbp), %rax
imulq 0x30(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x4599
movq -0x28(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x40, %ecx
movl %ecx, 0x4(%rax)
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x50(%rax)
jmp 0x459b
jmp 0x459d
movq -0x60(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, (%rax)
movl -0x2c(%rbp), %ecx
movl %ecx, 0x8(%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x4367
movq -0x68(%rbp), %rax
movq -0x70(%rbp), %rcx
movq -0x60(%rbp), %rdx
movq (%rdx), %rsi
movq %rsi, (%rcx)
movq 0x8(%rdx), %rsi
movq %rsi, 0x8(%rcx)
movq 0x10(%rdx), %rdx
movq %rdx, 0x10(%rcx)
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)