// File: /workspace/github_c_makefile_star2_O3/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 0x2cc99
movq %rax, (%rsp)
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, %r15
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq %rbx, %r8
callq 0x4d8dd
cmpl $0x0, (%rbx)
jne 0x48471
movq 0x48(%r14), %rdi
movl $0x43, %esi
movq %rbp, %rdx
movq %r15, %rcx
movq (%rsp), %r8
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x48471
movq 0x48(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x48471
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x4d752
cmpl $0x0, (%rbx)
jne 0x48471
movq %r14, %rdi
movq 0x8(%rsp), %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x4d272
cmpl $0x0, (%rbx)
jne 0x48471
movq %rax, %r15
movq 0x48(%r14), %rdi
movl $0x78, %esi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x2be1f
cmpl $0x0, (%rbx)
jne 0x48471
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x4d770
cmpl $0x0, (%rbx)
jne 0x48471
leaq 0x2c74d(%rip), %rsi     # 0x74ba8
movq %r14, %rdi
movq %r13, %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x4d4a6
cmpl $0x0, (%rbx)
je 0x48480
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 0x2cca6