// File: /workspace/github_c_makefile_star2_O1/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
pushq %rax
leaq 0x2a4ee(%rip), %rax     # 0x39cb0
leaq 0x2a4c3(%rip), %rcx     # 0x39c8c
movl (%rcx), %ecx
orl (%rax), %ecx
jne 0xf7ef
movl %edi, %ebx
leaq 0x279d0(%rip), %rax     # 0x371a8
movq (%rax), %rdi
leaq 0x14adf(%rip), %rsi     # 0x242c1
callq 0x41b0
orl 0x30297(%rip), %eax     # 0x3fa84
jne 0xf7fe
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %ebx, %ebx
je 0xfaa6
movl 0x3027c(%rip), %ecx     # 0x3fa88
leal 0x1(%rcx), %eax
movl %eax, 0x30273(%rip)     # 0x3fa88
leaq 0x2edd4(%rip), %rbx     # 0x3e5f0
leaq 0x15f49(%rip), %rsi     # 0x2576c
leaq 0x2a256(%rip), %rdx     # 0x39a80
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4290
leaq 0x1b0a4(%rip), %rsi     # 0x2a8df
movq %rbx, %rdi
callq 0x4260
testq %rax, %rax
je 0xfaf1
movq %rax, %rbx
leaq 0x2a1b2(%rip), %rbp     # 0x39a08
cmpl $0x0, (%rbp)
jne 0xfafb
leaq 0x15f3c(%rip), %rsi     # 0x257a3
leaq 0x27b12(%rip), %rdx     # 0x37380
movq %rbx, %rdi
xorl %eax, %eax
callq 0x41c0
movq 0x2cb41(%rip), %r14     # 0x3c3c0
testq %r14, %r14
je 0xfa3b
leaq 0x27af1(%rip), %r15     # 0x37380
movq 0x8(%r14), %rsi
movq %r15, %rdi
callq 0x41b0
testl %eax, %eax
je 0xf8ad
movq 0x38(%r14), %r14
testq %r14, %r14
jne 0xf88f
jmp 0xfa3b
leaq 0x2a3e4(%rip), %rax     # 0x39c98
cmpl $0x0, (%rax)
je 0xf8c0
cmpl $0x2, 0x30(%r14)
jne 0xf89f
cmpl $0x2, 0x30(%r14)
jne 0xf8e3
leaq 0x2a192(%rip), %rax     # 0x39a60
cmpl $0x0, (%rax)
jne 0xf8e3
leaq 0x2a196(%rip), %rax     # 0x39a70
cmpl $0x0, (%rax)
jne 0xfa2e
movq (%r14), %rdi
movq 0x8(%r14), %rsi
movl $0x1, %edx
callq 0xe686
testl %eax, %eax
je 0xf9cf
cmpl $0x0, 0x3017d(%rip)     # 0x3fa80
jne 0xf89f
movq 0x18(%r14), %r13
movq %r13, %rsi
testq %r13, %r13
jne 0xf914
movq (%r14), %rsi
movq 0x10(%r14), %rdi
callq 0xe09e
testq %rax, %rax
je 0xf89f
movq %rax, %r12
movq %r13, %rbp
testq %r13, %r13
jne 0xf934
movq (%r14), %rbp
testq %rbp, %rbp
je 0xfa03
movq %rbp, %rdi
leaq 0x15eac(%rip), %rsi     # 0x257f3
callq 0x42c0
testq %rax, %rax
je 0xfa03
movq %rbp, %rdi
callq 0x4110
leal 0xc(%rax), %edi
callq 0x6469
movq %rax, %r13
movq %rax, %rdi
movq %rbp, %rsi
callq 0x40b0
movq %r13, %rdi
leaq 0x15e76(%rip), %rsi     # 0x257f3
callq 0x42c0
movb $0x0, (%rax)
leaq 0xa(%rax), %rbp
movq %rbx, %rdi
leaq 0x15dbd(%rip), %rsi     # 0x25750
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x41c0
movl $0x15, %esi
movl $0x1, %edx
leaq 0x15e4d(%rip), %rdi     # 0x257fe
movq %rbx, %rcx
callq 0x42b0
movq %rbx, %rdi
leaq 0x15e51(%rip), %rsi     # 0x25814
movq %rbp, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0xfa22
leaq 0x2a09a(%rip), %rax     # 0x39a70
cmpl $0x0, (%rax)
je 0xf89f
movq 0x27612(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
movq (%r14), %rdx
movq 0x8(%r14), %rcx
leaq 0x15de6(%rip), %rsi     # 0x257dd
xorl %eax, %eax
callq 0x41c0
jmp 0xf89f
testq %r13, %r13
jne 0xfa0b
movq (%r14), %r13
movq %rbx, %rdi
leaq 0x15e10(%rip), %rsi     # 0x25825
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x41c0
leaq 0x29fdf(%rip), %rbp     # 0x39a08
jmp 0xf89f
movq %r14, %rdi
callq 0x4a31
jmp 0xf8e3
movl $0xa, %edi
movq %rbx, %rsi
callq 0x4190
cmpl $0x0, (%rbp)
jne 0xfb22
movq %rbx, %rdi
callq 0x793c
leaq 0x2a01f(%rip), %rbx     # 0x39a80
movq %rbx, %rdi
callq 0x4110
leal 0xa(%rax), %edi
callq 0x6469
movq %rax, %r14
movl 0x3000e(%rip), %ecx     # 0x3fa88
decl %ecx
leaq 0x15ce9(%rip), %rsi     # 0x2576c
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4290
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe728
leaq 0x2772f(%rip), %rax     # 0x371dc
cmpl $0x0, (%rax)
je 0xf7ef
movl 0x2ffcc(%rip), %ecx     # 0x3fa88
leaq 0x2eb2d(%rip), %rbx     # 0x3e5f0
leaq 0x15c8c(%rip), %rsi     # 0x25756
leaq 0x29faf(%rip), %rdx     # 0x39a80
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4290
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xebec
callq 0x4aa1
jmp 0xf7ef
movq 0x274f6(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0x158f7(%rip), %rsi     # 0x25403
leaq 0x2eadd(%rip), %rdx     # 0x3e5f0
movq %rbx, %rcx
xorl %eax, %eax
callq 0x41c0
jmp 0xf860
movq 0x274cf(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0x15d07(%rip), %rsi     # 0x2583a
movq %rbx, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0xfa52