// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/frontend/array_float64_type.c
// Function: prv_set
static void prv_set(subtilis_parser_t *p, const char *var_name,
		    const subtilis_type_t *type, size_t mem_reg, size_t loc,
		    subtilis_exp_t *e, bool check_size, subtilis_error_t *err)
{
	subtilis_type_t el_type;
	size_t ptr;
	size_t sizee;
	subtilis_ir_operand_t gt_zero;
	subtilis_ir_operand_t eq_zero;
	subtilis_ir_operand_t op0;
	subtilis_ir_operand_t op1;

	eq_zero.label = SIZE_MAX;

	subtilis_type_if_element_type(p, type, &el_type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto free_e;

	e = subtilis_type_if_coerce_type(p, e, &el_type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	sizee = subtilis_reference_type_get_size(p, mem_reg, loc, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (check_size) {
		gt_zero.label = subtilis_ir_section_new_label(p->current);
		eq_zero.label = subtilis_ir_section_new_label(p->current);
		op0.reg = sizee;
		subtilis_ir_section_add_instr_reg(p->current,
						  SUBTILIS_OP_INSTR_JMPC, op0,
						  gt_zero, eq_zero, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;

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

	ptr = subtilis_reference_get_data(p, mem_reg, loc, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	op0.reg = p->current->reg_counter++;
	op1.reg = p->current->reg_counter++;
	subtilis_ir_section_add_instr_reg(p->current,
					  SUBTILIS_OP_INSTR_MOV_FP_I32_I32, op0,
					  op1, e->exp.ir_op, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_builtin_memset_i64(p, ptr, sizee, op0.reg, op1.reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (check_size)
		subtilis_ir_section_add_label(p->current, eq_zero.label, err);

cleanup:
	subtilis_type_free(&el_type);

free_e:
	subtilis_exp_delete(e);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movl %r9d, %ebp
movq %r8, %rbx
movq %rcx, %r12
movq %rdx, %r13
movq %rdi, %r15
movq 0x1a0(%rsp), %r14
leaq 0x20(%rsp), %rdx
movq %r14, %rcx
callq 0x34108
cmpl $0x0, (%r14)
jne 0x3c2a0
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rcx
callq 0x35977
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x3c296
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4acab
movq %rax, 0x18(%rsp)
cmpl $0x0, (%r14)
je 0x3c2ba
leaq 0x20(%rsp), %rdi
callq 0x2dc7c
movq %rbx, %rdi
callq 0x29d88
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %bpl, %bpl
je 0x3c316
movq 0x48(%r15), %rdi
callq 0x2b774
movq %rax, 0x8(%rsp)
movq 0x48(%r15), %rdi
callq 0x2b774
movq 0x48(%r15), %rdi
pushq $0x43
popq %rsi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rcx
movq %rax, 0x10(%rsp)
movq %rax, %r8
movq %r14, %r9
callq 0x2a8c1
cmpl $0x0, (%r14)
jne 0x3c296
movq 0x48(%r15), %rdi
movq 0x8(%rsp), %rsi
movq %r14, %rdx
callq 0x2b781
cmpl $0x0, (%r14)
jne 0x3c296
jmp 0x3c31e
pushq $-0x1
popq %rax
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4a690
cmpl $0x0, (%r14)
jne 0x3c296
movq %rax, %r12
movq 0x48(%r15), %rdi
movq 0x18(%rdi), %r13
leaq 0x1(%r13), %rcx
leaq 0x2(%r13), %rax
movq %rax, 0x18(%rdi)
movq 0x148(%rbx), %r8
movl $0x99, %esi
movq %r13, %rdx
movq %rcx, 0x8(%rsp)
movq %r14, %r9
callq 0x2a8c1
cmpl $0x0, (%r14)
jne 0x3c296
movq %r15, %rdi
movq %r12, %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
movq 0x8(%rsp), %r8
movq %r14, %r9
callq 0x2ed4f
cmpl $0x0, (%r14)
setne %al
xorb $0x1, %bpl
orb %al, %bpl
jne 0x3c296
movq 0x48(%r15), %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0x2b781
jmp 0x3c296
nop