// File: /workspace/github_c_makefile_star2_O2/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 0x8(%rsp), %rax
andq $0x0, (%rax)
leaq 0x1eda5(%rip), %r15     # 0x3f540
movl $0x0, 0x10(%rsp)
movl $0x0, 0x14(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
testq %r14, %r14
je 0x20b05
movzbl (%r14), %eax
cmpl $0xb, %eax
ja 0x207cc
movl $0x848, %ecx            # imm = 0x848
btl %eax, %ecx
jb 0x20838
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x207f2
callq 0x2936d
movq %rbx, %rdi
leaq 0x1f269(%rip), %rsi     # 0x3fa4e
movq %rax, %rdx
xorl %eax, %eax
callq 0x219f8
movb (%r14), %al
cmpb $0x9, %al
je 0x207fe
movzbl %al, %eax
cmpl $0x2, %eax
jne 0x20805
andq $-0xe001, %rbp          # imm = 0xFFFF1FFF
movq %rbp, %rdi
callq 0x203f7
leaq 0x43d5c(%rip), %r13     # 0x64570
movq %r13, %rdi
callq 0xe0d0
movq (%rbx), %rdi
subq %rax, %rdi
movq %rdi, (%rbx)
movq %r13, %rsi
movq %rax, %rdx
callq 0xe1e0
andq $0x0, 0x8(%rsp)
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x206bb
testq %rax, %rax
jne 0x209f4
movzbl (%r14), %edx
leal -0x3(%rdx), %eax
cmpl $0xb, %eax
ja 0x20aa9
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x20884
callq 0x2936d
movq %rbx, %rdi
leaq 0x23e13(%rip), %rsi     # 0x4468d
movq %rax, %rdx
xorl %eax, %eax
callq 0x21aa3
orq 0x68(%r14), %rbp
movq 0x4(%r14), %rdi
movq 0x80(%r14), %rdx
leaq 0x8(%rsp), %rsi
callq 0x21b54
jmp 0x209eb
pushq $0x1
popq %rax
movl %eax, 0x14(%rsp)
jmp 0x209eb
movq 0x18(%r14), %rdi
testq %rdi, %rdi
jne 0x20ad4
pushq $0x1
popq %rax
movl %eax, 0x10(%rsp)
jmp 0x209eb
orq 0x68(%r14), %rbp
movq 0x4(%r14), %rdi
movq 0x80(%r14), %rdx
leaq 0x8(%rsp), %rsi
callq 0x21b54
movl 0x50(%r14), %edx
movq %rbx, %rdi
leaq 0x1f164(%rip), %rsi     # 0x3fa52
xorl %eax, %eax
callq 0x21aa3
jmp 0x209eb
movq 0x18(%r14), %rdi
callq 0x2936d
movq %rbx, %rdi
leaq 0x1f13c(%rip), %rsi     # 0x3fa49
movq %rax, %rdx
xorl %eax, %eax
callq 0x219f8
jmp 0x209eb
movq %rbx, %rdi
leaq 0x19fd6(%rip), %rsi     # 0x3a8fc
xorl %eax, %eax
callq 0x219f8
movq 0x68(%r14), %rbp
movq 0x80(%r14), %rax
movq %rax, 0x8(%rsp)
movq %r14, %rdi
callq 0x270ef
pushq $0x1
popq %r12
jmp 0x209eb
orq 0x68(%r14), %rbp
movq 0x4(%r14), %rdi
movq 0x80(%r14), %rdx
leaq 0x8(%rsp), %rsi
callq 0x21b54
testl %r12d, %r12d
je 0x2098e
movq %rbx, %rdi
leaq 0x1f0b5(%rip), %rsi     # 0x3fa2b
xorl %eax, %eax
callq 0x219f8
movq %rbx, %rdi
leaq 0x1f0ac(%rip), %rsi     # 0x3fa33
xorl %eax, %eax
callq 0x21aa3
movq 0x58(%r14), %rdi
callq 0xfe1b
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0x1f0bf(%rip), %rsi     # 0x3fa63
movq %rax, %rdx
xorl %eax, %eax
callq 0x21aa3
jmp 0x209eb
testl %r12d, %r12d
je 0x209d7
movq %rbx, %rdi
leaq 0x1f06c(%rip), %rsi     # 0x3fa2b
xorl %eax, %eax
callq 0x219f8
movq %rbx, %rdi
leaq 0x1f063(%rip), %rsi     # 0x3fa33
xorl %eax, %eax
callq 0x21aa3
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0x1f04a(%rip), %rsi     # 0x3fa2e
xorl %eax, %eax
callq 0x21aa3
movq 0x60(%r14), %r14
jmp 0x207b0
movq %rax, %r13
movq %rax, %rdi
callq 0xe0d0
movq (%rbx), %rdi
cmpq 0x8(%rbx), %rdi
je 0x20a16
leaq -0x1(%rdi), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rdi)
movq (%rbx), %rdi
movslq %eax, %rdx
subq %rdx, %rdi
movq %rdi, (%rbx)
movq %r13, %rsi
callq 0xe1e0
jmp 0x20b05
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x20a40
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movq 0x18(%r14), %rdi
callq 0x2936d
leaq 0x1eff0(%rip), %rsi     # 0x3fa40
jmp 0x20af8
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x20a69
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movq 0x18(%r14), %rdi
callq 0x2936d
leaq 0x1efbd(%rip), %rsi     # 0x3fa36
jmp 0x20af8
movq 0x18(%r14), %rdi
callq 0x2936d
leaq 0x1efcb(%rip), %rsi     # 0x3fa56
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 0x21aa3
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x20ac1
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movzbl (%r14), %edx
leaq 0x1efb0(%rip), %rsi     # 0x3fa78
movq %rbx, %rdi
xorl %eax, %eax
callq 0x219f8
jmp 0x20b05
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x20aec
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movq 0x18(%r14), %rdi
callq 0x2936d
leaq 0x1ef72(%rip), %rsi     # 0x3fa6a
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x219f8
cmpl $0x0, 0x10(%rsp)
je 0x20b1d
leaq 0x1ef75(%rip), %rsi     # 0x3fa88
movq %rbx, %rdi
xorl %eax, %eax
callq 0x219f8
cmpl $0x0, 0x14(%rsp)
je 0x20b35
leaq 0x1ef69(%rip), %rsi     # 0x3fa94
movq %rbx, %rdi
xorl %eax, %eax
callq 0x219f8
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
jbe 0x20b4b
cmpb $0x20, -0x1(%rax)
jne 0x20b4b
decq %rax
movq %rax, 0x8(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq