// File: /workspace/github_c_makefile_star2_O0/lmcilroy[P]lzm/lzmencode.c
// Function: matchlen_rev
static inline int
matchlen_rev(const unsigned char * const start, const unsigned char * const match,
    const unsigned char * const start_limit, const unsigned char * const match_limit)
{
	const unsigned char *curr = start;
	const unsigned char *last = match;
	const unsigned char *next_curr;
	const unsigned char *next_last;
	const unsigned char *end;
	unsigned long currval, lastval;
	unsigned int off;

	if (start == start_limit)
		return 0;

	if (match == match_limit)
		return 0;

	if (*(start-1) != *(match-1))
		return 0;

	end = match_limit;
	off = start - start_limit;
	if (off < (match - match_limit))
		end = match - off;

	if (last > (end + 7)) {
		next_curr = curr - 8;
		next_last = last - 8;
		currval = readmem64(next_curr);
		lastval = readmem64(next_last);
		if (currval != lastval)
			return (__builtin_clzl(currval ^ lastval) >> 3);
		curr = next_curr;
		last = next_last;
	}
	while (last > (end + 7)) {
		next_curr = curr - 8;
		next_last = last - 8;
		currval = readmem64(next_curr);
		lastval = readmem64(next_last);
		if (currval != lastval) {
			off = __builtin_clzl(currval ^ lastval) >> 3;
			return (start - curr) + off;
		}
		curr = next_curr;
		last = next_last;
	}
	if (last > (end + 3)) {
		next_curr = curr - 4;
		next_last = last - 4;
		currval = readmem32(next_curr);
		lastval = readmem32(next_last);
		if (currval != lastval) {
			off = __builtin_clz(currval ^ lastval) >> 3;
			return (start - curr) + off;
		}
		curr = next_curr;
		last = next_last;
	}
	if (last > (end + 1)) {
		next_curr = curr - 2;
		next_last = last - 2;
		currval = readmem16(next_curr);
		lastval = readmem16(next_last);
		if (readmem16(next_curr) == readmem16(next_last)) {
			curr = next_curr;
			last = next_last;
		}
	}
	if (last > end) {
		next_curr = curr - 1;
		next_last = last - 1;
		if (*next_curr == *next_last) {
			curr = next_curr;
			last = next_last;
		}
	}

	return start - curr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x55be
movl $0x0, -0x4(%rbp)
jmp 0x58a3
movq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0x55d4
movl $0x0, -0x4(%rbp)
jmp 0x58a3
movq -0x10(%rbp), %rax
movzbl -0x1(%rax), %eax
movq -0x18(%rbp), %rcx
movzbl -0x1(%rcx), %ecx
cmpl %ecx, %eax
je 0x55f4
movl $0x0, -0x4(%rbp)
jmp 0x58a3
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jge 0x5632
movq -0x18(%rbp), %rax
movl -0x64(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq -0x50(%rbp), %rcx
addq $0x7, %rcx
cmpq %rcx, %rax
jbe 0x56aa
movq -0x30(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x52d0
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
callq 0x52d0
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
je 0x569a
movq -0x58(%rbp), %rax
xorq -0x60(%rbp), %rax
bsrq %rax, %rax
xorq $0x3f, %rax
sarl $0x3, %eax
movl %eax, -0x4(%rbp)
jmp 0x58a3
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x56ac
movq -0x38(%rbp), %rax
movq -0x50(%rbp), %rcx
addq $0x7, %rcx
cmpq %rcx, %rax
jbe 0x5741
movq -0x30(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x52d0
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
callq 0x52d0
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
je 0x572c
movq -0x58(%rbp), %rax
xorq -0x60(%rbp), %rax
bsrq %rax, %rax
xorq $0x3f, %rax
sarl $0x3, %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movl -0x64(%rbp), %ecx
addq %rcx, %rax
movl %eax, -0x4(%rbp)
jmp 0x58a3
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x56ac
movq -0x38(%rbp), %rax
movq -0x50(%rbp), %rcx
addq $0x3, %rcx
cmpq %rcx, %rax
jbe 0x57cf
movq -0x30(%rbp), %rax
addq $-0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $-0x4, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5920
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5920
movl %eax, %eax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
je 0x57bf
movq -0x58(%rbp), %rax
xorq -0x60(%rbp), %rax
bsrl %eax, %eax
xorl $0x1f, %eax
sarl $0x3, %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movl -0x64(%rbp), %ecx
addq %rcx, %rax
movl %eax, -0x4(%rbp)
jmp 0x58a3
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x50(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jbe 0x584f
movq -0x30(%rbp), %rax
addq $-0x2, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $-0x2, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5b80
movzwl %ax, %eax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5b80
movzwl %ax, %eax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5b80
movzwl %ax, %eax
movl %eax, -0x68(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5b80
movw %ax, %cx
movl -0x68(%rbp), %eax
movzwl %cx, %ecx
cmpl %ecx, %eax
jne 0x584d
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x584f
movq -0x38(%rbp), %rax
cmpq -0x50(%rbp), %rax
jbe 0x5895
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movzbl (%rax), %eax
movq -0x48(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x5893
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x5895
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)