// File: /workspace/github_c_makefile_star2_O1/jarun[P]nnn/src/nnn.c
// Function: xstrverscasecmp
static int xstrverscasecmp(const char * const s1, const char * const s2)
{
	const uchar_t *p1 = (const uchar_t *)s1;
	const uchar_t *p2 = (const uchar_t *)s2;
	int state, diff;
	uchar_t c1, c2;

	/*
	 * Symbol(s)    0       [1-9]   others
	 * Transition   (10) 0  (01) d  (00) x
	 */
	static const uint8_t next_state[] = {
		/* state    x    d    0  */
		/* S_N */  S_N, S_I, S_Z,
		/* S_I */  S_N, S_I, S_I,
		/* S_F */  S_N, S_F, S_F,
		/* S_Z */  S_N, S_F, S_Z
	};

	alignas(max_align_t) static const int8_t result_type[] = {
		/* state   x/x  x/d  x/0  d/x  d/d  d/0  0/x  0/d  0/0  */

		/* S_N */  VCMP, VCMP, VCMP, VCMP, VLEN, VCMP, VCMP, VCMP, VCMP,
		/* S_I */  VCMP,   -1,   -1,    1, VLEN, VLEN,    1, VLEN, VLEN,
		/* S_F */  VCMP, VCMP, VCMP, VCMP, VCMP, VCMP, VCMP, VCMP, VCMP,
		/* S_Z */  VCMP,    1,    1,   -1, VCMP, VCMP,   -1, VCMP, VCMP
	};

	if (p1 == p2)
		return 0;

	c1 = TOUPPER(*p1);
	++p1;
	c2 = TOUPPER(*p2);
	++p2;

	/* Hint: '0' is a digit too.  */
	state = S_N + ((c1 == '0') + (xisdigit(c1) != 0));

	while ((diff = c1 - c2) == 0) {
		if (c1 == '\0')
			return diff;

		state = next_state[state];
		c1 = TOUPPER(*p1);
		++p1;
		c2 = TOUPPER(*p2);
		++p2;
		state += (c1 == '0') + (xisdigit(c1) != 0);
	}

	state = result_type[state * 3 + (((c2 == '0') + (xisdigit(c2) != 0)))]; // NOLINT

	switch (state) {
	case VCMP:
		return diff;
	case VLEN:
		while (xisdigit(*p1++))
			if (!xisdigit(*p2++))
				return 1;
		return xisdigit(*p2) ? -1 : diff;
	default:
		return state;
	}
}

// Assembly:
xorl %eax, %eax
cmpq %rsi, %rdi
je 0xf2f8
pushq %rbp
pushq %rbx
movzbl (%rdi), %ecx
leal -0x61(%rcx), %edx
leal -0x20(%rcx), %r8d
cmpb $0x1a, %dl
movzbl %r8b, %edx
cmovael %ecx, %edx
movzbl (%rsi), %ecx
leal -0x61(%rcx), %r8d
leal -0x20(%rcx), %r9d
cmpb $0x1a, %r8b
movzbl %r9b, %r10d
cmovael %ecx, %r10d
movl $0xff, %r8d
movl %edx, %ecx
andl %r8d, %ecx
xorl %r9d, %r9d
cmpb $0x30, %dl
sete %r9b
leal -0x30(%rcx), %r11d
cmpl $0xa, %r11d
adcl $0x0, %r9d
incq %rsi
incq %rdi
movl %r10d, %ebx
andl %r8d, %ebx
subl %ebx, %ecx
jne 0xf28e
leaq 0x6425(%rip), %r11      # 0x15650
testb %dl, %dl
je 0xf2f6
movl %r9d, %ecx
movzbl (%rcx,%r11), %ebx
movzbl (%rdi), %ecx
leal -0x61(%rcx), %edx
leal -0x20(%rcx), %r9d
cmpb $0x1a, %dl
movzbl %r9b, %edx
cmovael %ecx, %edx
movzbl (%rsi), %ecx
leal -0x61(%rcx), %r9d
leal -0x20(%rcx), %r10d
cmpb $0x1a, %r9b
movzbl %r10b, %r10d
cmovael %ecx, %r10d
movl %edx, %ecx
andl %r8d, %ecx
xorl %r9d, %r9d
cmpb $0x30, %dl
sete %r9b
leal -0x30(%rcx), %ebp
cmpl $0xa, %ebp
adcl %ebx, %r9d
incq %rsi
incq %rdi
movl %r10d, %ebx
andl %r8d, %ebx
subl %ebx, %ecx
je 0xf22b
leal (%r9,%r9,2), %eax
xorl %edx, %edx
cmpb $0x30, %r10b
sete %dl
addl $-0x30, %ebx
cmpl $0xa, %ebx
adcq %rax, %rdx
leaq 0x63b5(%rip), %rax      # 0x15660
movzbl (%rdx,%rax), %eax
cmpl $0x2, %eax
je 0xf2f4
cmpl $0x3, %eax
jne 0xf2dd
xorl %eax, %eax
movzbl (%rdi,%rax), %edx
addl $-0x30, %edx
cmpl $0x9, %edx
ja 0xf2e2
movzbl (%rsi,%rax), %edx
addl $-0x30, %edx
incq %rax
cmpl $0xa, %edx
jb 0xf2bb
movl $0x1, %eax
jmp 0xf2f6
movsbl %al, %eax
jmp 0xf2f6
movzbl (%rsi,%rax), %eax
addl $-0x30, %eax
cmpl $0xa, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovbl %eax, %ecx
movl %ecx, %eax
popq %rbx
popq %rbp
retq