// File: /workspace/github_c_makefile_star2_O3/oridb[P]mc/parse/infer.c
// Function: unify
static Type *
unify(Node *ctx, Type *u, Type *v)
{
	Type *t, *r;
	Type *a, *b;
	Type *ea, *eb;
	size_t i;

	/* a ==> b */
	a = tf(u);
	b = tf(v);
	if (a->tid == b->tid)
		return a;

	/* we unify from lower to higher ranked types */
	if (tyrank(b) < tyrank(a)) {
		t = a;
		a = b;
		b = t;
	}

	/* Disallow recursive types */
	if (a->type == Tyvar && b->type != Tyvar) {
		if (occursin(a, b))
			fatal(ctx, "%s occurs within %s, leading to infinite type near %s\n",
				tystr(a), tystr(b), ctxstr(ctx));
	}

	r = NULL;
	if (a->type == Tyvar || tyeq(a, b)) {
		tytab[a->tid] = b;
		if (ctx) {
			marksrc(a, ctx->loc);
			marksrc(b, ctx->loc);
		}
	}
	if (a->type == Tyvar) {
		ea = basetype(a);
		eb = basetype(b);
		if (ea && eb)
			unify(ctx, ea, eb);
		r = b;
	}

	if (a->type == Tyarray && b->type == Tyarray) {
		checksize(ctx, a, b);
	}

	/* if the tyrank of a is 0 (ie, a raw tyvar), just unify.
	 * Otherwise, match up subtypes. */
	if (a->type == b->type && a->type != Tyvar) {
		if (a->type == Tyname)
			if (!nameeq(a->name, b->name))
				typeerror(a, b, ctx, "incompatible types");
		if (hasargs(a) && hasargs(b)) {
			/* Only Tygeneric and Tyname should be able to unify. And they
			 * should have the same names for this to be true. */
			if (!nameeq(a->name, b->name))
				typeerror(a, b, ctx, NULL);
			if (a->narg != b->narg)
				typeerror(a, b, ctx, "incompatible parameter lists");
			for (i = 0; i < a->narg; i++)
				unify(ctx, a->arg[i], b->arg[i]);
			r = b;
		}
		if (a->nsub != b->nsub) {
			verifytraits(ctx, a, b);
			if (tybase(a)->type == Tyfunc)
				typeerror(a, b, ctx, "function arity mismatch");
			else
				typeerror(a, b, ctx, "subtype counts incompatible");
		}
		for (i = 0; i < b->nsub; i++)
			unify(ctx, a->sub[i], b->sub[i]);
		r = b;
	} else if (a->type != Tyvar) {
		typeerror(a, b, ctx, NULL);
	}
	mergetraits(ctx, a, b);
	if (a->isreflect || b->isreflect) {
		tagreflect(r);
		tagreflect(a);
		tagreflect(b);
	}
	membunify(ctx, a, b);

	/* if we have delayed types for a tyvar, transfer it over. */
	if (a->type == Tyvar && b->type == Tyvar) {
		if (hthas(delayed, a) && !hthas(delayed, b))
			htput(delayed, b, htget(delayed, a));
		else if (hthas(delayed, b) && !hthas(delayed, a))
			htput(delayed, a, htget(delayed, b));
	} else if (hthas(delayed, a)) {
		unify(ctx, htget(delayed, a), tybase(b));
	}

	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movq %rdi, %r12
movq %rsi, %rdi
callq 0x19640
movq %rax, %rbp
movq %r14, %rdi
callq 0x19640
movq %rax, %r14
movl 0x4(%rbp), %eax
cmpl 0x4(%r14), %eax
je 0x1aa9f
xorl %r15d, %r15d
movq %r12, 0x8(%rsp)
movl $0x2, %eax
cmpl $0x19, (%r14)
movl $0x2, %ecx
jne 0x1a3e5
xorl %ecx, %ecx
cmpq $0x0, 0x28(%r14)
setne %cl
cmpl $0x19, (%rbp)
jne 0x1a3f5
xorl %eax, %eax
cmpq $0x0, 0x28(%rbp)
setne %al
cmpl %eax, %ecx
movq %rbp, %r13
cmovbq %r14, %r13
cmovbq %rbp, %r14
cmpl $0x19, (%r13)
jne 0x1a453
cmpl $0x19, (%r14)
je 0x1a462
callq 0x2d13c
movq %rax, %r12
movq %r13, %rdi
callq 0x19640
movl 0x4(%rax), %esi
movq %r12, %rdi
callq 0x2d369
movq %r14, %rdi
movq %r12, %rsi
callq 0x1b37e
movl %eax, %ebp
movq %r12, %rdi
callq 0x2d164
testl %ebp, %ebp
jne 0x1ab68
cmpl $0x19, (%r13)
movq 0x8(%rsp), %r12
je 0x1a462
movq %r13, %rdi
movq %r14, %rsi
callq 0x2403c
testl %eax, %eax
je 0x1a491
leaq 0x47d67(%rip), %rax     # 0x621d0
movq (%rax), %rax
movl 0x4(%r13), %ecx
movq %r14, (%rax,%rcx,8)
testq %r12, %r12
je 0x1a491
movq (%r12), %rsi
movq %r13, %rdi
callq 0x1afe5
movq (%r12), %rsi
movq %r14, %rdi
callq 0x1afe5
movl (%r13), %eax
cmpl $0x19, %eax
jne 0x1a4d5
movq %r13, %rdi
callq 0x1b043
movq %rax, %r12
movq %r14, %rdi
callq 0x1b043
testq %r12, %r12
je 0x1a4c7
testq %rax, %rax
je 0x1a4c7
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x1a38c
movl (%r13), %eax
movq %r14, %rbx
movq 0x8(%rsp), %r12
jmp 0x1a4d7
xorl %ebx, %ebx
cmpl $0x15, %eax
jne 0x1a5aa
cmpl $0x15, (%r14)
jne 0x1a5aa
movq 0x88(%r13), %rdi
testq %rdi, %rdi
je 0x1a509
movl $0x1, %esi
callq 0x144db
movq %rax, 0x88(%r13)
jmp 0x1a50b
xorl %eax, %eax
movq 0x88(%r14), %rdi
testq %rdi, %rdi
je 0x1a534
movl $0x1, %esi
callq 0x144db
movq %rax, %rdi
movq %rax, 0x88(%r14)
movq 0x88(%r13), %rax
jmp 0x1a536
xorl %edi, %edi
testq %rax, %rax
je 0x1a553
movq %rax, %rdi
callq 0x1d422
cmpl $0x35, %eax
jne 0x1ac18
movq 0x88(%r14), %rdi
testq %rdi, %rdi
je 0x1a566
callq 0x1d422
cmpl $0x35, %eax
jne 0x1ac1d
movq 0x88(%r13), %rax
movq 0x88(%r14), %rcx
testq %rax, %rax
je 0x1a59a
testq %rcx, %rcx
je 0x1a5a3
movq 0x50(%rax), %rax
movq (%rax), %rdi
movq 0x50(%rcx), %rax
movq (%rax), %rsi
callq 0x1e3e3
testl %eax, %eax
jne 0x1a5aa
jmp 0x1ac48
movq %rcx, 0x88(%r13)
jmp 0x1a5aa
movq %rax, 0x88(%r14)
movl (%r13), %ecx
movl (%r14), %eax
cmpl $0x19, %ecx
je 0x1a690
cmpl %eax, %ecx
jne 0x1a690
cmpl $0x1c, %ecx
jne 0x1a652
movq 0x88(%r13), %rdi
movq 0x88(%r14), %rsi
callq 0x1e523
testl %eax, %eax
je 0x1abbc
cmpl $0x1c, (%r13)
jne 0x1a652
cmpq $0x0, 0x48(%r13)
je 0x1a652
cmpl $0x1c, (%r14)
jne 0x1a652
cmpq $0x0, 0x48(%r14)
je 0x1a652
movq 0x88(%r13), %rdi
movq 0x88(%r14), %rsi
callq 0x1e523
testl %eax, %eax
je 0x1ab2e
movq 0x48(%r13), %rax
cmpq 0x48(%r14), %rax
jne 0x1ac81
testq %rax, %rax
je 0x1a652
xorl %ebx, %ebx
movq 0x40(%r13), %rax
movq (%rax,%rbx,8), %rsi
movq 0x40(%r14), %rax
movq (%rax,%rbx,8), %rdx
movq %r12, %rdi
callq 0x1a38c
incq %rbx
cmpq 0x48(%r13), %rbx
jb 0x1a631
movq 0x70(%r13), %rax
cmpq 0x70(%r14), %rax
jne 0x1ab3e
testq %rax, %rax
je 0x1a688
xorl %ebx, %ebx
movq 0x68(%r13), %rax
movq (%rax,%rbx,8), %rsi
movq 0x68(%r14), %rax
movq (%rax,%rbx,8), %rdx
movq %r12, %rdi
callq 0x1a38c
incq %rbx
cmpq 0x70(%r14), %rbx
jb 0x1a667
movl (%r14), %eax
movq %r14, %rbx
jmp 0x1a699
cmpl $0x19, %ecx
jne 0x1ab2e
cmpl $0x19, %eax
jne 0x1a6c5
movq 0x80(%r13), %rsi
movq 0x80(%r14), %rdi
testq %rsi, %rsi
je 0x1a9da
testq %rdi, %rdi
je 0x1a9f4
callq 0x2d3f9
jmp 0x1a6d3
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1b132
cmpb $0x0, 0x95(%r13)
jne 0x1a6e7
cmpb $0x0, 0x95(%r14)
je 0x1a6ff
movq %rbx, %rdi
callq 0x13a50
movq %r13, %rdi
callq 0x13a50
movq %r14, %rdi
callq 0x13a50
movq 0x4709a(%rip), %rdi     # 0x617a0
movq %r13, %rsi
callq 0x2da24
movq %r13, %rdi
testl %eax, %eax
je 0x1a727
movq 0x47084(%rip), %rdi     # 0x617a0
movq %r13, %rsi
callq 0x2d8fa
movq %rax, %rdi
movq %rbx, 0x20(%rsp)
movq %r13, 0x28(%rsp)
callq 0x227ac
movq %rax, %r13
movq 0x47060(%rip), %rdi     # 0x617a0
movq %r14, %rsi
callq 0x2da24
movq %r14, %rdi
testl %eax, %eax
je 0x1a761
movq 0x4704a(%rip), %rdi     # 0x617a0
movq %r14, %rsi
callq 0x2d8fa
movq %rax, %rdi
movq %r15, 0x10(%rsp)
movq %r14, 0x30(%rsp)
callq 0x227ac
movq %rax, %rbp
movl (%r13), %eax
cmpl $0x17, %eax
je 0x1a85f
cmpl $0x18, %eax
jne 0x1a949
cmpl $0x18, (%rbp)
jne 0x1a949
cmpq %rbp, %r13
je 0x1a949
movq 0x78(%r13), %rax
cmpq 0x78(%rbp), %rax
jne 0x1abd1
testq %rax, %rax
je 0x1a949
movl $0x1, %eax
xorl %r15d, %r15d
testq %rax, %rax
je 0x1aab1
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x88(%r13), %rax
movq (%rax,%r15,8), %rax
movq 0x18(%rax), %rdi
movq 0x88(%rbp), %rax
movq (%rax,%r14,8), %rax
movq 0x18(%rax), %rsi
callq 0x1e523
testl %eax, %eax
je 0x1a839
movq 0x88(%r13), %rax
movq (%rax,%r15,8), %rax
movq 0x28(%rax), %rsi
movq 0x88(%rbp), %rax
movq (%rax,%r14,8), %rax
movq 0x28(%rax), %rdx
testq %rsi, %rsi
je 0x1a82b
testq %rdx, %rdx
je 0x1aab1
movq %r12, %rdi
callq 0x1a38c
movl $0x1, %ebx
jmp 0x1a839
movl $0x1, %ebx
testq %rdx, %rdx
jne 0x1aab1
incq %r14
movq 0x78(%rbp), %rax
cmpq %rax, %r14
jb 0x1a7c9
testl %ebx, %ebx
je 0x1aab1
incq %r15
cmpq 0x78(%r13), %r15
jb 0x1a7bb
jmp 0x1a949
cmpl $0x17, (%rbp)
jne 0x1a949
cmpq %rbp, %r13
je 0x1a949
movq 0x78(%r13), %rax
cmpq 0x78(%rbp), %rax
jne 0x1aab1
testq %rax, %rax
je 0x1a949
movl $0x1, %eax
xorl %r15d, %r15d
testq %rax, %rax
je 0x1ab09
movb $0x1, %bl
xorl %r14d, %r14d
movq 0x88(%r13), %rax
movq (%rax,%r15,8), %rax
movq 0x20(%rax), %rdi
callq 0x1e4eb
movq %rax, %r12
movq 0x88(%rbp), %rax
movq (%rax,%r14,8), %rax
movq 0x20(%rax), %rdi
callq 0x1e4eb
movq %r12, %rdi
movq %rax, %rsi
callq 0x4230
testl %eax, %eax
je 0x1a8e7
incq %r14
movq 0x78(%rbp), %rax
cmpq %rax, %r14
jb 0x1a89f
jmp 0x1a92e
movq 0x88(%r13), %rax
movq (%rax,%r15,8), %rdi
callq 0x1b51f
movq %rax, %r12
movq 0x88(%rbp), %rax
movq (%rax,%r14,8), %rdi
callq 0x1b51f
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x1a38c
incq %r14
movq 0x78(%rbp), %rax
xorl %ebx, %ebx
cmpq %rax, %r14
jb 0x1a89f
jmp 0x1a937
testb $0x1, %bl
jne 0x1ab09
incq %r15
cmpq 0x78(%r13), %r15
movq 0x8(%rsp), %r12
jb 0x1a891
movq 0x28(%rsp), %r15
cmpl $0x19, (%r15)
movq 0x30(%rsp), %r14
jne 0x1a963
cmpl $0x19, (%r14)
je 0x1aa08
movq 0x46e36(%rip), %rdi     # 0x617a0
movq %r15, %rsi
callq 0x2da24
testl %eax, %eax
movq 0x20(%rsp), %rbp
je 0x1aa93
movq 0x46e1a(%rip), %rdi     # 0x617a0
movq %r15, %rsi
callq 0x2d8fa
movq %rax, %r15
movq %r14, %rdi
callq 0x227ac
movq %rax, %r14
testb $0x1, 0x10(%rsp)
movq 0x18(%rsp), %rax
cmoveq %rbp, %rax
movq %rax, 0x18(%rsp)
movq %r15, %rdi
callq 0x19640
movq %rax, %rbp
movq %r14, %rdi
callq 0x19640
movq %rax, %r14
movl 0x4(%rbp), %eax
movb $0x1, %r15b
cmpl 0x4(%r14), %eax
jne 0x1a3cb
jmp 0x1aa9a
testq %rdi, %rdi
je 0x1a6d3
callq 0x2d180
movq %rax, 0x80(%r13)
jmp 0x1a6d3
movq %rsi, %rdi
callq 0x2d180
movq %rax, 0x80(%r14)
jmp 0x1a6d3
movq 0x46d91(%rip), %rdi     # 0x617a0
movq %r15, %rsi
callq 0x2da24
testl %eax, %eax
movq 0x20(%rsp), %rbp
je 0x1aa33
movq 0x46d79(%rip), %rdi     # 0x617a0
movq %r14, %rsi
callq 0x2da24
testl %eax, %eax
je 0x1aa73
movq 0x46d66(%rip), %rdi     # 0x617a0
movq %r14, %rsi
callq 0x2da24
testl %eax, %eax
je 0x1aa93
movq 0x46d53(%rip), %rdi     # 0x617a0
movq %r15, %rsi
callq 0x2da24
testl %eax, %eax
jne 0x1aa93
movq 0x46d40(%rip), %rbx     # 0x617a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2d8fa
movq %rbx, %rdi
movq %r15, %rsi
jmp 0x1aa8b
movq 0x46d26(%rip), %rbx     # 0x617a0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2d8fa
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2d71e
testb $0x1, 0x10(%rsp)
je 0x1aa9f
movq 0x18(%rsp), %rbp
movq %rbp, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0x2398e
movq %rax, %r14
movq %rbp, %rdi
callq 0x2398e
movq %rax, %r15
movq %r12, %rdi
callq 0x19858
movq %r12, %rbx
movq %rax, %r12
movq %r13, %rdi
callq 0x1b49b
movq %rax, %r13
movq %rbp, %rdi
callq 0x1b49b
movq %rax, (%rsp)
leaq 0x1b6cd(%rip), %rsi     # 0x361c0
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x138e7
movq %r13, %rdi
callq 0x2398e
movq %rax, %r14
movq %rbp, %rdi
callq 0x2398e
movq %rax, %r15
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x19858
jmp 0x1aad2
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x1b082
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rbx
movq %r14, %rdx
callq 0x1b132
movq %r13, %r14
movq %r13, %rdi
callq 0x227ac
cmpl $0x13, (%rax)
jne 0x1aba5
leaq 0x1b525(%rip), %rcx     # 0x3608b
jmp 0x1abac
movq %r13, %rdi
callq 0x2398e
movq %rax, %r15
movq %r14, %rdi
callq 0x2398e
movq %rax, %r14
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x19858
leaq 0x1b492(%rip), %rsi     # 0x36024
movq %rbx, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x138e7
leaq 0x1b4f7(%rip), %rcx     # 0x360a3
movq %r14, %rdi
movq %rbx, %rsi
movq 0x8(%rsp), %rdx
callq 0x1b082
leaq 0x1b498(%rip), %rcx     # 0x3605b
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x1b082
movq %r13, %rdi
callq 0x2398e
movq %rax, %r14
movq %rbp, %rdi
callq 0x2398e
movq %rax, %r15
movq %r12, %rdi
callq 0x19858
movq %r12, %rbx
movq %rax, %r12
movq %r13, %rdi
callq 0x1b49b
movq %rax, %r13
movq %rbp, %rdi
callq 0x1b49b
movq %rax, (%rsp)
leaq 0x1b58a(%rip), %rsi     # 0x3619d
jmp 0x1aaf3
movq %r13, %rdi
jmp 0x1ac20
movq %r14, %rdi
callq 0x2398e
movq %rax, %r14
movq %r12, %rdi
callq 0x19858
movq (%r12), %rdi
leaq 0x1b484(%rip), %rsi     # 0x360bf
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x139d2
movq %r13, %rdi
callq 0x2398e
movq %rax, %r15
movq %r14, %rdi
callq 0x2398e
movq %rax, %r14
movq %r12, %rdi
callq 0x19858
movq (%r12), %rdi
leaq 0x1b475(%rip), %rsi     # 0x360e6
movq %r15, %rdx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x139d2
leaq 0x1b3e6(%rip), %rcx     # 0x3606e
jmp 0x1abc3