// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x98(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x78(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rdx
movl $0x1d, %esi
callq 0x38490
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x665eb
movq $0x0, -0x8(%rbp)
jmp 0x6699c
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x58(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x39960
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x66616
movq $0x0, -0x8(%rbp)
jmp 0x6699c
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %r8
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl $0x11, %esi
callq 0x38230
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6664e
movq $0x0, -0x8(%rbp)
jmp 0x6699c
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %r9
movq -0x48(%rbp), %rdx
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x66686
movq $0x0, -0x8(%rbp)
jmp 0x6699c
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x60(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x39960
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x666b1
movq $0x0, -0x8(%rbp)
jmp 0x6699c
movl $0x1, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %r9
movq -0x38(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %r8
movl $0x9, %esi
callq 0x38360
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x666f0
movq $0x0, -0x8(%rbp)
jmp 0x6699c
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %rcx
movq -0x58(%rbp), %rdx
movl $0x45, %esi
callq 0x38540
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x66720
movq $0x0, -0x8(%rbp)
jmp 0x6699c
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x68(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x39960
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6674b
movq $0x0, -0x8(%rbp)
jmp 0x6699c
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %r8
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
movl $0x2, %esi
callq 0x38230
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x66783
movq $0x0, -0x8(%rbp)
jmp 0x6699c
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x20(%rbp), %rcx
leaq 0x453ca(%rip), %rsi     # 0xabb60
leaq -0x98(%rbp), %rdx
callq 0x3c920
movq %rax, -0x88(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x667b7
jmp 0x66988
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %r9
movq -0x50(%rbp), %rdx
movq -0x78(%rbp), %rcx
movq -0x70(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x667e7
jmp 0x66988
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x78(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x39960
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6680a
jmp 0x66988
movq -0x10(%rbp), %rdi
movq -0x88(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rcx
movq -0x50(%rbp), %r8
movq -0x20(%rbp), %rax
movl $0x2, %esi
xorl %r9d, %r9d
movq %rax, (%rsp)
callq 0x66160
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x66843
jmp 0x66988
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %rcx
movq -0x80(%rbp), %rdx
movl $0x45, %esi
callq 0x38540
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6686b
jmp 0x66988
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x70(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x39960
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6688e
jmp 0x66988
movq -0x10(%rbp), %rdi
movq -0x88(%rbp), %rax
movq (%rax), %rcx
movq -0x20(%rbp), %r9
leaq 0x452b9(%rip), %rsi     # 0xabb60
movl $0x2, %edx
xorl %r8d, %r8d
callq 0x65ee0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x668c2
jmp 0x66988
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x80(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x39960
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x668e5
jmp 0x66988
movq -0x10(%rbp), %rdi
movq -0x88(%rbp), %rax
movq (%rax), %rcx
movq -0x20(%rbp), %r8
leaq 0x45262(%rip), %rsi     # 0xabb60
movl $0x2, %edx
callq 0x6d540
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x66913
jmp 0x66988
movq -0x10(%rbp), %rdi
movq -0x88(%rbp), %rax
movq (%rax), %rdx
movq -0x20(%rbp), %rcx
movl $0x2, %esi
callq 0x6d920
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6693e
jmp 0x66988
movq -0x18(%rbp), %rax
movl %eax, %esi
movq -0x20(%rbp), %rdx
leaq 0x45211(%rip), %rdi     # 0xabb60
callq 0x37590
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x66966
jmp 0x66988
movq -0x98(%rbp), %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x158(%rax)
movq -0x90(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6699c
movq -0x98(%rbp), %rdi
callq 0x12290
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)