// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl 0x14(%rdi), %ecx
cmpq $0x4, %rcx
ja 0x388e3
callq 0x38071
jmp 0x38afd
movq (%rdi), %rdx
movzbl (%rdx), %esi
leaq 0x1(%rdx), %rax
movq %rax, (%rsp)
movzbl 0x1(%rdx), %r8d
xorl 0x78(%rdi,%rsi,4), %r8d
movzbl 0x2(%rdx), %esi
shll $0x8, %esi
xorl %r8d, %esi
andl $0x3ff, %r8d            # imm = 0x3FF
movzwl %si, %r9d
movzbl 0x3(%rdx), %r10d
movl 0x78(%rdi,%r10,4), %r10d
shll $0x5, %r10d
movzbl 0x4(%rdx), %r11d
movl 0x78(%rdi,%r11,4), %r14d
shll $0xa, %r14d
xorl %r10d, %r14d
xorl %esi, %r14d
andl 0x38(%rdi), %r14d
movq 0x28(%rdi), %r15
movl 0x8(%rdi), %r12d
movl %r12d, %r11d
subl (%r15,%r8,4), %r11d
movl %r12d, %r10d
subl 0x1000(%r15,%r9,4), %r10d
movl 0x41000(%r15,%r14,4), %esi
movl %r12d, (%r15,%r8,4)
movl %r12d, 0x1000(%r15,%r9,4)
movl %r12d, 0x41000(%r15,%r14,4)
movl 0x1c(%rdi), %ebp
cmpl %ebp, %r12d
cmovbl %r12d, %ebp
cmpl %ebp, %r11d
jae 0x389b4
movl %r11d, %r9d
movq %rdx, %r8
subq %r9, %r8
movb (%r8), %r8b
cmpb (%rdx), %r8b
jne 0x389b4
negq %r9
movl $0x2, (%rbx)
decl %r11d
movl %r11d, 0x4(%rbx)
leaq 0x8(%rbx), %r15
movb 0x2(%rdx,%r9), %r8b
cmpb 0x2(%rdx), %r8b
jne 0x38b0f
movq %r15, %rbx
jmp 0x389e9
movl $0x4, %r8d
cmpl %ebp, %r10d
jae 0x38a3c
movl %r10d, %r9d
movq %rdx, %r11
subq %r9, %r11
movb (%r11), %r11b
cmpb (%rdx), %r11b
jne 0x38a3c
negq %r9
movl $0x8, %r8d
movl $0x4, %r11d
decl %r10d
movl %r10d, (%rbx,%r11)
addq %r8, %rbx
movl $0x3, -0x8(%rbx)
movb 0x3(%rdx,%r9), %r10b
movl $0x4, %r8d
cmpb 0x3(%rdx), %r10b
jne 0x38a3c
leaq 0x4(%rdx), %r8
leaq (%rdx,%rcx), %r10
leaq -0x4(%rcx), %r11
movb (%r8,%r9), %bpl
cmpb (%r8), %bpl
jne 0x38a21
incq %r8
decq %r11
jne 0x38a0d
movq %r10, %r8
subl %edx, %r8d
movl %r8d, -0x8(%rbx)
cmpl %r8d, %ecx
jne 0x38a3c
movq 0x30(%rdi), %rcx
movl 0x18(%rdi), %edx
movl %esi, (%rcx,%rdx,4)
jmp 0x38ae1
movq %rbx, %r15
movl 0x8(%rdi), %r9d
movl 0x18(%rdi), %r10d
movq 0x30(%rdi), %r11
movl 0x1c(%rdi), %ebp
movl 0x3c(%rdi), %r14d
movl %esi, (%r11,%r10,4)
movq %r15, %rbx
testl %esi, %esi
je 0x38ae1
movl %r9d, %r15d
subl %esi, %r15d
cmpl %ebp, %r15d
jae 0x38ae1
movl %r15d, %r12d
movq %r10, %rsi
subq %r12, %rsi
cmpl %r10d, %r15d
movl $0x0, %r13d
cmoval %ebp, %r13d
leaq (%r11,%rsi,4), %rsi
movl (%rsi,%r13,4), %esi
movl %r8d, %r13d
movb (%rdx,%r13), %al
subq %r12, %r13
cmpb (%rdx,%r13), %al
jne 0x38acd
negq %r12
addq %rdx, %r12
xorl %r13d, %r13d
movb (%rdx,%r13), %al
cmpb (%r12,%r13), %al
jne 0x38ab7
incq %r13
cmpq %r13, %rcx
jne 0x38aa3
jmp 0x38ad4
cmpl %r13d, %r8d
jae 0x38acd
movl %r13d, (%rbx)
decl %r15d
movl %r15d, 0x4(%rbx)
addq $0x8, %rbx
movl %r13d, %r8d
decl %r14d
jne 0x38a59
jmp 0x38ae1
movl %ecx, (%rbx)
decl %r15d
movl %r15d, 0x4(%rbx)
addq $0x8, %rbx
incl 0x18(%rdi)
movq (%rsp), %rax
movq %rax, (%rdi)
movl 0x8(%rdi), %eax
incl %eax
movl %eax, 0x8(%rdi)
cmpl 0xc(%rdi), %eax
jne 0x38afd
callq 0x38085
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %r8d
cmpl %ebp, %r10d
jae 0x38a3f
movl %r10d, %r9d
movq %rdx, %r11
subq %r9, %r11
movb (%r11), %r11b
cmpb (%rdx), %r11b
jne 0x38a3f
negq %r9
movl $0x10, %r8d
movl $0xc, %r11d
jmp 0x389df