// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rsi, %r12
movq %rdi, %r15
movq 0x48(%rdi), %rdi
callq 0x2b774
movq %rax, %rbp
movq %r15, 0x8(%rsp)
movq 0x48(%r15), %rdi
callq 0x2b774
movq %rax, %r15
pushq $0x1
popq %rdi
movq %rbx, %rsi
callq 0x2a369
movq %rax, %r13
cmpl $0x0, (%rbx)
jne 0x49de8
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x351f7
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x49de8
movq 0x8(%rsp), %rcx
movq 0x48(%rcx), %rdi
movq 0x148(%r14), %rdx
pushq $0x43
popq %rsi
movq %rbp, %r13
movq %rbp, %rcx
movq %r15, %rbp
movq %r15, %r8
movq %rbx, %r9
callq 0x2a8c1
cmpl $0x0, (%rbx)
jne 0x49de5
movq %r14, %rdi
callq 0x29d88
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x2b781
cmpl $0x0, (%rbx)
je 0x49e06
xorl %r14d, %r14d
xorl %r13d, %r13d
movq %r13, %rdi
callq 0x29d88
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x29d88
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rdi
xorl %r14d, %r14d
pushq $0x1b
popq %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x2a981
cmpl $0x0, (%rbx)
movl $0x0, %r13d
jne 0x49de8
movq (%r12), %rdx
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movq %rbx, %r8
callq 0x4acc2
cmpl $0x0, (%rbx)
jne 0x49de2
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rdi
pushq $0x45
popq %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
callq 0x2a997
cmpl $0x0, (%rbx)
jne 0x49de2
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x2b781
jmp 0x49de2