// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/string_type.c
// Function: prv_string_str_check_count
static void prv_string_str_check_count(subtilis_parser_t *p,
				       const subtilis_symbol_t *s,
				       subtilis_exp_t *dup,
				       subtilis_ir_operand_t end,
				       subtilis_error_t *err)
{
	subtilis_ir_operand_t lt_one;
	subtilis_ir_operand_t gte_one;
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t zero_reg;
	subtilis_exp_t *one = NULL;

	lt_one.label = subtilis_ir_section_new_label(p->current);
	gte_one.label = subtilis_ir_section_new_label(p->current);

	one = subtilis_exp_new_int32(1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	dup = subtilis_type_if_lt(p, dup, one, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	one = NULL;

	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  dup->exp.ir_op, lt_one, gte_one, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	subtilis_exp_delete(dup);
	dup = NULL;

	subtilis_ir_section_add_label(p->current, lt_one.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, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_label(p->current, gte_one.label, err);

cleanup:

	subtilis_exp_delete(one);
	subtilis_exp_delete(dup);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, 0x10(%rsp)
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %r15
movq 0x48(%rdi), %rdi
callq 0x2cc99
movq %rax, %r14
movq %r15, 0x8(%rsp)
movq 0x48(%r15), %rdi
callq 0x2cc99
movq %rax, %r15
movl $0x1, %edi
movq %rbx, %rsi
callq 0x2b7af
movq %rax, %rbp
cmpl $0x0, (%rbx)
je 0x4c8e6
movq %r13, %r15
jmp 0x4c95c
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x3711a
cmpl $0x0, (%rbx)
je 0x4c903
movq %rax, %r15
jmp 0x4c95c
movq 0x8(%rsp), %rcx
movq 0x48(%rcx), %rdi
movq %rax, %rbp
movq 0x148(%rax), %rdx
movl $0x43, %esi
movq %r14, %rcx
movq %r15, %r13
movq %r15, %r8
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
je 0x4c936
movq %rbp, %r15
jmp 0x4c95a
movq %rbp, %rdi
callq 0x2b166
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
je 0x4c97a
xorl %r15d, %r15d
xorl %ebp, %ebp
movq %rbp, %rdi
callq 0x2b166
movq %r15, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b166
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rdi
xorl %r15d, %r15d
movl $0x1b, %esi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x2be09
cmpl $0x0, (%rbx)
movl $0x0, %ebp
jne 0x4c95c
movq (%r12), %rdx
movl $0x2, %esi
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movq %rbx, %r8
callq 0x4d8dd
cmpl $0x0, (%rbx)
jne 0x4c957
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rdi
movl $0x45, %esi
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
callq 0x2be1f
cmpl $0x0, (%rbx)
jne 0x4c957
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x2cca6
jmp 0x4c957