// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/frontend/string_type.c
// Function: subtilis_string_init_from_ptr
void subtilis_string_init_from_ptr(subtilis_parser_t *p, size_t mem_reg,
				   size_t loc, size_t source_reg,
				   size_t size_reg, size_t data_reg,
				   subtilis_error_t *err)
{
	subtilis_ir_operand_t heap_reg;
	subtilis_ir_operand_t op0;
	subtilis_ir_operand_t empty;
	subtilis_ir_operand_t not_empty;

	empty.label = subtilis_ir_section_new_label(p->current);
	not_empty.label = subtilis_ir_section_new_label(p->current);

	subtilis_reference_type_set_size(p, mem_reg, loc, size_reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	op0.reg = size_reg;
	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  op0, not_empty, empty, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_ir_section_add_label(p->current, not_empty.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_reference_set_data(p, data_reg, mem_reg, loc, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	heap_reg.reg = subtilis_reference_get_heap(p, source_reg, 0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_ir_section_add_instr_no_reg(p->current, SUBTILIS_OP_INSTR_REF,
					     heap_reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_reference_set_heap(p, heap_reg.reg, mem_reg, loc, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_reference_type_push_reference(p, &subtilis_type_string,
					       mem_reg, loc, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_ir_section_add_label(p->current, empty.label, err);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x10(%rsp)
movq %r8, %rbp
movq %rcx, 0x8(%rsp)
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
movq 0x50(%rsp), %rbx
movq 0x48(%rdi), %rdi
callq 0x2b774
movq %rax, (%rsp)
movq 0x48(%r14), %rdi
callq 0x2b774
movq %rax, %r15
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq %rbx, %r8
callq 0x4acc2
cmpl $0x0, (%rbx)
jne 0x45b45
movq 0x48(%r14), %rdi
pushq $0x43
popq %rsi
movq %rbp, %rdx
movq %r15, %rcx
movq (%rsp), %r8
movq %rbx, %r9
callq 0x2a8c1
cmpl $0x0, (%rbx)
jne 0x45b45
movq 0x48(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2b781
cmpl $0x0, (%rbx)
jne 0x45b45
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x4ab59
cmpl $0x0, (%rbx)
jne 0x45b45
movq %r14, %rdi
movq 0x8(%rsp), %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x4a6a8
cmpl $0x0, (%rbx)
jne 0x45b45
movq %rax, %r15
movq 0x48(%r14), %rdi
pushq $0x78
popq %rsi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x2a997
cmpl $0x0, (%rbx)
jne 0x45b45
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x4ab75
cmpl $0x0, (%rbx)
jne 0x45b45
leaq 0x29029(%rip), %rsi     # 0x6eb58
movq %r14, %rdi
movq %r13, %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x4a8be
cmpl $0x0, (%rbx)
je 0x45b54
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x48(%r14), %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b781