// File: sisong[P]ApkDiffPatch/lzma/C/LzFind.c
// Function: Bt5_MatchFinder_GetMatches
static UInt32* Bt5_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)
    {
      SkipMatchesSpec(MF_PARAMS(p));
      MOVE_POS_RET
    }
    break;
  }
  
  GET_MATCHES_FOOTER_BT(maxLen)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdi, -0x98(%rbp)
movq %rsi, -0xa0(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0xe8(%rbp)
cmpl $0x5, -0xe8(%rbp)
jae 0x73ed0
movq -0xa8(%rbp), %rdi
callq 0x707d0
movq -0xa0(%rbp), %rax
movq %rax, -0x90(%rbp)
jmp 0x747af
movq -0xa8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
movq -0xa8(%rbp), %rax
movq -0xe0(%rbp), %rcx
movzbl (%rcx), %ecx
movl 0x78(%rax,%rcx,4), %eax
movq -0xe0(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
xorl %ecx, %eax
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %eax
andl $0x3ff, %eax            # imm = 0x3FF
movl %eax, -0xb0(%rbp)
movq -0xe0(%rbp), %rax
movzbl 0x2(%rax), %eax
shll $0x8, %eax
xorl -0xec(%rbp), %eax
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0xb4(%rbp)
movq -0xa8(%rbp), %rax
movq -0xe0(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
movl 0x78(%rax,%rcx,4), %eax
shll $0x5, %eax
xorl -0xec(%rbp), %eax
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %eax
movq -0xa8(%rbp), %rcx
movq -0xe0(%rbp), %rdx
movzbl 0x4(%rdx), %edx
movl 0x78(%rcx,%rdx,4), %ecx
shll $0xa, %ecx
xorl %ecx, %eax
movq -0xa8(%rbp), %rcx
andl 0x38(%rcx), %eax
movl %eax, -0xd4(%rbp)
movq -0xa8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
movq -0xd0(%rbp), %rcx
movl -0xb0(%rbp), %edx
subl (%rcx,%rdx,4), %eax
movl %eax, -0xb8(%rbp)
movl -0xc0(%rbp), %eax
movq -0xd0(%rbp), %rcx
movl -0xb4(%rbp), %edx
subl 0x1000(%rcx,%rdx,4), %eax
movl %eax, -0xbc(%rbp)
movq -0xd0(%rbp), %rax
movl -0xd4(%rbp), %ecx
movl 0x41000(%rax,%rcx,4), %eax
movl %eax, -0xe4(%rbp)
movl -0xc0(%rbp), %edx
movq -0xd0(%rbp), %rax
movl -0xb0(%rbp), %ecx
movl %edx, (%rax,%rcx,4)
movl -0xc0(%rbp), %edx
movq -0xd0(%rbp), %rax
movl -0xb4(%rbp), %ecx
movl %edx, 0x1000(%rax,%rcx,4)
movl -0xc0(%rbp), %edx
movq -0xd0(%rbp), %rax
movl -0xd4(%rbp), %ecx
movl %edx, 0x41000(%rax,%rcx,4)
movq -0xa8(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0xac(%rbp)
movl -0xc0(%rbp), %eax
cmpl -0xac(%rbp), %eax
jae 0x74087
movl -0xc0(%rbp), %eax
movl %eax, -0xac(%rbp)
movl $0x4, -0xc4(%rbp)
movl -0xb8(%rbp), %eax
cmpl -0xac(%rbp), %eax
jae 0x74199
movq -0xe0(%rbp), %rax
movl -0xb8(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
movzbl (%rax,%rcx), %eax
movq -0xe0(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x74199
movq -0xa0(%rbp), %rax
movl $0x2, (%rax)
movl -0xb8(%rbp), %ecx
subl $0x1, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0xa0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xa0(%rbp)
movq -0xe0(%rbp), %rax
movl -0xb8(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
movzbl 0x2(%rax,%rcx), %eax
movq -0xe0(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jne 0x74129
jmp 0x74197
movl -0xbc(%rbp), %eax
cmpl -0xac(%rbp), %eax
jae 0x74190
movq -0xe0(%rbp), %rax
movl -0xbc(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
movzbl (%rax,%rcx), %eax
movq -0xe0(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x74190
movl -0xbc(%rbp), %ecx
subl $0x1, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0xa0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xa0(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0xb8(%rbp)
jmp 0x74195
jmp 0x743d6
jmp 0x74197
jmp 0x74207
movl -0xbc(%rbp), %eax
cmpl -0xac(%rbp), %eax
jae 0x74200
movq -0xe0(%rbp), %rax
movl -0xbc(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
movzbl (%rax,%rcx), %eax
movq -0xe0(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x74200
movl -0xbc(%rbp), %ecx
subl $0x1, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0xa0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xa0(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0xb8(%rbp)
jmp 0x74205
jmp 0x743d6
jmp 0x74207
movq -0xa0(%rbp), %rax
movl $0x3, -0x8(%rax)
movq -0xe0(%rbp), %rax
movl -0xb8(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
movzbl 0x3(%rax,%rcx), %eax
movq -0xe0(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
cmpl %ecx, %eax
je 0x74242
jmp 0x743d6
movl -0xb8(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
subq %rcx, %rax
movq %rax, -0xf8(%rbp)
movq -0xe0(%rbp), %rax
movl -0xc4(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x100(%rbp)
movq -0xe0(%rbp), %rax
movl -0xe8(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x108(%rbp)
movq -0x100(%rbp), %rax
cmpq -0x108(%rbp), %rax
je 0x742cc
movq -0x100(%rbp), %rax
movq -0xf8(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x100(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
je 0x742b6
jmp 0x742cc
jmp 0x742b8
movq -0x100(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x100(%rbp)
jmp 0x74284
movq -0x100(%rbp), %rax
movq -0xe0(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %ecx
movq -0xa0(%rbp), %rax
movl %ecx, -0x8(%rax)
movl -0xc4(%rbp), %eax
cmpl -0xe8(%rbp), %eax
jne 0x743d4
movl -0xe8(%rbp), %edi
movl -0xe4(%rbp), %esi
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %edx
movq -0xa8(%rbp), %rax
movq (%rax), %rcx
movq -0xa8(%rbp), %rax
movq 0x30(%rax), %r8
movq -0xa8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, %r9d
movq -0xa8(%rbp), %rax
movl 0x1c(%rax), %r10d
movq -0xa8(%rbp), %rax
movl 0x3c(%rax), %eax
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x70db0
movq -0xa8(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movq -0xa8(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
movl -0x10c(%rbp), %ecx
movq -0xa8(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x10c(%rbp), %eax
movq -0xa8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jne 0x743c1
movq -0xa8(%rbp), %rdi
callq 0x70830
movq -0xa0(%rbp), %rax
movq %rax, -0x90(%rbp)
jmp 0x747af
jmp 0x743d6
movl -0xe8(%rbp), %ebx
movl -0xe4(%rbp), %r11d
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %r10d
movq -0xa8(%rbp), %rax
movq (%rax), %r9
movq -0xa8(%rbp), %rax
movq 0x30(%rax), %r8
movq -0xa8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, %edi
movq -0xa8(%rbp), %rax
movl 0x1c(%rax), %esi
movq -0xa8(%rbp), %rax
movl 0x3c(%rax), %edx
movq -0xa0(%rbp), %rcx
movl -0xc4(%rbp), %eax
movl %ebx, -0x14(%rbp)
movl %r11d, -0x18(%rbp)
movl %r10d, -0x1c(%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 -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
shlq %rcx
shlq $0x2, %rcx
addq %rcx, %rax
addq $0x4, %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
shlq %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movl $0x0, -0x68(%rbp)
movl -0x1c(%rbp), %eax
subl -0x3c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
ja 0x744aa
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jae 0x74718
jmp 0x744b8
movl -0x1c(%rbp), %eax
subl -0x18(%rbp), %eax
movl %eax, -0x70(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x38(%rbp), %rax
movl -0x70(%rbp), %ecx
subq %rcx, %rax
movq %rax, -0x118(%rbp)
movl -0x70(%rbp), %eax
cmpq -0x38(%rbp), %rax
jbe 0x744f1
movl -0x3c(%rbp), %eax
movl %eax, -0x124(%rbp)
jmp 0x744fb
xorl %eax, %eax
movl %eax, -0x124(%rbp)
jmp 0x744fb
movq -0x120(%rbp), %rax
movq -0x118(%rbp), %rcx
movl -0x124(%rbp), %edx
movl %edx, %edx
addq %rdx, %rcx
shlq %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rax
movl -0x70(%rbp), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x68(%rbp), %eax
jae 0x7454a
movl -0x64(%rbp), %eax
movl %eax, -0x128(%rbp)
jmp 0x74553
movl -0x68(%rbp), %eax
movl %eax, -0x128(%rbp)
movl -0x128(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0x78(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x88(%rbp)
movq -0x80(%rbp), %rax
movl -0x84(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movq -0x28(%rbp), %rcx
movl -0x84(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x74676
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
cmpl -0x14(%rbp), %eax
je 0x745ff
movq -0x80(%rbp), %rax
movl -0x84(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movq -0x28(%rbp), %rcx
movl -0x84(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x745ff
jmp 0x745c5
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
cmpl -0x14(%rbp), %eax
je 0x745fd
movq -0x80(%rbp), %rax
movl -0x84(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movq -0x28(%rbp), %rcx
movl -0x84(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x745fb
jmp 0x745fd
jmp 0x745c5
jmp 0x745ff
movl -0x4c(%rbp), %eax
cmpl -0x84(%rbp), %eax
jae 0x74674
movl -0x84(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x84(%rbp), %ecx
movq -0x48(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x48(%rbp)
movl %ecx, (%rax)
movl -0x70(%rbp), %ecx
subl $0x1, %ecx
movq -0x48(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x48(%rbp)
movl %ecx, (%rax)
movl -0x84(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x74672
movl -0x88(%rbp), %ecx
movq -0x60(%rbp), %rax
movl %ecx, (%rax)
movq -0x78(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x58(%rbp), %rax
movl %ecx, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x74734
jmp 0x74674
jmp 0x74676
movq -0x80(%rbp), %rax
movl -0x84(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movq -0x28(%rbp), %rcx
movl -0x84(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jge 0x746c0
movl -0x18(%rbp), %ecx
movq -0x60(%rbp), %rax
movl %ecx, (%rax)
movq -0x78(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x78(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x60(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x68(%rbp)
jmp 0x746e3
movl -0x18(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, (%rax)
movq -0x78(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x40(%rbp), %ecx
addl $-0x1, %ecx
movl %ecx, -0x40(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x129(%rbp)
je 0x74708
movl -0x6c(%rbp), %eax
cmpl -0x18(%rbp), %eax
setb %al
movb %al, -0x129(%rbp)
movb -0x129(%rbp), %al
testb $0x1, %al
jne 0x744b8
jmp 0x74718
movq -0x60(%rbp), %rax
movl $0x0, (%rax)
movq -0x58(%rbp), %rax
movl $0x0, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa8(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movq -0xa8(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, -0x110(%rbp)
movl -0x110(%rbp), %ecx
movq -0xa8(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x110(%rbp), %eax
movq -0xa8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jne 0x747a1
movq -0xa8(%rbp), %rdi
callq 0x70830
movq -0xa0(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %rbp
retq