// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/string_type.c
// Function: prv_left_right_copy
static void prv_left_right_copy(subtilis_parser_t *p, size_t data_reg,
				size_t str_len_reg, size_t value_len_reg,
				subtilis_ir_operand_t to_copy,
				subtilis_exp_t *value, bool left,
				subtilis_error_t *err)
{
	subtilis_ir_operand_t data;
	subtilis_ir_operand_t str_len;
	subtilis_ir_operand_t value_len;
	subtilis_ir_operand_t source_str;

	if (value->type.type == SUBTILIS_TYPE_CONST_STRING)
		source_str.reg = subtilis_string_type_lca_const(
		    p, subtilis_buffer_get_string(&value->exp.str),
		    subtilis_buffer_get_size(&value->exp.str) - 1, err);
	else
		source_str.reg = subtilis_reference_get_data(
		    p, value->exp.ir_op.reg, 0, err);

	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (!left) {
		data.reg = data_reg;
		str_len.reg = str_len_reg;
		data.reg = subtilis_ir_section_add_instr(
		    p->current, SUBTILIS_OP_INSTR_ADD_I32, data, str_len, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		data_reg = subtilis_ir_section_add_instr(
		    p->current, SUBTILIS_OP_INSTR_SUB_I32, data, to_copy, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		value_len.reg = value_len_reg;
		source_str.reg = subtilis_ir_section_add_instr(
		    p->current, SUBTILIS_OP_INSTR_ADD_I32, source_str,
		    value_len, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		source_str.reg = subtilis_ir_section_add_instr(
		    p->current, SUBTILIS_OP_INSTR_SUB_I32, source_str, to_copy,
		    err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}

	subtilis_reference_type_memcpy_dest(p, data_reg, source_str.reg,
					    to_copy.reg, err);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq 0x18(%rbp), %rax
movb 0x10(%rbp), %al
movq %r8, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r9, -0x30(%rbp)
andb $0x1, %al
movb %al, -0x31(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x6a1df
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x30(%rbp), %rdi
addq $0x148, %rdi            # imm = 0x148
callq 0x16760
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rdi
addq $0x148, %rdi            # imm = 0x148
callq 0x16270
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq %rax, %rdx
subq $0x1, %rdx
movq 0x18(%rbp), %rcx
callq 0x65d80
movq %rax, -0x58(%rbp)
jmp 0x6a1ff
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x148(%rax), %rsi
movq 0x18(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0x6d1e0
movq %rax, -0x58(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a20d
jmp 0x6a2fb
testb $0x1, -0x31(%rbp)
jne 0x6a2e2
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x18(%rbp), %r8
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
xorl %esi, %esi
callq 0x38230
movq %rax, -0x40(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a254
jmp 0x6a2fb
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x18(%rbp), %r8
movq -0x40(%rbp), %rdx
movq -0x8(%rbp), %rcx
movl $0x2, %esi
callq 0x38230
movq %rax, -0x18(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a281
jmp 0x6a2fb
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x18(%rbp), %r8
movq -0x58(%rbp), %rdx
movq -0x50(%rbp), %rcx
xorl %esi, %esi
callq 0x38230
movq %rax, -0x58(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a2b3
jmp 0x6a2fb
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x18(%rbp), %r8
movq -0x58(%rbp), %rdx
movq -0x8(%rbp), %rcx
movl $0x2, %esi
callq 0x38230
movq %rax, -0x58(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a2e0
jmp 0x6a2fb
jmp 0x6a2e2
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq -0x8(%rbp), %rcx
movq 0x18(%rbp), %r8
callq 0x6dad0
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)