// File: /workspace/github_c_makefile_star2_O1/oridb[P]mc/parse/type.c
// Function: tybfmt
static int
tybfmt(char *buf, size_t len, Bitset *visited, Type *t)
{
	size_t i;
	char *p;
	char *end;
	char *sep;

	if (t)
		t = tysearch(t);

	sep = "";
	p = buf;
	end = p + len;

	if (!t) {
		p += bprintf(p, end - p, "tynil");
		return len - (end - p);
	}

	if (bshas(visited, t->tid)) {
		p += bprintf(buf, len, "<...>");
		return len - (end - p);
	}
        bsput(visited, t->tid);
	switch (t->type) {
	case Tybad:	p += bprintf(p, end - p, "BAD");	break;
	case Tyvoid:	p += bprintf(p, end - p, "void");	break;
	case Tybool:	p += bprintf(p, end - p, "bool");	break;
	case Tychar:	p += bprintf(p, end - p, "char");	break;
	case Tyint8:	p += bprintf(p, end - p, "int8");	break;
	case Tyint16:	p += bprintf(p, end - p, "int16");	break;
	case Tyint:	p += bprintf(p, end - p, "int");	break;
	case Tyint32:	p += bprintf(p, end - p, "int32");	break;
	case Tyint64:	p += bprintf(p, end - p, "int64");	break;
	case Tybyte:	p += bprintf(p, end - p, "byte");	break;
	case Tyuint8:	p += bprintf(p, end - p, "uint8");	break;
	case Tyuint16:	p += bprintf(p, end - p, "uint16");	break;
	case Tyuint:	p += bprintf(p, end - p, "uint");	break;
	case Tyuint32:	p += bprintf(p, end - p, "uint32");	break;
	case Tyuint64:	p += bprintf(p, end - p, "uint64");	break;
	case Tyflt32:	p += bprintf(p, end - p, "flt32");	break;
	case Tyflt64:	p += bprintf(p, end - p, "flt64");	break;
	case Tyvalist:	p += bprintf(p, end - p, "...");	break;
	case Tyvar:     p += bprintf(p, end - p, "$%d", t->tid);        break;

	case Typtr:
		p += tybfmt(p, end - p, visited, t->sub[0]);
		p += bprintf(p, end - p, "#");
		break;
	case Tyslice:
		p += tybfmt(p, end - p, visited, t->sub[0]);
		p += bprintf(p, end - p, "[:]");
		break;
	case Tyarray:
		p += tybfmt(p, end - p, visited, t->sub[0]);
		if (t->asize) {
			i = t->asize->expr.args[0]->lit.intval;
			p += bprintf(p, end - p, "[%zd]", i);
		} else {
			p += bprintf(p, end - p, "[]");
		}
		break;
	case Tycode:
	case Tyfunc:
		p += bprintf(p, end - p, "(");
		for (i = 1; i < t->nsub; i++) {
			p += bprintf(p, end - p, "%s", sep);
			p += tybfmt(p, end - p, visited, t->sub[i]);
			sep = ", ";
		}
		p += bprintf(p, end - p, " -> ");
		p += tybfmt(p, end - p, visited, t->sub[0]);
		p += bprintf(p, end - p, ")");
		break;
	case Tytuple:
		p += bprintf(p, end - p, "(");
		for (i = 0; i < t->nsub; i++) {
			p += bprintf(p, end - p, "%s", sep);
			p += tybfmt(p, end - p, visited, t->sub[i]);
			sep = ",";
		}
		p += bprintf(p, end - p, ")");
		break;
	case Typaram:	p += bprintf(p, end - p, "@%s", t->pname);	break;
	case Tyunres:
		p += namefmt(p, end - p, t->name);
		if (t->narg)
			p += fmtlist(p, end - p, visited, t->arg, t->narg);
		break;
	case Tyname:
		if (t->name->name.ns)
			p += bprintf(p, end - p, "%s.", t->name->name.ns);
		p += bprintf(p, end - p, "%s", namestr(t->name));
		if (t->narg)
			p += fmtlist(p, end - p, visited, t->arg, t->narg);
		break;
	case Tygeneric:
		if (t->name->name.ns)
			p += bprintf(p, end - p, "%s.", t->name->name.ns);
		p += bprintf(p, end - p, "%s", namestr(t->name));
		if (t->ngparam)
			p += fmtlist(p, end - p, visited, t->gparam, t->ngparam);
		break;
	case Tystruct:	p += fmtstruct(p, end - p, visited, t);	break;
	case Tyunion:	p += fmtunion(p, end - p, visited, t);	break;
	case Ntypes:	die("Ntypes is not a type");	break;
	}

	/* we only show constraints on non-builtin typaram */
	if (t->type == Tyvar || t->type == Typaram)
		p += traitfmt(p, end - p, t);

        bsdel(visited, t->tid);
	return p - buf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %r12
testq %rcx, %rcx
je 0x23834
movq %rcx, %rdi
callq 0x1727c
movq %rax, %r15
jmp 0x23837
xorl %r15d, %r15d
testq %r15, %r15
je 0x2392d
movl 0x4(%r15), %esi
movq (%r14), %rax
shlq $0x6, %rax
cmpq %rsi, %rax
jbe 0x2386f
movq 0x8(%r14), %rax
movl %esi, %ecx
shrl $0x6, %ecx
movq (%rax,%rcx,8), %rax
btq %rsi, %rax
jae 0x2386f
leaq 0x14649(%rip), %rdx     # 0x37eb3
jmp 0x23934
leaq (%r12,%r13), %rax
movq %rax, (%rsp)
movq %r14, %rdi
callq 0x2d816
movl (%r15), %eax
movq %r12, %rbp
cmpq $0x1f, %rax
ja 0x23b17
leaq 0x14386(%rip), %rcx     # 0x37c1c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rbx
leaq 0x11b41(%rip), %rdx     # 0x353ea
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2e42e
movq %rax, %r13
addq %r12, %r13
cmpq $0x2, 0x70(%r15)
movq %r12, 0x10(%rsp)
jb 0x23a31
movl $0x1, %ebp
leaq 0xe562(%rip), %rcx      # 0x31e3a
movq (%rsp), %r14
movq %r14, %rsi
subq %r13, %rsi
movq %r13, %rdi
leaq 0x131d1(%rip), %rdx     # 0x36abd
xorl %eax, %eax
callq 0x2e42e
movq %rax, %r12
addq %r13, %r12
movq %r14, %rsi
subq %r12, %rsi
movq 0x68(%r15), %rax
movq (%rax,%rbp,8), %rcx
movq %r12, %rdi
movq %rbx, %rdx
callq 0x2380b
movslq %eax, %r13
addq %r12, %r13
incq %rbp
leaq 0x12686(%rip), %rcx     # 0x35fa8
cmpq 0x70(%r15), %rbp
jb 0x238dc
jmp 0x23a35
leaq 0x14579(%rip), %rdx     # 0x37ead
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2e42e
movq %rax, %rbp
jmp 0x23b48
movq 0x88(%r15), %rcx
leaq 0x14578(%rip), %rdx     # 0x37ecf
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2e42e
jmp 0x23b11
leaq 0x134f3(%rip), %rdx     # 0x36e63
jmp 0x23b04
leaq 0x134da(%rip), %rdx     # 0x36e56
jmp 0x23b04
leaq 0x134bb(%rip), %rdx     # 0x36e43
jmp 0x23b04
leaq 0x134aa(%rip), %rdx     # 0x36e3e
jmp 0x23b04
leaq 0x134aa(%rip), %rdx     # 0x36e4a
jmp 0x23b04
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x2580d
jmp 0x239c9
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x2572f
movslq %eax, %rbp
jmp 0x23b14
leaq 0x13460(%rip), %rdx     # 0x36e38
jmp 0x23b04
leaq 0x13434(%rip), %rdx     # 0x36e18
jmp 0x23b04
leaq 0x1346d(%rip), %rdx     # 0x36e5d
jmp 0x23b04
leaq 0x13437(%rip), %rdx     # 0x36e33
jmp 0x23b04
leaq 0x13448(%rip), %rdx     # 0x36e50
jmp 0x23b04
leaq 0x13326(%rip), %rdx     # 0x36d3a
jmp 0x23b04
leaq 0x1340e(%rip), %rdx     # 0x36e2e
jmp 0x23b04
leaq 0x1448d(%rip), %rdx     # 0x37eb9
jmp 0x23b04
movq (%rsp), %r14
movq %r14, %rsi
subq %r13, %rsi
leaq 0x14488(%rip), %rdx     # 0x37eca
movq %r13, %rdi
xorl %eax, %eax
callq 0x2e42e
movq %rax, %r12
addq %r13, %r12
movq %r14, %rsi
subq %r12, %rsi
movq 0x68(%r15), %rax
movq (%rax), %rcx
movq %r12, %rdi
movq %rbx, %rdx
callq 0x2380b
movslq %eax, %r13
addq %r12, %r13
subq %r13, %r14
leaq 0x13969(%rip), %rdx     # 0x373e3
movq %r13, %rdi
movq %r14, %rsi
jmp 0x23df0
movq 0x68(%r15), %rax
movq (%rax), %rcx
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x2380b
cltq
leaq (%r12,%rax), %rbx
subq %rax, %r13
leaq 0x14413(%rip), %rdx     # 0x37ebd
jmp 0x23dc4
leaq 0x1338e(%rip), %rdx     # 0x36e44
jmp 0x23b04
leaq 0x13390(%rip), %rdx     # 0x36e4f
jmp 0x23b04
leaq 0x13202(%rip), %rdx     # 0x36cca
jmp 0x23b04
movq 0x68(%r15), %rax
movq (%rax), %rcx
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x2380b
cltq
leaq (%r12,%rax), %rbx
subq %rax, %r13
leaq 0x13263(%rip), %rdx     # 0x36d52
jmp 0x23dc4
leaq 0x13342(%rip), %rdx     # 0x36e3d
jmp 0x23b04
leaq 0x13353(%rip), %rdx     # 0x36e57
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2e42e
movq %rax, %rbp
addq %r12, %rbp
movl (%r15), %eax
addl $-0x19, %eax
cmpl $0x1, %eax
ja 0x23b39
movq (%rsp), %rsi
subq %rbp, %rsi
movq %rbp, %rdi
movq %r15, %rdx
callq 0x236d6
cltq
addq %rax, %rbp
movl 0x4(%r15), %esi
movq %r14, %rdi
callq 0x2d872
subq %r12, %rbp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x8(%rsp)
movq 0x88(%r15), %rax
movq 0x18(%rax), %rcx
movq %r12, %rbx
testq %rcx, %rcx
je 0x23b8b
leaq 0xf020(%rip), %rdx      # 0x32b98
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2e42e
movq %rax, %rbx
addq %r12, %rbx
movq %r12, %r13
movq (%rsp), %r14
movq %r14, %r12
subq %rbx, %r12
movq 0x88(%r15), %rdi
callq 0x1e73b
leaq 0x12f12(%rip), %rdx     # 0x36abd
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x2e42e
movq %rax, %rbp
addq %rbx, %rbp
movq 0x38(%r15), %r8
testq %r8, %r8
je 0x23dad
movq %r14, %rsi
subq %rbp, %rsi
movq 0x30(%r15), %rcx
jmp 0x23d79
movq 0x68(%r15), %rax
movq (%rax), %rcx
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x2380b
cltq
leaq (%r12,%rax), %rbx
movq 0x88(%r15), %rcx
testq %rcx, %rcx
je 0x23dba
movq 0x50(%rcx), %rcx
movq (%rcx), %rcx
movq 0x30(%rcx), %rcx
subq %rax, %r13
leaq 0x142a4(%rip), %rdx     # 0x37ec1
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2e42e
jmp 0x23dd1
movq %r14, %rbx
leaq 0x117b1(%rip), %rdx     # 0x353ea
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2e42e
movq %rax, %r13
movq %r12, 0x10(%rsp)
addq %r12, %r13
cmpq $0x0, 0x70(%r15)
je 0x23ddc
leaq 0xe1d7(%rip), %rcx      # 0x31e3a
xorl %ebp, %ebp
movq (%rsp), %r14
movq %r14, %rsi
subq %r13, %rsi
movq %r13, %rdi
leaq 0x12e44(%rip), %rdx     # 0x36abd
xorl %eax, %eax
callq 0x2e42e
movq %rax, %r12
addq %r13, %r12
movq %r14, %rsi
subq %r12, %rsi
movq 0x68(%r15), %rax
movq (%rax,%rbp,8), %rcx
movq %r12, %rdi
movq %rbx, %rdx
callq 0x2380b
movslq %eax, %r13
addq %r12, %r13
incq %rbp
leaq 0x150c9(%rip), %rcx     # 0x38d78
cmpq 0x70(%r15), %rbp
jb 0x23c69
jmp 0x23de0
movq 0x88(%r15), %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x25602
cltq
leaq (%r12,%rax), %rbp
movq 0x48(%r15), %r8
testq %r8, %r8
je 0x23b17
subq %rax, %r13
movq 0x40(%r15), %rcx
movq %rbp, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x2566c
cltq
addq %rax, %rbp
jmp 0x23b17
movq %r14, 0x8(%rsp)
movq 0x88(%r15), %rax
movq 0x18(%rax), %rcx
movq %r12, %rbx
testq %rcx, %rcx
je 0x23d30
leaq 0xee7b(%rip), %rdx      # 0x32b98
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2e42e
movq %rax, %rbx
addq %r12, %rbx
movq %r12, %r13
movq (%rsp), %r14
movq %r14, %r12
subq %rbx, %r12
movq 0x88(%r15), %rdi
callq 0x1e73b
leaq 0x12d6d(%rip), %rdx     # 0x36abd
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x2e42e
movq %rax, %rbp
addq %rbx, %rbp
movq 0x48(%r15), %r8
testq %r8, %r8
je 0x23dad
movq %r14, %rsi
subq %rbp, %rsi
movq 0x40(%r15), %rcx
movq %rbp, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x2566c
cltq
addq %rax, %rbp
jmp 0x23db2
movl 0x4(%r15), %ecx
leaq 0xb513(%rip), %rdx      # 0x2f2ae
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2e42e
jmp 0x23b11
movq 0x8(%rsp), %r14
movq %r13, %r12
jmp 0x23b17
subq %rax, %r13
leaq 0x14103(%rip), %rdx     # 0x37ec7
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2e42e
movq %rax, %rbp
addq %rbx, %rbp
jmp 0x23b17
movq (%rsp), %r14
movq %r14, %rsi
subq %r13, %rsi
leaq 0x135f6(%rip), %rdx     # 0x373e3
movq %r13, %rdi
xorl %eax, %eax
callq 0x2e42e
movq %rax, %rbp
addq %r13, %rbp
movq %rbx, %r14
movq 0x10(%rsp), %r12
jmp 0x23b17
leaq 0x140c2(%rip), %rdi     # 0x37ed3
xorl %eax, %eax
callq 0x13a00