// File: /workspace/github_c_makefile_star2_O0/nimble-code[P]Modex/Src/xtract.c
// Function: do_globals
void
do_globals(int setup, scopetab_t *that, int lastcall)
{	Fcts *g;
	char *z;
	FILE *fd;
	NameL *nl;

	if (suppress)
	{	return;
	}

	if (Verbose_cmds)
	{	printf("-- do globals [%d %d %d %s]\n", setup, do_inc_globals, allprocs, globfilename);
	}

	if (setup)
	{	setglobfile();
		if (do_inc_globals && allprocs)
		{	sprintf(tbuf, "#include \"%s\"	/* global header file */\n\n",
				globfilename);
			vis_direct(tbuf);
		}	/*  else created but not #include'd */
		return;
	}
	if (!globfilename)	/* no functions matched, user forgot -x */
	{	setglobfile();
	}

	#ifdef PC
		#define AFLAGS	"ab"
	#else
		#define AFLAGS	"a"
	#endif

	if ((fd = fopen(globfilename, AFLAGS)) == NULL)
	{	fprintf(stderr, "%s: error, cannot create global header file %s\n",
			progname, globfilename);
		return;
	}
if (debug_io) fprintf(stderr, ":: open %s -> %p\n", globfilename, fd);
	add_fnm(globfilename);

	fprintf(fd, "/** globals **/\n\n");

	do_constants(fd);
	fprintf(fd, "/** done with constants... **/\n\n");

	for (g = modex_globals; g; g = g->nxt)
	{
		if (strlen(g->full?g->full:g->nm) == 0)
			continue;

		if (!imported(g->nm, "Global", 1))
			continue;

		if (g->purged)
		{	continue;
		}
		g->purged = 1;

		if (0)
		printf("nm %s, dt %s, full %s\n", g->nm, g->dt, g->full);

		if ((z = spintype(g->dt, g->full?g->full:g->nm)) != NULL)
		{	sprintf(tbuf, "%s %s;\t/* derived <%s> */\n",
				z, g->full?g->full:g->nm, g->nm);
		} else if (strstr(g->dt, "typedef"))
		{	continue;
		} else
		{	z = checkfull(g->dt, g->full, g->lno);
			cleanse(g->dt);

			if (du_mode)
			{	char *yy, *y = g->full?g->full:g->nm;
				while (*y == '*' || *y == ' ' || *y == '\t')
					y++;
				if ((yy = strstr(y, "[]")) != NULL)
				{	*yy = '\0';
				}
				sprintf(tbuf, "int %s;	/* global */\n", y);
			} else
			{	if (z)
				sprintf(tbuf, " c_state \"%s %s\" \"Global\" \"%s\"\n",
					g->dt, g->full?g->full:g->nm, z);
				else
				sprintf(tbuf, " c_state \"%s %s\" \"Global\"\n",
					g->dt, g->full?g->full:g->nm);
		}	}
		fprintf(fd, "%s", tbuf);
	}

	for (nl = globchans; nl; nl = nl->nxt)
	{
		if (nl->purged)
		{	continue;
		}
		nl->purged = 1;

		fprintf(fd, "%s\n", nl->nm);
	}

	add_nomap_locals(fd);
	do_externals(fd);

	do_hidden(fd);			/* hidden vars */
	if (that)
	{	x_scopetab(that, fd, want);	/* extra c_state decls */
	}

	if (i_assert)
	{	ax_doprops(fd, that);
	}

	if (that && !nostructs)	/* import global structure declarations */
	{
		if (lastcall)				/* new 2.8 */
		{	find_typedefs(that, fd);	/* new 2.6 */
			put_structs(that, fd);
	}	}
if (debug_io) fprintf(stderr, "close z %p\n", fd);
	Fclose(fd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
leaq 0x378e4(%rip), %rax     # 0x47e90
cmpl $0x0, (%rax)
je 0x105b6
jmp 0x10b31
leaq 0x3762f(%rip), %rax     # 0x47bec
cmpl $0x0, (%rax)
je 0x105ec
movl -0x4(%rbp), %esi
leaq 0x34bf4(%rip), %rax     # 0x451c0
movl (%rax), %edx
leaq 0x37663(%rip), %rax     # 0x47c38
movl (%rax), %ecx
movq 0x3c1e2(%rip), %r8      # 0x4c7c0
leaq 0x25092(%rip), %rdi     # 0x35677
movb $0x0, %al
callq 0x4120
cmpl $0x0, -0x4(%rbp)
je 0x1063c
callq 0x10570
leaq 0x34bc2(%rip), %rax     # 0x451c0
cmpl $0x0, (%rax)
je 0x10637
leaq 0x3762e(%rip), %rax     # 0x47c38
cmpl $0x0, (%rax)
je 0x10637
movq 0x3c1aa(%rip), %rdx     # 0x4c7c0
leaq 0x3c1b3(%rip), %rdi     # 0x4c7d0
leaq 0x25070(%rip), %rsi     # 0x35694
movb $0x0, %al
callq 0x4260
leaq 0x3c19e(%rip), %rdi     # 0x4c7d0
callq 0x10b40
jmp 0x10b31
cmpq $0x0, 0x3c17c(%rip)     # 0x4c7c0
jne 0x1064b
callq 0x10570
movq 0x3c16e(%rip), %rdi     # 0x4c7c0
leaq 0x24344(%rip), %rsi     # 0x3499d
callq 0x4230
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x10696
movq 0x34989(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
leaq 0x34af7(%rip), %rax     # 0x45170
movq (%rax), %rdx
movq 0x3c13d(%rip), %rcx     # 0x4c7c0
leaq 0x25033(%rip), %rsi     # 0x356bd
movb $0x0, %al
callq 0x4190
jmp 0x10b31
leaq 0x3754b(%rip), %rax     # 0x47be8
cmpl $0x0, (%rax)
je 0x106c5
movq 0x3494f(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
movq 0x3c10d(%rip), %rdx     # 0x4c7c0
movq -0x30(%rbp), %rcx
leaq 0x2502f(%rip), %rsi     # 0x356ed
movb $0x0, %al
callq 0x4190
movq 0x3c0f4(%rip), %rdi     # 0x4c7c0
callq 0x10500
movq -0x30(%rbp), %rdi
leaq 0x25023(%rip), %rsi     # 0x356ff
movb $0x0, %al
callq 0x4190
movq -0x30(%rbp), %rdi
callq 0x6940
movq -0x30(%rbp), %rdi
leaq 0x2501a(%rip), %rsi     # 0x35711
movb $0x0, %al
callq 0x4190
movq 0x39e93(%rip), %rax     # 0x4a598
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x10a29
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x1072d
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x10738
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x40f0
cmpq $0x0, %rax
jne 0x1074c
jmp 0x10a18
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x22953(%rip), %rsi     # 0x330ad
movl $0x1, %edx
callq 0x10430
cmpl $0x0, %eax
jne 0x1076e
jmp 0x10a18
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x1077d
jmp 0x10a18
movq -0x20(%rbp), %rax
movl $0x1, 0x20(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x107ad
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x107b8
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0xfa40
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x10824
movq -0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x107f0
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x70(%rbp)
jmp 0x107fb
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq -0x20(%rbp), %rax
movq (%rax), %r8
leaq 0x3bfbf(%rip), %rdi     # 0x4c7d0
leaq 0x24f1a(%rip), %rsi     # 0x35732
movb $0x0, %al
callq 0x4260
jmp 0x109ff
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x24c2e(%rip), %rsi     # 0x35461
callq 0x4280
cmpq $0x0, %rax
je 0x10843
jmp 0x10a18
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x20(%rbp), %rax
movl 0x34(%rax), %edx
callq 0xfe90
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x10010
leaq 0x373b1(%rip), %rax     # 0x47c28
cmpl $0x0, (%rax)
je 0x10934
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x10899
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x108a4
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x2a, %ecx
movb %al, -0x79(%rbp)
je 0x108de
movq -0x48(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x79(%rbp)
je 0x108de
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
sete %al
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
testb $0x1, %al
jne 0x108e7
jmp 0x108f5
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x108ac
movq -0x48(%rbp), %rdi
leaq 0x22830(%rip), %rsi     # 0x33130
callq 0x4280
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x10916
movq -0x40(%rbp), %rax
movb $0x0, (%rax)
movq -0x48(%rbp), %rdx
leaq 0x3beaf(%rip), %rdi     # 0x4c7d0
leaq 0x24e25(%rip), %rsi     # 0x3574d
movb $0x0, %al
callq 0x4260
jmp 0x109fb
cmpq $0x0, -0x28(%rbp)
je 0x1099d
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x10966
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x90(%rbp)
jmp 0x10974
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdx
movq -0x90(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq 0x3be43(%rip), %rdi     # 0x4c7d0
leaq 0x24dcf(%rip), %rsi     # 0x35763
movb $0x0, %al
callq 0x4260
jmp 0x109f9
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x109c8
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xa0(%rbp)
jmp 0x109d6
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rdx
movq -0xa0(%rbp), %rcx
leaq 0x3bde5(%rip), %rdi     # 0x4c7d0
leaq 0x24d91(%rip), %rsi     # 0x35783
movb $0x0, %al
callq 0x4260
jmp 0x109fb
jmp 0x109fd
jmp 0x109ff
movq -0x30(%rbp), %rdi
leaq 0x24db7(%rip), %rsi     # 0x357c1
leaq 0x3bdbf(%rip), %rdx     # 0x4c7d0
movb $0x0, %al
callq 0x4190
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x10709
movq 0x3ce20(%rip), %rax     # 0x4d850
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x10a79
movq -0x38(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x10a47
jmp 0x10a6b
movq -0x38(%rbp), %rax
movl $0x1, 0x8(%rax)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rdx
leaq 0x24c05(%rip), %rsi     # 0x35669
movb $0x0, %al
callq 0x4190
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x10a34
movq -0x30(%rbp), %rdi
callq 0x10080
movq -0x30(%rbp), %rdi
callq 0x10be0
movq -0x30(%rbp), %rdi
callq 0xfbe0
cmpq $0x0, -0x10(%rbp)
je 0x10ab2
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq 0x346ce(%rip), %rax     # 0x45178
movq (%rax), %rdx
callq 0x10c50
leaq 0x3470f(%rip), %rax     # 0x451c8
cmpl $0x0, (%rax)
je 0x10acb
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x10d40
cmpq $0x0, -0x10(%rbp)
je 0x10b00
leaq 0x3713f(%rip), %rax     # 0x47c18
cmpl $0x0, (%rax)
jne 0x10b00
cmpl $0x0, -0x14(%rbp)
je 0x10afe
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x5bc0
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x5d70
jmp 0x10b00
leaq 0x370e1(%rip), %rax     # 0x47be8
cmpl $0x0, (%rax)
je 0x10b28
movq 0x344e5(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
movq -0x30(%rbp), %rdx
leaq 0x24c7d(%rip), %rsi     # 0x3579e
movb $0x0, %al
callq 0x4190
movq -0x30(%rbp), %rdi
callq 0x6d20
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)