// File: /workspace/github_c_makefile_star2_O1/oridb[P]mc/6/typeinfo.c
// Function: classify_recursive
static void
classify_recursive(Type *t, PassIn *p, size_t *total_offset)
{
	size_t i = 0, sz = tysize(t);
	size_t cur_offset = *total_offset;
	PassIn *cur = 0;

	if (!t)
		die("cannot pass empty type.");
	if (cur_offset + sz > 16) {
		p[0] = PassInMemory;
		p[1] = PassInMemory;
		return;
	}
	cur = &p[cur_offset / 8];

	switch(t->type) {
	case Tyvoid: break;
	case Tybool:
	case Tybyte:
	case Tychar:
	case Tyint:
	case Tyint16:
	case Tyint32:
	case Tyint64:
	case Tyint8:
	case Typtr:
	case Tyuint:
	case Tyuint16:
	case Tyuint32:
	case Tyuint64:
	case Tyuint8:
		join_classification(cur, PassInInt);
		break;
	case Tyslice:
		/* Slices are too myrddin-specific, they go on the stack. */
		join_classification(&p[0], PassInMemory);
		join_classification(&p[1], PassInMemory);
		break;
	case Tyflt32:
	case Tyflt64:
		join_classification(cur, PassInSSE);
		break;
	case Tyname:
		classify_recursive(t->sub[0], p, total_offset);
		break;
	case Tybad:
	case Tycode:
	case Tyfunc:
	case Tygeneric:
	case Typaram:
	case Tyunres:
	case Tyvalist:
	case Tyvar:
	case Ntypes:
		/* We shouldn't even be in this function */
		join_classification(cur, PassInMemory);
		break;
	case Tytuple:
		for (i = 0; i < t->nsub; ++i) {
			*total_offset = alignto(*total_offset, t->sub[i]);
			classify_recursive(t->sub[i], p, total_offset);
		}
		*total_offset = alignto(*total_offset, t);
		break;
	case Tystruct:
		for (i = 0; i < t->nmemb; ++i) {
			Type *fieldt = decltype(t->sdecls[i]);
			*total_offset = alignto(*total_offset, fieldt);
			classify_recursive(fieldt, p, total_offset);
		}
		*total_offset = alignto(*total_offset, t);
		break;
	case Tyunion:
		/*
		 * General enums are too complicated to interop with C, which is the only
		 * reason for anything other than PassInMemory.
		 */
		if (isenum(t))
			join_classification(cur, PassInInt);
		else
			join_classification(cur, PassInMemory);
		break;
	case Tyarray:
		if (t->asize) {
			t->asize = fold(t->asize, 1);
			assert(exprop(t->asize) == Olit);
			for (i = 0; i < t->asize->expr.args[0]->lit.intval; ++i) {
				classify_recursive(t->sub[0], p, total_offset);
			}
		}
	}

	*total_offset = align(cur_offset + sz, tyalign(t));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
callq 0x125dd
testq %r15, %r15
je 0x12efe
movq %rax, %r14
movq (%rbx), %r13
addq %r13, %r14
cmpq $0x11, %r14
jb 0x12cf3
movabsq $0x300000003, %rax      # imm = 0x300000003
movq %rax, (%r12)
jmp 0x12e71
movl (%r15), %eax
cmpq $0x1f, %rax
ja 0x12e5b
shrq $0x3, %r13
leaq 0x1fb5d(%rip), %rcx     # 0x32868
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x2, (%r12,%r13,4)
jmp 0x12e5b
movl (%r12,%r13,4), %eax
cmpl $0x2, %eax
je 0x12d14
cmpl $0x1, %eax
je 0x12e5b
testl %eax, %eax
jne 0x12df6
movl $0x1, (%r12,%r13,4)
jmp 0x12e5b
movl (%r12), %ecx
cmpl $0x3, %ecx
je 0x12d64
movl $0x3, %eax
cmpl $0x2, %ecx
jne 0x12d60
movl $0x2, %eax
movl %eax, (%r12)
movl 0x4(%r12), %eax
cmpl $0x3, %eax
je 0x12e5b
cmpl $0x2, %eax
je 0x12ef0
testl %eax, %eax
movl $0x3, 0x4(%r12)
jmp 0x12e5b
cmpq $0x0, 0x78(%r15)
je 0x12e4d
xorl %ebp, %ebp
movq 0x88(%r15), %rax
movq (%rax,%rbp,8), %rdi
callq 0x1e56c
movq %rax, %r13
movq (%rbx), %rdi
movq %rax, %rsi
callq 0xee68
movq %rax, (%rbx)
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x12caf
incq %rbp
cmpq 0x78(%r15), %rbp
jb 0x12d98
jmp 0x12e4d
movq %r15, %rdi
callq 0x22c7f
testl %eax, %eax
jne 0x12d14
movl (%r12,%r13,4), %eax
cmpl $0x3, %eax
je 0x12e5b
cmpl $0x2, %eax
je 0x12d14
testl %eax, %eax
movl $0x3, (%r12,%r13,4)
jmp 0x12e5b
movq 0x68(%r15), %rax
movq (%rax), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x12caf
jmp 0x12e5b
cmpq $0x0, 0x70(%r15)
je 0x12e4d
xorl %r13d, %r13d
movq (%rbx), %rdi
movq 0x68(%r15), %rax
movq (%rax,%r13,8), %rsi
callq 0xee68
movq %rax, (%rbx)
movq 0x68(%r15), %rax
movq (%rax,%r13,8), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x12caf
incq %r13
cmpq 0x70(%r15), %r13
jb 0x12e1e
movq (%rbx), %rdi
movq %r15, %rsi
callq 0xee68
movq %rax, (%rbx)
movq %r15, %rdi
callq 0x1282d
movq %r14, %rdi
movq %rax, %rsi
callq 0x2e697
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x88(%r15), %rdi
testq %rdi, %rdi
je 0x12e5b
movl $0x1, %esi
callq 0x14703
movq %rax, 0x88(%r15)
movq %rax, %rdi
callq 0x1d672
cmpl $0x35, %eax
jne 0x12f0c
movq 0x88(%r15), %rax
movq 0x50(%rax), %rax
movq (%rax), %rax
cmpq $0x0, 0x30(%rax)
je 0x12e5b
xorl %r13d, %r13d
movq 0x68(%r15), %rax
movq (%rax), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x12caf
incq %r13
movq 0x88(%r15), %rax
movq 0x50(%rax), %rax
movq (%rax), %rax
cmpq 0x30(%rax), %r13
jb 0x12ec2
jmp 0x12e5b
movl $0x2, 0x4(%r12)
jmp 0x12e5b
leaq 0x1fbcf(%rip), %rdi     # 0x32ad4
xorl %eax, %eax
callq 0x13a00
leaq 0x1faa9(%rip), %rdi     # 0x329bc
leaq 0x1fa32(%rip), %rsi     # 0x3294c
leaq 0x1fbcb(%rip), %rcx     # 0x32aec
movl $0x20c, %edx            # imm = 0x20C
callq 0x4180
nop