// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: find_longest_repeat_offset_match
static u32
find_longest_repeat_offset_match(const u8 * const in_next,
				 const u32 max_len,
				 const u32 recent_offsets[],
				 unsigned *rep_max_idx_ret)
{
#if MIN_MATCH_LEN == 2
#  define load_initial  load_u16_unaligned
#elif MIN_MATCH_LEN == 3
#  define load_initial	load_u24_unaligned
#elif MIN_MATCH_LEN == 4
#  define load_initial	load_u32_unaligned
#else
#  error "unsupported MIN_MATCH_LEN"
#endif
	const u32 next_bytes = load_initial(in_next);
	const u8 *matchptr;
	u32 rep_len;
	u32 rep_max_len;
	unsigned rep_max_idx;

	STATIC_ASSERT(NUM_REPS >= 1 && NUM_REPS <= 4);

	matchptr = in_next - recent_offsets[0];
	if (load_initial(matchptr) == next_bytes)
		rep_max_len = lz_extend(in_next, matchptr, MIN_MATCH_LEN, max_len);
	else
		rep_max_len = 0;
	rep_max_idx = 0;

#if NUM_REPS >= 2
	matchptr = in_next - recent_offsets[1];
	if (load_initial(matchptr) == next_bytes) {
		rep_len = lz_extend(in_next, matchptr, MIN_MATCH_LEN, max_len);
		if (rep_len > rep_max_len) {
			rep_max_len = rep_len;
			rep_max_idx = 1;
		}
	}
#endif

#if NUM_REPS >= 3
	matchptr = in_next - recent_offsets[2];
	if (load_initial(matchptr) == next_bytes) {
		rep_len = lz_extend(in_next, matchptr, MIN_MATCH_LEN, max_len);
		if (rep_len > rep_max_len) {
			rep_max_len = rep_len;
			rep_max_idx = 2;
		}
	}
#endif

#if NUM_REPS >= 4
	matchptr = in_next - recent_offsets[3];
	if (load_initial(matchptr) == next_bytes) {
		rep_len = lz_extend(in_next, matchptr, MIN_MATCH_LEN, max_len);
		if (rep_len > rep_max_len) {
			rep_max_len = rep_len;
			rep_max_idx = 3;
		}
	}
#endif

	*rep_max_idx_ret = rep_max_idx;
	return rep_max_len;
}

// Assembly:
subq $0x178, %rsp            # imm = 0x178
movq %rdi, -0x48(%rsp)
movl %esi, -0x4c(%rsp)
movq %rdx, -0x58(%rsp)
movq %rcx, -0x60(%rsp)
movq -0x48(%rsp), %rax
movq %rax, 0x170(%rsp)
movq 0x170(%rsp), %rax
movzwl (%rax), %eax
movl %eax, -0x64(%rsp)
movq -0x48(%rsp), %rax
movq -0x58(%rsp), %rcx
movl (%rcx), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rsp)
movq -0x70(%rsp), %rax
movq %rax, 0x168(%rsp)
movq 0x168(%rsp), %rax
movzwl (%rax), %eax
cmpl -0x64(%rsp), %eax
jne 0x9854
movq -0x48(%rsp), %rdx
movq -0x70(%rsp), %rcx
movl -0x4c(%rsp), %eax
movq %rdx, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movl $0x2, 0x34(%rsp)
movl %eax, 0x30(%rsp)
movl 0x34(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0x30(%rsp), %eax
subl 0x2c(%rsp), %eax
cmpl $0x20, %eax
setae %al
testb $0x1, %al
jne 0x9616
jmp 0x975e
movq 0x38(%rsp), %rax
movl 0x2c(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
movq (%rax), %rax
movq 0x40(%rsp), %rcx
movl 0x2c(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0x80(%rsp)
movq 0x80(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x9666
jmp 0x981d
movl 0x2c(%rsp), %eax
addl $0x8, %eax
movl %eax, 0x2c(%rsp)
movq 0x38(%rsp), %rax
movl 0x2c(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq 0x40(%rsp), %rcx
movl 0x2c(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0x70(%rsp)
movq 0x70(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x96b5
jmp 0x981d
movl 0x2c(%rsp), %eax
addl $0x8, %eax
movl %eax, 0x2c(%rsp)
movq 0x38(%rsp), %rax
movl 0x2c(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rax
movq 0x40(%rsp), %rcx
movl 0x2c(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0x60(%rsp)
movq 0x60(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x9704
jmp 0x981d
movl 0x2c(%rsp), %eax
addl $0x8, %eax
movl %eax, 0x2c(%rsp)
movq 0x38(%rsp), %rax
movl 0x2c(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq 0x40(%rsp), %rcx
movl 0x2c(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0x50(%rsp)
movq 0x50(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x9753
jmp 0x981d
movl 0x2c(%rsp), %eax
addl $0x8, %eax
movl %eax, 0x2c(%rsp)
jmp 0x9760
movl 0x2c(%rsp), %eax
addl $0x8, %eax
cmpl 0x30(%rsp), %eax
ja 0x97c7
movq 0x38(%rsp), %rax
movl 0x2c(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rax
movq 0x40(%rsp), %rcx
movl 0x2c(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0x90(%rsp)
movq 0x90(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x97ba
jmp 0x981d
movl 0x2c(%rsp), %eax
addl $0x8, %eax
movl %eax, 0x2c(%rsp)
jmp 0x9760
jmp 0x97c9
movl 0x2c(%rsp), %ecx
xorl %eax, %eax
cmpl 0x30(%rsp), %ecx
movb %al, -0x7d(%rsp)
jae 0x97fc
movq 0x38(%rsp), %rax
movl 0x2c(%rsp), %ecx
movzbl (%rax,%rcx), %eax
movq 0x40(%rsp), %rcx
movl 0x2c(%rsp), %edx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x7d(%rsp)
movb -0x7d(%rsp), %al
testb $0x1, %al
jne 0x9806
jmp 0x9813
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x97c9
movl 0x2c(%rsp), %eax
movl %eax, 0x4c(%rsp)
jmp 0x984a
movq 0x20(%rsp), %rax
movq %rax, 0x140(%rsp)
movq 0x140(%rsp), %rax
tzcntq %rax, %rax
shrl $0x3, %eax
addl 0x2c(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
movl %eax, -0x78(%rsp)
jmp 0x985c
movl $0x0, -0x78(%rsp)
movl $0x0, -0x7c(%rsp)
movq -0x48(%rsp), %rax
movq -0x58(%rsp), %rcx
movl 0x4(%rcx), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rsp)
movq -0x70(%rsp), %rax
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rax
movzwl (%rax), %eax
cmpl -0x64(%rsp), %eax
jne 0x9b5d
movq -0x48(%rsp), %rdx
movq -0x70(%rsp), %rcx
movl -0x4c(%rsp), %eax
movq %rdx, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movl $0x2, 0x4(%rsp)
movl %eax, (%rsp)
movl 0x4(%rsp), %eax
movl %eax, -0x4(%rsp)
movl (%rsp), %eax
subl -0x4(%rsp), %eax
cmpl $0x20, %eax
setae %al
testb $0x1, %al
jne 0x98e3
jmp 0x9a4f
movq 0x8(%rsp), %rax
movl -0x4(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0xd8(%rsp)
movq 0xd8(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movl -0x4(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0xd0(%rsp)
movq 0xd0(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, -0x10(%rsp)
cmpq $0x0, -0x10(%rsp)
je 0x9933
jmp 0x9b0c
movl -0x4(%rsp), %eax
addl $0x8, %eax
movl %eax, -0x4(%rsp)
movq 0x8(%rsp), %rax
movl -0x4(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movl -0x4(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0xc0(%rsp)
movq 0xc0(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, -0x10(%rsp)
cmpq $0x0, -0x10(%rsp)
je 0x998e
jmp 0x9b0c
movl -0x4(%rsp), %eax
addl $0x8, %eax
movl %eax, -0x4(%rsp)
movq 0x8(%rsp), %rax
movl -0x4(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movl -0x4(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0xb0(%rsp)
movq 0xb0(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, -0x10(%rsp)
cmpq $0x0, -0x10(%rsp)
je 0x99e9
jmp 0x9b0c
movl -0x4(%rsp), %eax
addl $0x8, %eax
movl %eax, -0x4(%rsp)
movq 0x8(%rsp), %rax
movl -0x4(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movl -0x4(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0xa0(%rsp)
movq 0xa0(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, -0x10(%rsp)
cmpq $0x0, -0x10(%rsp)
je 0x9a44
jmp 0x9b0c
movl -0x4(%rsp), %eax
addl $0x8, %eax
movl %eax, -0x4(%rsp)
jmp 0x9a51
movl -0x4(%rsp), %eax
addl $0x8, %eax
cmpl (%rsp), %eax
ja 0x9ab7
movq 0x8(%rsp), %rax
movl -0x4(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0xe8(%rsp)
movq 0xe8(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movl -0x4(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0xe0(%rsp)
movq 0xe0(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, -0x10(%rsp)
cmpq $0x0, -0x10(%rsp)
je 0x9aaa
jmp 0x9b0c
movl -0x4(%rsp), %eax
addl $0x8, %eax
movl %eax, -0x4(%rsp)
jmp 0x9a51
jmp 0x9ab9
movl -0x4(%rsp), %ecx
xorl %eax, %eax
cmpl (%rsp), %ecx
movb %al, -0x7e(%rsp)
jae 0x9aeb
movq 0x8(%rsp), %rax
movl -0x4(%rsp), %ecx
movzbl (%rax,%rcx), %eax
movq 0x10(%rsp), %rcx
movl -0x4(%rsp), %edx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x7e(%rsp)
movb -0x7e(%rsp), %al
testb $0x1, %al
jne 0x9af5
jmp 0x9b02
movl -0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rsp)
jmp 0x9ab9
movl -0x4(%rsp), %eax
movl %eax, 0x1c(%rsp)
jmp 0x9b39
movq -0x10(%rsp), %rax
movq %rax, 0x148(%rsp)
movq 0x148(%rsp), %rax
tzcntq %rax, %rax
shrl $0x3, %eax
addl -0x4(%rsp), %eax
movl %eax, -0x4(%rsp)
movl -0x4(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, -0x74(%rsp)
movl -0x74(%rsp), %eax
cmpl -0x78(%rsp), %eax
jbe 0x9b5b
movl -0x74(%rsp), %eax
movl %eax, -0x78(%rsp)
movl $0x1, -0x7c(%rsp)
jmp 0x9b5d
movq -0x48(%rsp), %rax
movq -0x58(%rsp), %rcx
movl 0x8(%rcx), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rsp)
movq -0x70(%rsp), %rax
movq %rax, 0x158(%rsp)
movq 0x158(%rsp), %rax
movzwl (%rax), %eax
cmpl -0x64(%rsp), %eax
jne 0x9e5a
movq -0x48(%rsp), %rdx
movq -0x70(%rsp), %rcx
movl -0x4c(%rsp), %eax
movq %rdx, -0x20(%rsp)
movq %rcx, -0x28(%rsp)
movl $0x2, -0x2c(%rsp)
movl %eax, -0x30(%rsp)
movl -0x2c(%rsp), %eax
movl %eax, -0x34(%rsp)
movl -0x30(%rsp), %eax
subl -0x34(%rsp), %eax
cmpl $0x20, %eax
setae %al
testb $0x1, %al
jne 0x9bde
jmp 0x9d4a
movq -0x28(%rsp), %rax
movl -0x34(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0x128(%rsp)
movq 0x128(%rsp), %rax
movq (%rax), %rax
movq -0x20(%rsp), %rcx
movl -0x34(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0x120(%rsp)
movq 0x120(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, -0x40(%rsp)
cmpq $0x0, -0x40(%rsp)
je 0x9c2e
jmp 0x9e09
movl -0x34(%rsp), %eax
addl $0x8, %eax
movl %eax, -0x34(%rsp)
movq -0x28(%rsp), %rax
movl -0x34(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0x118(%rsp)
movq 0x118(%rsp), %rax
movq (%rax), %rax
movq -0x20(%rsp), %rcx
movl -0x34(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0x110(%rsp)
movq 0x110(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, -0x40(%rsp)
cmpq $0x0, -0x40(%rsp)
je 0x9c89
jmp 0x9e09
movl -0x34(%rsp), %eax
addl $0x8, %eax
movl %eax, -0x34(%rsp)
movq -0x28(%rsp), %rax
movl -0x34(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rax
movq (%rax), %rax
movq -0x20(%rsp), %rcx
movl -0x34(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0x100(%rsp)
movq 0x100(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, -0x40(%rsp)
cmpq $0x0, -0x40(%rsp)
je 0x9ce4
jmp 0x9e09
movl -0x34(%rsp), %eax
addl $0x8, %eax
movl %eax, -0x34(%rsp)
movq -0x28(%rsp), %rax
movl -0x34(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0xf8(%rsp)
movq 0xf8(%rsp), %rax
movq (%rax), %rax
movq -0x20(%rsp), %rcx
movl -0x34(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0xf0(%rsp)
movq 0xf0(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, -0x40(%rsp)
cmpq $0x0, -0x40(%rsp)
je 0x9d3f
jmp 0x9e09
movl -0x34(%rsp), %eax
addl $0x8, %eax
movl %eax, -0x34(%rsp)
jmp 0x9d4c
movl -0x34(%rsp), %eax
addl $0x8, %eax
cmpl -0x30(%rsp), %eax
ja 0x9db3
movq -0x28(%rsp), %rax
movl -0x34(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0x138(%rsp)
movq 0x138(%rsp), %rax
movq (%rax), %rax
movq -0x20(%rsp), %rcx
movl -0x34(%rsp), %edx
addq %rdx, %rcx
movq %rcx, 0x130(%rsp)
movq 0x130(%rsp), %rcx
xorq (%rcx), %rax
movq %rax, -0x40(%rsp)
cmpq $0x0, -0x40(%rsp)
je 0x9da6
jmp 0x9e09
movl -0x34(%rsp), %eax
addl $0x8, %eax
movl %eax, -0x34(%rsp)
jmp 0x9d4c
jmp 0x9db5
movl -0x34(%rsp), %ecx
xorl %eax, %eax
cmpl -0x30(%rsp), %ecx
movb %al, -0x7f(%rsp)
jae 0x9de8
movq -0x28(%rsp), %rax
movl -0x34(%rsp), %ecx
movzbl (%rax,%rcx), %eax
movq -0x20(%rsp), %rcx
movl -0x34(%rsp), %edx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x7f(%rsp)
movb -0x7f(%rsp), %al
testb $0x1, %al
jne 0x9df2
jmp 0x9dff
movl -0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rsp)
jmp 0x9db5
movl -0x34(%rsp), %eax
movl %eax, -0x14(%rsp)
jmp 0x9e36
movq -0x40(%rsp), %rax
movq %rax, 0x150(%rsp)
movq 0x150(%rsp), %rax
tzcntq %rax, %rax
shrl $0x3, %eax
addl -0x34(%rsp), %eax
movl %eax, -0x34(%rsp)
movl -0x34(%rsp), %eax
movl %eax, -0x14(%rsp)
movl -0x14(%rsp), %eax
movl %eax, -0x74(%rsp)
movl -0x74(%rsp), %eax
cmpl -0x78(%rsp), %eax
jbe 0x9e58
movl -0x74(%rsp), %eax
movl %eax, -0x78(%rsp)
movl $0x2, -0x7c(%rsp)
jmp 0x9e5a
movl -0x7c(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, (%rax)
movl -0x78(%rsp), %eax
addq $0x178, %rsp            # imm = 0x178
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)