// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/expression.c
// Function: subtilis_exp_add_call
subtilis_exp_t *subtilis_exp_add_call(subtilis_parser_t *p, char *name,
				      subtilis_builtin_type_t ftype,
				      subtilis_type_section_t *stype,
				      subtilis_ir_arg_t *args,
				      const subtilis_type_t *fn_type,
				      size_t num_params, bool check_error,
				      subtilis_error_t *err)
{
	size_t call_site;
	subtilis_exp_t *e = NULL;
	subtilis_parser_call_t *call = NULL;

	if (fn_type->type == SUBTILIS_TYPE_VOID)
		subtilis_ir_section_add_call(p->current, num_params, args, err);
	else
		e = subtilis_type_if_call(p, fn_type, args, num_params, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;
	args = NULL;

	/* For calls made inside handlers we will add the offset from the start
	 * of the handler section and fix it up later on when checking the
	 * calls.
	 */

	call_site = p->current->in_error_handler ? p->current->error_len
						 : p->current->len;
	call_site--;

	/*
	 * We don't check for errors after calls to builtin functions that do
	 * not generate errors.  Doing so is wasteful and can also cause problem
	 * when a builtin, like deref, is called in a place where we don't want
	 * to check for errors, e.g., when unwinding the stack.  IR builtins
	 * are indistinguishable from normal functions, but the check_error
	 * flag can be used to disable error checking for those functions.
	 */

	if (check_error && ((ftype == SUBTILIS_BUILTINS_MAX) ||
			    subtilis_builtin_list[ftype].generates_error)) {
		subtilis_exp_handle_errors(p, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto on_error;
	}

	prv_tmp_ref_return(p, fn_type, e, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	if (ftype != SUBTILIS_BUILTINS_MAX) {
		prv_add_builtin(p, name, ftype, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto on_error;
	}

	call = subtilis_parser_call_new(p->current, call_site,
					p->current->in_error_handler, name,
					stype, p->l->line, ftype, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;
	name = NULL;
	stype = NULL;

	prv_add_call(p, call, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	return e;

on_error:

	subtilis_exp_delete(e);
	free(args);
	subtilis_parser_call_delete(call);
	subtilis_type_section_delete(stype);
	free(name);

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq 0x20(%rbp), %rax
movb 0x18(%rbp), %al
movq 0x10(%rbp), %r10
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
andb $0x1, %al
movb %al, -0x39(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x8, (%rax)
jne 0x36fb3
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq 0x20(%rbp), %rcx
callq 0x39c30
jmp 0x36fd0
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq 0x10(%rbp), %rcx
movq 0x20(%rbp), %r8
callq 0x49d60
movq %rax, -0x50(%rbp)
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36fde
jmp 0x3714c
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
testb $0x1, 0x60(%rax)
je 0x37006
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x50(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x37016
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x30(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
testb $0x1, -0x39(%rbp)
je 0x37072
cmpl $0x9, -0x1c(%rbp)
je 0x37055
movl -0x1c(%rbp), %eax
movl %eax, %ecx
leaq 0x946ee(%rip), %rax     # 0xcb730
imulq $0x688, %rcx, %rcx      # imm = 0x688
addq %rcx, %rax
testb $0x1, 0x680(%rax)
je 0x37072
movq -0x10(%rbp), %rdi
movq 0x20(%rbp), %rsi
callq 0x36ce0
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x37070
jmp 0x3714c
jmp 0x37072
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq 0x20(%rbp), %rcx
callq 0x37190
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x37095
jmp 0x3714c
cmpl $0x9, -0x1c(%rbp)
je 0x370bf
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movq 0x20(%rbp), %rcx
callq 0x37230
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x370bd
jmp 0x3714c
jmp 0x370bf
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x48(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movb 0x60(%rax), %dl
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %eax
movl %eax, %r9d
movl -0x1c(%rbp), %r10d
movq 0x20(%rbp), %rax
andb $0x1, %dl
movzbl %dl, %edx
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x46f10
movq %rax, -0x58(%rbp)
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x37116
jmp 0x3714c
movq $0x0, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq 0x20(%rbp), %rdx
callq 0x372f0
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x37142
jmp 0x3714c
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x37181
movq -0x50(%rbp), %rdi
callq 0x36ee0
movq -0x30(%rbp), %rdi
callq 0x12290
movq -0x58(%rbp), %rdi
callq 0x46fe0
movq -0x28(%rbp), %rdi
callq 0x3e040
movq -0x18(%rbp), %rdi
callq 0x12290
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)