// File: /workspace/github_cpp_makefile_star2_O1/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, %r13
movq %rdi, %rbx
movl 0x14(%rdi), %eax
cmpq $0x2, %rax
ja 0x3934c
movq %rbx, %rdi
callq 0x383da
jmp 0x39604
movq %rax, 0x8(%rsp)
movq (%rbx), %r11
movzbl (%r11), %eax
movzbl 0x1(%r11), %edx
xorl 0x78(%rbx,%rax,4), %edx
movzbl 0x2(%r11), %eax
shll $0x8, %eax
xorl %edx, %eax
andl $0x3ff, %edx            # imm = 0x3FF
andl 0x38(%rbx), %eax
movq 0x28(%rbx), %r8
movl 0x8(%rbx), %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(%rbx), %edx
cmpl %edx, %r9d
cmovbl %r9d, %edx
movl $0x2, %eax
cmpl %edx, %ecx
jae 0x39444
movl %ecx, %edx
movq %r11, %r8
subq %rdx, %r8
movb (%r8), %r8b
cmpb (%r11), %r8b
jne 0x39444
leaq 0x2(%r11), %rax
negq %rdx
movq 0x8(%rsp), %r9
leaq (%r11,%r9), %r8
addq $-0x2, %r9
movb (%rax,%rdx), %r10b
cmpb (%rax), %r10b
jne 0x393ea
incq %rax
decq %r9
jne 0x393d6
movq %r8, %rax
subl %r11d, %eax
movl %eax, (%r13)
decl %ecx
movl %ecx, 0x4(%r13)
addq $0x8, %r13
movq 0x8(%rsp), %rdi
cmpl %eax, %edi
jne 0x39444
movq 0x30(%rbx), %r8
movl 0x8(%rbx), %edx
movl 0x18(%rbx), %r9d
movl 0x1c(%rbx), %eax
movl 0x3c(%rbx), %r10d
movq %r11, %rcx
pushq %r10
pushq %rax
callq 0x386a6
addq $0x10, %rsp
incl 0x18(%rbx)
incq (%rbx)
movl 0x8(%rbx), %eax
incl %eax
movl %eax, 0x8(%rbx)
cmpl 0xc(%rbx), %eax
jne 0x39604
movq %rbx, %rdi
jmp 0x395ff
leaq 0x1(%r11), %rcx
movq %rcx, 0x40(%rsp)
movl 0x8(%rbx), %edx
movl 0x18(%rbx), %edi
movq 0x30(%rbx), %r8
movl 0x1c(%rbx), %r9d
leaq (%r8,%rdi,8), %rcx
movq %rcx, 0x10(%rsp)
movq %rdi, 0x50(%rsp)
movq %r8, 0x30(%rsp)
leaq (%r8,%rdi,8), %rcx
addq $0x4, %rcx
movq %rcx, 0x18(%rsp)
xorl %ecx, %ecx
movl %edx, 0x2c(%rsp)
movl %r9d, 0x28(%rsp)
subl %r9d, %edx
cmovbl %ecx, %edx
movl %edx, 0x24(%rsp)
cmpl %esi, %edx
movq %rbx, 0x48(%rsp)
jae 0x395cb
movl 0x3c(%rbx), %r9d
xorl %edi, %edi
xorl %ebx, %ebx
movq 0x8(%rsp), %rdx
movl 0x2c(%rsp), %ecx
movl %ecx, %ebp
subl %esi, %ebp
movq 0x50(%rsp), %r8
movq %r8, %rcx
subq %rbp, %rcx
cmpl %r8d, %ebp
movl $0x0, %r12d
cmoval 0x28(%rsp), %r12d
addq %rcx, %r12
movq %r11, %rcx
subq %rbp, %rcx
cmpl %ebx, %edi
movl %ebx, %r10d
cmovbl %edi, %r10d
movq 0x30(%rsp), %r8
leaq (%r8,%r12,8), %r8
movb (%rcx,%r10), %r14b
cmpb (%r11,%r10), %r14b
jne 0x3957f
leal 0x1(%r10), %r14d
cmpl %edx, %r14d
je 0x3953a
movq %r13, %rdx
movl %r14d, %r13d
movb (%rcx,%r13), %r15b
cmpb (%r11,%r13), %r15b
movq %rdx, %r13
movq 0x8(%rsp), %rdx
jne 0x3953a
addl $0x2, %r10d
cmpl %r10d, %edx
je 0x39537
movl %r10d, %r14d
movb (%rcx,%r14), %r15b
incl %r10d
cmpb (%r11,%r14), %r15b
je 0x3951a
decl %r10d
movl %r10d, %r14d
jmp 0x3953a
movl %edx, %r14d
cmpl %r14d, %eax
jae 0x3957c
movq 0x30(%rsp), %rax
movl (%rax,%r12,8), %eax
movl %r14d, (%r13)
decl %ebp
movl %ebp, 0x4(%r13)
addq $0x8, %r13
cmpl %edx, %r14d
jne 0x39579
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
movl 0x4(%r8), %eax
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
xorl %ecx, %ecx
movl %r14d, %eax
movq %r13, 0x38(%rsp)
jmp 0x395b8
movl %r14d, %eax
movl %r14d, %r10d
movl %r10d, %r14d
movb (%rcx,%r14), %cl
cmpb (%r11,%r14), %cl
jae 0x3959e
movq 0x10(%rsp), %rcx
movl %esi, (%rcx)
addq $0x4, %r8
movq %r8, 0x10(%rsp)
jmp 0x395b0
movq 0x18(%rsp), %rcx
movl %esi, (%rcx)
movq %r8, 0x18(%rsp)
movl %r10d, %edi
movl %ebx, %r10d
movl (%r8), %esi
movb $0x1, %cl
movl %r10d, %ebx
testb %cl, %cl
je 0x395dd
decl %r9d
je 0x395cb
cmpl %esi, 0x24(%rsp)
jb 0x394aa
xorl %ecx, %ecx
movq 0x10(%rsp), %rax
movl %ecx, (%rax)
movq 0x18(%rsp), %rax
movl %ecx, (%rax)
jmp 0x395e2
movq 0x38(%rsp), %r13
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 0x39604
callq 0x383ee
movq %r13, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq