// File: sisong[P]ApkDiffPatch/lzma/C/Lzma2Dec.c
// Function: Lzma2Dec_DecodeToBuf
SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
{
  SizeT outSize = *destLen, inSize = *srcLen;
  *srcLen = *destLen = 0;
  
  for (;;)
  {
    SizeT inCur = inSize, outCur, dicPos;
    ELzmaFinishMode curFinishMode;
    SRes res;
    
    if (p->decoder.dicPos == p->decoder.dicBufSize)
      p->decoder.dicPos = 0;
    dicPos = p->decoder.dicPos;
    curFinishMode = LZMA_FINISH_ANY;
    outCur = p->decoder.dicBufSize - dicPos;
    
    if (outCur >= outSize)
    {
      outCur = outSize;
      curFinishMode = finishMode;
    }

    res = Lzma2Dec_DecodeToDic(p, dicPos + outCur, src, &inCur, curFinishMode, status);
    
    src += inCur;
    inSize -= inCur;
    *srcLen += inCur;
    outCur = p->decoder.dicPos - dicPos;
    memcpy(dest, p->decoder.dic + dicPos, outCur);
    dest += outCur;
    outSize -= outCur;
    *destLen += outCur;
    if (res != 0)
      return res;
    if (outCur == 0 || outSize == 0)
      return SZ_OK;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jne 0xabc46
movq -0x10(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
subq -0x60(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x40(%rbp), %rax
jb 0xabc81
movq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
addq -0x58(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl -0x64(%rbp), %r8d
movq 0x10(%rbp), %r9
leaq -0x50(%rbp), %rcx
callq 0xab1d0
movl %eax, -0x68(%rbp)
movq -0x50(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rcx
movq -0x30(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
subq -0x60(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
addq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
callq 0x4320
movq -0x58(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x58(%rbp), %rcx
movq -0x40(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x58(%rbp), %rcx
movq -0x20(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
cmpl $0x0, -0x68(%rbp)
je 0xabd2e
movl -0x68(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xabd4a
cmpq $0x0, -0x58(%rbp)
je 0xabd3c
cmpq $0x0, -0x40(%rbp)
jne 0xabd45
movl $0x0, -0x4(%rbp)
jmp 0xabd4a
jmp 0xabc20
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)