// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/parse/infer.c
// Function: tryconstrain
static int
tryconstrain(Type *base, Trait *tr, int update)
{
	Traitmap *tm;
	Bitset *bs;
	Type *ty;
	size_t i;

	while(1) {
		ty = base;
		tm = traitmap->sub[ty->type];
		while (1) {
			if (ty->type == Typaram)
				if (ty->trneed && bshas(ty->trneed, tr->uid))
					return 1;
			if (ty->type == Tyvar) {
				if (!ty->trneed)
					ty->trneed = mkbs();
				if (update)
					bsput(ty->trneed, tr->uid);
				return 1;
			}
			if (bshas(tm->traits, tr->uid))
				return 1;
			if (tm->name && ty->type == Tyname) {
				bs = htget(tm->name, ty->name);
				if (bs && bshas(bs, tr->uid))
					return 1;
			}
			for (i = 0; i < tm->nfilter; i++) {
				if (tm->filtertr[i]->uid != tr->uid)
					continue;
				if (tymatchrank(tm->filter[i], ty) >= 0)
					return 1;
			}
			if (!ty->sub || ty->nsub != 1)
				break;
			ty = ty->sub[0];
			tm = tm->sub[ty->type];
			if (!tm)
				break;
		}
		if (base->type != Tyname)
			break;
		base = base->sub[0];
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq 0x578be(%rip), %rax     # 0x7d2d0
movq -0x38(%rbp), %rcx
movl (%rcx), %ecx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x1a, (%rax)
jne 0x25a62
movq -0x38(%rbp), %rax
cmpq $0x0, 0x80(%rax)
je 0x25a60
movq -0x38(%rbp), %rax
movq 0x80(%rax), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x27430
cmpl $0x0, %eax
je 0x25a60
movl $0x1, -0x4(%rbp)
jmp 0x25c19
jmp 0x25a62
movq -0x38(%rbp), %rax
cmpl $0x19, (%rax)
jne 0x25ab5
movq -0x38(%rbp), %rax
cmpq $0x0, 0x80(%rax)
jne 0x25a8c
callq 0x48650
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x80(%rax)
cmpl $0x0, -0x1c(%rbp)
je 0x25aa9
movq -0x38(%rbp), %rax
movq 0x80(%rax), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x48a50
movl $0x1, -0x4(%rbp)
jmp 0x25c19
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x27430
cmpl $0x0, %eax
je 0x25ad9
movl $0x1, -0x4(%rbp)
jmp 0x25c19
movq -0x28(%rbp), %rax
cmpq $0x0, 0x100(%rax)
je 0x25b39
movq -0x38(%rbp), %rax
cmpl $0x1c, (%rax)
jne 0x25b39
movq -0x28(%rbp), %rax
movq 0x100(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x88(%rax), %rsi
callq 0x49490
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x25b37
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x27430
cmpl $0x0, %eax
je 0x25b37
movl $0x1, -0x4(%rbp)
jmp 0x25c19
jmp 0x25b39
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x110(%rcx), %rax
jae 0x25bab
movq -0x28(%rbp), %rax
movq 0x118(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
je 0x25b71
jmp 0x25b9d
movq -0x28(%rbp), %rax
movq 0x108(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x38(%rbp), %rsi
callq 0x254b0
cmpl $0x0, %eax
jl 0x25b9b
movl $0x1, -0x4(%rbp)
jmp 0x25c19
jmp 0x25b9d
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x25b41
movq -0x38(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x25bc1
movq -0x38(%rbp), %rax
cmpq $0x1, 0x70(%rax)
je 0x25bc3
jmp 0x25bf3
movq -0x38(%rbp), %rax
movq 0x68(%rax), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
movl (%rcx), %ecx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x25bee
jmp 0x25bf3
jmp 0x25a21
movq -0x10(%rbp), %rax
cmpl $0x1c, (%rax)
je 0x25bfe
jmp 0x25c12
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x25a03
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)