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

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

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

	el_start.reg = SUBTILIS_IR_REG_TEMP_START;
	el_size.reg = SUBTILIS_IR_REG_TEMP_START + 1;
	el_destructor.reg = SUBTILIS_IR_REG_TEMP_START + 2;

	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;

	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;

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

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

	ref_count.reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_GETREF, offset, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	op2.integer = 1;
	ref_count.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_EQI_I32, ref_count, op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  ref_count, destruct_label,
					  deref_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_ORIG_SIZE_OFF;
	orig_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_array_type_deref_recs(p, offset.reg, orig_size.reg,
				       el_size.reg, el_destructor.reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_label(p->current, deref_label.label, 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 $0x80, %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 -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x28(%rbp)
movq $0x4, -0x58(%rbp)
movq $0x5, -0x60(%rbp)
movq $0x6, -0x68(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %r8
movq -0x58(%rbp), %rdx
movq -0x48(%rbp), %rcx
movl $0x12, %esi
callq 0x38230
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42a72
jmp 0x42c83
movl $0x8, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %r8
movq -0x58(%rbp), %rdx
movq -0x48(%rbp), %rcx
movl $0x12, %esi
callq 0x38230
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42aa9
jmp 0x42c83
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %r9
movq -0x78(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42ad9
jmp 0x42c83
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x39960
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42afc
jmp 0x42c83
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %rcx
movq -0x70(%rbp), %rdx
movl $0x7a, %esi
callq 0x38490
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42b28
jmp 0x42c83
movl $0x1, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %r8
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rcx
movl $0x2d, %esi
callq 0x38230
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42b5f
jmp 0x42c83
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %r9
movq -0x50(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42b8f
jmp 0x42c83
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x39960
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42bb2
jmp 0x42c83
movl $0xc, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %r8
movq -0x58(%rbp), %rdx
movq -0x48(%rbp), %rcx
movl $0x12, %esi
callq 0x38230
movq %rax, -0x80(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42be9
jmp 0x42c83
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %r8
movq -0x18(%rbp), %r9
callq 0x60400
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42c11
jmp 0x42c83
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x40(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x39960
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42c31
jmp 0x42c83
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x70(%rbp), %rsi
callq 0x6d670
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42c4d
jmp 0x42c83
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x39960
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x42c6d
jmp 0x42c83
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 $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)