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

	if (last < (end - 7)) {
		lastval = readmem64(last);

		if (likely(curr < (end - 7))) {
			currval = readmem64(curr);
			if (lastval != currval)
				return (__builtin_ctzl(lastval ^ currval) >> 3);
			curr += bytes;
		}
		while (curr < (end - 7)) {
			currval = readmem64(curr);
			if (lastval != currval) {
				return (curr - start) +
				    (__builtin_ctzl(lastval ^ currval) >> 3);
			}
			curr += bytes;
		}
		last = curr - off;
	}
	if (curr < (end - 3)) {
		lastval = readmem32(last);
		currval = readmem32(curr);
		if (lastval != currval) {
			return (curr - start) +
			    (__builtin_ctz(lastval ^ currval) >> 3);
		}
		last += 4;
		curr += 4;
	}
	if (curr < (end - 1) && readmem16(last) == readmem16(curr)) {
		last += 2;
		curr += 2;
	}
	if (curr < end && *last == *curr)
		curr++;

	return curr - start;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
addq $-0x7, %rcx
cmpq %rcx, %rax
jae 0x5a6f
movq -0x38(%rbp), %rdi
callq 0x52d0
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
addq $-0x7, %rcx
cmpq %rcx, %rax
setb %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x59f5
movq -0x30(%rbp), %rdi
callq 0x52d0
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x59e5
movq -0x50(%rbp), %rax
xorq -0x48(%rbp), %rax
tzcntq %rax, %rax
sarl $0x3, %eax
movl %eax, -0x4(%rbp)
jmp 0x5b6c
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x59f7
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
addq $-0x7, %rcx
cmpq %rcx, %rax
jae 0x5a5a
movq -0x30(%rbp), %rdi
callq 0x52d0
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x5a48
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movq -0x50(%rbp), %rcx
xorq -0x48(%rbp), %rcx
tzcntq %rcx, %rcx
sarl $0x3, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movl %eax, -0x4(%rbp)
jmp 0x5b6c
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x59f7
movq -0x30(%rbp), %rax
movl -0x3c(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
addq $-0x3, %rcx
cmpq %rcx, %rax
jae 0x5ae8
movq -0x38(%rbp), %rdi
callq 0x5920
movl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
callq 0x5920
movl %eax, %eax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x5ad0
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movq -0x50(%rbp), %rcx
xorq -0x48(%rbp), %rcx
tzcntl %ecx, %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movl %eax, -0x4(%rbp)
jmp 0x5b6c
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
addq $-0x1, %rcx
cmpq %rcx, %rax
jae 0x5b36
movq -0x38(%rbp), %rdi
callq 0x5b80
movzwl %ax, %eax
movl %eax, -0x54(%rbp)
movq -0x30(%rbp), %rdi
callq 0x5b80
movw %ax, %cx
movl -0x54(%rbp), %eax
movzwl %cx, %ecx
cmpl %ecx, %eax
jne 0x5b36
movq -0x38(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x5b5e
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
movq -0x30(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x5b5e
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)