// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/parse/infer.c
// Function: tyresolve
static void
tyresolve(Type *t)
{
	size_t i, j;
	Trait *tr;

	if (t->resolved)
		return;
	/* type resolution should never throw errors about non-generic
	 * showing up within a generic type, so we push and pop a generic
	 * around resolution */
	ingeneric++;
	t->resolved = 1;
	/* Walk through aggregate type members */
	pushenv(t->env);
	switch (t->type) {
	case Tystruct:
		inaggr++;
		for (i = 0; i < t->nmemb; i++)
			infernode(&t->sdecls[i], NULL, NULL);
		inaggr--;
		break;
	case Tyunion:
		inaggr++;
		for (i = 0; i < t->nmemb; i++) {
			if (!t->udecls[i]->utype)
				t->udecls[i]->utype = t;
			t->udecls[i]->utype = tf(t->udecls[i]->utype);
			if (t->udecls[i]->etype) {
				tyresolve(t->udecls[i]->etype);
				t->udecls[i]->etype = tf(t->udecls[i]->etype);
			}
		}
		inaggr--;
		break;
	case Tyarray:
		if (!inaggr && !t->asize)
			lfatal(t->loc, "unsized array type outside of struct");
		infernode(&t->asize, NULL, NULL);
		break;
	case Typaram:
		if (!boundtype(t))
			lfatal(t->loc, "type parameter %s is undefined in generic context", tystr(t));
		break;
	default:
		break;
	}

	for (i = 0; i < t->nspec; i++) {
		for (j = 0; j < t->spec[i]->ntrait; j++) {
			tr = gettrait(curstab(), t->spec[i]->trait[j]);
			if (!tr)
				lfatal(t->loc, "trait %s does not exist", ctxstr(t->spec[i]->trait[j]));
			if (!t->trneed)
				t->trneed = mkbs();
			bsput(t->trneed, tr->uid);
			if (nameeq(t->spec[i]->trait[j], traittab[Tciter]->name))
				t->seqaux = t->spec[i]->aux;
			t->spec[i]->trait[j] = tr->name;
		}
	}

	for (i = 0; i < t->nsub; i++) {
		t->sub[i] = tf(t->sub[i]);
		if (t->sub[i] == t) {
			lfatal(t->loc,
			     "%s occurs within %s, leading to infinite type\n",
			     tystr(t->sub[i]), tystr(t));
		}
	}
	if (occurs(t))
		lfatal(t->loc, "type %s includes itself", tystr(t));
	popenv(t->env);
	ingeneric--;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x97(%rax)
je 0x291ae
jmp 0x2969f
movl 0x5425c(%rip), %eax     # 0x7d410
incl %eax
movl %eax, 0x54254(%rip)     # 0x7d410
movq -0x8(%rbp), %rax
movb $0x1, 0x97(%rax)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x32f70
movq -0x8(%rbp), %rax
movl (%rax), %eax
addl $-0x15, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x5, %eax
ja 0x29411
movq -0x28(%rbp), %rax
leaq 0x2877d(%rip), %rcx     # 0x51974
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x541f2(%rip), %eax     # 0x7d3f8
addl $0x1, %eax
movl %eax, 0x541e9(%rip)     # 0x7d3f8
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x78(%rcx), %rax
jae 0x29255
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rdi
movq -0x10(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x260b0
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x29217
movl 0x5419d(%rip), %eax     # 0x7d3f8
addl $-0x1, %eax
movl %eax, 0x54194(%rip)     # 0x7d3f8
jmp 0x29413
movl 0x54189(%rip), %eax     # 0x7d3f8
addl $0x1, %eax
movl %eax, 0x54180(%rip)     # 0x7d3f8
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x78(%rcx), %rax
jae 0x2937c
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x20(%rax)
jne 0x292c7
movq -0x8(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x10(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %rdi
callq 0x277c0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x10(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x28(%rax)
je 0x29369
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rdi
callq 0x29190
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rdi
callq 0x277c0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x10(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x28(%rax)
jmp 0x2936b
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x29280
movl 0x54076(%rip), %eax     # 0x7d3f8
addl $-0x1, %eax
movl %eax, 0x5406d(%rip)     # 0x7d3f8
jmp 0x29413
cmpl $0x0, 0x54061(%rip)     # 0x7d3f8
jne 0x293bd
movq -0x8(%rbp), %rax
cmpq $0x0, 0x88(%rax)
jne 0x293bd
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x28db7(%rip), %rsi     # 0x5216d
movb $0x0, %al
callq 0x1e110
movq -0x8(%rbp), %rdi
addq $0x88, %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x260b0
jmp 0x29413
movq -0x8(%rbp), %rdi
callq 0x34c90
cmpq $0x0, %rax
jne 0x2940f
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x38a10
movq %rax, %rdx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x28d8a(%rip), %rsi     # 0x52192
movb $0x0, %al
callq 0x1e110
jmp 0x29413
jmp 0x29413
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x29599
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpq 0x8(%rcx), %rax
jae 0x29586
callq 0x32d60
movq %rax, %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x33870
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x294c7
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x27be0
movq %rax, %rdx
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x28d04(%rip), %rsi     # 0x521c4
movb $0x0, %al
callq 0x1e110
movq -0x8(%rbp), %rax
cmpq $0x0, 0x80(%rax)
jne 0x294e8
callq 0x48650
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rsi
callq 0x48a50
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x547ef(%rip), %rax     # 0x7dd10
movq (%rax), %rax
movq 0x30(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x30670
cmpl $0x0, %eax
je 0x29552
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x29435
jmp 0x29588
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x2941b
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x70(%rcx), %rax
jae 0x2964b
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x277c0
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x10(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x8(%rbp), %rax
jne 0x29638
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x38a10
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x38a10
movq -0x48(%rbp), %rdx
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x28bab(%rip), %rsi     # 0x521dc
movb $0x0, %al
callq 0x1e110
jmp 0x2963a
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x295a1
movq -0x8(%rbp), %rdi
callq 0x2ab50
cmpl $0x0, %eax
je 0x29683
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
callq 0x38a10
movq %rax, %rdx
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x28b8f(%rip), %rsi     # 0x5220b
movb $0x0, %al
callq 0x1e110
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x32fe0
movl 0x53d7a(%rip), %eax     # 0x7d410
addl $-0x1, %eax
movl %eax, 0x53d71(%rip)     # 0x7d410
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)