// File: /workspace/github_cpp_makefile_star2_O2/sisong[P]ApkDiffPatch/lzma/C/LzFind.c
// Function: Bt3_MatchFinder_GetMatches
static UInt32* Bt3_MatchFinder_GetMatches(void *_p, UInt32 *distances)
{
  CMatchFinder *p = (CMatchFinder *)_p;
  UInt32 mmm;
  UInt32 h2, d2, pos;
  unsigned maxLen;
  UInt32 *hash;
  GET_MATCHES_HEADER(3)

  HASH3_CALC

  hash = p->hash;
  pos = p->pos;

  d2 = pos - hash[h2];

  curMatch = (hash + kFix3HashSize)[hv];
  
  hash[h2] = pos;
  (hash + kFix3HashSize)[hv] = pos;

  SET_mmm

  maxLen = 2;

  if (d2 < mmm && *(cur - d2) == *cur)
  {
    UPDATE_maxLen
    distances[0] = (UInt32)maxLen;
    distances[1] = d2 - 1;
    distances += 2;
    if (maxLen == lenLimit)
    {
      SkipMatchesSpec(MF_PARAMS(p));
      MOVE_POS_RET
    }
  }
  
  GET_MATCHES_FOOTER_BT(maxLen)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r15
movl 0x14(%rdi), %r13d
cmpq $0x2, %r13
ja 0x30bb7
callq 0x2fd7d
jmp 0x30e6a
movq (%rdi), %r10
movzbl (%r10), %eax
movzbl 0x1(%r10), %ecx
xorl 0x78(%rdi,%rax,4), %ecx
movzbl 0x2(%r10), %edx
shll $0x8, %edx
xorl %ecx, %edx
andl $0x3ff, %ecx            # imm = 0x3FF
andl 0x38(%rdi), %edx
movq 0x28(%rdi), %r8
movl 0x8(%rdi), %r9d
movl %r9d, %eax
subl (%r8,%rcx,4), %eax
movl 0x1000(%r8,%rdx,4), %esi
movl %r9d, (%r8,%rcx,4)
movl %r9d, 0x1000(%r8,%rdx,4)
movl 0x1c(%rdi), %ecx
cmpl %ecx, %r9d
movq %rcx, 0x10(%rsp)
cmovael %ecx, %r9d
pushq $0x2
popq %r8
cmpl %r9d, %eax
jae 0x30cb8
movl %eax, %ecx
movq %r10, %rdx
subq %rcx, %rdx
movb (%rdx), %dl
cmpb (%r10), %dl
jne 0x30cb8
leaq 0x2(%r10), %rdx
negq %rcx
leaq (%r10,%r13), %r11
movq %r13, %r8
addq $-0x2, %r8
testq %r8, %r8
je 0x30c57
movb (%rdx,%rcx), %r9b
cmpb (%rdx), %r9b
jne 0x30c54
incq %rdx
decq %r8
jmp 0x30c3e
movq %rdx, %r11
subl %r10d, %r11d
movl %r11d, (%r15)
decl %eax
movl %eax, 0x4(%r15)
addq $0x8, %r15
movl 0x1c(%rdi), %r14d
cmpl %r11d, %r13d
jne 0x30cb0
movq 0x30(%rdi), %r8
movl 0x8(%rdi), %edx
movl 0x18(%rdi), %r9d
movl 0x3c(%rdi), %eax
movq %rdi, %rbx
movl %r13d, %edi
movq %r10, %rcx
pushq %rax
pushq %r14
callq 0x2ffe0
popq %rax
popq %rcx
incl 0x18(%rbx)
incq (%rbx)
movl 0x8(%rbx), %eax
incl %eax
movl %eax, 0x8(%rbx)
cmpl 0xc(%rbx), %eax
jne 0x30e6a
movq %rbx, %rdi
jmp 0x30e65
movq %r11, %r8
movq %r14, 0x10(%rsp)
leaq 0x1(%r10), %rax
movq %rax, 0x38(%rsp)
movl 0x8(%rdi), %ecx
movl 0x18(%rdi), %edx
movq 0x30(%rdi), %r9
leaq (%r9,%rdx,8), %rax
movq %rax, 0x18(%rsp)
movq %rdx, 0x50(%rsp)
movq %r9, 0x30(%rsp)
leaq (%r9,%rdx,8), %r12
addq $0x4, %r12
xorl %edx, %edx
movl %ecx, 0x28(%rsp)
subl 0x10(%rsp), %ecx
movl $0x0, 0xc(%rsp)
cmovbl %edx, %ecx
movl %ecx, 0x24(%rsp)
cmpl %esi, %ecx
movq %rdi, 0x40(%rsp)
jae 0x30e3b
movl 0x3c(%rdi), %edx
xorl %ebx, %ebx
movq %r8, %rdi
movq 0x10(%rsp), %rax
movl 0x28(%rsp), %ecx
movl %ecx, %r9d
subl %esi, %r9d
movq 0x50(%rsp), %r8
movq %r8, %rcx
subq %r9, %rcx
cmpl %r8d, %r9d
movl $0x0, %r11d
cmoval %eax, %r11d
addq %rcx, %r11
movq %r10, %rcx
subq %r9, %rcx
movl 0xc(%rsp), %r8d
cmpl %ebx, %r8d
movl %ebx, 0x2c(%rsp)
movl %ebx, %r14d
cmovbl %r8d, %r14d
movq 0x30(%rsp), %r8
leaq (%r8,%r11,8), %r8
movb (%rcx,%r14), %bl
cmpb (%r10,%r14), %bl
jne 0x30df8
movq %r12, 0x48(%rsp)
leal 0x1(%r14), %r12d
movl %r13d, %ebx
cmpl %r13d, %r12d
je 0x30dca
movl %r12d, %ebp
movq %rdi, %rax
movq %r13, %rdi
movq %r15, %r13
movb (%rcx,%rbp), %r15b
movl %r12d, %ebx
cmpb (%r10,%rbp), %r15b
movq %r13, %r15
movq %rdi, %r13
movq %rax, %rdi
movq 0x10(%rsp), %rax
jne 0x30dca
addl $0x2, %r14d
cmpl %r14d, %r13d
je 0x30dc7
movl %r14d, %ebx
movb (%rcx,%rbx), %bpl
incl %r14d
cmpb (%r10,%rbx), %bpl
je 0x30daa
decl %r14d
movl %r14d, %ebx
jmp 0x30dca
movl %r13d, %ebx
cmpl %ebx, %edi
movq 0x48(%rsp), %r12
jae 0x30df5
movq 0x30(%rsp), %rdi
movl (%rdi,%r11,8), %r11d
movl %ebx, (%r15)
decl %r9d
movl %r9d, 0x4(%r15)
addq $0x8, %r15
cmpl %r13d, %ebx
je 0x30e7c
movl %ebx, %edi
movl %ebx, %r14d
movl %r14d, %r9d
movb (%rcx,%r9), %cl
cmpb (%r10,%r9), %cl
jae 0x30e1a
movq 0x18(%rsp), %rcx
movl %esi, (%rcx)
addq $0x4, %r8
movq %r8, 0x18(%rsp)
movl %r14d, %ebx
jmp 0x30e2a
movl %esi, (%r12)
movq %r8, %r12
movl %r14d, 0xc(%rsp)
movl 0x2c(%rsp), %ebx
decl %edx
je 0x30e3b
movl (%r8), %esi
cmpl %esi, 0x24(%rsp)
jb 0x30d19
movq 0x18(%rsp), %rax
andl $0x0, (%rax)
andl $0x0, (%r12)
movq 0x40(%rsp), %rdi
incl 0x18(%rdi)
movq 0x38(%rsp), %rax
movq %rax, (%rdi)
movl 0x8(%rdi), %eax
incl %eax
movl %eax, 0x8(%rdi)
cmpl 0xc(%rdi), %eax
jne 0x30e6a
callq 0x2fd91
movq %r15, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rsp), %rax
movl %r11d, (%rax)
movl 0x4(%r8), %eax
movl %eax, (%r12)
jmp 0x30e48