// File: /workspace/github_c_makefile_star2_O2/lucvoo[P]sparse-dev/c2xml.c
// Function: examine_symbol
static void examine_symbol(struct symbol *sym, xmlNodePtr node)
{
	xmlNodePtr child = NULL;
	const char *base;
	int array_size;

	if (!sym)
		return;
	if (sym->aux)		/*already visited */
		return;

	if (sym->ident && sym->ident->reserved)
		return;

	child = new_sym_node(sym, get_type_name(sym->type), node);
	examine_modifiers(sym, child);
	examine_layout(sym, child);

	if (sym->ctype.base_type) {
		if ((base = builtin_typename(sym->ctype.base_type)) == NULL) {
			if (!sym->ctype.base_type->aux) {
				examine_symbol(sym->ctype.base_type, root_node);
			}
			xmlNewProp(child, BAD_CAST "base-type",
			           xmlGetProp((xmlNodePtr)sym->ctype.base_type->aux, BAD_CAST "id"));
		} else {
			newProp(child, "base-type-builtin", base);
		}
	}
	if (sym->array_size) {
		/* TODO: modify get_expression_value to give error return */
		array_size = get_expression_value(sym->array_size);
		newNumProp(child, "array-size", array_size);
	}


	switch (sym->type) {
	case SYM_STRUCT:
	case SYM_UNION:
		examine_members(sym->symbol_list, child);
		break;
	case SYM_FN:
		examine_members(sym->arguments, child);
		break;
	case SYM_UNINITIALIZED:
		newProp(child, "base-type-builtin", builtin_typename(sym));
		break;
	default:
		break;
	}
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xe74f
movq %rdi, %rbx
cmpq $0x0, 0xd0(%rdi)
je 0xe75e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r14
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0xe770
testb $0x2, 0x11(%rax)
jne 0xe74f
movzbl (%rbx), %edi
callq 0x1e672
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xe958
movq %rax, (%rsp)
movl $0x1ff00, %eax          # imm = 0x1FF00
andl (%rbx), %eax
cmpl $0x1000, %eax           # imm = 0x1000
jne 0xe7f2
xorl %r13d, %r13d
pushq $0x1
popq %rbp
leaq 0x4322b(%rip), %r14     # 0x519d0
leaq 0x35f8f(%rip), %r15     # 0x4473b
xorl %r12d, %r12d
cmpq $0x100, %r13            # imm = 0x100
je 0xe7f2
movl %ebp, %eax
movl %r12d, %ecx
shll %cl, %eax
cltq
testq %rax, 0x68(%rbx)
sete %al
leaq -0xd(%r12), %rcx
cmpq $0x5, %rcx
setb %cl
orb %al, %cl
jne 0xe7e9
movq (%r13,%r14), %rsi
movq (%rsp), %rdi
movq %r15, %rdx
callq 0xe210
incq %r12
addq $0x8, %r13
jmp 0xe7af
movq %rbx, %rdi
callq 0x1dd69
movl 0x50(%rbx), %edx
leaq 0x2a9ad(%rip), %rsi     # 0x391b1
movq (%rsp), %r14
movq %r14, %rdi
callq 0xeb18
movl 0x70(%rbx), %edx
leaq 0x2c726(%rip), %rsi     # 0x3af40
movq %r14, %rdi
callq 0xeb18
movl 0x48(%rbx), %edx
leaq 0x2a992(%rip), %rsi     # 0x391be
movq %r14, %rdi
callq 0xeb18
movzbl (%rbx), %eax
movq %rbx, %rcx
cmpl $0x3, %eax
jne 0xe846
movq 0x60(%rbx), %rcx
movzbl (%rcx), %eax
cmpl $0x9, %eax
jne 0xe852
movq 0x60(%rcx), %rax
movzbl (%rax), %eax
cmpl $0xb, %eax
jne 0xe86b
movzbl 0x54(%rbx), %edx
leaq 0x2a958(%rip), %rsi     # 0x391ba
movq (%rsp), %rdi
callq 0xeb18
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0xe8d0
callq 0x1c2bb
testq %rax, %rax
je 0xe887
leaq 0x2a883(%rip), %rsi     # 0x39108
jmp 0xe8c4
movq 0x60(%rbx), %rax
movq 0xd0(%rax), %rdi
testq %rdi, %rdi
jne 0xe8b1
movq 0x50c42(%rip), %rsi     # 0x5f4e0
movq %rax, %rdi
callq 0xe732
movq 0x60(%rbx), %rax
movq 0xd0(%rax), %rdi
leaq 0x2e404(%rip), %rsi     # 0x3ccbc
callq 0xe2e0
leaq 0x2a83a(%rip), %rsi     # 0x390fe
movq (%rsp), %rdi
movq %rax, %rdx
callq 0xe210
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0xe8f0
callq 0x104e7
leaq 0x2a835(%rip), %rsi     # 0x3911a
movq (%rsp), %rdi
movl %eax, %edx
callq 0xeb18
movzbl (%rbx), %eax
leal -0x7(%rax), %ecx
cmpl $0x2, %ecx
jb 0xe911
testl %eax, %eax
je 0xe92f
cmpl $0x5, %eax
jne 0xe74f
movq 0x88(%rbx), %rdi
jmp 0xe918
movq 0x98(%rbx), %rdi
movq (%rsp), %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xeb60
movq %rbx, %rdi
callq 0x1c2bb
leaq 0x2a7ca(%rip), %rsi     # 0x39108
movq (%rsp), %rdi
movq %rax, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe210