// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x1c920
movq %rax, -0x30(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0xdd97
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x30260
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x16770
movq %rax, -0x38(%rbp)
movl $0x8, -0x54(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
jb 0xdaa1
movl $0x1, -0x3c(%rbp)
jmp 0xdab3
movq -0x38(%rbp), %rdi
movl $0x8, %esi
callq 0x4a5b0
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x3c(%rbp)
jne 0xdac5
movq -0x50(%rbp), %rdi
callq 0x1c9b0
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %edi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xdda0
cmpl $0x0, %eax
jne 0xdae1
movl $0x8, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq %rax, -0x68(%rbp)
subq $0x8, %rax
ja 0xdd84
movq -0x68(%rbp), %rax
leaq 0x3ea53(%rip), %rcx     # 0x4c550
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0xdd84
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x3c(%rbp), %edx
leaq -0x28(%rbp), %rcx
leaq -0x20(%rbp), %r8
leaq -0x38(%rbp), %r9
callq 0xde00
jmp 0xdd84
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xd570
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl $0x2, %edx
movl $0x4, %ecx
leaq -0x28(%rbp), %r8
leaq -0x20(%rbp), %r9
leaq -0x38(%rbp), %rax
movq %rax, (%rsp)
callq 0xe030
jmp 0xdd84
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xd570
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl $0x1, %edx
movl $0x6, %ecx
leaq -0x28(%rbp), %r8
leaq -0x20(%rbp), %r9
leaq -0x38(%rbp), %rax
movq %rax, (%rsp)
callq 0xe030
jmp 0xdd84
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xd570
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl $0x2, %edx
movl $0x4, %ecx
leaq -0x28(%rbp), %r8
leaq -0x20(%rbp), %r9
leaq -0x38(%rbp), %rax
movq %rax, (%rsp)
callq 0xe030
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0xe150
movq -0x70(%rbp), %rdi
movq %rax, %rsi
movl $0x2, %edx
movl $0x4, %ecx
leaq -0x28(%rbp), %r8
leaq -0x20(%rbp), %r9
leaq -0x38(%rbp), %rax
movq %rax, (%rsp)
callq 0xe030
jmp 0xdd84
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xd570
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl $0x2, %edx
movl $0x4, %ecx
leaq -0x28(%rbp), %r8
leaq -0x20(%rbp), %r9
leaq -0x38(%rbp), %rax
movq %rax, (%rsp)
callq 0xe030
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0xe150
movq -0x78(%rbp), %rdi
movq %rax, %rsi
movl $0x1, %edx
movl $0x6, %ecx
leaq -0x28(%rbp), %r8
leaq -0x20(%rbp), %r9
leaq -0x38(%rbp), %rax
movq %rax, (%rsp)
callq 0xe030
jmp 0xdd84
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xd570
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl $0x1, %edx
movl $0x6, %ecx
leaq -0x28(%rbp), %r8
leaq -0x20(%rbp), %r9
leaq -0x38(%rbp), %rax
movq %rax, (%rsp)
callq 0xe030
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0xe150
movq -0x80(%rbp), %rdi
movq %rax, %rsi
movl $0x2, %edx
movl $0x4, %ecx
leaq -0x28(%rbp), %r8
leaq -0x20(%rbp), %r9
leaq -0x38(%rbp), %rax
movq %rax, (%rsp)
callq 0xe030
jmp 0xdd84
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xd570
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl $0x1, %edx
movl $0x6, %ecx
leaq -0x28(%rbp), %r8
leaq -0x20(%rbp), %r9
leaq -0x38(%rbp), %rax
movq %rax, (%rsp)
callq 0xe030
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0xe150
movq -0x88(%rbp), %rdi
movq %rax, %rsi
movl $0x1, %edx
movl $0x6, %ecx
leaq -0x28(%rbp), %r8
leaq -0x20(%rbp), %r9
leaq -0x38(%rbp), %rax
movq %rax, (%rsp)
callq 0xe030
jmp 0xdd86
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xda3b
addq $0x90, %rsp
popq %rbp
retq