// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r12
movq %rdi, %r14
movl 0x14(%rdi), %edi
cmpq $0x4, %rdi
ja 0x313c7
movq %r14, %rdi
callq 0x2fd7d
jmp 0x31728
movq (%r14), %rcx
movzbl (%rcx), %edx
movzbl 0x1(%rcx), %eax
xorl 0x78(%r14,%rdx,4), %eax
movzbl 0x2(%rcx), %r10d
shll $0x8, %r10d
xorl %eax, %r10d
andl $0x3ff, %eax            # imm = 0x3FF
movzwl %r10w, %r8d
movzbl 0x3(%rcx), %edx
movl 0x78(%r14,%rdx,4), %edx
shll $0x5, %edx
movzbl 0x4(%rcx), %esi
movl 0x78(%r14,%rsi,4), %r9d
shll $0xa, %r9d
xorl %edx, %r9d
xorl %r10d, %r9d
andl 0x38(%r14), %r9d
movq 0x28(%r14), %r10
movl 0x8(%r14), %r11d
movl %r11d, %edx
subl (%r10,%rax,4), %edx
movl %r11d, %ebx
subl 0x1000(%r10,%r8,4), %ebx
movl 0x41000(%r10,%r9,4), %esi
movl %r11d, (%r10,%rax,4)
movl %r11d, 0x1000(%r10,%r8,4)
movl %r11d, 0x41000(%r10,%r9,4)
movl 0x1c(%r14), %r8d
cmpl %r8d, %r11d
cmovbl %r11d, %r8d
pushq $0x4
popq %r13
cmpl %r8d, %edx
jae 0x3148f
movl %edx, %eax
movq %rcx, %r9
subq %rax, %r9
movb (%r9), %r9b
cmpb (%rcx), %r9b
jne 0x3148f
negq %rax
movl $0x2, (%r12)
decl %edx
movl %edx, 0x4(%r12)
leaq 0x8(%r12), %rdx
movb 0x2(%rcx,%rax), %r9b
cmpb 0x2(%rcx), %r9b
jne 0x314f8
movq %rdx, %r12
jmp 0x314bd
cmpl %r8d, %ebx
jae 0x3156d
movl %ebx, %eax
movq %rcx, %rdx
subq %rax, %rdx
movb (%rdx), %dl
cmpb (%rcx), %dl
jne 0x3156d
negq %rax
pushq $0x8
popq %rdx
pushq $0x4
popq %r8
decl %ebx
movl %ebx, (%r12,%r8)
addq %rdx, %r12
movl $0x3, -0x8(%r12)
movb 0x3(%rcx,%rax), %dl
cmpb 0x3(%rcx), %dl
jne 0x3156d
leaq 0x4(%rcx), %r9
leaq (%rcx,%rdi), %r13
movq %rdi, %rdx
addq $-0x4, %rdx
testq %rdx, %rdx
je 0x3151f
movb (%r9,%rax), %r8b
cmpb (%r9), %r8b
jne 0x3151c
incq %r9
decq %rdx
jmp 0x314e2
cmpl %r8d, %ebx
jae 0x31517
movl %ebx, %eax
movq %rcx, %r8
subq %rax, %r8
movb (%r8), %r8b
cmpb (%rcx), %r8b
jne 0x31517
negq %rax
pushq $0x10
popq %rdx
pushq $0xc
jmp 0x314b2
movq %rdx, %r12
jmp 0x3156d
movq %r9, %r13
subl %ecx, %r13d
movl %r13d, -0x8(%r12)
cmpl %r13d, %edi
jne 0x3156d
movq 0x30(%r14), %r8
movl 0x8(%r14), %edx
movl 0x18(%r14), %r9d
movl 0x1c(%r14), %eax
movl 0x3c(%r14), %r10d
pushq %r10
pushq %rax
callq 0x2ffe0
popq %rax
popq %rcx
incl 0x18(%r14)
incq (%r14)
movl 0x8(%r14), %eax
incl %eax
movl %eax, 0x8(%r14)
cmpl 0xc(%r14), %eax
jne 0x31728
movq %r14, %rdi
jmp 0x31723
leaq 0x1(%rcx), %rax
movq %rax, 0x20(%rsp)
movl 0x8(%r14), %r15d
movl 0x18(%r14), %eax
movq 0x30(%r14), %rdx
movl 0x1c(%r14), %r8d
leaq (%rdx,%rax,8), %r11
movq %rax, 0x40(%rsp)
movq %rdx, 0x18(%rsp)
leaq (%rdx,%rax,8), %rax
addq $0x4, %rax
xorl %r9d, %r9d
movl %r15d, %edx
movl %r8d, 0x10(%rsp)
subl %r8d, %edx
movl $0x0, 0x8(%rsp)
cmovbl %r9d, %edx
movl %edx, 0xc(%rsp)
cmpl %esi, %edx
movq %r14, 0x28(%rsp)
jae 0x316ff
movl 0x3c(%r14), %edx
xorl %ebp, %ebp
movl %r15d, 0x4(%rsp)
movl %r15d, %r9d
subl %esi, %r9d
movq 0x40(%rsp), %r10
movq %r10, %r8
subq %r9, %r8
cmpl %r10d, %r9d
movl $0x0, %r10d
cmoval 0x10(%rsp), %r10d
addq %r8, %r10
movq %rcx, %rbx
subq %r9, %rbx
movl 0x8(%rsp), %r8d
cmpl %ebp, %r8d
movl %ebp, 0x14(%rsp)
movl %ebp, %r14d
cmovbl %r8d, %r14d
movq 0x18(%rsp), %r8
leaq (%r8,%r10,8), %r8
movb (%rbx,%r14), %bpl
cmpb (%rcx,%r14), %bpl
jne 0x316c4
movq %r11, 0x38(%rsp)
leal 0x1(%r14), %r15d
movl %edi, %ebp
cmpl %edi, %r15d
je 0x31684
movq %rax, 0x30(%rsp)
movq %r13, %rax
movq %rdi, %r13
movq %r12, %rdi
movl %r15d, %r12d
movb (%rbx,%r12), %r11b
movl %r15d, %ebp
cmpb (%rcx,%r12), %r11b
movq %rdi, %r12
movq %r13, %rdi
movq %rax, %r13
movq 0x30(%rsp), %rax
jne 0x31684
addl $0x2, %r14d
cmpl %r14d, %edi
je 0x31682
movl %r14d, %r11d
movb (%rbx,%r11), %bpl
incl %r14d
cmpb (%rcx,%r11), %bpl
je 0x31665
decl %r14d
movl %r14d, %ebp
jmp 0x31684
movl %edi, %ebp
cmpl %ebp, %r13d
movq 0x38(%rsp), %r11
jae 0x316bc
movq 0x18(%rsp), %r14
movl (%r14,%r10,8), %r10d
movl %ebp, (%r12)
decl %r9d
movl %r9d, 0x4(%r12)
addq $0x8, %r12
cmpl %edi, %ebp
movl 0x4(%rsp), %r15d
je 0x3173a
movl %ebp, %r13d
movl %ebp, %r14d
jmp 0x316c4
movl %ebp, %r14d
movl 0x4(%rsp), %r15d
movl %r14d, %r9d
movb (%rbx,%r9), %r10b
cmpb (%rcx,%r9), %r10b
jae 0x316e0
movl %esi, (%r11)
addq $0x4, %r8
movq %r8, %r11
movl %r14d, %ebp
jmp 0x316ee
movl %esi, (%rax)
movq %r8, %rax
movl %r14d, 0x8(%rsp)
movl 0x14(%rsp), %ebp
decl %edx
je 0x316ff
movl (%r8), %esi
cmpl %esi, 0xc(%rsp)
jb 0x315d2
andl $0x0, (%r11)
andl $0x0, (%rax)
movq 0x28(%rsp), %rdi
incl 0x18(%rdi)
movq 0x20(%rsp), %rax
movq %rax, (%rdi)
movl 0x8(%rdi), %eax
incl %eax
movl %eax, 0x8(%rdi)
cmpl 0xc(%rdi), %eax
jne 0x31728
callq 0x2fd91
movq %r12, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r10d, (%r11)
movq %rax, %rcx
movl 0x4(%r8), %eax
movl %eax, (%rcx)
jmp 0x31706