// File: /workspace/github_c_makefile_star2_O2/nimble-code[P]Modex/Src/xtract.c
// Function: do_prefix
void
do_prefix(leafnode *n)
{	Fcts *g;
	static char buf[2048];
	char *s;

	s = n->data.sval->str;
	/* fp=stdout; */
	if (0 && fp)	fprintf(fp, "\n<<%3d: do_prefix --%s-- <%s> <%s> <%s> (%d,%d,%d) [%s] (%d,%d)>>\n",
		n->hdr.line, s, dertype, derproc, dername,
		in_call, in_args, is_label, OutBuf, in_call, ByPass);

	if (strlen(OutBuf) > 2
	&& (strstr(&OutBuf[strlen(OutBuf)-2], "->")
	||  strstr(&OutBuf[strlen(OutBuf)-1], ".")))
		return;	/* no prefix here */

	if (ByPass)
	{	if(0) fprintf(stderr, "	bypass (%d)\n", ByPass);
		return;	/* in the middle of a struct reference */
	}

	if (!n->syment)	/* not a variable name - i.e., no declaration appears in the source */
	{
if (debug)		fprintf(stderr, "%3d: --not a varname --%s-- <%s> <%s> <%s> (%d,%d,%d)\n",
			n->hdr.line, s, dertype, derproc, dername,
			in_call, in_args, is_label);

		/* it could have been declared in the lut... */
		for (g = modex_globals; g; g = g->nxt)
			if (!g->derived && strcmp(g->nm, s) == 0)
				goto b;

		add_hidden("Global", s, 1, n->hdr.line);
		return;
	}

	if (n->syment->kind == LABEL_ENTRY
	||  n->syment->kind == TAG_ENTRY)
		return;

if (0 && fp) fprintf(fp, "\n\t/* maptype=%d - kind=%d - decl_level=%d - owner_t=%d owner=%s */\n",
		map_type(s, n->syment),
		n->syment->kind,
		n->syment->decl_level,
		n->syment->nes && n->syment->nes->owner ? n->syment->nes->owner_t : -1,
		n->syment->nes && n->syment->nes->owner ? n->syment->nes->owner : "no owner");

	switch (map_type(s, n->syment)) {
	case 1:	/* local */
a:		if (strcmp(wanttype, "inline") != 0)
		{	sprintf(buf, "Pp_%s->", fct_name);
			vis_print(buf);
		}
		break;

	case 2:	/* global */
b:		vis_print("now.");
		break;

	case 3:	/* hidden global */
c:		break;

	default: /* undefined */
		if (in_call) return;	/* function name */

		if (n->syment->decl_level < 3)	/* global scope */
		{	char oder[512];
			strcpy(oder, derproc);
			strcpy(derproc, "");
			derive_type("Global", n->syment->node);
			if (strcmp(dertype, "extern ") == 0)
				break;
			strcpy(derproc, oder);

			if (!imported(dername, "Global", 0))
				goto c;

			if (n->syment->kind == TYPEDEF_ENTRY)	/* 2.6 new */
				goto c;

			add_full_global(dertype, dername, 1, n->hdr.line);
			goto b;
		} else if (n->syment->nes && n->syment->nes->owner)
		{
			if (in_args)
				strcpy(derproc, fct_name);
			else
				strcpy(derproc, n->syment->nes->owner);
			derive_type("Local", n->syment->node);
			if (Verbose&2)
			fprintf(stderr, "%3d, ==s=%s, proc=%s, type=%s, name=%s, own=%s, [obuf= %s]\n",
			n->hdr.line, s, derproc, dertype, dername, n->syment->nes->owner, OutBuf);

			if (strcmp(n->syment->nes->owner, "-") != 0)
			{
				if (!imported(dername, derproc, 0))
					goto c;
			
				add_full_local(dertype, dername, derproc, 1, n->hdr.line);
				goto a;
			}

			if (strcmp(dername, "") != 0
			&&  dername[strlen(dername)-1] != '*')
			{	if (debug || (Verbose&2))
				fprintf(stderr, "%3d: derived hidden <%s> <%s> <%s> <%s> (%d %d %d)\n",
					n->hdr.line,
					dertype, dername, derproc, fct_name,
					in_call, in_args, is_label);

				if (strlen(fct_name) > 0
				&&  in_args)	/* formal params */
					add_local(dertype, dername, fct_name, 1, n->hdr.line, 50);
				else
					add_hidden(dertype, dername, 1, n->hdr.line);
			}
			break;
		}
		/* else leave it hidden -- shouldn't happen */
		if (0 /* (Verbose&2) */)
		{	fprintf(stderr, "%s: unexpected (var %s) kind=%d\n", s,
				progname, n->syment->kind);
			if (fp) fprintf(fp, "  /* unexpected (var %s) */", s);
		}

		break;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rdi, %rbx
movq 0x30(%rdi), %rax
movq 0x8(%rax), %r14
leaq 0x257c2(%rip), %r15     # 0x37380
movq %r15, %rdi
callq 0x4110
cmpq $0x3, %rax
jb 0x11c04
movq %rax, %r12
leaq (%rax,%r15), %rdi
addq $-0x2, %rdi
leaq 0x11043(%rip), %rsi     # 0x22c21
callq 0x42d0
testq %rax, %rax
jne 0x11cf4
leaq (%r12,%r15), %rdi
decq %rdi
pushq $0x2e
popq %rsi
callq 0x4130
testq %rax, %rax
jne 0x11cf4
cmpb $0x0, 0x2f105(%rip)     # 0x40d10
jne 0x11cf4
movq 0x28(%rbx), %rsi
testq %rsi, %rsi
je 0x11d05
movl (%rsi), %eax
addl $-0x5, %eax
cmpl $0x2, %eax
jb 0x11cf4
movq %r14, %rdi
callq 0xe069
movl %eax, %eax
leaq 0x10233(%rip), %rcx     # 0x21e70
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, 0x2776b(%rip)     # 0x393b8
jne 0x11cf4
movq 0x28(%rbx), %r12
cmpw $0x2, 0x20(%r12)
jg 0x11d55
leaq 0x2faf5(%rip), %rsi     # 0x41760
movq %rsp, %rdi
callq 0x40b0
movb $0x0, 0x2fae6(%rip)     # 0x41760
movq 0x10(%r12), %rsi
leaq 0xe430(%rip), %rdi      # 0x200b6
callq 0x11b20
movabsq $0x206e7265747865, %rax # imm = 0x206E7265747865
cmpq %rax, 0x2f6a4(%rip)     # 0x41340
je 0x11cf4
leaq 0x2fabb(%rip), %rdi     # 0x41760
movq %rsp, %rsi
callq 0x40b0
leaq 0x2772c(%rip), %rdi     # 0x393e0
leaq 0xe3fb(%rip), %rsi      # 0x200b6
xorl %edx, %edx
callq 0xcaf8
testl %eax, %eax
je 0x11cf4
movq 0x28(%rbx), %rax
cmpl $0x1, (%rax)
je 0x11cf4
movl 0x10(%rbx), %ecx
leaq 0x2f667(%rip), %rdi     # 0x41340
leaq 0x27700(%rip), %rsi     # 0x393e0
pushq $0x1
popq %rdx
callq 0xadb9
leaq 0x10242(%rip), %rdi     # 0x21f31
callq 0x106f2
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x276bc(%rip), %r15     # 0x393c8
movq (%r15), %r15
testq %r15, %r15
je 0x11d30
cmpl $0x0, 0x24(%r15)
jne 0x11d2a
movq (%r15), %rdi
movq %r14, %rsi
callq 0x41b0
testl %eax, %eax
je 0x11ce8
addq $0x38, %r15
jmp 0x11d0c
movl 0x10(%rbx), %ecx
leaq 0xe37c(%rip), %rdi      # 0x200b6
pushq $0x1
popq %rdx
movq %r14, %rsi
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xaa70
movq 0x18(%r12), %rax
testq %rax, %rax
je 0x11cf4
movq 0x18(%rax), %rsi
testq %rsi, %rsi
je 0x11cf4
cmpl $0x0, 0x2764d(%rip)     # 0x393bc
leaq 0x2261a(%rip), %r12     # 0x34390
cmovneq %r12, %rsi
leaq 0x2f9df(%rip), %rdi     # 0x41760
callq 0x40b0
movq 0x28(%rbx), %rax
movq 0x10(%rax), %rsi
leaq 0x10bc3(%rip), %rdi     # 0x22958
callq 0x11b20
leaq 0x24cdb(%rip), %r13     # 0x36a7c
testb $0x2, (%r13)
jne 0x11ed4
movq 0x28(%rbx), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
cmpb $0x2d, (%rax)
jne 0x11dc7
cmpb $0x0, 0x1(%rax)
je 0x11e5a
leaq 0x27612(%rip), %rdi     # 0x393e0
leaq 0x2f98b(%rip), %rsi     # 0x41760
xorl %edx, %edx
callq 0xcaf8
testl %eax, %eax
je 0x11cf4
movl 0x10(%rbx), %r8d
leaq 0x2f551(%rip), %rdi     # 0x41340
leaq 0x275ea(%rip), %rsi     # 0x393e0
leaq 0x2f963(%rip), %rdx     # 0x41760
pushq $0x1
popq %rcx
callq 0xc107
leaq 0x223ac(%rip), %rax     # 0x341b8
movq (%rax), %rdi
leaq 0xf4a4(%rip), %rsi      # 0x212ba
callq 0x41b0
testl %eax, %eax
je 0x11cf4
leaq 0x30b56(%rip), %rbx     # 0x42980
leaq 0x100f8(%rip), %rsi     # 0x21f29
leaq 0x22558(%rip), %rdx     # 0x34390
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42a0
movq %rbx, %rdi
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x106f2
cmpb $0x0, 0x2757f(%rip)     # 0x393e0
je 0x11cf4
leaq 0x27572(%rip), %r14     # 0x393e0
movq %r14, %rdi
callq 0x4110
cmpb $0x2a, -0x1(%rax,%r14)
je 0x11cf4
testb $0x2, (%r13)
jne 0x11f3d
cmpb $0x0, 0x224fc(%rip)     # 0x34390
movl 0x10(%rbx), %r8d
je 0x11f24
cmpl $0x0, 0x27517(%rip)     # 0x393bc
je 0x11f24
leaq 0x2f492(%rip), %rdi     # 0x41340
leaq 0x2752b(%rip), %rsi     # 0x393e0
leaq 0x224d4(%rip), %rdx     # 0x34390
pushq $0x1
popq %rcx
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xbe70
movq 0x2211d(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
movl 0x10(%rbx), %edx
movq 0x28(%rbx), %rax
movq 0x18(%rax), %r10
subq $0x8, %rsp
leaq 0x274ec(%rip), %r11     # 0x393e0
leaq 0x10f22(%rip), %rsi     # 0x22e1d
leaq 0x2f85e(%rip), %r8      # 0x41760
leaq 0x2f437(%rip), %r9      # 0x41340
movq %r14, %rcx
xorl %eax, %eax
pushq %r15
pushq 0x18(%r10)
pushq %r11
callq 0x41c0
addq $0x20, %rsp
jmp 0x11dac
leaq 0x2f415(%rip), %rdi     # 0x41340
leaq 0x274ae(%rip), %rsi     # 0x393e0
pushq $0x1
popq %rdx
movl %r8d, %ecx
jmp 0x11d40
movq 0x220b4(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
movl 0x10(%rbx), %edx
movl 0x27467(%rip), %r10d    # 0x393b8
movl 0x27464(%rip), %r11d    # 0x393bc
movl 0x27461(%rip), %r14d    # 0x393c0
leaq 0x10ef3(%rip), %rsi     # 0x22e59
leaq 0x2f3d3(%rip), %rcx     # 0x41340
leaq 0x2746c(%rip), %r8      # 0x393e0
leaq 0x2f7e5(%rip), %r9      # 0x41760
xorl %eax, %eax
pushq %r14
pushq %r11
pushq %r10
pushq %r12
callq 0x41c0
addq $0x20, %rsp
jmp 0x11e8d