// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0xd7b2
movl $0x0, -0x4(%rbp)
jmp 0xda36
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x61, %eax
jl 0xd7dc
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x7a, %eax
jg 0xd7dc
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
subl $0x61, %eax
addl $0x41, %eax
movl %eax, -0x38(%rbp)
jmp 0xd7e6
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movb %al, -0x31(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x61, %eax
jl 0xd822
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x7a, %eax
jg 0xd822
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
subl $0x61, %eax
addl $0x41, %eax
movl %eax, -0x3c(%rbp)
jmp 0xd82c
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movb %al, -0x32(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movzbl -0x31(%rbp), %eax
cmpl $0x30, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movzbl -0x31(%rbp), %ecx
subl $0x30, %ecx
cmpl $0x9, %ecx
setbe %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl $0x0, %ecx
setne %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
addl $0x0, %eax
movl %eax, -0x2c(%rbp)
movzbl -0x31(%rbp), %eax
movzbl -0x32(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, %eax
jne 0xd977
movzbl -0x31(%rbp), %eax
cmpl $0x0, %eax
jne 0xd89e
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xda36
movslq -0x2c(%rbp), %rcx
leaq 0xdca0(%rip), %rax      # 0x1b549
movzbl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x61, %eax
jl 0xd8da
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x7a, %eax
jg 0xd8da
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
subl $0x61, %eax
addl $0x41, %eax
movl %eax, -0x40(%rbp)
jmp 0xd8e4
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movb %al, -0x31(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x61, %eax
jl 0xd920
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x7a, %eax
jg 0xd920
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
subl $0x61, %eax
addl $0x41, %eax
movl %eax, -0x44(%rbp)
jmp 0xd92a
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movb %al, -0x32(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movzbl -0x31(%rbp), %eax
cmpl $0x30, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movzbl -0x31(%rbp), %ecx
subl $0x30, %ecx
cmpl $0x9, %ecx
setbe %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl $0x0, %ecx
setne %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0xd874
movl -0x2c(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,2), %eax
movzbl -0x32(%rbp), %edx
movl %edx, %ecx
subl $0x30, %ecx
sete %cl
movzbl %cl, %ecx
addl $-0x30, %edx
subl $0xa, %edx
adcl $0x0, %ecx
addl %ecx, %eax
cltq
leaq 0xdbbe(%rip), %rcx      # 0x1b560
movsbl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x48(%rbp)
subl $0x2, %eax
je 0xd9c0
jmp 0xd9b6
movl -0x48(%rbp), %eax
subl $0x3, %eax
je 0xd9c8
jmp 0xda30
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xda36
jmp 0xd9ca
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movzbl (%rax), %eax
subl $0x30, %eax
cmpl $0x9, %eax
ja 0xda09
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movzbl (%rax), %eax
subl $0x30, %eax
cmpl $0x9, %eax
jbe 0xda07
movl $0x1, -0x4(%rbp)
jmp 0xda36
jmp 0xd9ca
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
subl $0x30, %eax
cmpl $0x9, %eax
ja 0xda22
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x4c(%rbp)
jmp 0xda28
movl -0x30(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xda36
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)