// File: /workspace/github_c_makefile_star2_O2/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 0x29082(%rip), %rax     # 0x36cc0
leaq 0x29057(%rip), %rcx     # 0x36c9c
movl (%rcx), %ecx
orl (%rax), %ecx
jne 0xdc6b
movl %edi, %ebx
leaq 0x26564(%rip), %rax     # 0x341b8
movq (%rax), %rdi
leaq 0x13663(%rip), %rsi     # 0x212c1
callq 0x41b0
orl 0x2ee2b(%rip), %eax     # 0x3ca94
jne 0xdc7a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %ebx, %ebx
je 0xdfa7
movl 0x2ee10(%rip), %ecx     # 0x3ca98
leal 0x1(%rcx), %eax
movl %eax, 0x2ee07(%rip)     # 0x3ca98
leaq 0x2d968(%rip), %rbx     # 0x3b600
leaq 0x149cd(%rip), %rsi     # 0x2266c
leaq 0x28dea(%rip), %rdx     # 0x36a90
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42a0
leaq 0x19b38(%rip), %rsi     # 0x277ef
movq %rbx, %rdi
callq 0x4270
testq %rax, %rax
je 0xdff2
movq %rax, %rbx
leaq 0x28d46(%rip), %rax     # 0x36a18
cmpl $0x0, (%rax)
jne 0xe029
leaq 0x149c1(%rip), %rsi     # 0x226a3
leaq 0x266a7(%rip), %r14     # 0x34390
movq %rbx, (%rsp)
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x41c0
leaq 0x2b6cf(%rip), %rbp     # 0x393d0
movq 0x262f0(%rip), %rbx     # 0x33ff8
leaq 0x149e4(%rip), %r15     # 0x226f3
movq (%rbp), %rbp
testq %rbp, %rbp
je 0xdf34
movq 0x8(%rbp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x41b0
testl %eax, %eax
jne 0xdf2b
leaq 0x28f6e(%rip), %rax     # 0x36ca8
movl (%rax), %eax
movl 0x30(%rbp), %ecx
testl %eax, %eax
je 0xdd4c
cmpl $0x2, %ecx
jne 0xdf2b
cmpl $0x2, %ecx
sete %cl
testl %eax, %eax
setne %al
orb %cl, %al
cmpb $0x1, %al
jne 0xdd79
leaq 0x28d0c(%rip), %rax     # 0x36a70
cmpl $0x0, (%rax)
jne 0xdd79
leaq 0x28d10(%rip), %rax     # 0x36a80
cmpl $0x0, (%rax)
jne 0xde9a
movq (%rbp), %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
callq 0xcaf8
testl %eax, %eax
je 0xde73
cmpl $0x0, 0x2ecf9(%rip)     # 0x3ca90
jne 0xdf2b
movq 0x18(%rbp), %r13
movq %r13, %rsi
testq %r13, %r13
jne 0xddad
movq (%rbp), %rsi
movq 0x10(%rbp), %rdi
callq 0xc486
testq %rax, %rax
je 0xdf2b
movq %r13, %r12
testq %r13, %r13
jne 0xddd4
movq (%rbp), %r12
testq %r12, %r12
je 0xdf10
movq %rax, 0x8(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x42d0
testq %rax, %rax
je 0xdf00
movq %r12, %rdi
callq 0x4110
leal 0xc(%rax), %edi
callq 0x4739
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x40b0
movq %r13, %rdi
leaq 0x148de(%rip), %rsi     # 0x226f3
callq 0x42d0
movb $0x0, (%rax)
addq $0xa, %rax
movq %rax, 0x10(%rsp)
movq (%rsp), %r12
movq %r12, %rdi
leaq 0x1481c(%rip), %rsi     # 0x22650
movq 0x8(%rsp), %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x41c0
leaq 0x148b4(%rip), %rdi     # 0x226fe
pushq $0x15
popq %rsi
pushq $0x1
popq %rdx
movq %r12, %rcx
callq 0x42c0
movq %r12, %rdi
leaq 0x148b2(%rip), %rsi     # 0x22714
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0xdf2b
leaq 0x28c06(%rip), %rax     # 0x36a80
cmpl $0x0, (%rax)
je 0xdf2b
movq (%rbx), %rdi
movq (%rbp), %rdx
movq 0x8(%rbp), %rcx
leaq 0x14848(%rip), %rsi     # 0x226dd
jmp 0xdf24
movq %rbx, %r12
movq (%rbx), %rdi
leaq 0x262f9(%rip), %rax     # 0x341a0
movq (%rax), %rdx
leaq 0x14254(%rip), %rsi     # 0x22105
xorl %eax, %eax
callq 0x41c0
movl 0x34(%rbp), %edx
testl %edx, %edx
jle 0xded1
movq (%r12), %rdi
leaq 0x14240(%rip), %rsi     # 0x2210a
xorl %eax, %eax
callq 0x41c0
movq (%r12), %rdi
movq 0x10(%rbp), %rcx
movq 0x18(%rbp), %r8
testq %r8, %r8
jne 0xdee6
movq (%rbp), %r8
leaq 0x147cd(%rip), %rsi     # 0x226ba
movq %r14, %rdx
xorl %eax, %eax
callq 0x41c0
movq 0x8(%rbp), %r12
jmp 0xdd79
testq %r13, %r13
movq 0x8(%rsp), %rax
jne 0xdf13
movq (%rbp), %r13
jmp 0xdf13
xorl %r13d, %r13d
movq (%rsp), %rdi
leaq 0x14807(%rip), %rsi     # 0x22725
movq %rax, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x41c0
addq $0x38, %rbp
jmp 0xdd0f
pushq $0xa
popq %rdi
movq (%rsp), %r14
movq %r14, %rsi
callq 0x4180
leaq 0x28ace(%rip), %rax     # 0x36a18
cmpl $0x0, (%rax)
jne 0xe050
movq %r14, %rdi
callq 0x59e0
leaq 0x28b2e(%rip), %rbx     # 0x36a90
movq %rbx, %rdi
callq 0x4110
leal 0xa(%rax), %edi
callq 0x4739
movq %rax, %r14
movl 0x2eb1d(%rip), %ecx     # 0x3ca98
decl %ecx
leaq 0x146e8(%rip), %rsi     # 0x2266c
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 0xcb92
leaq 0x2623e(%rip), %rax     # 0x341ec
cmpl $0x0, (%rax)
je 0xdc6b
movl 0x2eadb(%rip), %ecx     # 0x3ca98
leaq 0x2d63c(%rip), %rbx     # 0x3b600
leaq 0x1468b(%rip), %rsi     # 0x22656
leaq 0x28abe(%rip), %rdx     # 0x36a90
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 0xd07c
movq 0x25fff(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x2619d(%rip), %rax     # 0x341a0
movq (%rax), %rdx
leaq 0x14667(%rip), %rsi     # 0x22674
leaq 0x2d5ec(%rip), %rcx     # 0x3b600
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x41c0
movq 0x25fc8(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x142c9(%rip), %rsi     # 0x22303
leaq 0x2d5bf(%rip), %rdx     # 0x3b600
movq %rbx, %rcx
xorl %eax, %eax
callq 0x41c0
jmp 0xdcdb
movq (%rbx), %rdi
leaq 0x146e0(%rip), %rsi     # 0x2273a
movq %r14, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0xdf53