// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/string_type.c
// Function: prv_mid_str_cv
static subtilis_exp_t *prv_mid_str_cv(subtilis_parser_t *p, subtilis_exp_t *str,
				      size_t start_reg, size_t len_reg,
				      subtilis_error_t *err)
{
	size_t const_str_len;
	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 id;
	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++;
	const_str_len = subtilis_buffer_get_size(&str->exp.str) - 1;
	end.label = subtilis_ir_section_new_label(p->current);

	str_len = subtilis_exp_new_int32(const_str_len, 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;

	id = prv_add_string_constant(
	    p, subtilis_buffer_get_string(&str->exp.str), const_str_len, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	op1.integer = (int32_t)id;
	src_reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_LCA, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	op0.reg = src_reg;
	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_lca(p, SUBTILIS_IR_REG_LOCAL, s->loc, src_reg,
				      to_copy.reg, true, 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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x80(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rcx
movq 0x18(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x18(%rcx)
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
addq $0x148, %rdi            # imm = 0x148
callq 0x16270
subq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movl %eax, %edi
movq -0x30(%rbp), %rsi
callq 0x37800
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6922f
movq $0x0, -0x8(%rbp)
jmp 0x693ec
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x80(%rbp), %r9
movq -0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
movq -0x50(%rbp), %r8
leaq -0x58(%rbp), %r11
leaq -0x88(%rbp), %r10
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x6bdd0
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x69283
movq $0x0, -0x8(%rbp)
jmp 0x693ec
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rdi
addq $0x148, %rdi            # imm = 0x148
callq 0x16760
movq -0x90(%rbp), %rdi
movq %rax, %rsi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x65e00
movq %rax, -0x68(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x692c7
jmp 0x693d8
movq -0x68(%rbp), %rax
movl %eax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x30(%rbp), %rcx
movq -0x48(%rbp), %rdx
movl $0x7d, %esi
callq 0x38490
movq %rax, -0x70(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x692fa
jmp 0x693d8
movq -0x70(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x30(%rbp), %r8
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
xorl %esi, %esi
callq 0x38230
movq %rax, -0x70(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x69337
jmp 0x693d8
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rax
movq (%rax), %rdx
movq -0x70(%rbp), %rcx
movq -0x78(%rbp), %r8
movq -0x30(%rbp), %rax
movl $0x2, %esi
movl $0x1, %r9d
movq %rax, (%rsp)
callq 0x66160
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6936d
jmp 0x693d8
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x50(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x39960
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6938d
jmp 0x693d8
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rcx
movl $0x2, %esi
callq 0x6d920
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x693b5
jmp 0x693d8
movq -0x60(%rbp), %rax
movl %eax, %esi
movq -0x88(%rbp), %rdx
movq -0x30(%rbp), %rcx
leaq 0x42793(%rip), %rdi     # 0xabb60
callq 0x375f0
movq %rax, -0x8(%rbp)
jmp 0x693ec
movq -0x88(%rbp), %rdi
callq 0x12290
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)