// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1c0f0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x1cc01
leaq 0x31ce6(%rip), %rdi     # 0x4e8e0
movb $0x0, %al
callq 0x1df20
movq -0x30(%rbp), %rax
addq -0x28(%rbp), %rax
cmpq $0x10, %rax
jbe 0x1cc29
movq -0x10(%rbp), %rax
movl $0x3, (%rax)
movq -0x10(%rbp), %rax
movl $0x3, 0x4(%rax)
jmp 0x1cf0a
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
shrq $0x3, %rcx
leaq (%rax,%rcx,4), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x48(%rbp)
subq $0x1f, %rax
ja 0x1cedf
movq -0x48(%rbp), %rax
leaq 0x31a18(%rip), %rcx     # 0x4e674
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x1cedf
movq -0x38(%rbp), %rdi
movl $0x2, %esi
callq 0x1cf10
jmp 0x1cedf
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x1cf10
movq -0x10(%rbp), %rdi
addq $0x4, %rdi
movl $0x3, %esi
callq 0x1cf10
jmp 0x1cedf
movq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x1cf10
jmp 0x1cedf
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1cbb0
jmp 0x1cedf
movq -0x38(%rbp), %rdi
movl $0x3, %esi
callq 0x1cf10
jmp 0x1cedf
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x70(%rcx), %rax
jae 0x1cd4c
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x16770
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1cbb0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1cced
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x16770
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1cedf
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x78(%rcx), %rax
jae 0x1cdd6
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x30260
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x40(%rbp), %rsi
callq 0x16770
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1cbb0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1cd73
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x16770
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1cedf
movq -0x8(%rbp), %rdi
callq 0x36ab0
cmpl $0x0, %eax
je 0x1ce13
movq -0x38(%rbp), %rdi
movl $0x2, %esi
callq 0x1cf10
jmp 0x1ce21
movq -0x38(%rbp), %rdi
movl $0x3, %esi
callq 0x1cf10
jmp 0x1cedf
movq -0x8(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x1cedd
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rdi
movl $0x1, %esi
callq 0x1f390
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rdi
callq 0x2f210
cmpl $0x35, %eax
jne 0x1ce72
jmp 0x1ce91
leaq 0x3194f(%rip), %rdi     # 0x4e7c8
leaq 0x318d8(%rip), %rsi     # 0x4e758
movl $0x20c, %edx            # imm = 0x20C
leaq 0x31a6c(%rip), %rcx     # 0x4e8f8
callq 0x6160
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x88(%rcx), %rcx
movq 0x50(%rcx), %rcx
movq (%rcx), %rcx
cmpq 0x30(%rcx), %rax
jae 0x1cedb
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1cbb0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1ce99
jmp 0x1cedd
jmp 0x1cedf
movq -0x30(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1c4c0
movq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0x4a5b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
addq $0x50, %rsp
popq %rbp
retq