// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0xf5ec
movq -0x10(%rbp), %rdi
callq 0x167b0
cmpl $0x0, %eax
je 0xf58b
movl $0x3, -0x1c(%rbp)
jmp 0xf5ea
cmpl $0x0, -0x2c(%rbp)
jne 0xf5b5
movq -0x18(%rbp), %rax
movl 0x4(%rax), %edi
callq 0xfd70
cmpl $0x0, %eax
je 0xf5b5
movq 0x10(%rbp), %rax
cmpq $0x8, (%rax)
jae 0xf5b5
movl $0x1, -0x1c(%rbp)
jmp 0xf5e8
cmpl $0x0, -0x2c(%rbp)
jne 0xf5df
movq -0x18(%rbp), %rax
movl 0x4(%rax), %edi
callq 0xfd30
cmpl $0x0, %eax
je 0xf5df
movq 0x18(%rbp), %rax
cmpq $0x6, (%rax)
jae 0xf5df
movl $0x2, -0x1c(%rbp)
jmp 0xf5e6
movl $0x3, -0x1c(%rbp)
jmp 0xf5e8
jmp 0xf5ea
jmp 0xf5ec
movl -0x1c(%rbp), %eax
movq %rax, -0x50(%rbp)
subq $0x3, %rax
ja 0xf83e
movq -0x50(%rbp), %rax
leaq 0x3cfb0(%rip), %rcx     # 0x4c5b8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
callq 0x167b0
cmpl $0x0, %eax
je 0xf6ca
movl $0x4, %edi
callq 0xff10
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x38(%rbp), %rcx
movl $0x5, %esi
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0xbf80
movq -0x10(%rbp), %rdi
callq 0x30340
movq %rax, %rdi
callq 0x1c4c0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movq 0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1c480
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq %rax, %r9
movq -0x48(%rbp), %rax
xorl %r8d, %r8d
movq %rax, (%rsp)
callq 0xd740
movq -0x10(%rbp), %rdi
callq 0x1c480
movq %rax, %rcx
movq 0x20(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
jmp 0xf721
movq 0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rax
movl 0x4(%rax), %ecx
xorl %eax, %eax
movl %eax, %edx
callq 0x10050
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xc370
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0xfb60
movq -0x10(%rbp), %rdi
callq 0x1c480
movq %rax, %rcx
movq 0x20(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
jmp 0xf83e
movq 0x10(%rbp), %rax
movq (%rax), %rcx
leaq 0x505bc(%rip), %rax     # 0x5fcf0
movq (%rax,%rcx,8), %rax
movl %eax, -0x74(%rbp)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %edi
callq 0xfc30
movl -0x74(%rbp), %edi
movl %eax, %esi
callq 0x10240
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xc370
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %edi
callq 0xfd70
cmpl $0x0, %eax
je 0xf796
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x40(%rbp), %rcx
movl $0x27, %esi
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0xbf80
jmp 0xf7b3
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x40(%rbp), %rcx
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0xbf80
movq 0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xf83e
movq 0x18(%rbp), %rax
movq (%rax), %rcx
leaq 0x5055f(%rip), %rax     # 0x5fd30
movq (%rax,%rcx,8), %rax
movl %eax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %edi
callq 0xfca0
movl -0x78(%rbp), %edi
movl %eax, %esi
callq 0x10240
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xc370
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x40(%rbp), %rcx
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0xbf80
movq 0x18(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xf83e
leaq 0x3cf85(%rip), %rdi     # 0x4c7bc
movb $0x0, %al
callq 0x1df20
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)