// File: /workspace/github_c_makefile_star2_O3/nimble-code[P]Uno/Src/uno_lts.c
// Function: add_gstack
static SymRef *
add_gstack(symentry_t *t, treenode *n, int mark)
{	SymRef *r, *s, *lr;
	int x;

	uno_assert((dfstack != NULL), "no dfstack - add_gstack");

/*	if (is_enum_const(t)) return;	*/

	if (debug)
	printf("\tadd_gstack %s [%s:%d] + %d\n",
		t->nme->str, n->hdr.fnm, n->hdr.line, mark);

	if (!dfstack->globrefs)	/* empty list */
	{	r = uno_getref(t);
		r->n = n;
		r->status = mark;
		dfstack->globrefs = r;
		goto done;
	}

	lr = (SymRef *) 0;
	for (r = dfstack->globrefs; r; lr = r, r = r->nxt)	/* keep list sorted */
	{	if (debug) printf("\t<%s> status: [%d]\n", r->sm->nme->str, r->status);
		x = strcmp(r->sm->nme->str, t->nme->str);

		if (x < 0)
			continue;

		if (x == 0)
			r->status |= mark;
		else
		{	s = uno_getref(t);
			s->n = n;
			s->status = mark;
			s->nxt = r;	/* insert before r */
			if (!lr)	/* at head of list */
				dfstack->globrefs = s;
			else
				lr->nxt = s;
			r = s;
		}
		goto done;
	}
	/* fell off the end of the list - item should go at the end */
	r = uno_getref(t);
	r->n = n;
	r->status = mark;
	lr->nxt = r;	/* list had at least 1 item, so lr is set */
done:
	if (!(r->status & DEF))
		return r;

	return (SymRef *) 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
xorl %edi, %edi
cmpq $0x0, 0x5781a(%rip)     # 0x6ff28
setne %dil
leaq 0x17a0f(%rip), %rsi     # 0x30128
callq 0x1341d
movq 0x57803(%rip), %rcx     # 0x6ff28
movq 0x8(%rcx), %rbp
testq %rbp, %rbp
je 0x18774
movq 0x8(%r15), %rax
movq 0x8(%rax), %r12
movq (%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq %r12, %rsi
callq 0x3190
testl %eax, %eax
jns 0x18797
movq %rbp, %r13
movq 0x18(%rbp), %rbp
testq %rbp, %rbp
je 0x187c9
movq (%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq %r12, %rsi
callq 0x3190
testl %eax, %eax
js 0x1874e
jmp 0x1879a
movq 0x576e5(%rip), %rax     # 0x6fe60
testq %rax, %rax
je 0x187ec
movq 0x18(%rax), %rdx
movq %rdx, 0x576d5(%rip)     # 0x6fe60
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
jmp 0x187fd
xorl %r13d, %r13d
testl %eax, %eax
je 0x187c1
movq 0x576bb(%rip), %rax     # 0x6fe60
testq %rax, %rax
je 0x18809
movq 0x18(%rax), %rcx
movq %rcx, 0x576ab(%rip)     # 0x6fe60
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
jmp 0x18813
orl %ebx, 0x10(%rbp)
jmp 0x1884b
movq 0x57690(%rip), %rax     # 0x6fe60
testq %rax, %rax
je 0x18833
movq 0x18(%rax), %rcx
movq %rcx, 0x57680(%rip)     # 0x6fe60
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
jmp 0x1883d
movl $0x20, %edi
callq 0x5fdd
movq 0x5772b(%rip), %rcx     # 0x6ff28
movq %r15, (%rax)
movq %r14, 0x8(%rax)
movl %ebx, 0x10(%rax)
jmp 0x1882d
movl $0x20, %edi
callq 0x5fdd
movq %r15, (%rax)
movq %r14, 0x8(%rax)
movl %ebx, 0x10(%rax)
movq %rbp, 0x18(%rax)
testq %r13, %r13
jne 0x18847
movq 0x576fb(%rip), %rcx     # 0x6ff28
movq %rax, 0x8(%rcx)
jmp 0x1884b
movl $0x20, %edi
callq 0x5fdd
movq %r15, (%rax)
movq %r14, 0x8(%rax)
movl %ebx, 0x10(%rax)
movq %rax, 0x18(%r13)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq