// File: /workspace/github_c_makefile_star2_O3/oridb[P]mc/parse/infer.c
// Function: infernode
static void
infernode(Node **np, Type *ret, int *sawret)
{
	size_t i, nbound;
	Node **bound, *n, *pat;
	Type *t, *b, *e;

	n = *np;
	if (!n)
		return;
	if (n->inferred)
		return;
	n->inferred = 1;
	switch (n->type) {
	case Ndecl:
		if (n->decl.isgeneric)
			ingeneric++;
		indentdepth++;
		setsuperenv(n->decl.env, curenv());
		pushenv(n->decl.env);
		inferdecl(n);
		if (hasparams(type(n)) && !ingeneric)
			fatal(n, "generic type in non-generic near %s", ctxstr(n));
		popenv(n->decl.env);
		indentdepth--;
		if (n->decl.isgeneric)
			ingeneric--;
		break;
	case Nblock:
		setsuper(n->block.scope, curstab());
		pushstab(n->block.scope);
		inferstab(n->block.scope);
		for (i = 0; i < n->block.nstmts; i++)
			infernode(&n->block.stmts[i], ret, sawret);
		popstab();
		break;
	case Nifstmt:
		infernode(&n->ifstmt.cond, NULL, sawret);
		infernode(&n->ifstmt.iftrue, ret, sawret);
		infernode(&n->ifstmt.iffalse, ret, sawret);
		unify(n, type(n->ifstmt.cond), mktype(n->loc, Tybool));
		break;
	case Nloopstmt:
		setsuper(n->loopstmt.scope, curstab());
		pushstab(n->loopstmt.scope);
		infernode(&n->loopstmt.init, ret, sawret);
		infernode(&n->loopstmt.cond, NULL, sawret);
		infernode(&n->loopstmt.step, ret, sawret);
		infernode(&n->loopstmt.body, ret, sawret);
		unify(n, type(n->loopstmt.cond), mktype(n->loc, Tybool));
		popstab();
		break;
	case Niterstmt:
		bound = NULL;
		nbound = 0;

		inferpat(&n->iterstmt.elt, NULL, &bound, &nbound);
		addbindings(n->iterstmt.body, bound, nbound);

		infernode(&n->iterstmt.seq, NULL, sawret);
		infernode(&n->iterstmt.body, ret, sawret);

		e = type(n->iterstmt.elt);
		t = type(n->iterstmt.seq);
		constrain(n, t, traittab[Tciter]);
		b = basetype(t);
		if (b && t->type != Typtr)
			unify(n, e, b);
		else
			t->seqaux = e;
		delayedcheck(n);
		break;
	case Nmatchstmt:
		infernode(&n->matchstmt.val, NULL, sawret);
		for (i = 0; i < n->matchstmt.nmatches; i++) {
			infernode(&n->matchstmt.matches[i], ret, sawret);
			pat = n->matchstmt.matches[i]->match.pat;
			unify(pat, type(n->matchstmt.val),
					type(n->matchstmt.matches[i]->match.pat));
		}
		break;
	case Nmatch:
		bound = NULL;
		nbound = 0;
		inferpat(&n->match.pat, NULL, &bound, &nbound);
		addbindings(n->match.block, bound, nbound);
		infernode(&n->match.block, ret, sawret);
		break;
	case Nexpr:
		inferexpr(np, ret, sawret);
		break;
	case Nfunc:
		setsuper(n->func.scope, curstab());
		pushstab(n->func.scope);
		setsuperenv(n->func.env, curenv());
		pushenv(n->func.env);
		inferstab(n->func.scope);
		inferfunc(n);
		popenv(n->func.env);
		popstab();
		break;
	case Nimpl:
		specializeimpl(n);
		break;
	case Nlit:
	case Nname:
	case Nuse:
		break;
	case Nnone:
		die("Nnone should not be seen as node type!");
		break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq (%rdi), %rbx
testq %rbx, %rbx
je 0x1880a
cmpb $0x0, 0x10(%rbx)
je 0x18819
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, 0x10(%rbx)
movl 0x8(%rbx), %eax
cmpq $0xd, %rax
ja 0x1880a
movq %rdx, %r14
movq %rsi, %r13
leaq 0x1d1bd(%rip), %rcx     # 0x359f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%rbx), %r15
callq 0x1fdf7
movq %rax, %rcx
testq %rcx, %rcx
je 0x18eb4
movq (%rcx), %rcx
cmpq %r15, %rcx
jne 0x18848
jmp 0x18d85
callq 0x1fdf7
movq 0x18(%rbx), %rsi
movq %rax, %rdi
callq 0x20429
testq %rax, %rax
je 0x19031
movq %rax, %r14
movq %rax, 0x20(%rbx)
movq 0x40(%rbx), %rax
cmpq 0x28(%r14), %rax
jne 0x1904e
movq 0x10(%r14), %rax
movq 0x18(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rbx), %rdi
callq 0x19640
movq %rax, 0x28(%rbx)
movq 0x38(%rbx), %rdi
callq 0x1ff19
cmpq $0x0, 0x40(%rbx)
je 0x188d8
xorl %r15d, %r15d
movq 0x30(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x19640
movq 0x30(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
cmpq 0x40(%rbx), %r15
jb 0x188ba
cmpq $0x0, 0x50(%rbx)
je 0x18b06
xorl %r13d, %r13d
leaq 0x4898b(%rip), %r15     # 0x61278
movq %rbx, 0x8(%rsp)
movq 0x48(%rbx), %rax
movq (%rax,%r13,8), %rbp
movq 0x90(%r15), %rax
cmpq $0x0, 0x8(%rax)
je 0x18916
movq 0x20(%rbp), %rdi
movq 0x20(%rsp), %rsi
callq 0x1dcb0
cmpq $0x0, 0x38(%r14)
je 0x18f96
xorl %r15d, %r15d
movq 0x20(%rbp), %rdi
movq 0x30(%r14), %rax
movq (%rax,%r15,8), %rax
movq 0x20(%rax), %rsi
callq 0x1fc93
testl %eax, %eax
jne 0x1894b
incq %r15
cmpq 0x38(%r14), %r15
jb 0x18924
jmp 0x18f96
movq 0x30(%r14), %rax
movq (%rax,%r15,8), %r12
testq %r12, %r12
je 0x18f96
movq %r13, (%rsp)
movq 0x38(%r12), %rdi
callq 0x1ff19
movq 0x18(%r14), %rsi
movq 0x28(%rbx), %rdx
movq %rbx, %rdi
callq 0x1b132
callq 0x1e744
movq %rax, %r15
movq 0x18(%r14), %rsi
movq 0x28(%rbx), %rdx
movq %rax, %rdi
callq 0x1e6e8
cmpq $0x0, 0x28(%r14)
je 0x189bd
xorl %r13d, %r13d
movq 0x20(%r14), %rax
movq (%rax,%r13,8), %rsi
movq 0x30(%rbx), %rax
movq (%rax,%r13,8), %rdx
movq %r15, %rdi
callq 0x1e6e8
incq %r13
cmpq 0x28(%r14), %r13
jb 0x1899c
movq %r12, %rdi
callq 0x1b51f
movq 0x48dd4(%rip), %rdx     # 0x617a0
movq %rax, %rdi
movq %r15, %rsi
callq 0x1e7c0
movq %rax, %r13
movq %r15, %rdi
callq 0x1e785
movq 0x38(%r12), %rdi
callq 0x1ff64
movq %r13, %rdi
callq 0x231e7
movl %eax, 0x1c(%rsp)
testl %eax, %eax
je 0x18a02
incl 0x48eee(%rip)           # 0x618f0
movq %rbp, %rdi
callq 0x1b915
movq %rbp, %rdi
callq 0x1b51f
movq %rbx, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x1a38c
movq 0x28(%rbx), %rsi
movq %r12, %rdi
movq %r13, %rdx
callq 0x1f1a2
movq %r13, %rbx
movq %rax, %r13
leaq 0x4883c(%rip), %r15     # 0x61278
movq 0x90(%r15), %rdi
movq %rax, %rsi
callq 0x20250
testq %rax, %rax
jne 0x18fd0
movq %r13, 0x20(%rbp)
movq 0x90(%r15), %rdi
movq %rbp, %rsi
callq 0x204de
movq %r12, 0x28(%rsp)
movq 0x48(%r12), %rdi
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rsi
movq %rbp, %rdx
callq 0x2d71e
movb $0x1, 0x72(%rbp)
cmpl $0x1d, (%rbx)
je 0x18a97
movq %rbx, %rdi
callq 0x231e7
testl %eax, %eax
je 0x18ac6
movb $0x1, 0x73(%rbp)
movq 0x28(%rsp), %r12
leaq 0x50(%r12), %rdi
leaq 0x58(%r12), %rsi
movq %rbp, %rdx
callq 0x2ceff
leaq 0x60(%r12), %rdi
addq $0x68, %r12
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2ceff
movb 0xc(%r14), %al
movb %al, 0x70(%rbp)
leaq 0x48e64(%rip), %rdi     # 0x61938
leaq 0x48e65(%rip), %rsi     # 0x61940
movq %rbp, %rdx
callq 0x2ceff
cmpl $0x0, 0x1c(%rsp)
movq (%rsp), %r13
je 0x18af4
decl 0x48dfc(%rip)           # 0x618f0
incq %r13
movq 0x8(%rsp), %rbx
cmpq 0x50(%rbx), %r13
jb 0x188f2
movq 0x38(%rbx), %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1ff64
movq 0x20(%rbx), %r14
callq 0x1fdf7
movq %rax, %rcx
testq %rcx, %rcx
je 0x18df2
movq (%rcx), %rcx
cmpq %r14, %rcx
jne 0x18b29
jmp 0x18d85
cmpb $0x0, 0x73(%rbx)
je 0x18b4b
incl 0x48da5(%rip)           # 0x618f0
incl 0x48da3(%rip)           # 0x618f4
movq 0x38(%rbx), %r14
callq 0x1fefd
testq %r14, %r14
je 0x18b62
movq %rax, (%r14)
movq 0x38(%rbx), %rdi
callq 0x1ff19
movq %rbx, %rdi
callq 0x1b915
movq %rbx, %rdi
callq 0x1b51f
movq %rax, %rdi
callq 0x231e7
testl %eax, %eax
je 0x18b94
cmpl $0x0, 0x48d62(%rip)     # 0x618f0
je 0x19020
movq 0x38(%rbx), %rdi
callq 0x1ff64
decl 0x48d51(%rip)           # 0x618f4
cmpb $0x0, 0x73(%rbx)
je 0x1880a
decl 0x48d3d(%rip)           # 0x618f0
jmp 0x1880a
movq %r13, %rsi
movq %r14, %rdx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1bd5b
xorl %eax, %eax
leaq 0x30(%rsp), %r12
movq %rax, (%r12)
movq %r13, %r15
leaq 0x10(%rsp), %r13
movq %rax, (%r13)
leaq 0x18(%rbx), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x1ba53
leaq 0x28(%rbx), %rbp
movq 0x28(%rbx), %rdi
movq (%r12), %rsi
movq (%r13), %rdx
callq 0x175c6
leaq 0x20(%rbx), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x187ee
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x187ee
movq 0x18(%rbx), %rdi
callq 0x1b51f
movq %rax, %r14
movq 0x20(%rbx), %rdi
callq 0x1b51f
movq %rax, %r15
leaq 0x495b1(%rip), %rax     # 0x621f8
movq (%rax), %rax
movq 0x30(%rax), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1bcb4
movq %r15, %rdi
callq 0x1b043
testq %rax, %rax
je 0x18c70
cmpl $0x12, (%r15)
jne 0x18f7b
movq %r14, 0x28(%r15)
jmp 0x18f89
leaq 0x18(%rbx), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x187ee
cmpq $0x0, 0x20(%rbx)
je 0x1880a
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x28(%rbx), %rdi
addq %rbp, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x187ee
movq 0x18(%rbx), %rdi
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x18(%rax), %rax
movq %rax, (%rsp)
callq 0x1b51f
movq %r14, %r12
movq %r13, %r14
movq %rax, %r13
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x18(%rax), %rdi
callq 0x1b51f
movq (%rsp), %rdi
movq %r13, %rsi
movq %r14, %r13
movq %r12, %r14
movq %rax, %rdx
callq 0x1a38c
incq %r15
addq $0x8, %rbp
cmpq 0x20(%rbx), %r15
jb 0x18c97
jmp 0x1880a
leaq 0x18(%rbx), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x187ee
leaq 0x20(%rbx), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x187ee
leaq 0x28(%rbx), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x187ee
movq 0x18(%rbx), %rdi
callq 0x1b51f
movq %rax, %r14
movq (%rbx), %rdi
movl $0x2, %esi
callq 0x2289d
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1a38c
leaq 0x18(%rbx), %r12
movq 0x38(%rbx), %r15
callq 0x1fdf7
movq %rax, %rcx
testq %rcx, %rcx
je 0x18efb
movq (%rcx), %rcx
cmpq %r15, %rcx
jne 0x18d74
leaq 0x1d67b(%rip), %rdi     # 0x36407
leaq 0x1d525(%rip), %rsi     # 0x362b8
leaq 0x1d67c(%rip), %rcx     # 0x36416
movl $0x162, %edx            # imm = 0x162
callq 0x4180
xorl %eax, %eax
leaq 0x30(%rsp), %r12
movq %rax, (%r12)
movq %r13, %r15
leaq 0x10(%rsp), %r13
movq %rax, (%r13)
leaq 0x18(%rbx), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x1ba53
movq 0x20(%rbx), %rdi
addq $0x20, %rbx
movq (%r12), %rsi
movq (%r13), %rdx
callq 0x175c6
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x187ee
jmp 0x1880a
movq %rax, (%r14)
movq 0x20(%rbx), %rdi
callq 0x1fe30
movq 0x18(%rbx), %r14
callq 0x1fefd
testq %r14, %r14
je 0x18e0f
movq %rax, (%r14)
movq 0x18(%rbx), %rdi
callq 0x1ff19
movq 0x20(%rbx), %rdi
callq 0x18686
movl $0x0, 0x10(%rsp)
cmpq $0x0, 0x30(%rbx)
je 0x18e53
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x38(%rbx), %rdi
addq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x187ee
incq %r15
addq $0x8, %r14
cmpq 0x30(%rbx), %r15
jb 0x18e36
leaq 0x40(%rbx), %rdi
movq 0x28(%rbx), %rax
movq 0x68(%rax), %rax
movq (%rax), %rsi
leaq 0x10(%rsp), %r14
movq %r14, %rdx
callq 0x187ee
cmpl $0x0, (%r14)
jne 0x18ea1
movq %rbx, %rdi
callq 0x1b51f
movq 0x68(%rax), %rax
movq (%rax), %r14
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1, %esi
callq 0x2289d
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1a38c
movq 0x18(%rbx), %rdi
callq 0x1ff64
callq 0x1fe76
jmp 0x1880a
movq %rax, (%r15)
movq 0x18(%rbx), %rdi
callq 0x1fe30
movq 0x18(%rbx), %rdi
callq 0x18686
cmpq $0x0, 0x20(%rbx)
je 0x18f68
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x28(%rbx), %rdi
addq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x187ee
incq %r12
addq $0x8, %r15
cmpq 0x20(%rbx), %r12
jb 0x18eda
jmp 0x18f68
movq %rax, (%r15)
movq 0x38(%rbx), %rdi
callq 0x1fe30
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x187ee
leaq 0x20(%rbx), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x187ee
leaq 0x28(%rbx), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x187ee
leaq 0x30(%rbx), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x187ee
movq 0x20(%rbx), %rdi
callq 0x1b51f
movq %rax, %r14
movq (%rbx), %rdi
movl $0x2, %esi
callq 0x2289d
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1a38c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1fe76
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1a38c
movq %rbx, %rdi
callq 0x1bd15
jmp 0x1880a
movq 0x20(%rbp), %rdi
callq 0x1e4eb
movq %rax, %r15
movq 0x10(%r14), %rdi
callq 0x1e4eb
movq %rax, %r14
movq %rbx, %rdi
callq 0x19858
leaq 0x1d7cd(%rip), %rsi     # 0x3678a
movq %rbx, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x138e7
movq 0x10(%r14), %rdi
movq %rax, %r15
callq 0x1e4eb
movq %rax, %r14
movq 0x8(%rsp), %rbx
movq 0x28(%rbx), %rdi
callq 0x2398e
movq %rax, %r12
movq (%r15), %rdi
callq 0x1d31c
movq %rax, %r13
movq (%r15), %rdi
callq 0x1d330
leaq 0x1d7a6(%rip), %rsi     # 0x367b0
movq %rbx, %rdi
movq %r14, %rdx
movq %r12, %rcx
movq %r13, %r8
movl %eax, %r9d
xorl %eax, %eax
callq 0x138e7
movq %rbx, %rdi
callq 0x19858
leaq 0x1d32e(%rip), %rsi     # 0x3635d
jmp 0x19041
movq 0x18(%rbx), %rdi
callq 0x1e4eb
leaq 0x1d6fc(%rip), %rsi     # 0x3673d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x138e7
movq 0x18(%rbx), %rdi
callq 0x1e4eb
movq 0x40(%rbx), %rcx
movq 0x28(%r14), %r8
leaq 0x1d6e4(%rip), %rsi     # 0x3674a
movq %rbx, %rdi
movq %rax, %rdx
jmp 0x18fc9
leaq 0x1d309(%rip), %rdi     # 0x36381
xorl %eax, %eax
callq 0x13844