// File: /workspace/github_c_makefile_star2_O3/oridb[P]mc/6/isel.c
// Function: placearg
static void
placearg(Isel *s, Node *argn, Loc *argloc, PassIn p, Loc *rsp, int vararg, size_t *nfloats, size_t *nints, size_t *argoff)
{
	/*
	   placearg may be called when argn is stored at argloc, but it may also
	   be called when argloc is a small piece of argn, as in the case when
	   small structs are being passed. In those circumstances, p is PassInSSE
	   or PassInInt, and argn is irrelevant. Therefore, argn should not be
	   relied on when p is PassInSSE or PassInInt.
	 */
	Loc *src, *dst;
	size_t a;

	if (p == PassInNoPref) {
		if (stacknode(argn)) {
			p = PassInMemory;
		} else if (!vararg && isfloatmode(argloc->mode) && *nfloats < Nfloatregargs) {
			p = PassInSSE;
		} else if (!vararg && isintmode(argloc->mode) && *nints < Nintregargs) {
			p = PassInInt;
		} else {
			p = PassInMemory;
		}
	}

	switch (p) {
	case PassInMemory:
		if (stacknode(argn)) {
			src = locreg(ModeQ);
			g(s, Ilea, argloc, src, NULL);
			a = tyalign(exprtype(argn));
			blit(s, rsp, src, *argoff, 0, size(argn), a);
			*argoff += size(argn);
		} else {
			dst = locmem(*argoff, rsp, NULL, argloc->mode);
			argloc = inri(s, argloc);
			stor(s, argloc, dst);
			*argoff += size(argn);
		}
		break;
	case PassInSSE:
		dst = coreg(floatargregs[*nfloats], forcefltmode(argloc->mode));
		argloc = inri(s, argloc);
		if (isfloatmode(argloc->mode)) {
			g(s, Imovs, argloc, dst, NULL);
		} else {
			g(s, Imov, argloc, dst, NULL);
		}
		(*nfloats)++;
		break;
	case PassInInt:
		dst = coreg(intargregs[*nints], forceintmode(argloc->mode));
		argloc = inri(s, argloc);
		g(s, Imov, argloc, dst, NULL);
		(*nints)++;
		break;
	case PassInNoPref: /* impossible */
		die("cannot determine how to pass arg");
		break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r12
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
movq 0x58(%rsp), %r13
movq 0x50(%rsp), %rbx
movl %ecx, %eax
leaq 0x26623(%rip), %rcx     # 0x3096c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r9d, %ebp
movq %r15, %rdi
callq 0xec54
orl %ebp, %eax
je 0xa51e
movq 0x60(%rsp), %rbx
movq %r15, %rdi
callq 0xec54
testl %eax, %eax
je 0xa484
movl $0x4, %edi
callq 0xa8da
movq %rax, %r13
movq %r12, 0x10(%rsp)
movq 0x8(%rsp), %r12
movq %r12, %rdi
movl $0x5, %esi
movq %r14, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8dc2
movq %r15, %rdi
callq 0x1e384
movq %rax, %rdi
callq 0x12677
movq %rax, %r14
movq (%rbx), %rbp
movq %r15, %rdi
callq 0x12664
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
movq %rbp, %rcx
movq %rax, %r8
movq %r14, %r9
callq 0x9298
jmp 0xa511
movq (%rbx), %rax
leaq 0x39df1(%rip), %rcx     # 0x441e0
movl (%rcx,%rax,8), %ebp
movl 0x4(%r14), %edi
callq 0xa720
movl %ebp, %edi
movl %eax, %esi
callq 0xaacd
movq %rax, %r15
movl (%r14), %eax
cmpl $0x2, %eax
je 0xa55c
cmpl $0x5, %eax
movq 0x8(%rsp), %r12
je 0xa561
movq %r12, %rdi
movq %r14, %rsi
callq 0x8e9c
movq %rax, %r14
jmp 0xa561
movq (%r13), %rax
leaq 0x39de1(%rip), %rcx     # 0x44220
movl (%rcx,%rax,8), %ebp
movl 0x4(%r14), %edi
callq 0xa759
movl %ebp, %edi
movl %eax, %esi
callq 0xaacd
movq %rax, %r15
movl (%r14), %eax
cmpl $0x2, %eax
je 0xa593
cmpl $0x5, %eax
movq 0x8(%rsp), %rbx
je 0xa598
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8e9c
movq %rax, %r14
jmp 0xa598
movq (%rbx), %rdi
movl 0x4(%r14), %ecx
movq %r12, %rsi
xorl %edx, %edx
callq 0xa973
movq %rax, %r12
movl (%r14), %eax
cmpl $0x2, %eax
je 0xa4b7
cmpl $0x5, %eax
je 0xa4b7
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x8e9c
movq %rax, %r14
movl (%rax), %eax
cmpl $0x2, %eax
je 0xa4c5
cmpl $0x5, %eax
jne 0xa5ca
cmpl $0x2, (%r12)
movq %r12, %r13
jne 0xa4e3
movl 0x4(%r12), %ecx
xorl %edi, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0xa973
movq %rax, %r13
movl 0x4(%r12), %edi
callq 0xa7a3
testl %eax, %eax
movl $0x1, %eax
movl $0x27, %esi
cmovel %eax, %esi
movq 0x8(%rsp), %rdi
movq %r14, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8dc2
movq %r15, %rdi
callq 0x12664
jmp 0xa5b8
movl 0x4(%r14), %edi
callq 0xa7a3
testl %eax, %eax
je 0xa538
movq (%rbx), %rax
cmpq $0x8, %rax
jb 0xa3e8
movl 0x4(%r14), %edi
callq 0xa798
testl %eax, %eax
je 0xa365
movq (%r13), %rax
cmpq $0x6, %rax
jae 0xa365
jmp 0xa438
movq 0x8(%rsp), %r12
movl 0x4(%r14), %edi
callq 0xa7a3
testl %eax, %eax
movl $0x1, %eax
movl $0x27, %esi
cmovel %eax, %esi
movq %r12, %rdi
movq %r14, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8dc2
movl $0x1, %eax
jmp 0xa5b8
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8dc2
movl $0x1, %eax
movq %r13, %rbx
addq %rax, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x265cb(%rip), %rdi     # 0x30b9c
leaq 0x2649e(%rip), %rsi     # 0x30a76
leaq 0x265e4(%rip), %rcx     # 0x30bc3
movl $0x11e, %edx            # imm = 0x11E
callq 0x4180