// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/6/simp.c
// Function: simpcall
static Node *
simpcall(Simp *s, Node *n, Node *dst)
{
	Node *r, *call, *fn;
	size_t i, nargs;
	Node **args;
	Type *ft;
	ArgType rettype;
	Op op;

	/* NB: If we called rval() on a const function, we would end up with
	   a stack allocated closure. We don't want to do this. */
	fn = n->expr.args[0];
	if (!isconstfn(fn))
		fn = rval(s, fn, NULL);
	ft = tybase(exprtype(fn));
	if (exprtype(n)->type == Tyvoid)
		r = NULL;
	else if (isstacktype(exprtype(n)) && dst)
		r = dst;
	else
		r = temp(s, n);

	args = NULL;
	nargs = 0;
	op = Ocall;
	lappend(&args, &nargs, getcode(s, fn));
	if (!isconstfn(fn)) {
		op = Ocallind;
		lappend(&args, &nargs, getenvptr(s, fn));
	}

	rettype = classify(exprtype(n));
	switch (rettype) {
	case ArgVoid:
		break;
	case ArgBig:
	case ArgAggrI:
	case ArgAggrF:
	case ArgAggrII:
	case ArgAggrIF:
	case ArgAggrFI:
	case ArgAggrFF:
		lappend(&args, &nargs, addr(s, r, exprtype(n)));
		break;
	case ArgReg:
		lappend(&args, &nargs, r);
		break;
	}

	for (i = 1; i < n->expr.nargs; i++) {
		if (i < ft->nsub && tybase(ft->sub[i])->type == Tyvalist)
			lappend(&args, &nargs, vatypeinfo(s, n));
		if (tybase(exprtype(n->expr.args[i]))->type == Tyvoid)
			continue;
		lappend(&args, &nargs, rval(s, n->expr.args[i], NULL));
		if (exprop(n->expr.args[i]) == Oaddr)
			if (exprop(n->expr.args[i]->expr.args[0]) == Ovar)
				def(s, n->expr.args[i]->expr.args[0]);
	}
	if (i < ft->nsub && tybase(ft->sub[i])->type == Tyvalist)
		lappend(&args, &nargs, vatypeinfo(s, n));

	if (r)
		def(s, r);

	call = mkexprl(n->loc, op, args, nargs);
	call->expr.type = exprtype(n);
	append(s, call);
	return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x41010
cmpl $0x0, %eax
jne 0x19ae6
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x177e0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x30340
movq %rax, %rdi
callq 0x36a30
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30340
cmpl $0x1, (%rax)
jne 0x19b13
movq $0x0, -0x20(%rbp)
jmp 0x19b4d
movq -0x10(%rbp), %rdi
callq 0x30340
movq %rax, %rdi
callq 0x369d0
cmpl $0x0, %eax
je 0x19b3a
cmpq $0x0, -0x18(%rbp)
je 0x19b3a
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x19b4b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x16940
movq %rax, -0x20(%rbp)
jmp 0x19b4d
movq $0x0, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x2d, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x169c0
movq %rax, %rdx
leaq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x48290
movq -0x30(%rbp), %rdi
callq 0x41010
cmpl $0x0, %eax
jne 0x19bb3
movl $0x48, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x1aaa0
movq %rax, %rdx
leaq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x48290
movq -0x10(%rbp), %rdi
callq 0x30340
movq %rax, %rdi
callq 0x1c9b0
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x5c(%rbp)
testl %eax, %eax
je 0x19bea
jmp 0x19bd3
movl -0x5c(%rbp), %eax
subl $0x1, %eax
je 0x19c27
jmp 0x19bdd
movl -0x5c(%rbp), %eax
addl $-0x2, %eax
subl $0x7, %eax
jb 0x19bec
jmp 0x19c38
jmp 0x19c38
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30340
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq %rax, %rdx
callq 0x16af0
movq %rax, %rdx
leaq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x48290
jmp 0x19c38
movq -0x20(%rbp), %rdx
leaq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x48290
movq $0x1, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jae 0x19d5b
movq -0x38(%rbp), %rax
movq -0x50(%rbp), %rcx
cmpq 0x70(%rcx), %rax
jae 0x19c97
movq -0x50(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x36a30
cmpl $0x11, (%rax)
jne 0x19c97
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1ab10
movq %rax, %rdx
leaq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x48290
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x30340
movq %rax, %rdi
callq 0x36a30
cmpl $0x1, (%rax)
jne 0x19cbe
jmp 0x19d4a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x177e0
movq %rax, %rdx
leaq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x48290
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2f210
cmpl $0x12, %eax
jne 0x19d48
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movq (%rax), %rdi
callq 0x2f210
cmpl $0x33, %eax
jne 0x19d46
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movq (%rax), %rsi
callq 0x1aa40
jmp 0x19d48
jmp 0x19d4a
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x19c40
movq -0x38(%rbp), %rax
movq -0x50(%rbp), %rcx
cmpq 0x70(%rcx), %rax
jae 0x19da0
movq -0x50(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x36a30
cmpl $0x11, (%rax)
jne 0x19da0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1ab10
movq %rax, %rdx
leaq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x48290
cmpq $0x0, -0x20(%rbp)
je 0x19db4
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1aa40
movq -0x10(%rbp), %rax
movl -0x58(%rbp), %esi
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq (%rax), %rdi
callq 0x2f580
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30340
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x17710
movq -0x20(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)