// File: /workspace/github_c_makefile_star2_O1/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 %rsi, %r15
movq %rdi, 0x18(%rsp)
xorl %r13d, %r13d
movq %r15, %rdi
callq 0x196c0
movq %rax, %rbx
movq %r14, %rdi
callq 0x196c0
movq %rax, %rbp
movl 0x4(%rbx), %eax
cmpl 0x4(%rbp), %eax
je 0x1abcc
movl $0x2, %eax
cmpl $0x19, (%rbp)
movl $0x2, %ecx
jne 0x1a5f3
xorl %ecx, %ecx
cmpq $0x0, 0x28(%rbp)
setne %cl
cmpl $0x19, (%rbx)
movq 0x18(%rsp), %r14
jne 0x1a607
xorl %eax, %eax
cmpq $0x0, 0x28(%rbx)
setne %al
cmpl %eax, %ecx
movq %rbx, %r15
cmovbq %rbp, %r15
cmovbq %rbx, %rbp
cmpl $0x19, (%r15)
jne 0x1a65e
cmpl $0x19, (%rbp)
je 0x1a65e
callq 0x2d63c
movq %rax, %r12
movq %r15, %rdi
callq 0x196c0
movl 0x4(%rax), %esi
movq %r12, %rdi
callq 0x2d816
movq %rbp, %rdi
movq %r12, %rsi
callq 0x1b54d
movq %rbp, %rbx
movl %eax, %ebp
movq %r12, %rdi
callq 0x2d664
testl %ebp, %ebp
movq %rbx, %rbp
jne 0x1ad6d
cmpl $0x19, (%r15)
je 0x1a673
movq %r15, %rdi
movq %rbp, %rsi
callq 0x244b4
testl %eax, %eax
je 0x1a6a0
leaq 0x47b56(%rip), %rax     # 0x621d0
movq (%rax), %rax
movl 0x4(%r15), %ecx
movq %rbp, (%rax,%rcx,8)
testq %r14, %r14
je 0x1a6a0
movq (%r14), %rsi
movq %r15, %rdi
callq 0x1b1a5
movq (%r14), %rsi
movq %rbp, %rdi
callq 0x1b1a5
movq %r13, 0x20(%rsp)
cmpl $0x19, (%r15)
jne 0x1a6e1
movq %r15, %rdi
callq 0x1b20a
movq %rax, %r13
movq %rbp, %rdi
callq 0x1b20a
movq %rbp, %rbx
testq %r13, %r13
je 0x1a6e3
movq %rbp, %rbx
testq %rax, %rax
je 0x1a6e3
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x1a59b
movq %rbp, %rbx
jmp 0x1a6e3
xorl %ebx, %ebx
cmpl $0x15, (%r15)
jne 0x1a7a9
cmpl $0x15, (%rbp)
jne 0x1a7a9
movq 0x88(%r15), %rdi
testq %rdi, %rdi
je 0x1a714
movl $0x1, %esi
callq 0x14703
movq %rax, 0x88(%r15)
movq 0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x1a731
movl $0x1, %esi
callq 0x14703
movq %rax, 0x88(%rbp)
movq 0x88(%r15), %rdi
testq %rdi, %rdi
je 0x1a74b
callq 0x1d672
cmpl $0x35, %eax
jne 0x1adef
movq 0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x1a765
callq 0x1d672
cmpl $0x35, %eax
jne 0x1adf4
movq 0x88(%r15), %rax
movq 0x88(%rbp), %rcx
testq %rax, %rax
je 0x1a799
testq %rcx, %rcx
je 0x1a7a2
movq 0x50(%rax), %rax
movq (%rax), %rdi
movq 0x50(%rcx), %rax
movq (%rax), %rsi
callq 0x1e633
testl %eax, %eax
jne 0x1a7a9
jmp 0x1ae21
movq %rcx, 0x88(%r15)
jmp 0x1a7a9
movq %rax, 0x88(%rbp)
movl (%r15), %eax
cmpl $0x19, %eax
je 0x1a88b
cmpl (%rbp), %eax
jne 0x1a88b
cmpl $0x1c, %eax
jne 0x1a7de
movq 0x88(%r15), %rdi
movq 0x88(%rbp), %rsi
callq 0x1e773
testl %eax, %eax
je 0x1ad41
cmpl $0x1c, (%r15)
jne 0x1a84b
cmpq $0x0, 0x48(%r15)
je 0x1a84b
cmpl $0x1c, (%rbp)
jne 0x1a84b
cmpq $0x0, 0x48(%rbp)
je 0x1a84b
movq 0x88(%r15), %rdi
movq 0x88(%rbp), %rsi
callq 0x1e773
testl %eax, %eax
je 0x1ad07
movq 0x48(%r15), %rax
cmpq 0x48(%rbp), %rax
jne 0x1ae5c
cmpq $0x0, 0x48(%r15)
je 0x1a84b
xorl %ebx, %ebx
movq 0x40(%r15), %rax
movq (%rax,%rbx,8), %rsi
movq 0x40(%rbp), %rax
movq (%rax,%rbx,8), %rdx
movq %r14, %rdi
callq 0x1a59b
incq %rbx
cmpq 0x48(%r15), %rbx
jb 0x1a82a
movq 0x70(%r15), %rax
cmpq 0x70(%rbp), %rax
jne 0x1ad17
cmpq $0x0, 0x70(%rbp)
movq %rbp, %rbx
je 0x1a894
xorl %ebx, %ebx
movq 0x68(%r15), %rax
movq (%rax,%rbx,8), %rsi
movq 0x68(%rbp), %rax
movq (%rax,%rbx,8), %rdx
movq %r14, %rdi
callq 0x1a59b
incq %rbx
cmpq 0x70(%rbp), %rbx
jb 0x1a865
movq %rbp, %rbx
jmp 0x1a894
cmpl $0x19, %eax
jne 0x1ad07
cmpl $0x19, (%rbp)
jne 0x1a8b9
movq 0x80(%r15), %rsi
testq %rsi, %rsi
je 0x1a8df
movq 0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x1a8c9
callq 0x2d897
jmp 0x1a8f7
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x1b302
jmp 0x1a8f7
testq %rsi, %rsi
je 0x1a8df
movq %rsi, %rdi
callq 0x2d680
movq %rax, 0x80(%rbp)
jmp 0x1a8f7
movq 0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x1a8f7
callq 0x2d680
movq %rax, 0x80(%r15)
cmpb $0x0, 0x95(%r15)
jne 0x1a90a
cmpb $0x0, 0x95(%rbp)
je 0x1a922
movq %rbx, %rdi
callq 0x13c0c
movq %r15, %rdi
callq 0x13c0c
movq %rbp, %rdi
callq 0x13c0c
movq 0x46e77(%rip), %rdi     # 0x617a0
movq %r15, %rsi
callq 0x2decd
movq %r15, %rdi
testl %eax, %eax
je 0x1a94a
movq 0x46e61(%rip), %rdi     # 0x617a0
movq %r15, %rsi
callq 0x2dd9a
movq %rax, %rdi
movq %rbx, 0x8(%rsp)
movq %r15, 0x28(%rsp)
callq 0x22c44
movq %rax, %r13
movq 0x46e3d(%rip), %rdi     # 0x617a0
movq %rbp, %rsi
callq 0x2decd
movq %rbp, %rdi
testl %eax, %eax
je 0x1a984
movq 0x46e27(%rip), %rdi     # 0x617a0
movq %rbp, %rsi
callq 0x2dd9a
movq %rax, %rdi
movq %rbp, 0x30(%rsp)
callq 0x22c44
movq %rax, %rbp
movl (%r13), %eax
cmpl $0x17, %eax
je 0x1aa91
cmpl $0x18, %eax
jne 0x1ab60
cmpl $0x18, (%rbp)
jne 0x1aa88
cmpq %rbp, %r13
je 0x1aa88
movq 0x78(%r13), %rax
cmpq 0x78(%rbp), %rax
jne 0x1ada8
cmpq $0x0, 0x78(%r13)
je 0x1ab60
xorl %r12d, %r12d
cmpq $0x0, 0x78(%rbp)
je 0x1ac92
xorl %ebx, %ebx
xorl %r15d, %r15d
movq 0x88(%r13), %rax
movq (%rax,%r12,8), %rax
movq 0x18(%rax), %rdi
movq 0x88(%rbp), %rax
movq (%rax,%r15,8), %rax
movq 0x18(%rax), %rsi
callq 0x1e773
testl %eax, %eax
je 0x1aa61
movq 0x88(%r13), %rax
movq (%rax,%r12,8), %rax
movq 0x28(%rax), %rsi
testq %rsi, %rsi
jne 0x1aa3c
movq 0x88(%rbp), %rax
movq (%rax,%r15,8), %rax
cmpq $0x0, 0x28(%rax)
je 0x1aa5c
testq %rsi, %rsi
je 0x1ac92
movq 0x88(%rbp), %rax
movq (%rax,%r15,8), %rax
movq 0x28(%rax), %rdx
testq %rdx, %rdx
je 0x1ac92
movq %r14, %rdi
callq 0x1a59b
movl $0x1, %ebx
incq %r15
cmpq 0x78(%rbp), %r15
jb 0x1a9e6
testl %ebx, %ebx
je 0x1ac92
incq %r12
cmpq 0x78(%r13), %r12
jb 0x1a9d6
jmp 0x1ab60
cmpl $0x17, %eax
jne 0x1ab60
cmpl $0x17, (%rbp)
jne 0x1ab60
cmpq %rbp, %r13
je 0x1ab60
movq 0x78(%r13), %rax
cmpq 0x78(%rbp), %rax
jne 0x1ac92
cmpq $0x0, 0x78(%r13)
je 0x1ab60
xorl %r15d, %r15d
cmpq $0x0, 0x78(%rbp)
je 0x1acea
xorl %r14d, %r14d
xorl %ebx, %ebx
movq 0x88(%r13), %rax
movq (%rax,%r15,8), %rax
movq 0x20(%rax), %rdi
callq 0x1e73b
movq %rax, %r12
movq 0x88(%rbp), %rax
movq (%rax,%r14,8), %rax
movq 0x20(%rax), %rdi
callq 0x1e73b
movq %r12, %rdi
movq %rax, %rsi
callq 0x4230
testl %eax, %eax
jne 0x1ab42
movq 0x88(%r13), %rax
movq (%rax,%r15,8), %rdi
callq 0x1b6e6
movq %rax, %r12
movq 0x88(%rbp), %rax
movq (%rax,%r14,8), %rdi
callq 0x1b6e6
movq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x1a59b
movl $0x1, %ebx
incq %r14
cmpq 0x78(%rbp), %r14
jb 0x1aad0
testl %ebx, %ebx
je 0x1acea
incq %r15
cmpq 0x78(%r13), %r15
jb 0x1aac0
movq 0x28(%rsp), %r15
cmpl $0x19, (%r15)
movq 0x30(%rsp), %r12
jne 0x1ab77
cmpl $0x19, (%r12)
je 0x1abd6
movq 0x46c22(%rip), %rdi     # 0x617a0
movq %r15, %rsi
callq 0x2decd
testl %eax, %eax
movq 0x20(%rsp), %r13
je 0x1ac6e
movq 0x46c06(%rip), %rdi     # 0x617a0
movq %r15, %rsi
callq 0x2dd9a
movq %rax, %r15
movq %r12, %rdi
callq 0x22c44
movq %rax, %r14
testb $0x1, %r13b
movq 0x10(%rsp), %rax
cmoveq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movb $0x1, %r13b
jmp 0x1a5b7
movq 0x10(%rsp), %r14
jmp 0x1ac78
movq 0x46bc3(%rip), %rdi     # 0x617a0
movq %r15, %rsi
callq 0x2decd
testl %eax, %eax
movq 0x20(%rsp), %r13
je 0x1ac01
movq 0x46bab(%rip), %rdi     # 0x617a0
movq %r12, %rsi
callq 0x2decd
testl %eax, %eax
je 0x1ac4e
movq 0x46b98(%rip), %rdi     # 0x617a0
movq %r12, %rsi
callq 0x2decd
testl %eax, %eax
movq 0x10(%rsp), %r14
je 0x1ac73
movq 0x46b80(%rip), %rdi     # 0x617a0
movq %r15, %rsi
callq 0x2decd
testl %eax, %eax
jne 0x1ac73
movq 0x46b6d(%rip), %rbx     # 0x617a0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2dd9a
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2dbc2
jmp 0x1ac73
movq 0x46b4b(%rip), %rbx     # 0x617a0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2dd9a
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2dbc2
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %rbx
testb $0x1, %r13b
cmovneq %r14, %rbx
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0x23e44
movq %r14, %rbx
movq %rax, %r14
movq %rbp, %rdi
callq 0x23e44
movq %rax, %r15
movq %rbx, %rdi
callq 0x19a6f
movq %rax, %r12
movq %r13, %rdi
callq 0x1b662
movq %rax, %r13
movq %rbp, %rdi
callq 0x1b662
movq %rax, (%rsp)
leaq 0x1b4dc(%rip), %rsi     # 0x361b0
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x13aa3
movq %r13, %rdi
callq 0x23e44
movq %rax, %r14
movq %rbp, %rdi
callq 0x23e44
movq %rax, %r15
movq 0x18(%rsp), %rbx
jmp 0x1acab
movq %r15, %rdi
movq %rbp, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x1b252
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rbx
movq %rbp, %rdx
callq 0x1b302
movq %r15, %r14
movq %r15, %rdi
callq 0x22c44
cmpl $0x13, (%rax)
jne 0x1ad56
leaq 0x1b33c(%rip), %rcx     # 0x3607b
jmp 0x1ad5d
leaq 0x1b303(%rip), %rcx     # 0x3604b
movq %r15, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x1b252
leaq 0x1b336(%rip), %rcx     # 0x36093
movq %r14, %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %rdx
callq 0x1b252
movq %r15, %rdi
callq 0x23e44
movq %rax, %r15
movq %rbp, %rdi
callq 0x23e44
movq %r14, %rbx
movq %rax, %r14
movq %rbx, %rdi
callq 0x19a6f
leaq 0x1b27f(%rip), %rsi     # 0x36014
movq %rbx, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x13aa3
movq %r13, %rdi
callq 0x23e44
movq %r14, %rbx
movq %rax, %r14
movq %rbp, %rdi
callq 0x23e44
movq %rax, %r15
movq %rbx, %rdi
callq 0x19a6f
movq %rax, %r12
movq %r13, %rdi
callq 0x1b662
movq %rax, %r13
movq %rbp, %rdi
callq 0x1b662
movq %rax, (%rsp)
leaq 0x1b3a3(%rip), %rsi     # 0x3618d
jmp 0x1acd4
movq %r15, %rdi
jmp 0x1adf7
movq %rbp, %rdi
callq 0x23e44
movq %r14, %rbx
movq %rax, %r14
movq %rbx, %rdi
callq 0x19a6f
movq (%rbx), %rdi
leaq 0x1b29b(%rip), %rsi     # 0x360af
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x13b8e
movq %r15, %rdi
callq 0x23e44
movq %rax, %r15
movq %rbp, %rdi
callq 0x23e44
movq %r14, %rbx
movq %rax, %r14
movq %rbx, %rdi
callq 0x19a6f
movq (%rbx), %rdi
leaq 0x1b28a(%rip), %rsi     # 0x360d6
movq %r15, %rdx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x13b8e
leaq 0x1b1fb(%rip), %rcx     # 0x3605e
jmp 0x1ad48