// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/show-parse.c
// Function: show_call_expression
static int show_call_expression(struct expression *expr)
{
	struct symbol *direct;
	struct expression *arg, *fn;
	int fncall, retval;
	int framesize;

	if (!expr->ctype) {
		warning(expr->pos, "\tcall with no type!");
		return 0;
	}

	framesize = 0;
	FOR_EACH_PTR_REVERSE(expr->args, arg) {
		int new = show_expression(arg);
		int size = arg->ctype->bit_size;
		printf("\tpush.%d\t\tv%d\n", size, new);
		framesize += bits_to_bytes(size);
	} END_FOR_EACH_PTR_REVERSE(arg);

	fn = expr->fn;

	/* Remove dereference, if any */
	direct = NULL;
	if (fn->type == EXPR_PREOP) {
		if (fn->unop->type == EXPR_SYMBOL) {
			struct symbol *sym = fn->unop->symbol;
			if (sym->ctype.base_type->type == SYM_FN)
				direct = sym;
		}
	}
	if (direct) {
		printf("\tcall\t\t%s\n", show_ident(direct->ident));
	} else {
		fncall = show_expression(fn);
		printf("\tcall\t\t*v%d\n", fncall);
	}
	if (framesize)
		printf("\tadd.%d\t\tvSP,vSP,$%d\n", bits_in_pointer, framesize);

	retval = new_pseudo();
	printf("\tmov.%d\t\tv%d,retval\n", expr->ctype->bit_size, retval);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x34219
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x34378(%rip), %rsi     # 0x6857e
movb $0x0, %al
callq 0x16d80
movl $0x0, -0x4(%rbp)
jmp 0x343ea
movl $0x0, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x3424c
jmp 0x342f4
jmp 0x3424e
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movw (%rax), %ax
shlw $0x8, %ax
sarw $0x8, %ax
cwtl
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, %eax
jl 0x342e4
movq -0x48(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0x48(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x342a6
cmpq $0x0, -0x20(%rbp)
jne 0x342a6
jmp 0x3426d
movq -0x20(%rbp), %rdi
callq 0x33a40
movl %eax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x50(%rax), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %esi
movl -0x58(%rbp), %edx
leaq 0x342c5(%rip), %rdi     # 0x68592
movb $0x0, %al
callq 0x110f0
movl -0x5c(%rbp), %edi
callq 0x34d50
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0x3426d
jmp 0x342e6
movq -0x48(%rbp), %rax
cmpq -0x40(%rbp), %rax
jne 0x3424e
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x9, %eax
jne 0x3435c
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x3, %eax
jne 0x3435a
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq 0x60(%rax), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x5, %eax
jne 0x34358
movq -0x68(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x3435a
jmp 0x3435c
cmpq $0x0, -0x18(%rbp)
je 0x34383
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x44150
movq %rax, %rsi
leaq 0x34227(%rip), %rdi     # 0x685a1
movb $0x0, %al
callq 0x110f0
jmp 0x343a0
movq -0x28(%rbp), %rdi
callq 0x33a40
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %esi
leaq 0x34213(%rip), %rdi     # 0x685ac
movb $0x0, %al
callq 0x110f0
cmpl $0x0, -0x34(%rbp)
je 0x343c0
leaq 0x5634f(%rip), %rax     # 0x8a6fc
movl (%rax), %esi
movl -0x34(%rbp), %edx
leaq 0x34200(%rip), %rdi     # 0x685b9
movb $0x0, %al
callq 0x110f0
callq 0x33f60
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x50(%rax), %esi
movl -0x30(%rbp), %edx
leaq 0x341f2(%rip), %rdi     # 0x685cf
movb $0x0, %al
callq 0x110f0
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)