// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/builtins_ir.c
// Function: prv_find_first_stop_prolog
static size_t prv_find_first_stop_prolog(subtilis_parser_t *p,
					 subtilis_ir_operand_t str_data,
					 subtilis_ir_operand_t str_len,
					 subtilis_ir_operand_t max_digit,
					 bool immediate_digit,
					 subtilis_ir_operand_t end_str,
					 subtilis_ir_operand_t *byte,
					 subtilis_ir_operand_t skip_sign_label,
					 subtilis_ir_operand_t first_end_label,
					 subtilis_ir_operand_t end_label,
					 subtilis_ir_operand_t *minus,
					 subtilis_ir_operand_t *loop_cond,
					 subtilis_error_t *err)
/* clang-format on */

{
	subtilis_ir_operand_t ptr;
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t le_9;
	subtilis_ir_operand_t have_sign_label;
	subtilis_ir_operand_t check_for_minus_label;
	subtilis_ir_operand_t negative_label;
	subtilis_ir_operand_t whole_number_start_label;
	subtilis_ir_operand_t keep_looking_label;
	subtilis_ir_operand_t condee;

	check_for_minus_label.label = subtilis_ir_section_new_label(p->current);
	negative_label.label = subtilis_ir_section_new_label(p->current);
	have_sign_label.label = subtilis_ir_section_new_label(p->current);
	whole_number_start_label.label =
	    subtilis_ir_section_new_label(p->current);
	keep_looking_label.label = subtilis_ir_section_new_label(p->current);

	ptr.reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_MOV, str_data, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	op1.integer = 1;
	minus->reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_MOVI_I32, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	op1.integer = 0;
	byte->reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LOADO_I8, ptr, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	op1.integer = '+';
	condee.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_NEQI_I32, *byte, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  condee, check_for_minus_label,
					  have_sign_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	subtilis_ir_section_add_label(p->current, check_for_minus_label.label,
				      err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	op1.integer = '-';
	condee.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_EQI_I32, *byte, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  condee, negative_label,
					  whole_number_start_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	subtilis_ir_section_add_label(p->current, negative_label.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	op1.integer = 0;
	subtilis_ir_section_add_instr_reg(
	    p->current, SUBTILIS_OP_INSTR_RSUBI_I32, *minus, *minus, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	subtilis_ir_section_add_label(p->current, have_sign_label.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	op1.integer = 1;
	subtilis_ir_section_add_instr_reg(p->current,
					  SUBTILIS_OP_INSTR_ADDI_I32, str_data,
					  str_data, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	subtilis_ir_section_add_label(p->current, skip_sign_label.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	op1.integer = 1;
	subtilis_ir_section_add_instr_reg(
	    p->current, SUBTILIS_OP_INSTR_ADDI_I32, ptr, ptr, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	condee.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LT_I32, ptr, end_str, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  condee, keep_looking_label,
					  first_end_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	subtilis_ir_section_add_label(p->current, keep_looking_label.label,
				      err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	op1.integer = 0;
	subtilis_ir_section_add_instr_reg(
	    p->current, SUBTILIS_OP_INSTR_LOADO_I8, *byte, ptr, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	subtilis_ir_section_add_label(p->current,
				      whole_number_start_label.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	op1.integer = '0';
	condee.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LTI_I32, *byte, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	le_9.reg = subtilis_ir_section_add_instr(
	    p->current, immediate_digit ? SUBTILIS_OP_INSTR_GTI_I32
					: SUBTILIS_OP_INSTR_GT_I32,
	    *byte, max_digit, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	loop_cond->reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_OR_I32, condee, le_9, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	return ptr.reg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x50(%rsp)
movq %r8, 0x38(%rsp)
movl %ecx, 0x14(%rsp)
movq %rdx, 0x30(%rsp)
movq %rsi, %rbx
movq %rdi, %r15
movq 0xb0(%rsp), %r12
movq 0x48(%rdi), %rdi
callq 0x2cc99
movq %rax, 0x48(%rsp)
movq 0x48(%r15), %rdi
callq 0x2cc99
movq %rax, 0x40(%rsp)
movq 0x48(%r15), %rdi
callq 0x2cc99
movq %rax, %r13
movq 0x48(%r15), %rdi
callq 0x2cc99
movq %rax, %rbp
movq 0x48(%r15), %rdi
callq 0x2cc99
movq %rax, %r14
movq %r15, (%rsp)
movq 0x48(%r15), %rdi
movl $0x1d, %esi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x2be09
movq $-0x1, %rcx
cmpl $0x0, (%r12)
jne 0x35166
movq 0x48(%rsp), %r15
movq %rbx, 0x28(%rsp)
movq %r14, 0x18(%rsp)
movq %rbp, 0x20(%rsp)
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rbp
movq 0xa0(%rsp), %r14
movq (%rsp), %rbx
movq 0x48(%rbx), %rdi
movl $0x1, %edx
movl $0x1b, %esi
movq 0xb0(%rsp), %r12
movq %r12, %rcx
callq 0x2be09
movq %rax, (%r14)
cmpl $0x0, (%r12)
jne 0x3515f
movq 0x48(%rbx), %rdi
movl $0x11, %esi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
movq 0xb0(%rsp), %r12
movq %r12, %r8
callq 0x2bc8f
movq %rax, (%rbp)
cmpl $0x0, (%r12)
jne 0x3515f
movq %rbp, %r14
movq 0x48(%rbx), %rdi
movl $0x2b, %ecx
movl $0x31, %esi
movq %rax, %rdx
movq 0xb0(%rsp), %r12
movq %r12, %r8
callq 0x2bc8f
cmpl $0x0, (%r12)
jne 0x3515f
movq 0x48(%rbx), %rdi
movl $0x43, %esi
movq %rax, %rdx
movq %r15, %rcx
movq %r13, %r8
movq 0xb0(%rsp), %r12
movq %r12, %r9
callq 0x2bd42
cmpl $0x0, (%r12)
jne 0x3515f
movq 0x48(%rbx), %rdi
movq %r15, %rsi
movq 0xb0(%rsp), %rbx
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movq (%r14), %rdx
movl $0x2d, %ecx
movl $0x2d, %esi
movq 0xb0(%rsp), %rbx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rcx
movq 0x48(%rcx), %rdi
movl $0x43, %esi
movq %rax, %rdx
movq 0x40(%rsp), %r14
movq %r14, %rcx
movq 0x20(%rsp), %r8
movq 0xb0(%rsp), %rbx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movq %r14, %rsi
movq 0xb0(%rsp), %rbx
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movq 0xa0(%rsp), %rax
movq (%rax), %rcx
movl $0x21, %esi
movq %rcx, %rdx
xorl %r8d, %r8d
movq 0xb0(%rsp), %rbx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movq %r13, %rsi
movq 0xb0(%rsp), %rbx
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movl $0x1, %r8d
movl $0x9, %esi
movq 0x28(%rsp), %rcx
movq %rcx, %rdx
movq 0xb0(%rsp), %rbx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x3515f
movq 0x90(%rsp), %rsi
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movq 0xb0(%rsp), %rbx
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movl $0x1, %r8d
movl $0x9, %esi
movq 0x8(%rsp), %rcx
movq %rcx, %rdx
movq 0xb0(%rsp), %rbx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movl $0x3b, %esi
movq 0x8(%rsp), %rdx
movq 0x38(%rsp), %rcx
movq 0xb0(%rsp), %rbx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x3515f
movq 0x98(%rsp), %r8
movq (%rsp), %rcx
movq 0x48(%rcx), %rdi
movl $0x43, %esi
movq %rax, %rdx
movq 0x18(%rsp), %rcx
movq 0xb0(%rsp), %rbx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x18(%rsp), %rsi
movq 0xb0(%rsp), %rbx
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movq (%rbp), %rdx
movl $0x11, %esi
movq 0x8(%rsp), %rcx
xorl %r8d, %r8d
movq 0xb0(%rsp), %rbx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x20(%rsp), %rsi
movq 0xb0(%rsp), %rbx
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x3515f
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movq (%rbp), %rdx
movl $0x30, %ecx
movl $0x3d, %esi
movq 0xb0(%rsp), %r12
movq %r12, %r8
callq 0x2bc8f
cmpl $0x0, (%r12)
je 0x35178
movq $-0x1, %rcx
movq %rcx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rax
movq 0x48(%rax), %rdi
movzbl 0x14(%rsp), %eax
leal 0x33(,%rax,2), %esi
movq (%rbp), %rdx
movq 0x30(%rsp), %rcx
movq 0xb0(%rsp), %r14
movq %r14, %r8
callq 0x2bc8f
cmpl $0x0, (%r14)
movq $-0x1, %rcx
jne 0x35166
movq 0xa8(%rsp), %r12
movq (%rsp), %rcx
movq 0x48(%rcx), %rdi
movl $0x26, %esi
movq %rbx, %rdx
movq %rax, %rcx
movq 0xb0(%rsp), %rbx
movq %rbx, %r8
callq 0x2bc8f
movq %rax, (%r12)
xorl %ecx, %ecx
cmpl (%rbx), %ecx
sbbq %rcx, %rcx
orq 0x8(%rsp), %rcx
jmp 0x35166