// File: /workspace/github_c_makefile_star2_O0/nimble-code[P]Modex/Src/tree.c
// Function: find_typedef_name
void
find_typedef_name(treenode *n, treenode *def, FindFunction find)
{
    if (!n)
        return;

	if (0)
	printf("%s: find_typedef_name %s - %s\n",
		progname, name_of_nodetype(n->hdr.which), name_of_node(n->hdr.type));

    switch(n->hdr.which)
    {
        case LEAF_T:
            (find)((leafnode*) n, def, NULL);
            break;

        case NODE_T:
        {
            switch(n->hdr.type)
            {
            case TN_DECL:
                find_typedef_name(n->rnode,def,find);
                break;

            case TN_ARRAY_DECL:
                find_typedef_name(n->lnode,def,find);
                break;

            case TN_PNTR:
#if 0
                fprintf(stderr,
                    "%s: parse error: TN_PNTR reached in find_typedef_name!\n", progname);
		/* can happen, e.g.: typedef long name(int *); */
#endif
                break;

            case TN_DECL_LIST:
            case TN_DECLS:
                find_typedef_name(n->lnode,def,find);
                find_typedef_name(n->rnode,def,find);
                break;

            case TN_FUNC_DECL:

		if (0) printf("lnode=%s %s rnode=%s %s\n",
		name_of_nodetype(n->lnode->hdr.which), name_of_node(n->lnode->hdr.type),
		name_of_nodetype(n->rnode->hdr.which), name_of_node(n->rnode->hdr.type));

		if (n->lnode->hdr.which == LEAF_T)		/* gjh added */
			find_typedef_name(n->lnode,def,find);
		else if (n->lnode->hdr.type == TN_DECL)
                    find_typedef_name(n->lnode,def,find);
                else
                    find_typedef_name(n->rnode,def,find);
                break;

	    case TN_PARAM_LIST:
		return;

            default:
                fprintf(stderr,
                        "%s: parse error: "
                        "unknown node type (%s) in find_typedef_name\n",
                        progname, name_of_node(n->hdr.type));
                break;
            }
        }
        break;

        case IF_T:
        case FOR_T:
        case NONE_T:
        default:
            fprintf(stderr,
                "%s: parse error: unknown node %s in find_typedef_name;"
                "  type: %s\n", progname, print_ptr(n), name_of_nodetype(n->hdr.which));
            break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x1ba60
jmp 0x1bc31
movq -0x8(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x20(%rbp)
subq $0x4, %rax
ja 0x1bbe0
movq -0x20(%rbp), %rax
leaq 0x1c0d9(%rip), %rcx     # 0x37b58
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
jmp 0x1bc31
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x11, %eax
ja 0x1bb9b
movq -0x28(%rbp), %rax
leaq 0x1c0a9(%rip), %rcx     # 0x37b6c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1ba40
jmp 0x1bbdc
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1ba40
jmp 0x1bbdc
jmp 0x1bbdc
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1ba40
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1ba40
jmp 0x1bbdc
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
cmpl $0x1, (%rax)
jne 0x1bb58
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1ba40
jmp 0x1bb94
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
cmpl $0x5, 0x1c(%rax)
jne 0x1bb7d
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1ba40
jmp 0x1bb92
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1ba40
jmp 0x1bb94
jmp 0x1bbdc
jmp 0x1bc31
movq 0x29456(%rip), %rax     # 0x44ff8
movq (%rax), %rax
movq %rax, -0x38(%rbp)
leaq 0x295c0(%rip), %rax     # 0x45170
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %edi
callq 0x1bc40
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rdx
movq %rax, %rcx
leaq 0x1c35e(%rip), %rsi     # 0x37f33
movb $0x0, %al
callq 0x4190
jmp 0x1bc31
jmp 0x1bbe0
movq 0x29411(%rip), %rax     # 0x44ff8
movq (%rax), %rax
movq %rax, -0x50(%rbp)
leaq 0x2957b(%rip), %rax     # 0x45170
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1b360
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0x1b9c0
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq %rax, %r8
leaq 0x1c347(%rip), %rsi     # 0x37f71
movb $0x0, %al
callq 0x4190
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)