// File: /workspace/github_c_makefile_star2_O0/nimble-code[P]Uno/Src/uno_bounds.c
// Function: fix_dups
static void
fix_dups(State *s)
{	ArBound *a, *b;
	int cnt = 0;

	for (a = boundstack->curbounds; a; a = a->nxt)
		if (a->bounds & DUP)
		{	a->dup = (ArBound *) 0;
			if (a->s == a->sameas)
			{	if (Verbose)
				{	printf("uno: warning: reflexive dup\n");
					explain_bound("target:", a, s->n);
				}
				a->bounds &= ~DUP;
				a->sameas = (symentry_t *) 0;
			}
			cnt = 0;
again:
			for (b = boundstack->curbounds; b; b = b->nxt)
			{	if (b == a) continue;

				if (b->s == a->sameas)
				{	if (debug>1)
					{	printf("\tdup on '%s' picked up from stack\n",
						a->s->nme->str);
						explain_bound("from", b, ZT);
					}

					if (b->bounds & UNK)
					{	a->bounds |= UNK;
						a->bounds &= ~DUP;
						a->sameas = (symentry_t *) 0;
						break;
					}

					if (!(b->bounds & DUP))
						a->dup = b;
					else
					{	if (b->s == b->sameas)
						{	printf("uno: warning: reflextive dup target\n");
							explain_bound("target:", b, ZT);
							b->bounds &= ~DUP;
							b->sameas = (symentry_t *) 0;
							a->dup = b;
						} else
						{	a->sameas = b->sameas;
							if (cnt++ <= 10)
								goto again;
							printf("dup cycle\n");
							explain_bound("member:", a, s->n);
							a->bounds |= UNK;
							a->bounds &= ~DUP;
							a->sameas = (symentry_t *) 0;
							a->dup = (ArBound *) 0;
					}	}
					break;
				}
			}
			if (!b)
			{	if (debug>1)
				printf("\tcould not find dup for %s on stack\n",
					a->s->nme->str);
				a->bounds |= UNK;
				a->bounds &= ~DUP;
				a->sameas = (symentry_t *) 0;
				a->dup = (ArBound *) 0;
			}
		}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x1c(%rbp)
movq 0x6902e(%rip), %rax     # 0x96b68
movq (%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x2de15
movq -0x10(%rbp), %rax
movswl 0x18(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x2de02
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x2dbc9
leaq 0x207f4(%rip), %rax     # 0x4e378
cmpl $0x0, (%rax)
je 0x2dbae
leaq 0x18f24(%rip), %rdi     # 0x46ab4
movb $0x0, %al
callq 0x30f0
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x18f28(%rip), %rdi     # 0x46ad1
callq 0x2b960
movq -0x10(%rbp), %rax
movswl 0x18(%rax), %ecx
andl $-0x21, %ecx
movw %cx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movl $0x0, -0x1c(%rbp)
movq 0x68f91(%rip), %rax     # 0x96b68
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x2dd9d
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0x2dbf8
jmp 0x2dd8c
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x2dd8a
cmpl $0x1, 0x68f44(%rip)     # 0x96b58
jle 0x2dc47
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
leaq 0x18ead(%rip), %rdi     # 0x46ad9
movb $0x0, %al
callq 0x30f0
movq -0x18(%rbp), %rsi
leaq 0x18ebe(%rip), %rdi     # 0x46afc
xorl %eax, %eax
movl %eax, %edx
callq 0x2b960
movq -0x18(%rbp), %rax
movswl 0x18(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x2dc86
movq -0x10(%rbp), %rax
movswl 0x18(%rax), %ecx
orl $0x4, %ecx
movw %cx, 0x18(%rax)
movq -0x10(%rbp), %rax
movswl 0x18(%rax), %ecx
andl $-0x21, %ecx
movw %cx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
jmp 0x2dd9d
movq -0x18(%rbp), %rax
movswl 0x18(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x2dca7
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x2dd88
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x2dd06
leaq 0x18e42(%rip), %rdi     # 0x46b01
movb $0x0, %al
callq 0x30f0
movq -0x18(%rbp), %rsi
leaq 0x18e00(%rip), %rdi     # 0x46ad1
xorl %eax, %eax
movl %eax, %edx
callq 0x2b960
movq -0x18(%rbp), %rax
movswl 0x18(%rax), %ecx
andl $-0x21, %ecx
movw %cx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x2dd86
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x1c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
cmpl $0xa, %eax
jg 0x2dd2b
jmp 0x2dbd0
leaq 0x18df4(%rip), %rdi     # 0x46b26
movb $0x0, %al
callq 0x30f0
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x18de6(%rip), %rdi     # 0x46b31
callq 0x2b960
movq -0x10(%rbp), %rax
movswl 0x18(%rax), %ecx
orl $0x4, %ecx
movw %cx, 0x18(%rax)
movq -0x10(%rbp), %rax
movswl 0x18(%rax), %ecx
andl $-0x21, %ecx
movw %cx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
jmp 0x2dd88
jmp 0x2dd9d
jmp 0x2dd8c
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x2dbde
cmpq $0x0, -0x18(%rbp)
jne 0x2de00
cmpl $0x1, 0x68dad(%rip)     # 0x96b58
jle 0x2ddca
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
leaq 0x18d76(%rip), %rdi     # 0x46b39
movb $0x0, %al
callq 0x30f0
movq -0x10(%rbp), %rax
movswl 0x18(%rax), %ecx
orl $0x4, %ecx
movw %cx, 0x18(%rax)
movq -0x10(%rbp), %rax
movswl 0x18(%rax), %ecx
andl $-0x21, %ecx
movw %cx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
jmp 0x2de02
jmp 0x2de04
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x2db41
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)