// File: /workspace/github_c_makefile_star2_O3/nimble-code[P]Modex/Src/xtract.c
// Function: do_locals
void
do_locals(int d)
{	FILE *fd;
	Fcts *g;
	char *z;

	if (suppress || globals_only
	||  (strcmp(wanttype, "body") == 0
	&&   import_all == 0))
		return;

if (0) fprintf(stderr, "===> %d %d %d\n", suppress, globals_only, import_all);

	if (!d)
	{	if (do_inc_locals)
		{	sprintf(tbuf, "\n#include \"%s_%d.h\"\n\n", o_base, o_cnt);
			vis_direct(tbuf);
		}
		return;
	}

	sprintf(tbuf, "%s_%d.h", o_base, o_cnt++);
	if ((fd = fopen(tbuf, MFLAGS)) == NULL)
	{	fprintf(stderr, "%s: error, cannot create local header file %s\n",
			progname, tbuf);
		return;
	}
if (debug_io) fprintf(stderr, "open %s -> %p\n", tbuf, fd);

	fprintf(fd, "/** locals of %s **/\n\n", fct_name);

	for (g = modex_locals; g; g = g->nxt)
	{
if (0)		printf("%3d: %s: %s %s %s (%s) (%d,%d)\n",
		g->lno, fct_name, g->dt, g->nm, g->tg, g->full, g->fc, g->derived);
		if (strcmp(fct_name, g->tg) != 0
		||  (allkeep && g->fc != 2))	/* formal params only */
			continue;

		if (g->fc == 2 && !show_deps && Warnings)
		{	fprintf(stderr, "%s: ", progname);
			if (g->lno > 0)
			fprintf(stderr, "line %3d, ", g->lno);
			fprintf(stderr, "initialize parameter to %s: %s %s\n",
				fct_name, g->dt, g->full?g->full:g->nm);
		}

		if (!imported(g->nm, g->tg, 1))
		{	if (Warnings)
			fprintf(stderr, "Not imported %s <%s>\n", g->nm, g->tg);
			continue;
		}

		if (!did_parameters)
		if ((z = spintype(g->dt, g->full?g->full:g->nm)) != NULL)
		{	char *w, *x, *y = g->full?g->full:g->nm;
			if (y && strstr(y, "pan_rand()"))
			{	x = e_malloc(strlen(y)+strlen("c_expr { } ") + 1);
				strcpy(x, y);
				w = strstr(x, "pan_rand()");
				*w = '\0';
				w += strlen("pan_rand()");
				fprintf(fd, "%s %s", z, x);
				fprintf(fd, "c_expr { pan_rand() }");
				fprintf(fd, "%s;\t/*mapped */\n", w);
			} else
			{	fprintf(fd, "%s %s;\t/* mapped */\n",
					z, g->full?g->full:g->nm);
			}
			/* others printed in add_nomap_locals */
	}	}
	fprintf(fd, "\n");
if (debug_io) fprintf(stderr, "close x %p\n", fd);
	Fclose(fd);

	z = (char *) e_malloc(strlen(o_base)+10);
	sprintf(z, "%s_%d.h", o_base, o_cnt-1);
	add_fnm(z);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x29648(%rip), %rax     # 0x38cc0
leaq 0x2961d(%rip), %rcx     # 0x38c9c
movl (%rcx), %ecx
orl (%rax), %ecx
jne 0xf6a5
movl %edi, %ebx
leaq 0x26b2a(%rip), %rax     # 0x361b8
movq (%rax), %rdi
leaq 0x13c29(%rip), %rsi     # 0x232c1
callq 0x41c0
orl 0x2f3f1(%rip), %eax     # 0x3ea94
jne 0xf6b4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %ebx, %ebx
je 0xf9a5
movl 0x2f3d6(%rip), %ecx     # 0x3ea98
leal 0x1(%rcx), %eax
movl %eax, 0x2f3cd(%rip)     # 0x3ea98
leaq 0x2df2e(%rip), %rbx     # 0x3d600
leaq 0x15093(%rip), %rsi     # 0x2476c
leaq 0x293b0(%rip), %rdx     # 0x38a90
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42a0
leaq 0x1a1ee(%rip), %rsi     # 0x298df
movq %rbx, %rdi
callq 0x4270
testq %rax, %rax
je 0xf9f0
movq %rax, %rbx
leaq 0x2930c(%rip), %rax     # 0x38a18
cmpl $0x0, (%rax)
jne 0xf9fa
leaq 0x15087(%rip), %rsi     # 0x247a3
leaq 0x26c6d(%rip), %rdx     # 0x36390
movq %rbx, %rdi
xorl %eax, %eax
callq 0x41d0
movq 0x2bc9c(%rip), %r14     # 0x3b3d0
testq %r14, %r14
je 0xf934
leaq 0x26c4c(%rip), %r15     # 0x36390
leaq 0x150a8(%rip), %rdx     # 0x247f3
movq 0x8(%r14), %r12
movq %r15, %rdi
movq %rdx, %rbp
movq %r12, %rsi
callq 0x41c0
movq %rbp, %rdx
testl %eax, %eax
jne 0xf927
leaq 0x29539(%rip), %rax     # 0x38ca8
movl (%rax), %eax
movl 0x30(%r14), %ecx
testl %eax, %eax
je 0xf782
cmpl $0x2, %ecx
jne 0xf927
cmpl $0x2, %ecx
sete %cl
testl %eax, %eax
setne %al
orb %cl, %al
cmpb $0x1, %al
jne 0xf7af
leaq 0x292d6(%rip), %rax     # 0x38a70
cmpl $0x0, (%rax)
jne 0xf7af
leaq 0x292da(%rip), %rax     # 0x38a80
cmpl $0x0, (%rax)
jne 0xf8ec
movq (%r14), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0xe541
testl %eax, %eax
je 0xf7f9
cmpl $0x0, 0x2f2c6(%rip)     # 0x3ea90
movq %rbp, %rdx
jne 0xf927
movq 0x10(%r14), %rdi
movq 0x18(%r14), %r12
testq %r12, %r12
je 0xf829
movq %r12, %rsi
callq 0xdf6b
testq %rax, %rax
movq %rbp, %rdx
je 0xf927
movq %rax, %r13
jmp 0xf84c
leaq 0x29280(%rip), %rax     # 0x38a80
cmpl $0x0, (%rax)
movq %rbp, %rdx
je 0xf927
movq 0x267e5(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
movq (%r14), %rdx
movq 0x8(%r14), %rcx
leaq 0x14fb9(%rip), %rsi     # 0x247dd
jmp 0xf91d
movq (%r14), %r12
movq %r12, %rsi
callq 0xdf6b
testq %rax, %rax
movq %rbp, %rdx
je 0xf927
movq %rax, %r13
testq %r12, %r12
je 0xf907
movq %r12, %rdi
movq %rdx, %rbp
movq %rdx, %rsi
callq 0x42d0
testq %rax, %rax
je 0xf90d
movq %r13, 0x8(%rsp)
movq %r12, %rdi
callq 0x4110
leal 0xc(%rax), %edi
callq 0x6321
movq %rbx, %r13
movq %rbp, %rbx
movq %rax, %rbp
movq %rax, %rdi
movq %r12, %rsi
callq 0x40b0
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x42d0
movb $0x0, (%rax)
leaq 0xa(%rax), %r12
movq %r13, %rdi
leaq 0x14ea8(%rip), %rsi     # 0x24750
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x41d0
movl $0x15, %esi
movl $0x1, %edx
leaq 0x14f36(%rip), %rdi     # 0x247fe
movq %r13, %rcx
callq 0x42c0
movq %r13, %rdi
leaq 0x14f3a(%rip), %rsi     # 0x24814
movq %r12, %rdx
xorl %eax, %eax
callq 0x41d0
movq %rbx, %rdx
movq %r13, %rbx
jmp 0xf927
leaq 0x8(%r14), %rsi
movq %r14, %rdi
leaq 0x10(%rsp), %rdx
callq 0x49f4
movq 0x10(%rsp), %r12
jmp 0xf7af
xorl %r12d, %r12d
movq %rdx, %rbp
movq %rbx, %rdi
leaq 0x14f0e(%rip), %rsi     # 0x24825
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x41d0
movq %rbp, %rdx
movq 0x38(%r14), %r14
testq %r14, %r14
jne 0xf74b
movl $0xa, %edi
movq %rbx, %rsi
callq 0x4190
leaq 0x290d0(%rip), %rax     # 0x38a18
cmpl $0x0, (%rax)
jne 0xfa21
movq %rbx, %rdi
callq 0x77d0
leaq 0x29130(%rip), %rbx     # 0x38a90
movq %rbx, %rdi
callq 0x4110
leal 0xa(%rax), %edi
callq 0x6321
movq %rax, %r14
movl 0x2f11f(%rip), %ecx     # 0x3ea98
decl %ecx
leaq 0x14dea(%rip), %rsi     # 0x2476c
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x42a0
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe5e3
leaq 0x26840(%rip), %rax     # 0x361ec
cmpl $0x0, (%rax)
je 0xf6a5
movl 0x2f0dd(%rip), %ecx     # 0x3ea98
leaq 0x2dc3e(%rip), %rbx     # 0x3d600
leaq 0x14d8d(%rip), %rsi     # 0x24756
leaq 0x290c0(%rip), %rdx     # 0x38a90
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42a0
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xeab6
callq 0x4a7d
jmp 0xf6a5
movq 0x265f7(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
leaq 0x149f8(%rip), %rsi     # 0x24403
leaq 0x2dbee(%rip), %rdx     # 0x3d600
movq %rbx, %rcx
xorl %eax, %eax
callq 0x41d0
jmp 0xf715
movq 0x265d0(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
leaq 0x14e08(%rip), %rsi     # 0x2483a
movq %rbx, %rdx
xorl %eax, %eax
callq 0x41d0
jmp 0xf951