// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/string_type.c
// Function: subtilis_string_new_str_from_zt
subtilis_exp_t *subtilis_string_new_str_from_zt(subtilis_parser_t *p,
						size_t reg,
						subtilis_error_t *err)
{
	subtilis_ir_operand_t zero;
	subtilis_ir_operand_t one;
	subtilis_ir_operand_t reg_copy;
	subtilis_ir_operand_t reg_orig;
	subtilis_ir_operand_t byte;
	subtilis_ir_operand_t size;
	subtilis_ir_operand_t start;
	subtilis_ir_operand_t next;
	subtilis_ir_operand_t end;
	subtilis_ir_operand_t empty;
	subtilis_ir_operand_t full;
	subtilis_ir_operand_t real_end;
	const subtilis_symbol_t *s;
	subtilis_exp_t *e;
	char *tmp_name = NULL;

	/*
	 * Compute length of string.
	 */

	start.label = subtilis_ir_section_new_label(p->current);
	next.label = subtilis_ir_section_new_label(p->current);
	end.label = subtilis_ir_section_new_label(p->current);
	empty.label = subtilis_ir_section_new_label(p->current);
	real_end.label = subtilis_ir_section_new_label(p->current);
	full.label = subtilis_ir_section_new_label(p->current);

	zero.integer = 0;

	reg_orig.reg = reg;
	reg_copy.reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_MOV, reg_orig, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

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

	byte.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LOADO_I8, reg_copy, zero, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  byte, next, end, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

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

	one.integer = 1;
	subtilis_ir_section_add_instr_reg(p->current,
					  SUBTILIS_OP_INSTR_ADDI_I32, reg_copy,
					  reg_copy, one, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	subtilis_ir_section_add_instr_no_reg(p->current, SUBTILIS_OP_INSTR_JMP,
					     start, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

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

	size.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_SUB_I32, reg_copy, reg_orig, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	s = subtilis_symbol_table_insert_tmp(p->local_st, &subtilis_type_string,
					     &tmp_name, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  size, full, empty, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	subtilis_string_init_from_lca(p, SUBTILIS_IR_REG_LOCAL, s->loc, reg,
				      size.reg, false, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_instr_no_reg(p->current, SUBTILIS_OP_INSTR_JMP,
					     real_end, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	subtilis_string_type_zero_ref(p, &subtilis_type_string,
				      SUBTILIS_IR_REG_LOCAL, s->loc, false,
				      err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	subtilis_reference_type_push_reference(
	    p, &subtilis_type_string, SUBTILIS_IR_REG_LOCAL, s->loc, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	e = subtilis_exp_new_var(&subtilis_type_string, reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	e->temporary = tmp_name;

	return e;

cleanup:

	free(tmp_name);

	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %r14
movq $0x0, 0x20(%rsp)
movq 0x48(%rdi), %rdi
callq 0x2cc99
movq %rax, 0x50(%rsp)
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, 0x40(%rsp)
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, 0x48(%rsp)
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, %r15
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, %rbx
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, %r13
movq 0x48(%r14), %rdi
movl $0x1d, %esi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x2be09
movq %r12, 0x10(%rsp)
cmpl $0x0, (%r12)
jne 0x487dc
movq %rbx, %r12
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rbx
movq %r13, 0x38(%rsp)
movq %r15, 0x30(%rsp)
movq 0x48(%r14), %rdi
movq 0x50(%rsp), %r15
movq %r15, %rsi
movq 0x10(%rsp), %r13
movq %r13, %rdx
callq 0x2cca6
cmpl $0x0, (%r13)
je 0x487f1
xorl %r12d, %r12d
movq %r12, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, 0x28(%rsp)
movq 0x48(%r14), %rdi
xorl %r12d, %r12d
movl $0x11, %esi
movq 0x18(%rsp), %rdx
xorl %ecx, %ecx
movq %r13, %r8
callq 0x2bc8f
cmpl $0x0, (%r13)
jne 0x487df
movq 0x48(%r14), %rdi
movl $0x43, %esi
movq %rax, %rdx
movq 0x40(%rsp), %r12
movq %r12, %rcx
movq %rbx, %r8
movq %r13, %r9
callq 0x2bd42
cmpl $0x0, (%r13)
jne 0x487dc
movq 0x48(%r14), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2cca6
cmpl $0x0, (%r13)
jne 0x487dc
movq 0x48(%r14), %rdi
movl $0x1, %r8d
movl $0x9, %esi
movq 0x18(%rsp), %rcx
movq %rcx, %rdx
movq %r13, %r9
callq 0x2bd42
cmpl $0x0, (%r13)
jne 0x487dc
movq 0x48(%r14), %rdi
movl $0x45, %esi
movq %r15, %rdx
movq %r13, %rcx
callq 0x2be1f
cmpl $0x0, (%r13)
jne 0x487dc
movq 0x48(%r14), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x2cca6
cmpl $0x0, (%r13)
jne 0x487dc
movq 0x48(%r14), %rdi
movl $0x2, %esi
movq 0x18(%rsp), %rdx
movq %rbp, %rcx
movq %r13, %r8
callq 0x2bc8f
cmpl $0x0, (%r13)
jne 0x487dc
movq %rax, %r12
movq 0x68(%r14), %rdi
leaq 0x2c2bf(%rip), %rsi     # 0x74ba8
leaq 0x20(%rsp), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x2e6f1
cmpl $0x0, (%rbx)
jne 0x48a5e
movq %rax, %r15
movq 0x48(%r14), %rdi
movl $0x43, %esi
movq %r12, %rdx
movq 0x38(%rsp), %rcx
movq 0x30(%rsp), %r8
movq 0x10(%rsp), %rbx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x48a5e
movq 0x48(%r14), %rdi
movq 0x38(%rsp), %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x48a5e
movq (%r15), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, (%rsp)
movl $0x2, %esi
movq %r14, %rdi
movq %rbp, %rcx
movq %r12, %r8
xorl %r9d, %r9d
callq 0x4849e
cmpl $0x0, (%rbx)
jne 0x48a5e
movq 0x48(%r14), %rdi
movl $0x45, %esi
movq 0x28(%rsp), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x2be1f
cmpl $0x0, (%rbx)
jne 0x48a5e
movq 0x48(%r14), %rdi
movq 0x30(%rsp), %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x48a5e
movq (%r15), %rcx
leaq 0x2c1de(%rip), %rsi     # 0x74ba8
movl $0x2, %edx
movq %r14, %rdi
xorl %r8d, %r8d
movq 0x10(%rsp), %rbx
movq %rbx, %r9
callq 0x482aa
cmpl $0x0, (%rbx)
jne 0x48a5e
movq 0x48(%r14), %rdi
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x48a5e
movq (%r15), %rcx
leaq 0x2c19c(%rip), %rsi     # 0x74ba8
movl $0x2, %edx
movq %r14, %rdi
movq 0x10(%rsp), %rbx
movq %rbx, %r8
callq 0x4d4a6
cmpl $0x0, (%rbx)
jne 0x48a5e
movq (%r15), %rdx
movl $0x2, %esi
movq %r14, %rdi
movq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x4d71f
cmpl $0x0, (%rbx)
jne 0x48a5e
leaq 0x2c15e(%rip), %rdi     # 0x74ba8
movl %eax, %esi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x2b5fb
cmpl $0x0, (%rbx)
je 0x48a6d
movq 0x20(%rsp), %rdi
callq 0x122c0
jmp 0x487dc
movq %rax, %r12
movq 0x20(%rsp), %rax
movq %rax, 0x158(%r12)
jmp 0x487df