// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/show-parse.c
// Function: do_show_type
static void do_show_type(struct symbol *sym, struct type_name *name)
{
	const char *typename;
	unsigned long mod = 0;
	struct ident *as = NULL;
	int was_ptr = 0;
	int restr = 0;
	int fouled = 0;

deeper:
	if (sym && (sym->type != SYM_NODE && sym->type != SYM_ARRAY &&
		     sym->type != SYM_BITFIELD)) {
		const char *s;
		size_t len;

		if (as)
			prepend(name, "%s ", show_as(as));

		if (sym && (sym->type == SYM_BASETYPE || sym->type == SYM_ENUM))
			mod &= ~MOD_SPECIFIER;
		s = modifier_string(mod);
		len = strlen(s);
		name->start -= len;
		memcpy(name->start, s, len);
		mod = 0;
		as = NULL;
	}

	if (!sym)
		goto out;

	if ((typename = builtin_typename(sym))) {
		int len = strlen(typename);
		if (name->start != name->end)
			*--name->start = ' ';
		name->start -= len;
		memcpy(name->start, typename, len);
		goto out;
	}

	/* Prepend */
	switch (sym->type) {
	case SYM_PTR:
		prepend(name, "*");
		mod = sym->ctype.modifiers;
		as = sym->ctype.as;
		was_ptr = 1;
		examine_pointer_target(sym);
		break;

	case SYM_FN:
		if (was_ptr) {
			prepend(name, "( ");
			append(name, " )");
			was_ptr = 0;
		}
		append(name, "( ... )");
		break;

	case SYM_STRUCT:
		if (name->start != name->end)
			*--name->start = ' ';
		prepend(name, "struct %s", show_ident(sym->ident));
		goto out;

	case SYM_UNION:
		if (name->start != name->end)
			*--name->start = ' ';
		prepend(name, "union %s", show_ident(sym->ident));
		goto out;

	case SYM_ENUM:
		prepend(name, "enum %s ", show_ident(sym->ident));
		break;

	case SYM_NODE:
		if (sym->ident)
			append(name, "%s", show_ident(sym->ident));
		mod |= sym->ctype.modifiers;
		combine_address_space(sym->pos, &as, sym->ctype.as);
		break;

	case SYM_BITFIELD:
		mod |= sym->ctype.modifiers;
		combine_address_space(sym->pos, &as, sym->ctype.as);
		append(name, ":%d", sym->bit_size);
		break;

	case SYM_LABEL:
		append(name, "label(%s:%p)", show_ident(sym->ident), sym);
		return;

	case SYM_ARRAY:
		mod |= sym->ctype.modifiers;
		combine_address_space(sym->pos, &as, sym->ctype.as);
		if (was_ptr) {
			prepend(name, "( ");
			append(name, " )");
			was_ptr = 0;
		}
		append(name, "[%lld]", get_expression_value(sym->array_size));
		break;

	case SYM_RESTRICT:
		if (!sym->ident) {
			restr = 1;
			break;
		}
		if (name->start != name->end)
			*--name->start = ' ';
		prepend(name, "restricted %s", show_ident(sym->ident));
		goto out;

	case SYM_FOULED:
		fouled = 1;
		break;

	default:
		if (name->start != name->end)
			*--name->start = ' ';
		prepend(name, "unknown type %d", sym->type);
		goto out;
	}

	sym = sym->ctype.base_type;
	goto deeper;

out:
	if (restr)
		prepend(name, "restricted ");
	if (fouled)
		prepend(name, "fouled ");

	// strip trailing space
	if (name->end > name->start && name->end[-1] == ' ')
		name->end--;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x36764(%rip), %rbp     # 0x59b60
xorl %r12d, %r12d
movl $0x0, 0x10(%rsp)
movl $0x0, 0x14(%rsp)
movl $0x0, 0xc(%rsp)
xorl %r13d, %r13d
testq %r14, %r14
je 0x2349e
movzbl (%r14), %eax
cmpl $0xb, %eax
ja 0x23432
movl $0x848, %ecx            # imm = 0x848
btl %eax, %ecx
jb 0x2349e
testq %r12, %r12
je 0x23453
movq %r12, %rdi
callq 0x2e465
movq %rbx, %rdi
leaq 0x24625(%rip), %rsi     # 0x47a6e
movq %rax, %rdx
xorl %eax, %eax
callq 0x2483c
movzbl (%r14), %eax
cmpl $0x9, %eax
je 0x23461
cmpl $0x2, %eax
jne 0x23468
andq $-0xe001, %r13          # imm = 0xFFFF1FFF
movq %r13, %rdi
movl $0x1, %esi
callq 0x23054
leaq 0x480f4(%rip), %r15     # 0x6b570
movq %r15, %rdi
callq 0xe0d0
movq (%rbx), %rdi
subq %rax, %rdi
movq %rdi, (%rbx)
movq %r15, %rsi
movq %rax, %rdx
callq 0xe1e0
xorl %r12d, %r12d
xorl %r13d, %r13d
testq %r14, %r14
je 0x23817
movl $0x8, %eax
cmpq %r14, -0x8(%rax,%rbp)
je 0x234c4
addq $0x18, %rax
cmpq $0x2a8, %rax            # imm = 0x2A8
jne 0x234ac
xorl %r15d, %r15d
jmp 0x234c8
movq (%rax,%rbp), %r15
testq %r15, %r15
jne 0x23709
movzbl (%r14), %eax
addl $-0x3, %eax
cmpl $0xb, %eax
ja 0x237bb
leaq 0x24078(%rip), %rcx     # 0x47560
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x23513
callq 0x2e465
movq %rbx, %rdi
leaq 0x28fc4(%rip), %rsi     # 0x4c4cd
movq %rax, %rdx
xorl %eax, %eax
callq 0x248e7
orq 0x68(%r14), %r13
movq 0x80(%r14), %rax
testq %rax, %rax
je 0x236fb
testq %r12, %r12
je 0x23704
cmpq %rax, %r12
je 0x236fb
movq 0x4(%r14), %rdi
leaq 0x24578(%rip), %rsi     # 0x47abc
xorl %eax, %eax
callq 0x11a38
leaq 0x42e8e(%rip), %r12     # 0x663e0
jmp 0x236fb
movl $0x1, 0x14(%rsp)
jmp 0x236fb
cmpq $0x0, 0x18(%r14)
jne 0x237e6
movl $0x1, 0x10(%rsp)
jmp 0x236fb
orq 0x68(%r14), %r13
movq 0x80(%r14), %rax
testq %rax, %rax
je 0x23693
testq %r12, %r12
je 0x23690
cmpq %rax, %r12
je 0x23693
movq 0x4(%r14), %rdi
leaq 0x2450f(%rip), %rsi     # 0x47abc
xorl %eax, %eax
callq 0x11a38
leaq 0x42e25(%rip), %r12     # 0x663e0
jmp 0x23693
movq 0x18(%r14), %rdi
callq 0x2e465
movq %rbx, %rdi
leaq 0x24496(%rip), %rsi     # 0x47a69
movq %rax, %rdx
xorl %eax, %eax
callq 0x2483c
jmp 0x236fb
movq %rbx, %rdi
leaq 0x1f2e0(%rip), %rsi     # 0x428cc
xorl %eax, %eax
callq 0x2483c
movq 0x68(%r14), %r13
movq 0x80(%r14), %r12
movq %r14, %rdi
callq 0x2bfd0
movl $0x1, 0xc(%rsp)
jmp 0x236fb
orq 0x68(%r14), %r13
movq 0x80(%r14), %rax
testq %rax, %rax
je 0x236ad
testq %r12, %r12
je 0x236aa
cmpq %rax, %r12
je 0x236ad
movq 0x4(%r14), %rdi
leaq 0x24480(%rip), %rsi     # 0x47abc
xorl %eax, %eax
callq 0x11a38
leaq 0x42d96(%rip), %r12     # 0x663e0
jmp 0x236ad
cmpl $0x0, 0xc(%rsp)
je 0x23675
movq %rbx, %rdi
leaq 0x243ee(%rip), %rsi     # 0x47a4b
xorl %eax, %eax
callq 0x2483c
movq %rbx, %rdi
leaq 0x243e5(%rip), %rsi     # 0x47a53
xorl %eax, %eax
callq 0x248e7
movl $0x0, 0xc(%rsp)
movq %rbx, %rdi
leaq 0x243c7(%rip), %rsi     # 0x47a4e
xorl %eax, %eax
callq 0x248e7
jmp 0x236fb
movq %rax, %r12
movl 0x50(%r14), %edx
movq %rbx, %rdi
leaq 0x243d1(%rip), %rsi     # 0x47a72
xorl %eax, %eax
callq 0x248e7
jmp 0x236fb
movq %rax, %r12
cmpl $0x0, 0xc(%rsp)
je 0x236d6
movq %rbx, %rdi
leaq 0x2438d(%rip), %rsi     # 0x47a4b
xorl %eax, %eax
callq 0x2483c
movq %rbx, %rdi
leaq 0x24384(%rip), %rsi     # 0x47a53
xorl %eax, %eax
callq 0x248e7
movq 0x58(%r14), %rdi
callq 0xf23d
movl $0x0, 0xc(%rsp)
movq %rbx, %rdi
leaq 0x24392(%rip), %rsi     # 0x47a83
movq %rax, %rdx
xorl %eax, %eax
callq 0x248e7
movq 0x60(%r14), %r14
jmp 0x2341a
movq %rax, %r12
jmp 0x236fb
movq %r15, %rdi
callq 0xe0d0
movq (%rbx), %rcx
cmpq 0x8(%rbx), %rcx
je 0x23725
leaq -0x1(%rcx), %rdx
movq %rdx, (%rbx)
movb $0x20, -0x1(%rcx)
movq (%rbx), %rdi
movslq %eax, %rdx
subq %rdx, %rdi
movq %rdi, (%rbx)
movq %r15, %rsi
callq 0xe1e0
jmp 0x23817
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x23752
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movq 0x18(%r14), %rdi
callq 0x2e465
leaq 0x242fe(%rip), %rsi     # 0x47a60
jmp 0x2380a
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x2377b
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movq 0x18(%r14), %rdi
callq 0x2e465
leaq 0x242cb(%rip), %rsi     # 0x47a56
jmp 0x2380a
movq 0x18(%r14), %rdi
callq 0x2e465
leaq 0x242d9(%rip), %rsi     # 0x47a76
movq %rbx, %rdi
movq %rax, %rdx
movq %r14, %rcx
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x248e7
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x237cf
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movzbl (%r14), %edx
leaq 0x242be(%rip), %rsi     # 0x47a98
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2483c
jmp 0x23817
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x237fa
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movq 0x18(%r14), %rdi
callq 0x2e465
leaq 0x24280(%rip), %rsi     # 0x47a8a
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2483c
cmpl $0x0, 0x10(%rsp)
je 0x2382f
leaq 0x24283(%rip), %rsi     # 0x47aa8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2483c
cmpl $0x0, 0x14(%rsp)
je 0x23847
leaq 0x24277(%rip), %rsi     # 0x47ab4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2483c
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
jbe 0x2385d
cmpb $0x20, -0x1(%rax)
jne 0x2385d
decq %rax
movq %rax, 0x8(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq