// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/frontend/string_type.c
// Function: prv_mid_str_vvv
static subtilis_exp_t *prv_mid_str_vvv(subtilis_parser_t *p,
				       subtilis_exp_t *str, size_t start_reg,
				       size_t len_reg, subtilis_error_t *err)
{
	subtilis_ir_operand_t op0;
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t end;
	const subtilis_symbol_t *s;
	size_t ptr;
	size_t src_reg;
	subtilis_ir_operand_t to_copy;
	subtilis_exp_t *str_len = NULL;
	char *tmp_name = NULL;

	to_copy.reg = p->current->reg_counter++;
	end.label = subtilis_ir_section_new_label(p->current);

	op1.integer = SUBTIILIS_STRING_SIZE_OFF;
	op1.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LOADO_I32, str->exp.ir_op, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	str_len = subtilis_exp_new_int32_var(op1.reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	start_reg = prv_mid_str_check(p, start_reg, len_reg, to_copy, end,
				      str_len, &s, &tmp_name, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	ptr = subtilis_reference_get_data(p, str->exp.ir_op.reg, 0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	op0.reg = ptr;
	op1.reg = start_reg;
	src_reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_ADD_I32, op0, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_string_init_from_ptr(p, SUBTILIS_IR_REG_LOCAL, s->loc,
				      str->exp.ir_op.reg, to_copy.reg, src_reg,
				      err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	ptr = subtilis_reference_get_pointer(p, SUBTILIS_IR_REG_LOCAL, s->loc,
					     err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	return subtilis_exp_new_tmp_var(&subtilis_type_string, ptr, tmp_name,
					err);

cleanup:

	free(tmp_name);

	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %rbp
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r14
movq $0x0, (%rsp)
movq 0x48(%rdi), %rdi
movq 0x18(%rdi), %r12
leaq 0x1(%r12), %rax
movq %rax, 0x18(%rdi)
callq 0x2d00a
movq %rax, 0x8(%rsp)
movq 0x48(%r14), %rdi
movq 0x148(%r13), %rdx
movl $0x12, %esi
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x2c00f
cmpl $0x0, (%rbx)
jne 0x4ab13
movl %eax, %edi
movq %rbx, %rsi
callq 0x2ba99
cmpl $0x0, (%rbx)
jne 0x4ab13
subq $0x8, %rsp
leaq 0x8(%rsp), %r10
leaq 0x18(%rsp), %r11
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r12, %rcx
movq 0x10(%rsp), %r8
movq %rax, %r9
pushq %rbx
pushq %r10
pushq %r11
callq 0x4c324
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x4ab13
movq %rax, %r15
movq 0x148(%r13), %rsi
movq %r14, %rdi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x4d29c
cmpl $0x0, (%rbx)
jne 0x4ab0a
movq 0x48(%r14), %rdi
xorl %esi, %esi
movq %rax, %rdx
movq %r15, %rcx
movq %rbx, %r8
callq 0x2c00f
cmpl $0x0, (%rbx)
jne 0x4ab0a
movq 0x10(%rsp), %r15
movq (%r15), %rdx
movq 0x148(%r13), %rcx
subq $0x8, %rsp
movl $0x2, %esi
movq %r14, %rdi
movq %r12, %r8
movq %rax, %r9
pushq %rbx
callq 0x483d2
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x4ab0a
movq 0x48(%r14), %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0x2d017
cmpl $0x0, (%rbx)
jne 0x4ab0a
movq (%r15), %rdx
movl $0x2, %esi
movq %r14, %rdi
movq %rbx, %rcx
callq 0x4d763
cmpl $0x0, (%rbx)
je 0x4ab24
movq (%rsp), %rdi
callq 0x122c0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rdx
leaq 0x2a059(%rip), %rdi     # 0x74b88
movl %eax, %esi
movq %rbx, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b99d