// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/6/isel.c
// Function: handlesmallstructargs
static void
handlesmallstructargs(Isel *is, Func *fn)
{
	/*
	 * Perform a last-minute adjustment to fn->stksz to handle small structs
	 * that will be passed in registers. We do this inside selfunc so that
	 * generics will be specialized.
	 */
	size_t vasplit = countargs(fn->type);
	size_t i = 0;
	Type *t;
	Node *arg;

	for (i = 0; i < fn->nargs; i++) {
		arg = fn->args[i];
		t = decltype(arg);
		int vararg = 0;
		ArgType a = ArgBig;

		if (i >= vasplit)
			vararg = 1;

		if (!vararg) {
			a = classify(t);
		}

		switch(a) {
		case ArgVoid:
		case ArgReg:
		case ArgBig:
			/* No need for any extra space for this arg */
			break;
		case ArgAggrI:
		case ArgAggrF:
			fn->stksz += 8;
			fn->stksz = align(fn->stksz, min(8, Ptrsz));
			htput(fn->stkoff, fn->args[i], itop(fn->stksz));
			break;
		case ArgAggrII:
		case ArgAggrIF:
		case ArgAggrFI:
		case ArgAggrFF:
			fn->stksz += 16;
			fn->stksz = align(fn->stksz, min(16, Ptrsz));
			htput(fn->stkoff, fn->args[i], itop(fn->stksz));
			break;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x1c920
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0xe8a4
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x30260
movq %rax, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x8, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jb 0xe743
movl $0x1, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0xe755
movq -0x28(%rbp), %rdi
callq 0x1c9b0
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x3c(%rbp)
subl $0x2, %eax
jb 0xe78e
jmp 0xe762
movl -0x3c(%rbp), %eax
addl $-0x2, %eax
subl $0x2, %eax
jb 0xe793
jmp 0xe76f
movl -0x3c(%rbp), %eax
addl $-0x4, %eax
subl $0x4, %eax
jb 0xe812
jmp 0xe780
movl -0x3c(%rbp), %eax
subl $0x8, %eax
jne 0xe891
jmp 0xe78e
jmp 0xe891
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
addq $0x8, %rcx
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x58(%rbp)
movl $0x8, %esi
movq %rsi, %rdi
callq 0x4a580
movq -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0x4a5b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0xfd20
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %rax, %rdx
callq 0x49100
jmp 0xe891
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
addq $0x10, %rcx
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x70(%rbp)
movl $0x10, %edi
movl $0x8, %esi
callq 0x4a580
movq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0x4a5b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0xfd20
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq %rax, %rdx
callq 0x49100
jmp 0xe893
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xe6f1
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)