// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]cproc/expr.c
// Function: generic
static struct expr *
generic(struct scope *s)
{
	struct expr *e, *match = NULL, *def = NULL;
	struct type *t, *want;
	enum typequal qual;

	next();
	expect(TLPAREN, "after '_Generic'");
	e = assignexpr(s);
	expect(TCOMMA, "after generic selector expression");
	want = e->type;
	delexpr(e);
	do {
		if (consume(TDEFAULT)) {
			if (def)
				error(&tok.loc, "multiple default expressions in generic association list");
			expect(TCOLON, "after 'default'");
			def = assignexpr(s);
		} else {
			qual = QUALNONE;
			t = typename(s, &qual, NULL);
			if (!t)
				error(&tok.loc, "expected typename for generic association");
			if (t->kind == TYPEFUNC)
				error(&tok.loc, "generic association must have object type");
			if (t->incomplete)
				error(&tok.loc, "generic association must have complete type");
			if (t->prop & PROPVM)
				error(&tok.loc, "generic association has variably modified type");
			expect(TCOLON, "after type name");
			e = assignexpr(s);
			if (typecompatible(t, want) && qual == QUALNONE) {
				if (match)
					error(&tok.loc, "generic selector matches multiple associations");
				match = e;
			} else {
				delexpr(e);
			}
		}
	} while (consume(TCOMMA));
	expect(TRPAREN, "after generic assocation list");
	if (!match) {
		if (!def)
			error(&tok.loc, "generic selector matches no associations and no default was specified");
		match = def;
	} else if (def) {
		delexpr(def);
	}
	return match;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
callq 0xd540
movl $0x42, %edi
leaq 0xe476(%rip), %rsi      # 0x19f73
callq 0xd8d0
movq -0x8(%rbp), %rdi
callq 0x9170
movq %rax, -0x10(%rbp)
movl $0x6e, %edi
leaq 0xe469(%rip), %rsi      # 0x19f84
callq 0xd8d0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7ee0
movl $0x12, %edi
callq 0xd910
testb $0x1, %al
jne 0xbb45
jmp 0xbb88
cmpq $0x0, -0x20(%rbp)
je 0xbb65
leaq 0x16655(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xe448(%rip), %rsi      # 0x19fa6
movb $0x0, %al
callq 0x11190
movl $0x5f, %edi
leaq 0xe46e(%rip), %rsi      # 0x19fdf
callq 0xd8d0
movq -0x8(%rbp), %rdi
callq 0x9170
movq %rax, -0x20(%rbp)
jmp 0xbc9d
movl $0x0, -0x34(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x34(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x3960
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xbbc4
leaq 0x165f6(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xe432(%rip), %rsi      # 0x19fef
movb $0x0, %al
callq 0x11190
movq -0x28(%rbp), %rax
cmpl $0xe, (%rax)
jne 0xbbe6
leaq 0x165d4(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xe43a(%rip), %rsi      # 0x1a019
movb $0x0, %al
callq 0x11190
movq -0x28(%rbp), %rax
testb $0x1, 0x3c(%rax)
je 0xbc09
leaq 0x165b1(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xe441(%rip), %rsi      # 0x1a043
movb $0x0, %al
callq 0x11190
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0xbc31
leaq 0x16589(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xe445(%rip), %rsi      # 0x1a06f
movb $0x0, %al
callq 0x11190
movl $0x5f, %edi
leaq 0xdfd0(%rip), %rsi      # 0x19c0d
callq 0xd8d0
movq -0x8(%rbp), %rdi
callq 0x9170
movq %rax, -0x10(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x11890
testb $0x1, %al
jne 0xbc62
jmp 0xbc92
cmpl $0x0, -0x34(%rbp)
jne 0xbc92
cmpq $0x0, -0x18(%rbp)
je 0xbc88
leaq 0x16532(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xe41d(%rip), %rsi      # 0x1a09e
movb $0x0, %al
callq 0x11190
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0xbc9b
movq -0x10(%rbp), %rdi
callq 0x7ee0
jmp 0xbc9d
jmp 0xbc9f
movl $0x6e, %edi
callq 0xd910
testb $0x1, %al
jne 0xbb35
movl $0x43, %edi
leaq 0xe410(%rip), %rsi      # 0x1a0cd
callq 0xd8d0
cmpq $0x0, -0x18(%rbp)
jne 0xbcf3
cmpq $0x0, -0x20(%rbp)
jne 0xbce9
leaq 0x164d1(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xe409(%rip), %rsi      # 0x1a0eb
movb $0x0, %al
callq 0x11190
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0xbd05
cmpq $0x0, -0x20(%rbp)
je 0xbd03
movq -0x20(%rbp), %rdi
callq 0x7ee0
jmp 0xbd05
movq -0x18(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop