// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/lzma/C/LzFind.c
// Function: SkipMatchesSpec
static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
    size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue)
{
  CLzRef *ptr0 = son + ((size_t)_cyclicBufferPos << 1) + 1;
  CLzRef *ptr1 = son + ((size_t)_cyclicBufferPos << 1);
  unsigned len0 = 0, len1 = 0;

  UInt32 cmCheck;

  cmCheck = (UInt32)(pos - _cyclicBufferSize);
  if ((UInt32)pos <= _cyclicBufferSize)
    cmCheck = 0;

  if (// curMatch >= pos ||  // failure
      cmCheck < curMatch)
  do
  {
    const UInt32 delta = pos - curMatch;
    {
      CLzRef *pair = son + ((size_t)(_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
      const Byte *pb = cur - delta;
      unsigned len = (len0 < len1 ? len0 : len1);
      if (pb[len] == cur[len])
      {
        while (++len != lenLimit)
          if (pb[len] != cur[len])
            break;
        {
          if (len == lenLimit)
          {
            *ptr1 = pair[0];
            *ptr0 = pair[1];
            return;
          }
        }
      }
      if (pb[len] < cur[len])
      {
        *ptr1 = curMatch;
        curMatch = pair[1];
        ptr1 = pair + 1;
        len1 = len;
      }
      else
      {
        *ptr0 = curMatch;
        curMatch = pair[0];
        ptr0 = pair;
        len0 = len;
      }
    }
  }
  while(--cutValue && cmCheck < curMatch);
  
  *ptr0 = *ptr1 = kEmptyHashValue;
  return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r14
movl 0x38(%rsp), %eax
leaq (%r8,%r9,8), %rcx
movq %rcx, -0x18(%rsp)
leaq (%r8,%r9,8), %rcx
addq $0x4, %rcx
movq %rcx, -0x20(%rsp)
xorl %ecx, %ecx
movl %edx, -0xc(%rsp)
subl %eax, %edx
cmovbl %ecx, %edx
cmpl %esi, %edx
jae 0x387ad
movl 0x40(%rsp), %ebp
movl %eax, %eax
movq %rax, -0x8(%rsp)
decl %edi
xorl %r15d, %r15d
xorl %r12d, %r12d
movl -0xc(%rsp), %eax
subl %esi, %eax
movq %r9, %rcx
subq %rax, %rcx
movl $0x0, %r10d
cmovbq -0x8(%rsp), %r10
leaq (%rcx,%r10), %r13
movq %r14, %rcx
subq %rax, %rcx
cmpl %r12d, %r15d
movl %r12d, %r10d
cmovbl %r15d, %r10d
leaq (%r8,%r13,8), %r13
movb (%rcx,%r10), %al
cmpb (%r14,%r10), %al
jne 0x38764
cmpl %r10d, %edi
je 0x3874a
movl %r10d, %eax
leal 0x1(%rax), %r10d
movl %r10d, %r11d
movb (%rcx,%r11), %bl
cmpb (%r14,%r11), %bl
je 0x3872d
cmpl %eax, %edi
jne 0x38764
movl (%r13), %eax
movq -0x18(%rsp), %rcx
movl %eax, (%rcx)
movl 0x4(%r13), %eax
movq -0x20(%rsp), %rcx
movl %eax, (%rcx)
xorl %ecx, %ecx
jmp 0x3879d
movl %r10d, %eax
movb (%rcx,%rax), %cl
cmpb (%r14,%rax), %cl
jae 0x38782
movq -0x18(%rsp), %rax
movl %esi, (%rax)
addq $0x4, %r13
movq %r13, -0x18(%rsp)
jmp 0x38794
movq -0x20(%rsp), %rax
movl %esi, (%rax)
movl %r10d, %r15d
movl %r12d, %r10d
movq %r13, -0x20(%rsp)
movl (%r13), %esi
movb $0x1, %cl
movl %r10d, %r12d
testb %cl, %cl
je 0x387bd
decl %ebp
je 0x387ad
cmpl %esi, %edx
jb 0x386f3
xorl %eax, %eax
movq -0x18(%rsp), %rcx
movl %eax, (%rcx)
movq -0x20(%rsp), %rcx
movl %eax, (%rcx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq