// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %rbx
subq $0x98, %rsp
movl %r8d, %eax
movq %rcx, %r8
movq %rdx, %r10
movq %rsi, %r11
movq 0x40(%rbp), %rcx
movq 0x38(%rbp), %rcx
movq 0x30(%rbp), %rcx
movq 0x28(%rbp), %rcx
movq 0x20(%rbp), %rdx
movq 0x18(%rbp), %rsi
movq 0x10(%rbp), %rbx
movq %r11, -0x18(%rbp)
movq %r10, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %rdi, -0x50(%rbp)
andb $0x1, %al
movb %al, -0x51(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x80(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x88(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x90(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x98(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x40(%rbp), %rcx
movq -0x18(%rbp), %rdx
movl $0x1d, %esi
callq 0x38490
movq %rax, -0x60(%rbp)
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45b4b
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movl $0x1, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x40(%rbp), %rcx
movq -0x68(%rbp), %rdx
movl $0x1b, %esi
callq 0x38490
movq %rax, %rcx
movq 0x30(%rbp), %rax
movq %rcx, (%rax)
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45b8c
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movl $0x0, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x40(%rbp), %r8
movq -0x60(%rbp), %rdx
movq -0x68(%rbp), %rcx
movl $0x11, %esi
callq 0x38230
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45bd1
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movl $0x2b, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x40(%rbp), %r8
movq (%rax), %rdx
movq -0x68(%rbp), %rcx
movl $0x31, %esi
callq 0x38230
movq %rax, -0xa0(%rbp)
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45c16
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x40(%rbp), %r9
movq -0xa0(%rbp), %rdx
movq -0x80(%rbp), %rcx
movq -0x78(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45c51
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x80(%rbp), %rsi
movq 0x40(%rbp), %rdx
callq 0x39960
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45c7c
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movl $0x2d, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x40(%rbp), %r8
movq (%rax), %rdx
movq -0x68(%rbp), %rcx
movl $0x2d, %esi
callq 0x38230
movq %rax, -0xa0(%rbp)
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45cc1
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x40(%rbp), %r9
movq -0xa0(%rbp), %rdx
movq -0x88(%rbp), %rcx
movq -0x90(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45d02
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x88(%rbp), %rsi
movq 0x40(%rbp), %rdx
callq 0x39960
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45d30
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movl $0x0, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x30(%rbp), %rcx
movq 0x30(%rbp), %rax
movq 0x40(%rbp), %r9
movq (%rcx), %rdx
movq (%rax), %rcx
movq -0x68(%rbp), %r8
movl $0x21, %esi
callq 0x38360
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45d75
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x78(%rbp), %rsi
movq 0x40(%rbp), %rdx
callq 0x39960
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45da0
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movl $0x1, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x40(%rbp), %r9
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x68(%rbp), %r8
movl $0x9, %esi
callq 0x38360
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45ddf
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x38(%rbp), %rsi
movq 0x40(%rbp), %rdx
callq 0x39960
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45e0a
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movl $0x1, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x40(%rbp), %r9
movq -0x60(%rbp), %rdx
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %r8
movl $0x9, %esi
callq 0x38360
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45e49
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x40(%rbp), %r8
movq -0x60(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl $0x3b, %esi
callq 0x38230
movq %rax, -0xa0(%rbp)
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45e84
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x40(%rbp), %r9
movq -0xa0(%rbp), %rdx
movq -0x98(%rbp), %rcx
movq -0x40(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45ec2
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x98(%rbp), %rsi
movq 0x40(%rbp), %rdx
callq 0x39960
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45ef0
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movl $0x0, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x40(%rbp), %r9
movq (%rax), %rdx
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %r8
movl $0x11, %esi
callq 0x38360
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45f32
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x90(%rbp), %rsi
movq 0x40(%rbp), %rdx
callq 0x39960
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45f60
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movl $0x30, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x40(%rbp), %r8
movq (%rax), %rdx
movq -0x68(%rbp), %rcx
movl $0x3d, %esi
callq 0x38230
movq %rax, -0xa0(%rbp)
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45fa5
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movb -0x51(%rbp), %cl
movl $0x33, %esi
movl $0x35, %eax
testb $0x1, %cl
cmovnel %eax, %esi
movq 0x10(%rbp), %rax
movq 0x40(%rbp), %r8
movq (%rax), %rdx
movq -0x28(%rbp), %rcx
callq 0x38230
movq %rax, -0x70(%rbp)
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x45feb
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0x40(%rbp), %r8
movq -0xa0(%rbp), %rdx
movq -0x70(%rbp), %rcx
movl $0x26, %esi
callq 0x38230
movq %rax, %rcx
movq 0x38(%rbp), %rax
movq %rcx, (%rax)
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
je 0x46029
movq $-0x1, -0x10(%rbp)
jmp 0x46031
movq -0x60(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x98, %rsp
popq %rbx
popq %rbp
retq
nop