// File: /workspace/github_c_makefile_star2_O3/nimble-code[P]Modex/Src/symtab.c
// Function: put_structs
void
put_structs(scopetab_t *that, FILE *fp)
{	scopetab_t *z;
	symentry_t *t;
	char *s;
	int j;

	if (that->htab)
	{	for (z = that; z; z = z->parent)
		{	if (z->owner
			&&  z->owner_t == TN_OBJ_DEF
			&&  strcmp(z->owner, "-") != 0)
			{	/* sanity pretest */
				int shouldshow = 1;
				for (j = 0; j < that->htab->tsize && shouldshow; j++)
				for (t = that->htab->tab[j]; t; t = t->next)
				{	s = nx_stmnt(t->node);
					if (strstr(s, "->")
					||  strstr(s, "[]"))	/* both would produce invalid code */
					{	shouldshow = 0;
						break;
				}	}
				if (!shouldshow) break;
				/* end pretest */

				/* a possible issue:
				 * this does not reproduce the fields in
				 * the same order as the original
				 * struct declaration
				 */
				fprintf(fp, "c_decl {	/* put_structs */\n");
				fprintf(fp, "	struct %s {\n", z->owner);
				for (j = 0; j < that->htab->tsize; j++)
				for (t = that->htab->tab[j]; t; t = t->next)
				{	s = nx_stmnt(t->node);
					remove_newlines(s);

					while (strlen(s) > 0
					&& (s[strlen(s)-1] == ';'
					 || s[strlen(s)-1] == ' '))
					{	s[strlen(s)-1] = '\0';
					}
					fprintf(fp, "\t\t%s; /* P: %p */\n", s, z);
				}
				fprintf(fp, "\t};\n");
				fprintf(fp, "} /* end c_code. */\n");
				break;
		}	}
	}

	for (j = 0; j < that->nchild; j++)
		put_structs(that->children[j], fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq 0x8(%rdi), %rax
testq %rax, %rax
sete %cl
movq %rdi, (%rsp)
testq %rdi, %rdi
sete %dl
orb %cl, %dl
jne 0x7094
movq (%rsp), %r15
movq 0x18(%r15), %rcx
testq %rcx, %rcx
je 0x6f16
cmpl $0x18, 0x20(%r15)
jne 0x6f16
cmpb $0x2d, (%rcx)
jne 0x6f24
cmpb $0x0, 0x1(%rcx)
jne 0x6f24
movq 0x10(%r15), %r15
testq %r15, %r15
jne 0x6efb
jmp 0x7094
movl (%rax), %ecx
testl %ecx, %ecx
jle 0x6fa2
xorl %r13d, %r13d
leaq 0x1dded(%rip), %r12     # 0x24d21
movq 0x8(%rax), %rax
movslq %ecx, %rcx
movq (%rax,%r13,8), %r14
testq %r14, %r14
jne 0x6f4e
incq %r13
cmpq %rcx, %r13
jl 0x6f3b
jmp 0x6fa2
movq 0x10(%r14), %rdi
callq 0xc0aa
movq %rax, %rbp
movq %rax, %rdi
movq %r12, %rsi
callq 0x42d0
testq %rax, %rax
jne 0x7094
movq %rbp, %rdi
leaq 0x1b1a7(%rip), %rsi     # 0x2211f
callq 0x42d0
testq %rax, %rax
jne 0x7094
movq 0x38(%r14), %r14
testq %r14, %r14
jne 0x6f4e
movq (%rsp), %rax
movq 0x8(%rax), %rax
movslq (%rax), %rcx
incq %r13
cmpq %rcx, %r13
jl 0x6f34
leaq 0x1b179(%rip), %rdi     # 0x22122
movl $0x1b, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42c0
movq 0x18(%r15), %rdx
leaq 0x1b178(%rip), %rsi     # 0x2213e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x41d0
movq (%rsp), %rax
movq 0x8(%rax), %rax
movl (%rax), %ecx
testl %ecx, %ecx
jle 0x7062
leaq 0x1b163(%rip), %r12     # 0x2214c
xorl %ebp, %ebp
movq 0x8(%rax), %rdx
movq (%rdx,%rbp,8), %r14
testq %r14, %r14
je 0x7057
movq 0x10(%r14), %rdi
callq 0xc0aa
movq %rax, %r13
movq %rax, %rdi
callq 0x6e91
movq %r13, %rdi
callq 0x4110
testq %rax, %rax
je 0x7031
movzbl -0x1(%r13,%rax), %ecx
cmpl $0x3b, %ecx
je 0x7029
cmpl $0x20, %ecx
jne 0x7031
movb $0x0, -0x1(%r13,%rax)
jmp 0x700c
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x41d0
movq 0x38(%r14), %r14
testq %r14, %r14
jne 0x6ff8
movq (%rsp), %rax
movq 0x8(%rax), %rax
movl (%rax), %ecx
incq %rbp
movslq %ecx, %rdx
cmpq %rdx, %rbp
jl 0x6feb
leaq 0x1d6b4(%rip), %rdi     # 0x2471d
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42c0
leaq 0x1b0dd(%rip), %rdi     # 0x2215f
movl $0x14, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42c0
movq (%rsp), %r15
cmpl $0x0, 0x28(%r15)
jle 0x70be
xorl %r14d, %r14d
movq 0x30(%r15), %rax
movq (%rax,%r14,8), %rdi
movq %rbx, %rsi
callq 0x6ecd
incq %r14
movslq 0x28(%r15), %rax
cmpq %rax, %r14
jl 0x70a2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq