// File: sisong[P]ApkDiffPatch/lzma/C/LzFind.c
// Function: Hc5_MatchFinder_GetMatches
static UInt32 * Hc5_MatchFinder_GetMatches(void *_p, UInt32 *distances)
{
  CMatchFinder *p = (CMatchFinder *)_p;
  UInt32 mmm;
  UInt32 h2, h3, d2, d3, pos;
  unsigned maxLen;
  UInt32 *hash;
  GET_MATCHES_HEADER(5)

  HASH5_CALC

  hash = p->hash;
  pos = p->pos;

  d2 = pos - hash                  [h2];
  d3 = pos - (hash + kFix3HashSize)[h3];
  // d4 = pos - (hash + kFix4HashSize)[h4];

  curMatch = (hash + kFix5HashSize)[hv];

  hash                  [h2] = pos;
  (hash + kFix3HashSize)[h3] = pos;
  // (hash + kFix4HashSize)[h4] = pos;
  (hash + kFix5HashSize)[hv] = pos;

  SET_mmm
  
  maxLen = 4;

  for (;;)
  {
    if (d2 < mmm && *(cur - d2) == *cur)
    {
      distances[0] = 2;
      distances[1] = d2 - 1;
      distances += 2;
      if (*(cur - d2 + 2) == cur[2])
      {
      }
      else if (d3 < mmm && *(cur - d3) == *cur)
      {
        distances[1] = d3 - 1;
        distances += 2;
        d2 = d3;
      }
      else
        break;
    }
    else if (d3 < mmm && *(cur - d3) == *cur)
    {
      distances[1] = d3 - 1;
      distances += 2;
      d2 = d3;
    }
    else
      break;

    distances[-2] = 3;
    if (*(cur - d2 + 3) != cur[3])
      break;
    UPDATE_maxLen
    distances[-2] = (UInt32)maxLen;
    if (maxLen == lenLimit)
    {
      p->son[p->cyclicBufferPos] = curMatch;
      MOVE_POS_RET
    }
    break;
  }
  
  GET_MATCHES_FOOTER_HC(maxLen)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, -0x88(%rbp)
movq %rsi, -0x90(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0xd8(%rbp)
cmpl $0x5, -0xd8(%rbp)
jae 0x71c3d
movq -0x98(%rbp), %rdi
callq 0x707d0
movq -0x90(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x7237c
movq -0x98(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0x98(%rbp), %rax
movq -0xd0(%rbp), %rcx
movzbl (%rcx), %ecx
movl 0x78(%rax,%rcx,4), %eax
movq -0xd0(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
xorl %ecx, %eax
movl %eax, -0xdc(%rbp)
movl -0xdc(%rbp), %eax
andl $0x3ff, %eax            # imm = 0x3FF
movl %eax, -0xa0(%rbp)
movq -0xd0(%rbp), %rax
movzbl 0x2(%rax), %eax
shll $0x8, %eax
xorl -0xdc(%rbp), %eax
movl %eax, -0xdc(%rbp)
movl -0xdc(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0xa4(%rbp)
movq -0x98(%rbp), %rax
movq -0xd0(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
movl 0x78(%rax,%rcx,4), %eax
shll $0x5, %eax
xorl -0xdc(%rbp), %eax
movl %eax, -0xdc(%rbp)
movl -0xdc(%rbp), %eax
movq -0x98(%rbp), %rcx
movq -0xd0(%rbp), %rdx
movzbl 0x4(%rdx), %edx
movl 0x78(%rcx,%rdx,4), %ecx
shll $0xa, %ecx
xorl %ecx, %eax
movq -0x98(%rbp), %rcx
andl 0x38(%rcx), %eax
movl %eax, -0xc4(%rbp)
movq -0x98(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0x98(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
movq -0xc0(%rbp), %rcx
movl -0xa0(%rbp), %edx
subl (%rcx,%rdx,4), %eax
movl %eax, -0xa8(%rbp)
movl -0xb0(%rbp), %eax
movq -0xc0(%rbp), %rcx
movl -0xa4(%rbp), %edx
subl 0x1000(%rcx,%rdx,4), %eax
movl %eax, -0xac(%rbp)
movq -0xc0(%rbp), %rax
movl -0xc4(%rbp), %ecx
movl 0x41000(%rax,%rcx,4), %eax
movl %eax, -0xd4(%rbp)
movl -0xb0(%rbp), %edx
movq -0xc0(%rbp), %rax
movl -0xa0(%rbp), %ecx
movl %edx, (%rax,%rcx,4)
movl -0xb0(%rbp), %edx
movq -0xc0(%rbp), %rax
movl -0xa4(%rbp), %ecx
movl %edx, 0x1000(%rax,%rcx,4)
movl -0xb0(%rbp), %edx
movq -0xc0(%rbp), %rax
movl -0xc4(%rbp), %ecx
movl %edx, 0x41000(%rax,%rcx,4)
movq -0x98(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x9c(%rbp)
movl -0xb0(%rbp), %eax
cmpl -0x9c(%rbp), %eax
jae 0x71df4
movl -0xb0(%rbp), %eax
movl %eax, -0x9c(%rbp)
movl $0x4, -0xb4(%rbp)
movl -0xa8(%rbp), %eax
cmpl -0x9c(%rbp), %eax
jae 0x71f06
movq -0xd0(%rbp), %rax
movl -0xa8(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
movzbl (%rax,%rcx), %eax
movq -0xd0(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x71f06
movq -0x90(%rbp), %rax
movl $0x2, (%rax)
movl -0xa8(%rbp), %ecx
subl $0x1, %ecx
movq -0x90(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x90(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x90(%rbp)
movq -0xd0(%rbp), %rax
movl -0xa8(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
movzbl 0x2(%rax,%rcx), %eax
movq -0xd0(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jne 0x71e96
jmp 0x71f04
movl -0xac(%rbp), %eax
cmpl -0x9c(%rbp), %eax
jae 0x71efd
movq -0xd0(%rbp), %rax
movl -0xac(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
movzbl (%rax,%rcx), %eax
movq -0xd0(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x71efd
movl -0xac(%rbp), %ecx
subl $0x1, %ecx
movq -0x90(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x90(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x90(%rbp)
movl -0xac(%rbp), %eax
movl %eax, -0xa8(%rbp)
jmp 0x71f02
jmp 0x72104
jmp 0x71f04
jmp 0x71f74
movl -0xac(%rbp), %eax
cmpl -0x9c(%rbp), %eax
jae 0x71f6d
movq -0xd0(%rbp), %rax
movl -0xac(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
movzbl (%rax,%rcx), %eax
movq -0xd0(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x71f6d
movl -0xac(%rbp), %ecx
subl $0x1, %ecx
movq -0x90(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x90(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x90(%rbp)
movl -0xac(%rbp), %eax
movl %eax, -0xa8(%rbp)
jmp 0x71f72
jmp 0x72104
jmp 0x71f74
movq -0x90(%rbp), %rax
movl $0x3, -0x8(%rax)
movq -0xd0(%rbp), %rax
movl -0xa8(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
movzbl 0x3(%rax,%rcx), %eax
movq -0xd0(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
cmpl %ecx, %eax
je 0x71faf
jmp 0x72104
movl -0xa8(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
subq %rcx, %rax
movq %rax, -0xe8(%rbp)
movq -0xd0(%rbp), %rax
movl -0xb4(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0xf0(%rbp)
movq -0xd0(%rbp), %rax
movl -0xd8(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0xf8(%rbp)
movq -0xf0(%rbp), %rax
cmpq -0xf8(%rbp), %rax
je 0x72039
movq -0xf0(%rbp), %rax
movq -0xe8(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0xf0(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
je 0x72023
jmp 0x72039
jmp 0x72025
movq -0xf0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xf0(%rbp)
jmp 0x71ff1
movq -0xf0(%rbp), %rax
movq -0xd0(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %ecx
movq -0x90(%rbp), %rax
movl %ecx, -0x8(%rax)
movl -0xb4(%rbp), %eax
cmpl -0xd8(%rbp), %eax
jne 0x72102
movl -0xd4(%rbp), %edx
movq -0x98(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x98(%rbp), %rcx
movl 0x18(%rcx), %ecx
movl %edx, (%rax,%rcx,4)
movq -0x98(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movq -0x98(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0x98(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, -0xfc(%rbp)
movl -0xfc(%rbp), %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0xfc(%rbp), %eax
movq -0x98(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jne 0x720f2
movq -0x98(%rbp), %rdi
callq 0x70830
movq -0x90(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x7237c
jmp 0x72104
movl -0xd8(%rbp), %eax
movl %eax, %ebx
movl -0xd4(%rbp), %r11d
movq -0x98(%rbp), %rax
movl 0x8(%rax), %r10d
movq -0x98(%rbp), %rax
movq (%rax), %r9
movq -0x98(%rbp), %rax
movq 0x30(%rax), %r8
movq -0x98(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, %edi
movq -0x98(%rbp), %rax
movl 0x1c(%rax), %esi
movq -0x98(%rbp), %rax
movl 0x3c(%rax), %edx
movq -0x90(%rbp), %rcx
movl -0xb4(%rbp), %eax
movq %rbx, -0x18(%rbp)
movl %r11d, -0x1c(%rbp)
movl %r10d, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %rdi, -0x38(%rbp)
movl %esi, -0x3c(%rbp)
movl %edx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movq -0x28(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x1c(%rbp), %edx
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
cmpl $0x0, -0x1c(%rbp)
jne 0x721aa
jmp 0x722fc
movl -0x20(%rbp), %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jb 0x721c0
jmp 0x722fc
movq -0x30(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x38(%rbp), %rax
movl -0x5c(%rbp), %ecx
subq %rcx, %rax
movq %rax, -0x108(%rbp)
movl -0x5c(%rbp), %eax
cmpq -0x38(%rbp), %rax
jbe 0x721f0
movl -0x3c(%rbp), %eax
movl %eax, -0x114(%rbp)
jmp 0x721fa
xorl %eax, %eax
movl %eax, -0x114(%rbp)
jmp 0x721fa
movq -0x110(%rbp), %rax
movq -0x108(%rbp), %rcx
movl -0x114(%rbp), %edx
movl %edx, %edx
addq %rdx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x1c(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
subq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movl -0x4c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movq -0x28(%rbp), %rcx
movl -0x4c(%rbp), %edx
addq -0x68(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x722ea
movq -0x28(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movzbl (%rax), %eax
movq -0x70(%rbp), %rcx
movq -0x68(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x722aa
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
cmpq -0x58(%rbp), %rax
jne 0x722a8
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, (%rax)
movl -0x5c(%rbp), %ecx
subl $0x1, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x48(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
jmp 0x72304
jmp 0x72251
movq -0x70(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x74(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x74(%rbp), %eax
jae 0x722e8
movl -0x74(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x74(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, (%rax)
movl -0x5c(%rbp), %ecx
subl $0x1, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x48(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x48(%rbp)
jmp 0x722ea
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, %eax
jne 0x7219f
movq -0x48(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x98(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movq -0x98(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0x98(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, -0x100(%rbp)
movl -0x100(%rbp), %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x100(%rbp), %eax
movq -0x98(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jne 0x72371
movq -0x98(%rbp), %rdi
callq 0x70830
movq -0x90(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %rbp
retq
nopw (%rax,%rax)