// File: sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HPatchLite/hpatch_lite.c
// Function: patch_add_old_withClip
static hpi_BOOL _patch_add_old_withClip(hpatchi_listener_t* old_and_new,_TInputCache* diff,hpi_BOOL isNotNeedSubDiff,
                                        hpi_size_t oldPos,hpi_size_t addLength,hpi_byte* temp_cache){
    while (addLength>0){
        hpi_size_t decodeStep=diff->cache_end;
        if (!isNotNeedSubDiff){
            decodeStep-=diff->cache_begin;
            if (decodeStep==0){
                _cache_update(diff);
                decodeStep=diff->cache_end-diff->cache_begin;
            }
        }
        _CHECK(decodeStep>0);
        if (decodeStep>addLength)
            decodeStep=(hpi_size_t)addLength;
        _CHECK(old_and_new->read_old(old_and_new,oldPos,temp_cache,(hpi_pos_t)decodeStep));
        if (!isNotNeedSubDiff){
            addData(temp_cache,diff->cache_buf+diff->cache_begin,decodeStep);
            diff->cache_begin+=decodeStep;
        }
        _CHECK(old_and_new->write_new(old_and_new,temp_cache,decodeStep));
        oldPos+=decodeStep;
        addLength-=decodeStep;
    }
    return hpi_TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movl %edx, -0x2c(%rbp)
movl %ecx, -0x30(%rbp)
movl %r8d, -0x34(%rbp)
movq %r9, -0x40(%rbp)
cmpl $0x0, -0x34(%rbp)
jbe 0x1854a
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x18457
movq -0x28(%rbp), %rax
movl (%rax), %ecx
movl -0x44(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jne 0x18455
movq -0x28(%rbp), %rdi
callq 0x17e00
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x28(%rbp), %rcx
subl (%rcx), %eax
movl %eax, -0x44(%rbp)
jmp 0x18457
cmpl $0x0, -0x44(%rbp)
ja 0x18469
movl $0x0, -0x18(%rbp)
jmp 0x18551
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jbe 0x18477
movl -0x34(%rbp), %eax
movl %eax, -0x44(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rdi
movl -0x30(%rbp), %esi
movq -0x40(%rbp), %rdx
movl -0x44(%rbp), %ecx
callq *%rax
cmpl $0x0, %eax
jne 0x184a0
movl $0x0, -0x18(%rbp)
jmp 0x18551
cmpl $0x0, -0x2c(%rbp)
jne 0x1850e
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movl (%rax), %eax
addq %rax, %rcx
movl -0x44(%rbp), %eax
movq %rdx, -0x8(%rbp)
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x14(%rbp)
cmpl $0x0, %eax
je 0x18503
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movzbl (%rax), %edx
movq -0x8(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x8(%rbp)
movzbl (%rax), %ecx
addl %edx, %ecx
movb %cl, (%rax)
jmp 0x184c9
movl -0x44(%rbp), %ecx
movq -0x28(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x44(%rbp), %edx
callq *%rax
cmpl $0x0, %eax
jne 0x18531
movl $0x0, -0x18(%rbp)
jmp 0x18551
movl -0x44(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x44(%rbp), %ecx
movl -0x34(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x34(%rbp)
jmp 0x1840e
movl $0x1, -0x18(%rbp)
movl -0x18(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)