// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/array_type.c
// Function: prv_slice_set_sizes
static size_t prv_slice_set_sizes(subtilis_parser_t *p,
				  const subtilis_type_t *type,
				  size_t source_reg, size_t dest_reg,
				  subtilis_exp_t *index1,
				  subtilis_exp_t *index2, subtilis_error_t *err)
{
	size_t size_reg;
	size_t orig_size_reg;
	subtilis_exp_t *one = NULL;
	subtilis_exp_t *size = NULL;
	subtilis_exp_t *index1_dup = NULL;
	subtilis_exp_t *index2_dup = NULL;
	subtilis_exp_t *size_dup = NULL;
	subtilis_exp_t *el_count = NULL;

	index1_dup = subtilis_type_if_dup(index1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	index2_dup = subtilis_type_if_dup(index2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	size = subtilis_type_if_sub(p, index2_dup, index1_dup, err);
	index1_dup = NULL;
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	size_dup = subtilis_type_if_dup(size, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	one = subtilis_exp_new_int32(1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	el_count = subtilis_type_if_sub(p, size_dup, one, err);
	size_dup = NULL;
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	size = subtilis_type_if_data_size(p, type, size, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	size = subtilis_type_if_exp_to_var(p, size, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	size_reg = size->exp.ir_op.reg;
	subtilis_exp_delete(size);
	size = NULL;

	subtilis_reference_type_set_size(p, dest_reg, 0, size_reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	orig_size_reg =
	    subtilis_reference_type_get_orig_size(p, source_reg, 0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_reference_type_set_orig_size(p, dest_reg, 0, orig_size_reg,
					      err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_type_if_assign_to_mem(p, dest_reg, SUBTIILIS_ARRAY_DIMS_OFF,
				       el_count, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	return size_reg;

cleanup:
	subtilis_exp_delete(el_count);
	subtilis_exp_delete(size);
	subtilis_exp_delete(size_dup);
	subtilis_exp_delete(index1_dup);

	return SIZE_MAX;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x30(%rbp), %rdi
movq 0x10(%rbp), %rsi
callq 0x47d20
movq %rax, -0x60(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d7fe
movq $-0x1, -0x8(%rbp)
jmp 0x5d9f3
movq -0x38(%rbp), %rdi
movq 0x10(%rbp), %rsi
callq 0x47d20
movq %rax, -0x68(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d81d
jmp 0x5d9c7
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq 0x10(%rbp), %rcx
callq 0x492c0
movq %rax, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d84c
jmp 0x5d9c7
movq -0x58(%rbp), %rdi
movq 0x10(%rbp), %rsi
callq 0x47d20
movq %rax, -0x70(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d86b
jmp 0x5d9c7
movq 0x10(%rbp), %rsi
movl $0x1, %edi
callq 0x37800
movq %rax, -0x50(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d88b
jmp 0x5d9c7
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq 0x10(%rbp), %rcx
callq 0x492c0
movq %rax, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d8ba
jmp 0x5d9c7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq 0x10(%rbp), %rcx
callq 0x474f0
movq %rax, -0x58(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d8e1
jmp 0x5d9c7
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq 0x10(%rbp), %rdx
callq 0x47c10
movq %rax, -0x58(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d904
jmp 0x5d9c7
movq -0x58(%rbp), %rax
movq 0x148(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x58(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x40(%rbp), %rcx
movq 0x10(%rbp), %r8
xorl %eax, %eax
movl %eax, %edx
callq 0x6dc50
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d948
jmp 0x5d9c7
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq 0x10(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0x6e390
movq %rax, -0x48(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d96c
jmp 0x5d9c7
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x48(%rbp), %rcx
movq 0x10(%rbp), %r8
xorl %eax, %eax
movl %eax, %edx
callq 0x6dfa0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d990
jmp 0x5d9c7
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x78(%rbp), %rcx
movq 0x10(%rbp), %r8
movl $0x10, %edx
callq 0x47f20
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d9bd
movq $-0x1, -0x8(%rbp)
jmp 0x5d9f3
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x5d9f3
movq -0x78(%rbp), %rdi
callq 0x36ee0
movq -0x58(%rbp), %rdi
callq 0x36ee0
movq -0x70(%rbp), %rdi
callq 0x36ee0
movq -0x60(%rbp), %rdi
callq 0x36ee0
movq $-0x1, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq