// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/string_type.c
// Function: prv_string_str_non_const
static subtilis_exp_t *prv_string_str_non_const(subtilis_parser_t *p,
						subtilis_exp_t *count,
						subtilis_exp_t *str,
						subtilis_error_t *err)
{
	subtilis_ir_operand_t zero_label;
	subtilis_ir_operand_t gt_zero_label;
	subtilis_ir_operand_t end_label;
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t op2;
	subtilis_ir_operand_t zero_reg;
	size_t size_reg;
	const subtilis_symbol_t *s;
	size_t str_data;
	subtilis_exp_t *str_len;
	char *tmp_name = NULL;

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

	zero_label.label = subtilis_ir_section_new_label(p->current);
	gt_zero_label.label = subtilis_ir_section_new_label(p->current);
	end_label.label = subtilis_ir_section_new_label(p->current);

	op1.reg = str->exp.ir_op.reg;
	op2.integer = 0;
	size_reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LOADO_I32, op1, op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	op1.reg = size_reg;
	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  op1, gt_zero_label, zero_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	op1.integer = 0;
	zero_reg.reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_MOVI_I32, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

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

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

	str_data = subtilis_reference_get_data(p, str->exp.ir_op.reg, 0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_exp_delete(str);
	str = NULL;

	str_len = subtilis_exp_new_int32_var(size_reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	prv_string_str_non_const_common(p, s, count, str_data, str_len, true,
					err);
	count = NULL;
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

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

	return subtilis_exp_new_tmp_var(&subtilis_type_string, str_data,
					tmp_name, err);

cleanup:

	free(tmp_name);
	subtilis_exp_delete(count);
	subtilis_exp_delete(str);

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x28(%rbp), %rcx
leaq 0x410aa(%rip), %rsi     # 0xabb60
leaq -0x80(%rbp), %rdx
callq 0x3c920
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6aad1
jmp 0x6ad50
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x148(%rax), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x28(%rbp), %r8
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
movl $0x12, %esi
callq 0x38230
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6ab4a
jmp 0x6ad50
movq -0x60(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x28(%rbp), %r9
movq -0x48(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6ab82
jmp 0x6ad50
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x39960
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6aba5
jmp 0x6ad50
movl $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x28(%rbp), %rcx
movq -0x48(%rbp), %rdx
movl $0x1b, %esi
callq 0x38490
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6abd8
jmp 0x6ad50
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rax
movq (%rax), %rdx
movq -0x58(%rbp), %rcx
movq -0x28(%rbp), %r8
movl $0x2, %esi
callq 0x6dc50
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6ac03
jmp 0x6ad50
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rdx
movl $0x45, %esi
callq 0x38540
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6ac2b
jmp 0x6ad50
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x39960
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6ac4e
jmp 0x6ad50
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x148(%rax), %rsi
movq -0x28(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0x6d1e0
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6ac7c
jmp 0x6ad50
movq -0x20(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x20(%rbp)
movq -0x60(%rbp), %rax
movl %eax, %edi
movq -0x28(%rbp), %rsi
callq 0x37770
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6acae
jmp 0x6ad50
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq -0x78(%rbp), %r8
movq -0x28(%rbp), %rax
movl $0x1, %r9d
movq %rax, (%rsp)
callq 0x6c6a0
movq $0x0, -0x18(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6ace8
jmp 0x6ad50
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x40(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x39960
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6ad08
jmp 0x6ad50
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rax
movq (%rax), %rdx
movq -0x28(%rbp), %rcx
movl $0x2, %esi
callq 0x6d920
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6ad30
jmp 0x6ad50
movq -0x70(%rbp), %rax
movl %eax, %esi
movq -0x80(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq 0x40e1b(%rip), %rdi     # 0xabb60
callq 0x375f0
movq %rax, -0x8(%rbp)
jmp 0x6ad73
movq -0x80(%rbp), %rdi
callq 0x12290
movq -0x18(%rbp), %rdi
callq 0x36ee0
movq -0x20(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq