// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/builtins_ir.c
// Function: prv_builtins_ir_call_deref
static void prv_builtins_ir_call_deref(subtilis_parser_t *p,
				       subtilis_ir_section_t *current,
				       subtilis_error_t *err)
{
	subtilis_ir_section_t *old_current;
	subtilis_ir_operand_t el_start;
	subtilis_ir_operand_t op2;
	subtilis_ir_operand_t offset;
	subtilis_ir_operand_t size;
	subtilis_ir_operand_t no_destruct_label;
	subtilis_ir_operand_t destruct_label;

	old_current = p->current;
	p->current = current;

	el_start.reg = SUBTILIS_IR_REG_TEMP_START;

	destruct_label.label = subtilis_ir_section_new_label(p->current);
	no_destruct_label.label = subtilis_ir_section_new_label(p->current);

	op2.integer = SUBTIILIS_REFERENCE_SIZE_OFF;
	size.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LOADO_I32, el_start, op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  size, destruct_label,
					  no_destruct_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_label(p->current, destruct_label.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	op2.integer = SUBTIILIS_REFERENCE_HEAP_OFF;
	offset.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LOADO_I32, el_start, op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	reference_type_call_deref(p, offset, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_label(p->current, no_destruct_label.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_instr_no_arg(p->current, SUBTILIS_OP_INSTR_RET,
					     err);

cleanup:
	p->current = old_current;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq $0x4, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x48(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %r8
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl $0x12, %esi
callq 0x38230
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x451bd
jmp 0x45296
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %r9
movq -0x40(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x451ed
jmp 0x45296
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x50(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x39960
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45210
jmp 0x45296
movl $0x8, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %r8
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl $0x12, %esi
callq 0x38230
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45244
jmp 0x45296
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x38(%rbp), %rsi
callq 0x6d670
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45260
jmp 0x45296
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x48(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x39960
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45280
jmp 0x45296
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %rdx
movl $0x46, %esi
callq 0x385f0
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)