// File: /workspace/github_c_makefile_star2_O3/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
testq %rdi, %rdi
je 0x237a0
movq %rdi, %r14
leaq 0x35814(%rip), %r15     # 0x58b70
xorl %ebp, %ebp
movl $0x0, 0xc(%rsp)
movl $0x0, 0x14(%rsp)
movl $0x0, 0x10(%rsp)
xorl %r13d, %r13d
movzbl (%r14), %eax
cmpl $0xb, %eax
ja 0x2338c
movl $0x848, %ecx            # imm = 0x848
btl %eax, %ecx
jb 0x233f8
testq %r13, %r13
je 0x233b0
movq %r13, %rdi
callq 0x2de35
movq %rbx, %rdi
leaq 0x2364b(%rip), %rsi     # 0x469ee
movq %rax, %rdx
xorl %eax, %eax
callq 0x2479b
movb (%r14), %al
cmpb $0x9, %al
je 0x233bc
movzbl %al, %eax
cmpl $0x2, %eax
jne 0x233c3
andq $-0xe001, %rbp          # imm = 0xFFFF1FFF
movq %rbp, %rdi
movl $0x1, %esi
callq 0x22fa1
leaq 0x47199(%rip), %r12     # 0x6a570
movq %r12, %rdi
callq 0xe0d0
movq (%rbx), %rdi
subq %rax, %rdi
movq %rdi, (%rbx)
movq %r12, %rsi
movq %rax, %rdx
callq 0xe1e0
xorl %r13d, %r13d
xorl %ebp, %ebp
movl $0x8, %eax
cmpq %r14, -0x8(%rax,%r15)
je 0x23412
addq $0x18, %rax
cmpq $0x2a8, %rax            # imm = 0x2A8
jne 0x233fd
jmp 0x2341f
movq (%rax,%r15), %r12
testq %r12, %r12
jne 0x23662
movzbl (%r14), %edx
leal -0x3(%rdx), %eax
cmpl $0xb, %eax
ja 0x23714
leaq 0x230aa(%rip), %rcx     # 0x464e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x23461
callq 0x2de35
movq %rbx, %rdi
leaq 0x27fe6(%rip), %rsi     # 0x4b43d
movq %rax, %rdx
xorl %eax, %eax
callq 0x24846
orq 0x68(%r14), %rbp
movq 0x80(%r14), %rax
testq %rax, %rax
je 0x2364b
testq %r13, %r13
je 0x2365d
cmpq %rax, %r13
je 0x2364b
movq 0x4(%r14), %rdi
leaq 0x235aa(%rip), %rsi     # 0x46a3c
xorl %eax, %eax
callq 0x11a80
leaq 0x41f40(%rip), %r13     # 0x653e0
jmp 0x2364b
movl $0x1, 0x14(%rsp)
jmp 0x2364b
movq 0x18(%r14), %rdi
testq %rdi, %rdi
jne 0x2373f
movl $0x1, 0x10(%rsp)
jmp 0x2364b
orq 0x68(%r14), %rbp
movq 0x80(%r14), %rax
testq %rax, %rax
je 0x235e3
testq %r13, %r13
je 0x235e0
cmpq %rax, %r13
je 0x235e3
movq 0x4(%r14), %rdi
leaq 0x2353f(%rip), %rsi     # 0x46a3c
xorl %eax, %eax
callq 0x11a80
leaq 0x41ed5(%rip), %r13     # 0x653e0
jmp 0x235e3
movq 0x18(%r14), %rdi
callq 0x2de35
movq %rbx, %rdi
leaq 0x234c6(%rip), %rsi     # 0x469e9
movq %rax, %rdx
xorl %eax, %eax
callq 0x2479b
jmp 0x2364b
movq %rbx, %rdi
leaq 0x1e360(%rip), %rsi     # 0x4189c
xorl %eax, %eax
callq 0x2479b
movq 0x68(%r14), %rbp
movq 0x80(%r14), %r13
movq %r14, %rdi
callq 0x2baa4
movl $0x1, 0xc(%rsp)
jmp 0x2364b
orq 0x68(%r14), %rbp
movq 0x80(%r14), %rax
testq %rax, %rax
je 0x235fd
testq %r13, %r13
je 0x235fa
cmpq %rax, %r13
je 0x235fd
movq 0x4(%r14), %rdi
leaq 0x234b0(%rip), %rsi     # 0x46a3c
xorl %eax, %eax
callq 0x11a80
leaq 0x41e46(%rip), %r13     # 0x653e0
jmp 0x235fd
cmpl $0x0, 0xc(%rsp)
je 0x235c5
movq %rbx, %rdi
leaq 0x2341e(%rip), %rsi     # 0x469cb
xorl %eax, %eax
callq 0x2479b
movq %rbx, %rdi
leaq 0x23415(%rip), %rsi     # 0x469d3
xorl %eax, %eax
callq 0x24846
movl $0x0, 0xc(%rsp)
movq %rbx, %rdi
leaq 0x233f7(%rip), %rsi     # 0x469ce
xorl %eax, %eax
callq 0x24846
jmp 0x2364b
movq %rax, %r13
movl 0x50(%r14), %edx
movq %rbx, %rdi
leaq 0x23401(%rip), %rsi     # 0x469f2
xorl %eax, %eax
callq 0x24846
jmp 0x2364b
movq %rax, %r13
cmpl $0x0, 0xc(%rsp)
je 0x23626
movq %rbx, %rdi
leaq 0x233bd(%rip), %rsi     # 0x469cb
xorl %eax, %eax
callq 0x2479b
movq %rbx, %rdi
leaq 0x233b4(%rip), %rsi     # 0x469d3
xorl %eax, %eax
callq 0x24846
movq 0x58(%r14), %rdi
callq 0xf401
movl $0x0, 0xc(%rsp)
movq %rbx, %rdi
leaq 0x233c2(%rip), %rsi     # 0x46a03
movq %rax, %rdx
xorl %eax, %eax
callq 0x24846
movq 0x60(%r14), %r14
testq %r14, %r14
jne 0x23379
jmp 0x23770
movq %rax, %r13
jmp 0x2364b
movq %r12, %rdi
callq 0xe0d0
movq (%rbx), %rdi
cmpq 0x8(%rbx), %rdi
je 0x23681
leaq -0x1(%rdi), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rdi)
movq (%rbx), %rdi
movslq %eax, %rdx
subq %rdx, %rdi
movq %rdi, (%rbx)
movq %r12, %rsi
callq 0xe1e0
jmp 0x23770
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x236ab
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movq 0x18(%r14), %rdi
callq 0x2de35
leaq 0x23325(%rip), %rsi     # 0x469e0
jmp 0x23763
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x236d4
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movq 0x18(%r14), %rdi
callq 0x2de35
leaq 0x232f2(%rip), %rsi     # 0x469d6
jmp 0x23763
movq 0x18(%r14), %rdi
callq 0x2de35
leaq 0x23300(%rip), %rsi     # 0x469f6
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 0x24846
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x2372c
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movzbl (%r14), %edx
leaq 0x232e5(%rip), %rsi     # 0x46a18
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2479b
jmp 0x23770
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x23757
leaq -0x1(%rax), %rcx
movq %rcx, (%rbx)
movb $0x20, -0x1(%rax)
movq 0x18(%r14), %rdi
callq 0x2de35
leaq 0x232a7(%rip), %rsi     # 0x46a0a
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2479b
cmpl $0x0, 0x10(%rsp)
je 0x23788
leaq 0x232aa(%rip), %rsi     # 0x46a28
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2479b
cmpl $0x0, 0x14(%rsp)
je 0x237a0
leaq 0x2329e(%rip), %rsi     # 0x46a34
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2479b
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
jbe 0x237b6
cmpb $0x20, -0x1(%rax)
jne 0x237b6
decq %rax
movq %rax, 0x8(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq