// File: /workspace/github_c_makefile_star2_O3/oridb[P]mc/6/typeinfo.c
// Function: tydescsub
Blob *
tydescsub(Type *ty)
{
	Blob **sub, *sz, *bt, *b;
	size_t i, nsub;
	char buf[512];
	uint8_t tt;
	Node *len;
	int isextern;

	sub = NULL;
	nsub = 0;
	/* names are pulled out of line */
	tt = ty->type;
	/* tyvars can get tagged, but aren't desired */
	if (ty->type == Tyvar)
		return NULL;

	ty = tydedup(ty);
	if (ty->type == Tyname)
		tt |= Tdindirect;
	sz = mkblobi(Btimin, 0);
	bt = mkblobi(Bti8, tt);
	lappend(&sub, &nsub, bt);
	switch (ty->type) {
	case Ntypes: case Tyvar: case Tybad: case Typaram:
	case Tygeneric: case Tycode: case Tyunres:
		die("invalid type in tydesc");
		break;

		/* atomic types -- nothing else to do */
	case Tyvoid: case Tychar: case Tybool: case Tyint8:
	case Tyint16: case Tyint: case Tyint32: case Tyint64:
	case Tybyte: case Tyuint8: case Tyuint16:
	case Tyuint: case Tyuint32: case Tyuint64:
	case Tyflt32: case Tyflt64: case Tyvalist:
		break;

	case Typtr:
		lappend(&sub, &nsub, tydescsub(ty->sub[0]));
		break;
	case Tyslice:
		lappend(&sub, &nsub, tydescsub(ty->sub[0]));
		break;
	case Tyarray:
		encodetypeinfo(&sub, &nsub, ty);
		ty->asize = fold(ty->asize, 1);
		len = ty->asize;
		if (len) {
			assert(len->type == Nexpr);
			len = len->expr.args[0];
			assert(len->type == Nlit && len->lit.littype == Lint);
			lappend(&sub, &nsub, mkblobi(Btimin, len->lit.intval));
		} else {
			lappend(&sub, &nsub, mkblobi(Btimin, 0));
		}

		lappend(&sub, &nsub, tydescsub(ty->sub[0]));
		break;
	case Tyfunc:
		lappend(&sub, &nsub, mkblobi(Btimin, ty->nsub));
		for (i = 0; i < ty->nsub; i++)
			lappend(&sub, &nsub, tydescsub(ty->sub[i]));
		break;
	case Tytuple:
		encodetypeinfo(&sub, &nsub, ty);
		lappend(&sub, &nsub, mkblobi(Btimin, ty->nsub));
		for (i = 0; i < ty->nsub; i++)
			lappend(&sub, &nsub, tydescsub(ty->sub[i]));
		break;
	case Tystruct:
		encodetypeinfo(&sub, &nsub, ty);
		lappend(&sub, &nsub, mkblobi(Btimin, ty->nmemb));
		for (i = 0; i < ty->nmemb; i++)
			structmemb(&sub, &nsub, ty->sdecls[i]);
		break;
	case Tyunion:
		encodetypeinfo(&sub, &nsub, ty);
		lappend(&sub, &nsub, mkblobi(Btimin, ty->nmemb));
		for (i = 0; i < ty->nmemb; i++)
			unionmemb(&sub, &nsub, ty->udecls[i]);
		break;
	case Tyname:
		i = bprintf(buf, sizeof buf, "%s", Symprefix);
		tydescid(buf + i, sizeof buf - i, ty);
		isextern = ty->isimport || ty->vis != Visintern;
		lappend(&sub, &nsub, mkblobref(buf, 0, isextern));
		break;
	}
	b = mkblobseq(sub, nsub);
	sz->ival = blobsz(b);
	linsert(&b->seq.sub, &b->seq.nsub, 0, sz);
	return b;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
xorl %r14d, %r14d
movq %r14, 0x8(%rsp)
movq %r14, (%rsp)
movl (%rdi), %ebx
cmpl $0x19, %ebx
je 0x12219
callq 0x22851
movq %rax, %r14
movl %ebx, %ebp
orl $0x80, %ebp
cmpl $0x1c, (%rax)
cmovnel %ebx, %ebp
movl $0x4, %edi
xorl %esi, %esi
callq 0x491c
movq %rax, %rbx
movzbl %bpl, %esi
xorl %edi, %edi
callq 0x491c
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
movq %rax, %rdx
callq 0x2ceff
movl (%r14), %eax
cmpq $0x1f, %rax
ja 0x121e7
leaq 0x20884(%rip), %rcx     # 0x32764
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x70(%r14), %rsi
movl $0x4, %edi
callq 0x491c
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
movq %rax, %rdx
callq 0x2ceff
cmpq $0x0, 0x70(%r14)
je 0x121e7
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
movq %rsp, %r12
movq 0x68(%r14), %rax
movq (%rax,%r13,8), %rdi
callq 0x11e64
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2ceff
incq %r13
cmpq 0x70(%r14), %r13
jb 0x11f1d
jmp 0x121e7
leaq 0x8(%rsp), %r15
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1227a
movq 0x78(%r14), %rsi
movl $0x4, %edi
callq 0x491c
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2ceff
cmpq $0x0, 0x78(%r14)
je 0x121e7
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
movq %rsp, %r12
movq 0x88(%r14), %rax
movq (%rax,%r13,8), %rbp
movq 0x18(%rbp), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x11d8e
movq 0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x11fb8
callq 0x11e64
jmp 0x11fde
movl $0x1, %esi
movl $0x4, %edi
callq 0x491c
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2ceff
xorl %edi, %edi
xorl %esi, %esi
callq 0x491c
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2ceff
incq %r13
cmpq 0x78(%r14), %r13
jb 0x11f8e
jmp 0x121e7
leaq 0x8(%rsp), %r15
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1227a
movq 0x78(%r14), %rsi
movl $0x4, %edi
callq 0x491c
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2ceff
cmpq $0x0, 0x78(%r14)
je 0x121e7
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
movq %rsp, %r12
movq 0x88(%r14), %rax
movq (%rax,%r13,8), %rbp
movq 0x20(%rbp), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x11d8e
movq 0x28(%rbp), %rdi
callq 0x11e64
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2ceff
incq %r13
cmpq 0x78(%r14), %r13
jb 0x12042
jmp 0x121e7
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
movq %r14, %rdx
callq 0x1227a
movq 0x88(%r14), %rdi
movl $0x1, %esi
callq 0x144db
movq %rax, 0x88(%r14)
testq %rax, %rax
je 0x121af
cmpl $0x8, 0x8(%rax)
jne 0x1225b
movq 0x50(%rax), %rax
movq (%rax), %rax
cmpl $0x9, 0x8(%rax)
jne 0x1223c
cmpl $0x2, 0x18(%rax)
jne 0x1223c
movq 0x30(%rax), %rsi
jmp 0x121b1
leaq 0x249e6(%rip), %rdx     # 0x36acd
leaq 0x1fd5c(%rip), %rcx     # 0x31e4a
leaq 0x10(%rsp), %rdi
movl $0x200, %r15d           # imm = 0x200
movl $0x200, %esi            # imm = 0x200
xorl %eax, %eax
callq 0x2dfae
leaq (%rsp,%rax), %rdi
addq $0x10, %rdi
subq %rax, %r15
movq %r15, %rsi
movq %r14, %rdx
callq 0x579f
movl $0x1, %edx
cmpb $0x0, 0x94(%r14)
jne 0x12134
xorl %edx, %edx
cmpl $0x0, 0x10(%r14)
setne %dl
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x49a9
jmp 0x121d7
leaq 0x8(%rsp), %r15
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1227a
movq 0x70(%r14), %rsi
movl $0x4, %edi
callq 0x491c
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2ceff
cmpq $0x0, 0x70(%r14)
je 0x121e7
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
movq %rsp, %r12
movq 0x68(%r14), %rax
movq (%rax,%r13,8), %rdi
callq 0x11e64
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2ceff
incq %r13
cmpq 0x70(%r14), %r13
jb 0x12189
jmp 0x121e7
xorl %esi, %esi
movl $0x4, %edi
callq 0x491c
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
movq %rax, %rdx
callq 0x2ceff
movq 0x68(%r14), %rax
movq (%rax), %rdi
callq 0x11e64
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
movq %rax, %rdx
callq 0x2ceff
movq 0x8(%rsp), %rdi
movq (%rsp), %rsi
callq 0x497f
movq %rax, %r14
movq %rax, %rdi
callq 0x11cc4
movq %rax, 0x20(%rbx)
leaq 0x20(%r14), %rsi
movq %r14, %rdi
addq $0x28, %rdi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x2cf6a
movq %r14, %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x206fd(%rip), %rdi     # 0x32932
xorl %eax, %eax
callq 0x13844
leaq 0x2073c(%rip), %rdi     # 0x3297f
leaq 0x20712(%rip), %rsi     # 0x3295c
leaq 0x20716(%rip), %rcx     # 0x32967
movl $0x9c, %edx
callq 0x4180
leaq 0x206e7(%rip), %rdi     # 0x32949
leaq 0x206f3(%rip), %rsi     # 0x3295c
leaq 0x206f7(%rip), %rcx     # 0x32967
movl $0x9a, %edx
callq 0x4180