// File: /workspace/github_c_makefile_star2_O1/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 0x3620e
cmpl $0x0, (%r14)
jne 0x3e721
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rcx
callq 0x379c3
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x3e717
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4d908
movq %rax, 0x18(%rsp)
cmpl $0x0, (%r14)
je 0x3e73b
leaq 0x20(%rsp), %rdi
callq 0x2f843
movq %rbx, %rdi
callq 0x2b4c3
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $-0x1, %rax
testb %bpl, %bpl
je 0x3e7a7
movq 0x48(%r15), %rdi
callq 0x2d00a
movq %rax, 0x8(%rsp)
movq 0x48(%r15), %rdi
callq 0x2d00a
movq 0x48(%r15), %rdi
movl $0x43, %esi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rcx
movq %rax, 0x10(%rsp)
movq %rax, %r8
movq %r14, %r9
callq 0x2c0c2
cmpl $0x0, (%r14)
jne 0x3e717
movq 0x48(%r15), %rdi
movq 0x8(%rsp), %rsi
movq %r14, %rdx
callq 0x2d017
cmpl $0x0, (%r14)
jne 0x3e717
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4d29c
cmpl $0x0, (%r14)
jne 0x3e717
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 0x2c0c2
cmpl $0x0, (%r14)
jne 0x3e717
movq %r15, %rdi
movq %r12, %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
movq 0x8(%rsp), %r8
movq %r14, %r9
callq 0x30a3d
cmpl $0x0, (%r14)
setne %al
xorb $0x1, %bpl
orb %al, %bpl
jne 0x3e717
movq 0x48(%r15), %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0x2d017
jmp 0x3e717
nopl (%rax)