// File: /workspace/github_cpp_makefile_star2_O3/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, %rbx
movq %rdi, %r14
movl 0x14(%rdi), %edi
cmpq $0x2, %rdi
ja 0x38ee3
movq %r14, %rdi
callq 0x38071
jmp 0x39196
movq (%r14), %r10
movzbl (%r10), %eax
movzbl 0x1(%r10), %edx
xorl 0x78(%r14,%rax,4), %edx
movzbl 0x2(%r10), %eax
shll $0x8, %eax
xorl %edx, %eax
andl $0x3ff, %edx            # imm = 0x3FF
andl 0x38(%r14), %eax
movq 0x28(%r14), %r8
movl 0x8(%r14), %r9d
movl %r9d, %ecx
subl (%r8,%rdx,4), %ecx
movl 0x1000(%r8,%rax,4), %esi
movl %r9d, (%r8,%rdx,4)
movl %r9d, 0x1000(%r8,%rax,4)
movl 0x1c(%r14), %r15d
cmpl %r15d, %r9d
cmovael %r15d, %r9d
movl $0x2, %eax
movq %rax, 0x18(%rsp)
cmpl %r9d, %ecx
jae 0x38fe0
movl %ecx, %edx
movq %r10, %r8
subq %rdx, %r8
movb (%r8), %r8b
cmpb (%r10), %r8b
jne 0x38fe0
leaq 0x2(%r10), %rax
negq %rdx
leaq (%r10,%rdi), %r8
movq %rdi, %r9
addq $-0x2, %r9
movb (%rax,%rdx), %r11b
cmpb (%rax), %r11b
jne 0x38f83
incq %rax
decq %r9
jne 0x38f6f
movq %r8, %rax
subl %r10d, %eax
movl %eax, (%rbx)
decl %ecx
movl %ecx, 0x4(%rbx)
addq $0x8, %rbx
movl 0x1c(%r14), %r15d
movq %rax, 0x18(%rsp)
cmpl %eax, %edi
jne 0x38fe0
movq 0x30(%r14), %r8
movl 0x8(%r14), %edx
movl 0x18(%r14), %r9d
movl 0x3c(%r14), %eax
movq %r10, %rcx
pushq %rax
pushq %r15
callq 0x382f2
addq $0x10, %rsp
incl 0x18(%r14)
incq (%r14)
movl 0x8(%r14), %eax
incl %eax
movl %eax, 0x8(%r14)
cmpl 0xc(%r14), %eax
jne 0x39196
movq %r14, %rdi
jmp 0x39191
movq %rbx, 0x8(%rsp)
leaq 0x1(%r10), %rcx
movq %rcx, 0x40(%rsp)
movl 0x8(%r14), %ecx
movl 0x18(%r14), %edx
movq 0x30(%r14), %r8
leaq (%r8,%rdx,8), %rax
movq %rax, 0x10(%rsp)
movq %rdx, 0x50(%rsp)
movq %r8, 0x38(%rsp)
leaq (%r8,%rdx,8), %r13
addq $0x4, %r13
xorl %eax, %eax
movl %ecx, 0x28(%rsp)
subl %r15d, %ecx
cmovbl %eax, %ecx
movl %ecx, 0x24(%rsp)
cmpl %esi, %ecx
movq %r14, 0x48(%rsp)
jae 0x39162
movl 0x3c(%r14), %edx
xorl %r9d, %r9d
xorl %r14d, %r14d
movq %r15, 0x30(%rsp)
movl 0x28(%rsp), %eax
movl %eax, %ebp
subl %esi, %ebp
movq 0x50(%rsp), %rax
movq %rax, %rcx
subq %rbp, %rcx
cmpl %eax, %ebp
movl $0x0, %ebx
cmoval %r15d, %ebx
addq %rcx, %rbx
movq %r10, %rcx
subq %rbp, %rcx
cmpl %r14d, %r9d
movl %r14d, %r11d
cmovbl %r9d, %r11d
movq 0x38(%rsp), %rax
leaq (%rax,%rbx,8), %r8
movb (%rcx,%r11), %r12b
cmpb (%r10,%r11), %r12b
movl %r9d, 0x2c(%rsp)
jne 0x39120
movq %r13, %rax
movq %rdi, %r9
leal 0x1(%r11), %r13d
movl %r9d, %r12d
cmpl %r9d, %r13d
je 0x390d4
movl %r13d, %r15d
movb (%rcx,%r15), %r9b
movl %r13d, %r12d
cmpb (%r10,%r15), %r9b
jne 0x390d4
addl $0x2, %r11d
movq %rdi, %r12
cmpl %r11d, %r12d
je 0x390d4
movl %r11d, %r9d
movb (%rcx,%r9), %r15b
incl %r11d
cmpb (%r10,%r9), %r15b
je 0x390b7
decl %r11d
movl %r11d, %r12d
jmp 0x390d4
cmpl %r12d, 0x18(%rsp)
movq %rax, %r13
jae 0x39118
movq 0x38(%rsp), %rax
movl (%rax,%rbx,8), %eax
movq 0x8(%rsp), %r9
movl %r12d, (%r9)
decl %ebp
movl %ebp, 0x4(%r9)
addq $0x8, %r9
movq %r9, 0x8(%rsp)
cmpl %edi, %r12d
movq 0x30(%rsp), %r15
je 0x391a8
movl %r12d, %eax
movq %rax, 0x18(%rsp)
movl %r12d, %r11d
jmp 0x39120
movl %r12d, %r11d
movq 0x30(%rsp), %r15
movl %r11d, %r9d
movb (%rcx,%r9), %cl
cmpb (%r10,%r9), %cl
jae 0x39147
movq 0x10(%rsp), %rax
movl %esi, (%rax)
addq $0x4, %r8
movq %r8, 0x10(%rsp)
movl %r11d, %r14d
movl 0x2c(%rsp), %r9d
jmp 0x39151
movl %esi, (%r13)
movq %r8, %r13
movl %r11d, %r9d
decl %edx
je 0x39162
movl (%r8), %esi
cmpl %esi, 0x24(%rsp)
jb 0x39041
xorl %eax, %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
movl %eax, (%r13)
movq 0x8(%rsp), %rbx
movq 0x48(%rsp), %rdi
incl 0x18(%rdi)
movq 0x40(%rsp), %rax
movq %rax, (%rdi)
movl 0x8(%rdi), %eax
incl %eax
movl %eax, 0x8(%rdi)
cmpl 0xc(%rdi), %eax
jne 0x39196
callq 0x38085
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
movl 0x4(%r8), %eax
jmp 0x3916b