// File: /workspace/github_c_makefile_star2_O3/oridb[P]mc/parse/infer.c
// Function: typesub
static void
typesub(Node *n, int noerr)
{
	char *name;
	size_t i;
	Node *l;

	if (!n)
		return;
	switch (n->type) {
	case Ndecl:
		pushenv(n->decl.env);
		settype(n, tyfix(n, type(n), noerr));
		if (n->decl.init)
			typesub(n->decl.init, noerr);
		if (streq(declname(n), "main"))
			if (!maincompatible(tybase(decltype(n))))
				fatal(n, "main must be (->void) or (byte[:][:] -> void), got %s",
						tystr(decltype(n)));
		name = declname(n);
		if (streq(name, "__init__") || streq(name, "__fini__"))
			if (!initcompatible(tybase(decltype(n))))
				fatal(n, "%s must be (->void), got %s", name, tystr(decltype(n)));
		popenv(n->decl.env);
		break;
	case Nblock:
		pushstab(n->block.scope);
		for (i = 0; i < n->block.nstmts; i++)
			typesub(n->block.stmts[i], noerr);
		popstab();
		break;
	case Nifstmt:
		typesub(n->ifstmt.cond, noerr);
		typesub(n->ifstmt.iftrue, noerr);
		typesub(n->ifstmt.iffalse, noerr);
		break;
	case Nloopstmt:
		typesub(n->loopstmt.cond, noerr);
		typesub(n->loopstmt.init, noerr);
		typesub(n->loopstmt.step, noerr);
		typesub(n->loopstmt.body, noerr);
		break;
	case Niterstmt:
		typesub(n->iterstmt.elt, noerr);
		typesub(n->iterstmt.seq, noerr);
		typesub(n->iterstmt.body, noerr);
		if (!ingeneric)
			additerspecialization(n, curstab());
		break;
	case Nmatchstmt:
		typesub(n->matchstmt.val, noerr);
		for (i = 0; i < n->matchstmt.nmatches; i++) {
			typesub(n->matchstmt.matches[i], noerr);
		}
		break;
	case Nmatch:
		typesub(n->match.pat, noerr);
		typesub(n->match.block, noerr);
		break;
	case Nexpr:
		settype(n, tyfix(n, type(n), 0));
		if (n->expr.param)
			n->expr.param = tyfix(n, n->expr.param, 0);
		typesub(n->expr.idx, noerr);
		if (exprop(n) == Ocast && exprop(n->expr.args[0]) == Olit) {
			l = n->expr.args[0]->expr.args[0];
			if(l->lit.littype == Lint && istyint(exprtype(n))) {
				settype(n->expr.args[0], exprtype(n));
				settype(n->expr.args[0]->expr.args[0], exprtype(n));
			}
		}
		if (exprop(n) == Oauto)
			adddispspecialization(n, curstab());
		for (i = 0; i < n->expr.nargs; i++)
			typesub(n->expr.args[i], noerr);
		if (!noerr)
			verifyop(n);
		break;
	case Nfunc:
		pushstab(n->func.scope);
		settype(n, tyfix(n, n->func.type, 0));
		for (i = 0; i < n->func.nargs; i++)
			typesub(n->func.args[i], noerr);
		typesub(n->func.body, noerr);
		popstab();
		break;
	case Nlit:
		settype(n, tyfix(n, type(n), 0));
		switch (n->lit.littype) {
		case Lfunc:	typesub(n->lit.fnval, noerr);	break;
		case Lint:	checkrange(n);			break;
		default: 					break;
		}
		break;
	case Nimpl:
		pushenv(n->impl.env);
		putimpl(curstab(), n);
		popenv(n->impl.env);
	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 %r12
pushq %rbx
testq %rdi, %rdi
je 0x19137
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x1c98c(%rip), %r14     # 0x35a28
movl 0x8(%rbx), %eax
cmpq $0xd, %rax
ja 0x19137
movl $0x20, %r15d
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
movl $0x28, %r12d
jmp 0x190d7
movq 0x20(%rbx), %rdi
movl %ebp, %esi
callq 0x1907f
movl $0x30, %r12d
movl $0x28, %r15d
movq 0x18(%rbx), %rdi
movl %ebp, %esi
callq 0x1907f
movq %r15, %rax
movq %r12, %r15
jmp 0x190ef
movl $0x18, %eax
movq (%rbx,%rax), %rdi
movl %ebp, %esi
callq 0x1907f
jmp 0x1912a
movq %rbx, %rdi
callq 0x1b51f
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x19e9f
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1c686
movl 0x18(%rbx), %eax
movl $0x30, %r15d
cmpl $0x5, %eax
jne 0x19140
movq (%rbx,%r15), %rbx
testq %rbx, %rbx
jne 0x1909c
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x2, %eax
jne 0x19137
movq %rbx, %rdi
callq 0x1b51f
movl (%rax), %ecx
leal -0x4(%rcx), %edx
cmpl $0x4, %edx
ja 0x195ae
movq 0x30(%rbx), %r14
shlq $0x4, %rcx
leaq 0x1cba6(%rip), %rdx     # 0x35d10
cmpq (%rcx,%rdx), %r14
jl 0x19179
addq %rcx, %rdx
cmpq 0x8(%rdx), %r14
jle 0x19137
movq %rax, %rdi
callq 0x2398e
leaq 0x1d89c(%rip), %rsi     # 0x36a24
jmp 0x192d4
movq 0x38(%rbx), %rdi
callq 0x1ff19
movq %rbx, %rdi
callq 0x1b51f
movq %rbx, %rdi
movq %rax, %rsi
movl %ebp, %edx
callq 0x19e9f
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1c686
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x191c6
movl %ebp, %esi
callq 0x1907f
movq %rbx, %rdi
callq 0x1e2ed
leaq 0x18950(%rip), %rsi     # 0x31b25
movq %rax, %rdi
callq 0x2db3b
testl %eax, %eax
je 0x1925b
movq %rbx, %rdi
callq 0x1e31c
movq %rax, %rdi
callq 0x227ac
cmpq $0x2, 0x70(%rax)
ja 0x195fd
movq %rax, %r14
movq 0x68(%rax), %rax
movq (%rax), %rdi
callq 0x227ac
cmpl $0x1, (%rax)
jne 0x195fd
cmpq $0x2, 0x70(%r14)
jne 0x1925b
movq 0x68(%r14), %rax
movq 0x8(%rax), %rdi
callq 0x227ac
cmpl $0x14, (%rax)
jne 0x195fd
movq 0x68(%rax), %rax
movq (%rax), %rdi
callq 0x227ac
cmpl $0x14, (%rax)
jne 0x195fd
movq 0x68(%rax), %rax
movq (%rax), %rdi
callq 0x227ac
cmpl $0x9, (%rax)
jne 0x195fd
movq %rbx, %rdi
callq 0x1e2ed
movq %rax, %r14
leaq 0x18867(%rip), %rsi     # 0x31ad4
movq %rax, %rdi
callq 0x2db3b
testl %eax, %eax
jne 0x19290
leaq 0x1885d(%rip), %rsi     # 0x31add
movq %r14, %rdi
callq 0x2db3b
testl %eax, %eax
je 0x19331
movq %rbx, %rdi
callq 0x1e31c
movq %rax, %rdi
callq 0x227ac
cmpl $0x13, (%rax)
jne 0x192bd
cmpq $0x1, 0x70(%rax)
jne 0x192bd
movq 0x68(%rax), %rax
movq (%rax), %rdi
callq 0x227ac
cmpl $0x1, (%rax)
je 0x19331
movq %rbx, %rdi
callq 0x1e31c
movq %rax, %rdi
callq 0x2398e
leaq 0x1d6bd(%rip), %rsi     # 0x36991
movq %rbx, %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x138e7
movq 0x18(%rbx), %rdi
callq 0x1fe30
cmpq $0x0, 0x20(%rbx)
je 0x1940d
xorl %r14d, %r14d
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rdi
movl %ebp, %esi
callq 0x1907f
incq %r14
cmpq 0x20(%rbx), %r14
jb 0x192fb
jmp 0x1940d
movq 0x38(%rbx), %rdi
callq 0x1ff19
callq 0x1fdf7
movq %rax, %rdi
movq %rbx, %rsi
callq 0x20bf3
movq 0x38(%rbx), %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1ff64
movq 0x18(%rbx), %rdi
movl %ebp, %esi
callq 0x1907f
cmpq $0x0, 0x20(%rbx)
je 0x19137
xorl %r14d, %r14d
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rdi
movl %ebp, %esi
callq 0x1907f
incq %r14
cmpq 0x20(%rbx), %r14
jb 0x1935b
jmp 0x19137
movq 0x18(%rbx), %rdi
movl %ebp, %esi
callq 0x1907f
movq 0x20(%rbx), %rdi
movl %ebp, %esi
callq 0x1907f
movq 0x28(%rbx), %rdi
movl %ebp, %esi
callq 0x1907f
cmpl $0x0, 0x48550(%rip)     # 0x618f0
jne 0x19137
callq 0x1fdf7
movq %rbx, %rdi
movq %rax, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1d082
movq 0x20(%rbx), %rdi
callq 0x1fe30
movq 0x28(%rbx), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x19e9f
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1c686
cmpq $0x0, 0x30(%rbx)
je 0x19402
xorl %r14d, %r14d
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rdi
movl %ebp, %esi
callq 0x1907f
incq %r14
cmpq 0x30(%rbx), %r14
jb 0x193ea
movq 0x40(%rbx), %rdi
movl %ebp, %esi
callq 0x1907f
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1fe76
movq %rbx, %rdi
callq 0x1b51f
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x19e9f
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1c686
movq 0x28(%rbx), %rsi
testq %rsi, %rsi
je 0x19451
movq %rbx, %rdi
xorl %edx, %edx
callq 0x19e9f
movq %rax, 0x28(%rbx)
movq 0x48(%rbx), %rdi
movl %ebp, %esi
callq 0x1907f
movq %rbx, %rdi
callq 0x1d422
cmpl $0x2e, %eax
jne 0x194dd
movq 0x50(%rbx), %rax
movq (%rax), %rdi
callq 0x1d422
cmpl $0x35, %eax
jne 0x194dd
movq 0x50(%rbx), %rax
movq (%rax), %rax
movq 0x50(%rax), %rax
movq (%rax), %rax
cmpl $0x2, 0x18(%rax)
jne 0x194dd
movq %rbx, %rdi
callq 0x1e384
movq %rax, %rdi
callq 0x22fc8
testl %eax, %eax
je 0x194dd
movq 0x50(%rbx), %rax
movq (%rax), %r14
movq %rbx, %rdi
callq 0x1e384
movq %r14, %rdi
movq %rax, %rsi
callq 0x1c686
movq 0x50(%rbx), %rax
movq (%rax), %rax
movq 0x50(%rax), %rax
movq (%rax), %r14
movq %rbx, %rdi
callq 0x1e384
movq %r14, %rdi
movq %rax, %rsi
callq 0x1c686
movq %rbx, %rdi
callq 0x1d422
cmpl $0x1, %eax
jne 0x19574
callq 0x1fdf7
movq %rax, %r14
leaq 0x48cfb(%rip), %rax     # 0x621f8
movq (%rax), %rax
movq 0x38(%rax), %r15
movq %rbx, %rdi
callq 0x1e384
cmpq $0x1, 0x38(%r15)
jne 0x19621
movq 0x30(%r15), %rcx
movq (%rcx), %rcx
movq 0x48(%rcx), %rdi
movq %rax, %rsi
callq 0x2da24
testl %eax, %eax
jne 0x19574
leaq 0x483c3(%rip), %rdi     # 0x618f8
leaq 0x483c4(%rip), %rsi     # 0x61900
movq %r14, %rdx
callq 0x2ceff
leaq 0x483bd(%rip), %rdi     # 0x61908
leaq 0x483be(%rip), %rsi     # 0x61910
movq %rbx, %rdx
callq 0x2ceff
movq 0x30(%r15), %rax
movq (%rax), %rdx
leaq 0x483b0(%rip), %rdi     # 0x61918
leaq 0x483b1(%rip), %rsi     # 0x61920
callq 0x2ceff
cmpq $0x0, 0x40(%rbx)
je 0x19596
xorl %r14d, %r14d
movq 0x50(%rbx), %rax
movq (%rax,%r14,8), %rdi
movl %ebp, %esi
callq 0x1907f
incq %r14
cmpq 0x40(%rbx), %r14
jb 0x1957e
testl %ebp, %ebp
jne 0x19137
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1d159
leal -0x9(%rcx), %edx
cmpl $0x6, %edx
jae 0x195e4
movq 0x30(%rbx), %r14
shlq $0x4, %rcx
leaq 0x1c7db(%rip), %rdx     # 0x35da0
cmpq 0x8(%rcx,%rdx), %r14
jbe 0x19137
movq %rax, %rdi
callq 0x2398e
leaq 0x1d473(%rip), %rsi     # 0x36a52
jmp 0x192d4
cmpl $0x3, %ecx
jne 0x19137
jmp 0x195b6
leaq 0x1cd8b(%rip), %rdi     # 0x36381
xorl %eax, %eax
callq 0x13844
movq %rbx, %rdi
callq 0x1e31c
movq %rax, %rdi
callq 0x2398e
leaq 0x1d347(%rip), %rsi     # 0x3695b
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x138e7
leaq 0x1d385(%rip), %rdi     # 0x369ad
leaq 0x1cc89(%rip), %rsi     # 0x362b8
leaq 0x1d387(%rip), %rcx     # 0x369bd
movl $0x113, %edx            # imm = 0x113
callq 0x4180