// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/parse/infer.c
// Function: tyfix
static Type *
tyfix(Node *ctx, Type *orig, int noerr)
{
	static Type *tyint, *tyflt;
	static Bitset *intset, *fltset;
	Type *t, *d, *base;
	Tyenv *env;
	vlong val;
	size_t i;
	char buf[1024];

	if (!tyint) {
		tyint = mktype(Zloc, Tyint);
		intset = mkbs();
		traitsfor(tyint, intset);
	}
	if (!tyflt) {
		tyflt = mktype(Zloc, Tyflt64);
		fltset = mkbs();
		traitsfor(tyflt, fltset);
	}

	t = tysearch(tf(orig));
	env = t->env;
	if (env)
		pushenv(env);
	base = orig->seqaux;
	/* Process delayed type mappings. */
	if (orig->type == Tyvar && hthas(delayed, orig)) {
		d = htget(delayed, orig);
		if (t->type == Tyvar) {
			/* tyvar is guaranteed to unify error-free */
			unify(ctx, t, d);
			t = tf(t);
		} else if (tybase(t)->type != d->type && !noerr) {
			fatal(ctx, "type %s not compatible with %s near %s\n",
			    tystr(t), tystr(d), ctxstr(ctx));
		}
	}

	/* Default the type */
	if (t->type == Tyvar && t->trneed) {
		if (bsissubset(t->trneed, intset))
			t = tyint;
		else if (bsissubset(t->trneed, fltset))
			t = tyflt;
	}

	if (!t->fixed) {
		t->fixed = 1;
		switch(t->type) {
		case Tyarray:
			if (t->type == Tyarray && t->asize)
				t->asize = fold(t->asize, 1);
			if (t->asize && getintlit(t->asize, &val) && val < 0)
				fatal(t->asize, "negative array size %lld\n", val);
			typesub(t->asize, noerr);
			break;
		case Tystruct:
			inaggr++;
			for (i = 0; i < t->nmemb; i++)
				typesub(t->sdecls[i], noerr);
			inaggr--;
			break;
		case Tyunion:
			for (i = 0; i < t->nmemb; i++) {
				if (t->udecls[i]->etype) {
					tyresolve(t->udecls[i]->etype);
					t->udecls[i]->etype =
						tyfix(ctx, t->udecls[i]->etype, noerr);
				}
			}
			break;
		case Tyname:
			for (i = 0; i < t->narg; i++)
				t->arg[i] = tyfix(ctx, t->arg[i], noerr);
			break;
		default:
			break;
		}
	}

	for (i = 0; i < t->nsub; i++)
		t->sub[i] = tyfix(ctx, t->sub[i], noerr);

	if (t->type == Tyvar && !noerr)
		fatal(ctx, "underconstrained type %s near %s", tyfmt(buf, 1024, t), ctxstr(ctx));
	if (base) {
		if (base != orig)
			base = tyfix(ctx, base, noerr);
		t->seqaux = base;
	}
	if (env)
		popenv(env);
	return t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpq $0x0, 0x54eba(%rip)     # 0x7d3d8
jne 0x2856b
movl $0xffffffff, -0x458(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x454(%rbp)
movq -0x458(%rbp), %rdi
movl $0x6, %esi
callq 0x36c10
movq %rax, 0x54e8c(%rip)     # 0x7d3d8
callq 0x48650
movq %rax, 0x54e90(%rip)     # 0x7d3e8
movq 0x54e79(%rip), %rdi     # 0x7d3d8
movq 0x54e82(%rip), %rsi     # 0x7d3e8
callq 0x28a90
cmpq $0x0, 0x54e6d(%rip)     # 0x7d3e0
jne 0x285c0
movl $0xffffffff, -0x460(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x45c(%rbp)
movq -0x460(%rbp), %rdi
movl $0x10, %esi
callq 0x36c10
movq %rax, 0x54e3f(%rip)     # 0x7d3e0
callq 0x48650
movq %rax, 0x54e43(%rip)     # 0x7d3f0
movq 0x54e2c(%rip), %rdi     # 0x7d3e0
movq 0x54e35(%rip), %rsi     # 0x7d3f0
callq 0x28a90
movq -0x10(%rbp), %rdi
callq 0x277c0
movq %rax, %rdi
callq 0x25450
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x285f1
movq -0x38(%rbp), %rdi
callq 0x32f70
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x19, (%rax)
jne 0x286d7
movq 0x54caf(%rip), %rdi     # 0x7d2c0
movq -0x10(%rbp), %rsi
callq 0x496f0
cmpl $0x0, %eax
je 0x286d7
movq 0x54c96(%rip), %rdi     # 0x7d2c0
movq -0x10(%rbp), %rsi
callq 0x49490
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x19, (%rax)
jne 0x28660
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x28c00
movq -0x20(%rbp), %rdi
callq 0x277c0
movq %rax, -0x20(%rbp)
jmp 0x286d5
movq -0x20(%rbp), %rdi
callq 0x36a30
movl (%rax), %eax
movq -0x28(%rbp), %rcx
cmpl (%rcx), %eax
je 0x286d3
cmpl $0x0, -0x14(%rbp)
jne 0x286d3
movq -0x8(%rbp), %rax
movq %rax, -0x478(%rbp)
movq -0x20(%rbp), %rdi
callq 0x38a10
movq %rax, -0x470(%rbp)
movq -0x28(%rbp), %rdi
callq 0x38a10
movq %rax, -0x468(%rbp)
movq -0x8(%rbp), %rdi
callq 0x27be0
movq -0x478(%rbp), %rdi
movq -0x470(%rbp), %rdx
movq -0x468(%rbp), %rcx
movq %rax, %r8
leaq 0x2986d(%rip), %rsi     # 0x51f39
movb $0x0, %al
callq 0x1dfe0
jmp 0x286d5
jmp 0x286d7
movq -0x20(%rbp), %rax
cmpl $0x19, (%rax)
jne 0x28742
movq -0x20(%rbp), %rax
cmpq $0x0, 0x80(%rax)
je 0x28742
movq -0x20(%rbp), %rax
movq 0x80(%rax), %rdi
movq 0x54ce8(%rip), %rsi     # 0x7d3e8
callq 0x48f50
cmpl $0x0, %eax
je 0x28717
movq 0x54cc7(%rip), %rax     # 0x7d3d8
movq %rax, -0x20(%rbp)
jmp 0x28740
movq -0x20(%rbp), %rax
movq 0x80(%rax), %rdi
movq 0x54cc7(%rip), %rsi     # 0x7d3f0
callq 0x48f50
cmpl $0x0, %eax
je 0x2873e
movq 0x54ca6(%rip), %rax     # 0x7d3e0
movq %rax, -0x20(%rbp)
jmp 0x28740
jmp 0x28742
movq -0x20(%rbp), %rax
cmpb $0x0, 0x98(%rax)
jne 0x2898a
movq -0x20(%rbp), %rax
movb $0x1, 0x98(%rax)
movq -0x20(%rbp), %rax
movl (%rax), %eax
addl $-0x15, %eax
movl %eax, %ecx
movq %rcx, -0x480(%rbp)
subl $0x7, %eax
ja 0x28986
movq -0x480(%rbp), %rax
leaq 0x291cd(%rip), %rcx     # 0x51954
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
cmpl $0x15, (%rax)
jne 0x287ca
movq -0x20(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x287ca
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rdi
movl $0x1, %esi
callq 0x1f390
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x28815
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1f230
cmpl $0x0, %eax
je 0x28815
cmpq $0x0, -0x40(%rbp)
jge 0x28815
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rdi
movq -0x40(%rbp), %rdx
leaq 0x29753(%rip), %rsi     # 0x51f61
movb $0x0, %al
callq 0x1dfe0
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rdi
movl -0x14(%rbp), %esi
callq 0x268f0
jmp 0x28988
movl 0x54bc5(%rip), %eax     # 0x7d3f8
addl $0x1, %eax
movl %eax, 0x54bbc(%rip)     # 0x7d3f8
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x78(%rcx), %rax
jae 0x2887b
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x14(%rbp), %esi
callq 0x268f0
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x28844
movl 0x54b77(%rip), %eax     # 0x7d3f8
addl $-0x1, %eax
movl %eax, 0x54b6e(%rip)     # 0x7d3f8
jmp 0x28988
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x78(%rcx), %rax
jae 0x2892f
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x28(%rax)
je 0x2891c
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rdi
callq 0x29190
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x28500
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x48(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x28(%rax)
jmp 0x2891e
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x28897
jmp 0x28988
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jae 0x28984
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl -0x14(%rbp), %edx
callq 0x28500
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x48(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x28939
jmp 0x28988
jmp 0x28988
jmp 0x2898a
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x70(%rcx), %rax
jae 0x289dd
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl -0x14(%rbp), %edx
callq 0x28500
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x48(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x28992
movq -0x20(%rbp), %rax
cmpl $0x19, (%rax)
jne 0x28a3b
cmpl $0x0, -0x14(%rbp)
jne 0x28a3b
movq -0x8(%rbp), %rax
movq %rax, -0x490(%rbp)
leaq -0x450(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x400, %esi            # imm = 0x400
callq 0x37e90
movq %rax, -0x488(%rbp)
movq -0x8(%rbp), %rdi
callq 0x27be0
movq -0x490(%rbp), %rdi
movq -0x488(%rbp), %rdx
movq %rax, %rcx
leaq 0x29547(%rip), %rsi     # 0x51f7b
movb $0x0, %al
callq 0x1dfe0
cmpq $0x0, -0x30(%rbp)
je 0x28a6c
movq -0x30(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0x28a60
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x28500
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
cmpq $0x0, -0x38(%rbp)
je 0x28a7c
movq -0x38(%rbp), %rdi
callq 0x32fe0
movq -0x20(%rbp), %rax
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
nopl (%rax)