// File: /workspace/github_c_makefile_star2_O2/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
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r12
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x5316
movq %r12, %r15
testq %r15, %r15
je 0x5316
movq 0x18(%r15), %rcx
testq %rcx, %rcx
je 0x5195
cmpl $0x18, 0x20(%r15)
jne 0x5195
cmpb $0x2d, (%rcx)
jne 0x519b
cmpb $0x0, 0x1(%rcx)
jne 0x519b
movq 0x10(%r15), %r15
jmp 0x5171
movq %r12, 0x8(%rsp)
pushq $0x1
popq %r14
xorl %edx, %edx
leaq 0x1da74(%rip), %r12     # 0x22c21
testl %r14d, %r14d
je 0x5224
movslq (%rax), %rcx
cmpq %rcx, %rdx
jge 0x5224
movq %rdx, 0x10(%rsp)
leaq (,%rdx,8), %r13
addq 0x8(%rax), %r13
movq (%r13), %r13
testq %r13, %r13
je 0x520d
movq 0x10(%r13), %rdi
callq 0xa49b
movq %rax, %rbp
movq %rax, %rdi
movq %r12, %rsi
callq 0x42d0
xorl %r14d, %r14d
testq %rax, %rax
jne 0x5211
movq %rbp, %rdi
leaq 0x1af22(%rip), %rsi     # 0x2011f
callq 0x42d0
addq $0x38, %r13
testq %rax, %rax
je 0x51cb
jmp 0x5211
pushq $0x1
popq %r14
movq 0x10(%rsp), %rdx
incq %rdx
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
jmp 0x51ad
testl %r14d, %r14d
movq 0x8(%rsp), %r12
je 0x5316
leaq 0x1aee9(%rip), %rdi     # 0x20122
pushq $0x1b
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x42c0
movq 0x18(%r15), %rdx
leaq 0x1aeec(%rip), %rsi     # 0x2013e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x41c0
leaq 0x1aee9(%rip), %r12     # 0x2014c
xorl %r14d, %r14d
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movslq (%rax), %rcx
cmpq %rcx, %r14
jge 0x52e3
leaq (,%r14,8), %rbp
addq 0x8(%rax), %rbp
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x52de
movq 0x10(%rbp), %rdi
callq 0xa49b
movq %rax, %r13
movq %rax, %rdi
callq 0x5120
movq %r13, %rdi
callq 0x4110
testq %rax, %rax
je 0x52c5
movzbl -0x1(%r13,%rax), %ecx
cmpl $0x3b, %ecx
je 0x52bd
cmpl $0x20, %ecx
jne 0x52c5
movb $0x0, -0x1(%r13,%rax)
jmp 0x52a0
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x41c0
addq $0x38, %rbp
jmp 0x5283
incq %r14
jmp 0x5266
leaq 0x1d333(%rip), %rdi     # 0x2261d
pushq $0x4
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
movq %rbx, %rcx
callq 0x42c0
leaq 0x1ae5c(%rip), %rdi     # 0x2015f
pushq $0x14
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x42c0
movq 0x8(%rsp), %r12
xorl %r14d, %r14d
movslq 0x28(%r12), %rax
cmpq %rax, %r14
jge 0x5339
movq 0x30(%r12), %rax
movq (%rax,%r14,8), %rdi
movq %rbx, %rsi
callq 0x514d
incq %r14
jmp 0x5319
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq