// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/src/../HDiffPatch/compress_plugin_demo.h
// Function: zlib_compress(hdiff_TCompress const*, hpatch_TStreamOutput const*, hpatch_TStreamInput const*)
static hpatch_StreamPos_t _zlib_compress(const hdiff_TCompress* compressPlugin,
                                             const hpatch_TStreamOutput* out_code,
                                             const hpatch_TStreamInput*  in_data){
        const TCompressPlugin_zlib* plugin=(const TCompressPlugin_zlib*)compressPlugin;
        hpatch_StreamPos_t result=0; //writedPos
        hpatch_StreamPos_t readFromPos=0;
        const char*        errAt="";
        int                 outStream_isCanceled=0;
        unsigned char*     _temp_buf=0;
        unsigned char*     data_buf=0;
        _zlib_TCompress*   self=0;
        _temp_buf=(unsigned char*)malloc(sizeof(_zlib_TCompress)+kCompressBufSize*2);
        if (!_temp_buf) _compress_error_return("memory alloc");
        self=_zlib_compress_open_by(compressPlugin,plugin->compress_level,plugin->mem_level,
                                    out_code,_temp_buf,sizeof(_zlib_TCompress)+kCompressBufSize);
        data_buf=_temp_buf+sizeof(_zlib_TCompress)+kCompressBufSize;
        if (!self) _compress_error_return("deflateInit2()");
        if (plugin->isNeedSaveWindowBits){
            const unsigned char* pchar=(const unsigned char*)&plugin->windowBits;
            if (!out_code->write(out_code,0,pchar,pchar+1)) _compress_error_return("out_code->write()");
            ++result;
        }
        while (readFromPos<in_data->streamSize){
            size_t readLen=kCompressBufSize;
            if (readLen>(hpatch_StreamPos_t)(in_data->streamSize-readFromPos))
                readLen=(size_t)(in_data->streamSize-readFromPos);
            if (!in_data->read(in_data,readFromPos,data_buf,data_buf+readLen))
                _compress_error_return("in_data->read()");
            readFromPos+=readLen;
            if (!_zlib_compress_part(self,data_buf,data_buf+readLen,
                                     (readFromPos==in_data->streamSize),&result,&outStream_isCanceled))
                _compress_error_return("_zlib_compress_part()");
        }
    clear:
        if (!_zlib_compress_close_by(compressPlugin,self))
            { result=kCompressFailResult; if (strlen(errAt)==0) errAt="deflateEnd()"; }
        _check_compress_result(result,outStream_isCanceled,"_zlib_compress()",errAt);
        if (_temp_buf) free(_temp_buf);
        return result;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %r15
movl $0x10088, %edi          # imm = 0x10088
callq 0x4400
movq %rax, %rbx
testq %rax, %rax
je 0x62a1
leaq 0x8088(%rbx), %rcx
leaq 0x7(%rbx), %r14
andq $-0x8, %r14
leaq 0x52f71(%rip), %rsi     # 0x59132
movq %rcx, %rax
subq %r14, %rax
jbe 0x62a8
movq %rcx, 0x30(%rsp)
movq %r12, 0x20(%rsp)
cmpq $0x88, %rax
jbe 0x650e
movq %rsi, %r13
movl 0x28(%r15), %esi
movl 0x2c(%r15), %r8d
leaq 0x18(%r14), %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%r14)
movups %xmm0, 0x38(%r14)
movups %xmm0, 0x78(%r14)
movups %xmm0, 0x68(%r14)
movups %xmm0, 0x58(%r14)
movups %xmm0, 0x48(%r14)
movups %xmm0, 0x18(%r14)
leaq 0x88(%r14), %rcx
movq %rcx, 0x8(%r14)
addq $-0x88, %rax
movq %rax, 0x10(%r14)
movq %rbp, (%r14)
movq %rcx, 0x30(%r14)
movl %eax, 0x38(%r14)
movsbl 0x30(%r15), %ecx
movl 0x38(%r15), %r9d
leaq 0x5304b(%rip), %rax     # 0x59293
movq %r12, %rdi
movl $0x8, %edx
pushq $0x70
pushq %rax
callq 0x49e97
addq $0x10, %rsp
testl %eax, %eax
movq %r13, %rsi
jne 0x62a8
movq %r12, 0x18(%rsp)
cmpl $0x0, 0x34(%r15)
je 0x62d8
leaq 0x30(%r15), %rdx
addq $0x31, %r15
xorl %r13d, %r13d
movq %rbp, %rdi
xorl %esi, %esi
movq %r15, %rcx
callq *0x18(%rbp)
movl $0x1, %ecx
testl %eax, %eax
jne 0x62da
leaq 0x52eac(%rip), %r15     # 0x59141
movb $0x1, %al
movq %rax, 0x10(%rsp)
jmp 0x6456
leaq 0x52e7d(%rip), %rsi     # 0x59125
leaq 0x52ed7(%rip), %rdi     # 0x59186
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x4060
testq %rbx, %rbx
je 0x62c6
movq %rbx, %rdi
callq 0x43b0
movq %r13, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ecx, %ecx
movq 0x20(%rsp), %rax
movq 0x8(%rax), %r15
leaq 0x5498f(%rip), %rdx     # 0x5ac79
movb $0x1, %al
movq %rax, 0x10(%rsp)
testq %r15, %r15
je 0x6450
movq %rcx, 0x8(%rsp)
movl $0x8000, %eax           # imm = 0x8000
xorl %r12d, %r12d
subq %r12, %r15
cmpq %rax, %r15
cmovaeq %rax, %r15
movq 0x30(%rsp), %r13
leaq (%r13,%r15), %rcx
movq 0x20(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq *0x10(%rbp)
testl %eax, %eax
je 0x64cf
addq %r15, %r12
movq 0x8(%rbp), %rax
movq %rax, 0x28(%rsp)
movq %r13, 0x18(%r14)
movl %r15d, 0x20(%r14)
movl $0x0, 0x4(%rsp)
movq 0x18(%rsp), %r13
xorl %ebp, %ebp
movl 0x38(%r14), %eax
movq 0x10(%r14), %r15
xorl %ecx, %ecx
cmpq %rax, %r15
seta %cl
orl %ebp, %ecx
jne 0x63c2
cmpl $0x0, 0x20(%r14)
je 0x6385
movq %r13, %rdi
xorl %esi, %esi
callq 0x4ab03
testl %eax, %eax
je 0x6357
jmp 0x642f
cmpl $0x0, 0x4(%rsp)
jne 0x639d
movl $0x1, 0x4(%rsp)
cmpq 0x28(%rsp), %r12
je 0x6357
jmp 0x640a
movq %r13, %rdi
movl $0x4, %esi
callq 0x4ab03
xorl %ebp, %ebp
movl $0x1, 0x4(%rsp)
cmpl $0x1, %eax
sete %bpl
jbe 0x6357
jmp 0x6502
movq 0x8(%r14), %rdx
subq %rax, %r15
je 0x63fa
movq (%r14), %rdi
leaq (%rdx,%r15), %rcx
movq 0x8(%rsp), %r13
movq %r13, %rsi
callq *0x18(%rdi)
testl %eax, %eax
je 0x64de
addq %r15, %r13
movq %r13, 0x8(%rsp)
movq 0x8(%r14), %rdx
movl 0x10(%r14), %eax
movq 0x18(%rsp), %r13
movq %rdx, 0x30(%r14)
movl %eax, 0x38(%r14)
testl %ebp, %ebp
je 0x6355
movq 0x20(%rsp), %rax
movq 0x8(%rax), %r15
cmpq %r15, %r12
movl $0x8000, %eax           # imm = 0x8000
jb 0x6307
movq 0x8(%rsp), %r13
leaq 0x5484c(%rip), %r15     # 0x5ac79
jmp 0x6456
leaq 0x52e63(%rip), %rsi     # 0x59299
leaq 0x52e79(%rip), %rdi     # 0x592b6
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x4060
leaq 0x52d15(%rip), %r15     # 0x59163
jmp 0x6456
movq %rcx, %r13
movq %rdx, %r15
cmpq $0x0, 0x50(%r14)
je 0x6495
movq 0x18(%rsp), %rdi
callq 0x4a16a
movl %eax, %ebp
movl $0x88, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x41c0
cmpl $-0x3, %ebp
je 0x64a4
testl %ebp, %ebp
je 0x64a4
movq %r15, %rsi
cmpb $0x0, (%r15)
leaq 0x52cea(%rip), %rax     # 0x59179
cmoveq %rax, %rsi
jmp 0x64b0
movl $0x88, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x41c0
testq %r13, %r13
movq %r15, %rsi
jne 0x62b9
cmpb $0x0, 0x10(%rsp)
jne 0x62a8
leaq 0x53adb(%rip), %rdi     # 0x59f9d
callq 0x44e0
xorl %r13d, %r13d
jmp 0x62b9
leaq 0x52c7d(%rip), %r15     # 0x59153
xorl %r13d, %r13d
jmp 0x6456
leaq 0x53b1f(%rip), %rdi     # 0x5a004
callq 0x44e0
leaq 0x52c72(%rip), %r15     # 0x59163
xorl %r13d, %r13d
movq $0x0, 0x10(%rsp)
jmp 0x6456
leaq 0x52d9a(%rip), %rsi     # 0x592a3
jmp 0x6436
leaq 0x52ca6(%rip), %rdi     # 0x591bb
leaq 0x52cca(%rip), %rsi     # 0x591e6
leaq 0x52cec(%rip), %rcx     # 0x5920f
movl $0x8d, %edx
callq 0x4200