// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/frontend/array_int32_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;

	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;

	subtilis_builtin_memset_i32(p, ptr, sizee, e->exp.ir_op.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 0x3d521
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rcx
callq 0x379c3
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x3d517
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4d908
movq %rax, 0x18(%rsp)
cmpl $0x0, (%r14)
je 0x3d53b
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 0x3d5a7
movq 0x48(%r15), %rdi
callq 0x2d00a
movq %rax, 0x10(%rsp)
movq 0x48(%r15), %rdi
callq 0x2d00a
movq 0x48(%r15), %rdi
movl $0x43, %esi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq %rax, 0x8(%rsp)
movq %rax, %r8
movq %r14, %r9
callq 0x2c0c2
cmpl $0x0, (%r14)
jne 0x3d517
movq 0x48(%r15), %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0x2d017
cmpl $0x0, (%r14)
jne 0x3d517
movq 0x8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4d29c
cmpl $0x0, (%r14)
jne 0x3d517
movq 0x148(%rbx), %rcx
movq %r15, %rdi
movq %rax, %rsi
movq 0x18(%rsp), %rdx
movq %r14, %r8
callq 0x3087c
cmpl $0x0, (%r14)
setne %al
xorb $0x1, %bpl
orb %al, %bpl
jne 0x3d517
movq 0x48(%r15), %rdi
movq 0x8(%rsp), %rsi
movq %r14, %rdx
callq 0x2d017
jmp 0x3d517
nop