// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/expression.c
// Function: generic_selection
static struct token *generic_selection(struct token *token, struct expression **tree)
{
	struct expression *expr = alloc_expression(token->pos, EXPR_GENERIC);
	struct type_expression **last = &expr->map;

	token = expect(token, '(', "after '_Generic'");
	token = assignment_expression(token, &expr->control);
	if (!match_op(token, ',')) {
		goto end;
	}
	while (match_op(token, ',')) {
		token = token->next;
		if (lookup_type(token)) {
			struct type_expression *map = __alloc_type_expression(0);
			token = typename(token, &map->type, NULL);
			token = expect(token, ':', "after typename");
			token = assignment_expression(token, &map->expr);
			*last = map;
			last = &map->next;
		} else if (match_ident(token, &default_ident)) {
			if (expr->def) {
				warning(token->pos, "multiple default in generic expression");
				info(expr->def->pos, "note: previous was here");
			}
			token = token->next;
			token = expect(token, ':', "after typename");
			token = assignment_expression(token, &expr->def);
		}
	}
end:
	*tree = expr;
	return expect(token, ')', "after expression");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
movq (%rdi), %r12
xorl %edi, %edi
callq 0x30029
movq %rax, %r14
movl (%rax), %eax
orl $0x1f, %eax
movq %r12, 0x8(%r14)
andl $0xffff001f, %eax       # imm = 0xFFFF001F
movl %eax, (%r14)
leaq 0x20(%r14), %r12
leaq 0x11902(%rip), %rdx     # 0x4bef5
movq %r15, %rdi
movl $0x28, %esi
callq 0x195d7
movq %rax, %rdi
movq %r12, %rsi
callq 0x3a91c
movq %rax, %r15
movl (%rax), %eax
andl $0x3f, %eax
cmpl $0x12, %eax
jne 0x3a74c
cmpl $0x2c, 0x10(%r15)
jne 0x3a74c
movl (%r15), %eax
andl $0x3f, %eax
cmpl $0x12, %eax
jne 0x3a74c
leaq 0x30(%r14), %rax
movq %rax, (%rsp)
movq %r14, %r12
addq $0x28, %r12
leaq 0x2a804(%rip), %rbp     # 0x64e50
cmpl $0x2c, 0x10(%r15)
jne 0x3a74c
movq 0x8(%r15), %r15
movl (%r15), %eax
andl $0x3f, %eax
cmpl $0x3, %eax
jne 0x3a67f
movq 0x10(%r15), %rdi
movl $0x12, %esi
callq 0x2b511
testq %rax, %rax
je 0x3a67f
testb $0x2, 0x1(%rax)
jne 0x3a6ea
movq (%r15), %rdi
movl %edi, %eax
andl $0x3f, %eax
cmpl $0x3, %eax
jne 0x3a73d
cmpq %rbp, 0x10(%r15)
jne 0x3a73d
cmpq $0x0, (%r12)
je 0x3a6c5
leaq 0x1186d(%rip), %rsi     # 0x4bf15
xorl %eax, %eax
callq 0x118b4
movq (%r12), %rax
movq 0x8(%rax), %rdi
leaq 0x1187e(%rip), %rsi     # 0x4bf3c
xorl %eax, %eax
callq 0x11744
movq 0x8(%r15), %rdi
movl $0x3a, %esi
leaq 0x11831(%rip), %rdx     # 0x4bf06
callq 0x195d7
movq %rax, %rdi
movq %r12, %rsi
callq 0x3a91c
movq %rax, %r15
jmp 0x3a73d
leaq 0x2bd0f(%rip), %rdi     # 0x66400
movl $0x18, %esi
callq 0x2fd3c
movq %rax, %r13
movq %r15, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x19726
movq %rax, %rdi
movl $0x3a, %esi
leaq 0x117ec(%rip), %rdx     # 0x4bf06
callq 0x195d7
leaq 0x8(%r13), %rsi
movq %rax, %rdi
callq 0x3a91c
movq %rax, %r15
movq (%rsp), %rax
movq %r13, (%rax)
addq $0x10, %r13
movq %r13, (%rsp)
movl (%r15), %eax
andl $0x3f, %eax
cmpl $0x12, %eax
je 0x3a64c
movq %r14, (%rbx)
leaq 0x117fe(%rip), %rdx     # 0x4bf54
movq %r15, %rdi
movl $0x29, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x195d7