// File: sisong[P]ApkDiffPatch/src/patch/Zipper.cpp
// Function: Zipper_file_append_stream::_append_part_input(hpatch_TStreamOutput const*, unsigned long long, unsigned char const*, unsigned char const*)
hpatch_BOOL Zipper_file_append_stream::_append_part_input(const hpatch_TStreamOutput* stream,hpatch_StreamPos_t pos,
                                                          const unsigned char *part_data,
                                                          const unsigned char *part_data_end){
    Zipper_file_append_stream* append_state=(Zipper_file_append_stream*)stream->streamImport;
    assert(append_state->inputPos==pos);
    size_t partSize=(size_t)(part_data_end-part_data);
    append_state->inputPos+=partSize;
    if (append_state->inputPos>append_state->streamSize) return hpatch_FALSE;//error
    int is_data_end=(append_state->inputPos==append_state->streamSize);
#if (_IS_USED_MULTITHREAD)
    if (append_state->threadWork){
        memcpy(append_state->threadWork->inputData+append_state->inputPos-partSize,part_data,partSize);
        return hpatch_TRUE;
    } else
#endif
    if (append_state->compressHandle){
        hpatch_StreamPos_t curWritedPos=append_state->outputPos;
        if(!append_state->compressor->compressPart(append_state->compressHandle,part_data,
                                part_data_end,is_data_end,&curWritedPos)) return hpatch_FALSE;//error
        assert(curWritedPos==append_state->outputPos);
        return hpatch_TRUE;
    }else{
        return _append_part_output(stream,append_state->outputPos,part_data,part_data_end);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0x81ff3
jmp 0x82012
leaq 0x31f5d(%rip), %rdi     # 0xb3f57
leaq 0x31989(%rip), %rsi     # 0xb398a
movl $0x502, %edx            # imm = 0x502
leaq 0x31f66(%rip), %rcx     # 0xb3f73
callq 0x4270
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
addq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jbe 0x8204f
movl $0x0, -0x4(%rbp)
jmp 0x82147
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x8(%rcx), %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x820aa
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rax
addq 0x20(%rax), %rdi
xorl %eax, %eax
subq -0x38(%rbp), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x4320
movl $0x1, -0x4(%rbp)
jmp 0x82147
movq -0x30(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x8212b
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x48(%rcx), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl -0x3c(%rbp), %ecx
leaq -0x48(%rbp), %r8
callq *%rax
testb $0x1, %al
jne 0x820f3
movl $0x0, -0x4(%rbp)
jmp 0x82147
movq -0x48(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x28(%rcx), %rax
jne 0x82103
jmp 0x82122
leaq 0x31f0a(%rip), %rdi     # 0xb4014
leaq 0x31879(%rip), %rsi     # 0xb398a
movl $0x511, %edx            # imm = 0x511
leaq 0x31e56(%rip), %rcx     # 0xb3f73
callq 0x4270
movl $0x1, -0x4(%rbp)
jmp 0x82147
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x82150
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq