// File: /workspace/github_cpp_makefile_star2_O2/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 $0x48, %rsp
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %r15
movl $0x10088, %edi          # imm = 0x10088
callq 0x4430
movq %rax, %rbx
testq %rax, %rax
je 0x5878
leaq 0x8088(%rbx), %rcx
leaq 0x7(%rbx), %r14
andq $-0x8, %r14
leaq 0x48983(%rip), %rsi     # 0x4e132
movq %rcx, %rax
subq %r14, %rax
jbe 0x587f
movq %rcx, 0x38(%rsp)
movq %r12, 0x40(%rsp)
cmpq $0x88, %rax
jbe 0x5ad6
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 0x48a5d(%rip), %rax     # 0x4e293
pushq $0x8
popq %rdx
movq %r12, %rdi
pushq $0x70
pushq %rax
callq 0x406aa
popq %rcx
popq %rdx
testl %eax, %eax
movq %r13, %rsi
jne 0x587f
cmpl $0x0, 0x34(%r15)
je 0x58aa
leaq 0x30(%r15), %rdx
addq $0x31, %r15
xorl %r13d, %r13d
movq %rbp, %rdi
xorl %esi, %esi
movq %r15, %rcx
callq *0x18(%rbp)
testl %eax, %eax
je 0x5a04
pushq $0x1
popq %r13
jmp 0x58ad
leaq 0x488a6(%rip), %rsi     # 0x4e125
leaq 0x48900(%rip), %rdi     # 0x4e186
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x4060
movq %rbx, %rdi
callq 0x43d0
movq %r13, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
movl $0x8000, %ecx           # imm = 0x8000
xorl %esi, %esi
movq %rbx, 0x18(%rsp)
movq 0x40(%rsp), %rbp
movq 0x8(%rbp), %r15
movb $0x1, %al
movq %rax, 0x10(%rsp)
subq %rsi, %r15
jbe 0x5a89
movq %r13, 0x30(%rsp)
cmpq %rcx, %r15
cmovaeq %rcx, %r15
movq 0x38(%rsp), %r13
leaq (%r13,%r15), %rcx
movq %rbp, %rdi
movq %r13, %rdx
movq %rsi, %rbx
callq *0x10(%rbp)
testl %eax, %eax
je 0x5a92
addq %r15, %rbx
movq 0x8(%rbp), %rax
movq %rax, 0x28(%rsp)
movq %r13, 0x18(%r14)
movl %r15d, 0x20(%r14)
movl $0x0, 0xc(%rsp)
movq 0x30(%rsp), %r13
movq %rbx, %rax
movq 0x18(%rsp), %rbx
movq %rax, 0x20(%rsp)
xorl %ebp, %ebp
movl 0x38(%r14), %eax
movq 0x10(%r14), %r15
xorl %ecx, %ecx
cmpq %rax, %r15
seta %cl
orl %ebp, %ecx
jne 0x5998
cmpl $0x0, 0x20(%r14)
je 0x595a
movq %r12, %rdi
xorl %esi, %esi
callq 0x4126a
testl %eax, %eax
je 0x592c
jmp 0x59e3
cmpl $0x0, 0xc(%rsp)
jne 0x5976
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x28(%rsp), %rax
je 0x592c
jmp 0x59d6
movq %r12, %rdi
pushq $0x4
popq %rsi
callq 0x4126a
xorl %ebp, %ebp
pushq $0x1
popq %rcx
movl %ecx, 0xc(%rsp)
cmpl $0x1, %eax
sete %bpl
jbe 0x592c
jmp 0x5aca
movq 0x8(%r14), %rdx
subq %rax, %r15
je 0x59c1
movq (%r14), %rdi
leaq (%rdx,%r15), %rcx
movq %r13, %rsi
callq *0x18(%rdi)
testl %eax, %eax
je 0x5aa6
addq %r15, %r13
movq 0x8(%r14), %rdx
movl 0x10(%r14), %eax
movq %rdx, 0x30(%r14)
movl %eax, 0x38(%r14)
testl %ebp, %ebp
movq 0x20(%rsp), %rax
je 0x592a
movl $0x8000, %ecx           # imm = 0x8000
movq %rax, %rsi
jmp 0x58b9
leaq 0x488af(%rip), %rsi     # 0x4e299
leaq 0x488c5(%rip), %rdi     # 0x4e2b6
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x4060
leaq 0x48761(%rip), %r15     # 0x4e163
jmp 0x5a12
leaq 0x48736(%rip), %r15     # 0x4e141
movb $0x1, %al
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x50(%r14)
je 0x5a4f
movq %r12, %rdi
callq 0x4095e
movl %eax, %ebp
movl $0x88, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x41f0
cmpl $-0x3, %ebp
je 0x5a5e
testl %ebp, %ebp
je 0x5a5e
movq %r15, %rsi
cmpb $0x0, (%r15)
leaq 0x48730(%rip), %rax     # 0x4e179
cmoveq %rax, %rsi
jmp 0x5a6a
movl $0x88, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x41f0
testq %r13, %r13
movq %r15, %rsi
jne 0x5890
cmpb $0x0, 0x10(%rsp)
jne 0x587f
leaq 0x49521(%rip), %rdi     # 0x4ef9d
callq 0x4510
xorl %r13d, %r13d
jmp 0x5890
leaq 0x4a1e9(%rip), %r15     # 0x4fc79
jmp 0x5a12
xorl %r13d, %r13d
leaq 0x486b7(%rip), %r15     # 0x4e153
movq 0x18(%rsp), %rbx
jmp 0x5a12
leaq 0x49557(%rip), %rdi     # 0x4f004
callq 0x4510
leaq 0x486aa(%rip), %r15     # 0x4e163
xorl %r13d, %r13d
movq $0x0, 0x10(%rsp)
jmp 0x5a12
leaq 0x487d2(%rip), %rsi     # 0x4e2a3
jmp 0x59ea
leaq 0x486de(%rip), %rdi     # 0x4e1bb
leaq 0x48702(%rip), %rsi     # 0x4e1e6
leaq 0x48724(%rip), %rcx     # 0x4e20f
movl $0x8d, %edx
callq 0x4230