// File: /workspace/github_c_makefile_star2_O1/oridb[P]mc/6/isel.c
// Function: addarglocs
void
addarglocs(Isel *s, Func *fn)
{
	size_t i, nints, nfloats, nargs;
	size_t argoff;
	int vararg;
	Node *arg;
	Type *t;

	argoff = 0;
	nfloats = 0;
	nints = 0;
	vararg = 0;
	nargs = countargs(fn->type);
	for (i = 0; i < fn->nargs; i++) {
		arg = fn->args[i];
		t = decltype(arg);
		argoff = alignto(argoff, t);
		ArgType a = ArgBig;
		Loc *l = NULL;
		if (i >= nargs)
			vararg = 1;
		else
			argoff = align(argoff, 8);

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

		if (!sufficientregs(a, nfloats, nints)) {
			a = ArgBig;
		}

		switch(a) {
		case ArgVoid:
			break;
		case ArgReg:
		case ArgBig:
			/* retrievearg can figure this out */
			retrievearg(s, arg, vararg, &nfloats, &nints, &argoff);
			break;
		case ArgAggrI:
			l = loc(s, arg);
			movearg(s, l, PassInInt, ModeQ, &nfloats, &nints, &argoff);
			break;
		case ArgAggrF:
			l = loc(s, arg);
			movearg(s, l, PassInSSE, ModeD, &nfloats, &nints, &argoff);
			break;
		case ArgAggrII:
			l = loc(s, arg);
			movearg(s,          l , PassInInt, ModeQ, &nfloats, &nints, &argoff);
			movearg(s, plus8(s, l), PassInInt, ModeQ, &nfloats, &nints, &argoff);
			break;
		case ArgAggrIF:
			l = loc(s, arg);
			movearg(s,          l , PassInInt, ModeQ, &nfloats, &nints, &argoff);
			movearg(s, plus8(s, l), PassInSSE, ModeD, &nfloats, &nints, &argoff);
			break;
		case ArgAggrFI:
			l = loc(s, arg);
			movearg(s,          l , PassInSSE, ModeD, &nfloats, &nints, &argoff);
			movearg(s, plus8(s, l), PassInInt, ModeQ, &nfloats, &nints, &argoff);
			break;
		case ArgAggrFF:
			l = loc(s, arg);
			movearg(s,          l , PassInSSE, ModeD, &nfloats, &nints, &argoff);
			movearg(s, plus8(s, l), PassInSSE, ModeD, &nfloats, &nints, &argoff);
			break;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, 0x10(%rsp)
xorl %r14d, %r14d
movq %r14, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq 0x10(%rsi), %rdi
callq 0x12b29
movq %rax, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
cmpq %r14, 0x20(%rbx)
je 0x99b1
xorl %r15d, %r15d
xorl %ebp, %ebp
movq %rbx, 0x8(%rsp)
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %r12
movq %r12, %rdi
callq 0x1e56c
movq %rax, %r13
movq %rbp, %rdi
movq %rax, %rsi
callq 0xee68
movq %rax, %rbp
cmpq 0x30(%rsp), %r15
jae 0x96b0
movl $0x8, %esi
movq %rbp, %rdi
callq 0x2e697
movq %rax, %rbp
movq 0x28(%rsp), %rcx
jmp 0x96b5
movl $0x1, %ecx
movl $0x8, %r14d
movl $0x8, %eax
movq %rcx, 0x28(%rsp)
testl %ecx, %ecx
jne 0x96d1
movq %r13, %rdi
callq 0x12b78
movq 0x18(%rsp), %rbx
movq 0x20(%rsp), %r13
movl %eax, %eax
leaq 0x272bc(%rip), %rcx     # 0x309a0
movslq 0x4(%rcx,%rax,8), %rcx
addq %rbx, %rcx
cmpq $0x8, %rcx
ja 0x970f
leaq 0x272a7(%rip), %rcx     # 0x309a0
movslq (%rcx,%rax,8), %rcx
addq %r13, %rcx
cmpq $0x7, %rcx
movl $0x8, %ecx
cmovael %ecx, %eax
movl %eax, %r14d
decl %r14d
cmpl $0x7, %r14d
ja 0x98b8
leaq 0x27209(%rip), %rcx     # 0x3092c
movslq (%rcx,%r14,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r12, %rdi
callq 0xee80
testl %eax, %eax
je 0x98cf
movq 0x10(%rsp), %rax
movq 0x50(%rax), %rdi
movq $-0x10, %rdx
subq %rbp, %rdx
movq %r12, %rsi
callq 0x2dbc2
movq %r12, %rdi
callq 0x1281a
addq %rax, %rbp
jmp 0x98b8
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x92d0
movq %rax, %r12
movq %rbx, %rdi
movq %rax, %rsi
movl $0x2, %edx
movl $0x4, %ecx
jmp 0x9828
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x92d0
movq %rbx, %rdi
movq %rax, %rsi
movl $0x2, %edx
movl $0x4, %ecx
jmp 0x97d1
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x92d0
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
movl $0x6, %ecx
leaq 0x18(%rsp), %r8
leaq 0x20(%rsp), %r9
jmp 0x98b3
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x92d0
movq %rax, %r12
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
movl $0x6, %ecx
jmp 0x987d
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x92d0
movq %rax, %r12
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
movl $0x6, %ecx
leaq 0x18(%rsp), %r14
movq %r14, %r8
leaq 0x20(%rsp), %r13
movq %r13, %r9
callq 0x99c0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x9a54
movq %rbx, %rdi
movq %rax, %rsi
movl $0x2, %edx
movl $0x4, %ecx
jmp 0x98ad
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x92d0
movq %rax, %r12
movq %rbx, %rdi
movq %rax, %rsi
movl $0x2, %edx
movl $0x4, %ecx
leaq 0x18(%rsp), %r14
movq %r14, %r8
leaq 0x20(%rsp), %r13
movq %r13, %r9
callq 0x99c0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x9a54
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
movl $0x6, %ecx
movq %r14, %r8
movq %r13, %r9
callq 0x99c0
movq 0x8(%rsp), %rbx
incq %r15
cmpq 0x20(%rbx), %r15
jb 0x9671
jmp 0x99b1
cmpl $0x0, 0x28(%rsp)
je 0x98f1
movq %r12, %rdi
callq 0x1e56c
movq %rax, %rdi
callq 0x22c44
cmpl $0x1, (%rax)
jne 0x973c
jmp 0x98b8
movq %r12, %rdi
callq 0x8feb
movl %eax, %edi
callq 0xa8d7
cmpq $0x7, %rbx
ja 0x9939
testl %eax, %eax
je 0x9939
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x92d0
movq %rax, %r13
movq %r12, %rdi
callq 0x8feb
movl %eax, %edi
callq 0xa855
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %edx
jmp 0x998c
movq %r12, %rdi
callq 0x8feb
movl %eax, %edi
callq 0xa8cc
testl %eax, %eax
setne %al
cmpq $0x6, %r13
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x98d6
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x92d0
movq %rax, %r13
movq %r12, %rdi
callq 0x8feb
movl %eax, %edi
callq 0xa88e
movq %rbx, %rdi
movq %r13, %rsi
movl $0x2, %edx
movl %eax, %ecx
leaq 0x18(%rsp), %r8
leaq 0x20(%rsp), %r9
callq 0x99c0
movq 0x48(%rbx), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2dbc2
jmp 0x98b8
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq