// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/string_type.c
// Function: prv_string_from_const_char
static subtilis_exp_t *prv_string_from_const_char(subtilis_parser_t *p,
						  subtilis_exp_t *count,
						  subtilis_exp_t *str,
						  subtilis_error_t *err)
{
	const subtilis_symbol_t *s;
	size_t dest_reg;
	size_t val_reg;
	size_t str_reg;
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t end;
	subtilis_exp_t *dup = NULL;
	char *tmp_name = NULL;

	end.label = subtilis_ir_section_new_label(p->current);

	op1.integer = (int32_t)subtilis_buffer_get_string(&str->exp.str)[0];
	val_reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_MOVI_I32, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	count = subtilis_type_if_exp_to_var(p, count, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	dup = subtilis_type_if_dup(count, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	prv_string_str_check_count(p, s, dup, end, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	dest_reg = subtilis_reference_type_alloc(
	    p, &subtilis_type_string, s->loc, SUBTILIS_IR_REG_LOCAL,
	    count->exp.ir_op.reg, true, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_builtin_memset_i8(p, dest_reg, count->exp.ir_op.reg, val_reg,
				   err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

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

	subtilis_exp_delete(count);
	subtilis_exp_delete(str);

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

cleanup:

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

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rdi
addq $0x148, %rdi            # imm = 0x148
callq 0x16760
movsbl (%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x28(%rbp), %rcx
movq -0x50(%rbp), %rdx
movl $0x1b, %esi
callq 0x38490
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a7cb
jmp 0x6a94e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x47c10
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a7ee
jmp 0x6a94e
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x28(%rbp), %rcx
leaq 0x4135f(%rip), %rsi     # 0xabb60
leaq -0x68(%rbp), %rdx
callq 0x3c920
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a81c
jmp 0x6a94e
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x47d20
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a83b
jmp 0x6a94e
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq -0x28(%rbp), %r8
movq -0x58(%rbp), %rcx
callq 0x6c4f0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a862
jmp 0x6a94e
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x148(%rax), %r8
movq -0x28(%rbp), %rax
leaq 0x412dd(%rip), %rsi     # 0xabb60
movl $0x2, %ecx
movl $0x1, %r9d
movq %rax, (%rsp)
callq 0x6e3e0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a8a9
jmp 0x6a94e
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x148(%rax), %rdx
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x3fc60
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a8d4
jmp 0x6a94e
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x58(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x39960
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a8f4
jmp 0x6a94e
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rdx
movq -0x28(%rbp), %rcx
movl $0x2, %esi
callq 0x6d920
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6a91c
jmp 0x6a94e
movq -0x18(%rbp), %rdi
callq 0x36ee0
movq -0x20(%rbp), %rdi
callq 0x36ee0
movq -0x48(%rbp), %rax
movl %eax, %esi
movq -0x68(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq 0x4121d(%rip), %rdi     # 0xabb60
callq 0x375f0
movq %rax, -0x8(%rbp)
jmp 0x6a971
movq -0x18(%rbp), %rdi
callq 0x36ee0
movq -0x68(%rbp), %rdi
callq 0x12290
movq -0x20(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)