// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movl $0x10088, %edi          # imm = 0x10088
callq 0x4400
movb $0x1, %bpl
testq %rax, %rax
movq %rax, 0x20(%rsp)
je 0x62f8
movq %r15, 0x28(%rsp)
leaq 0x8088(%rax), %r13
movq %r13, 0x48(%rsp)
leaq 0x7(%rax), %r12
andq $-0x8, %r12
subq %r12, %r13
jbe 0x6301
cmpq $0x88, %r13
jbe 0x666f
movl 0x28(%r14), %eax
movl %eax, 0x8(%rsp)
movl 0x2c(%r14), %eax
movl %eax, 0x14(%rsp)
xorl %r15d, %r15d
movl $0x88, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x41c0
leaq 0x88(%r12), %rax
movq %rax, 0x8(%r12)
addq $-0x88, %r13
movq %r13, 0x10(%r12)
movq %rbx, (%r12)
leaq 0x18(%r12), %rdi
movq %rax, 0x30(%r12)
movl %r13d, 0x38(%r12)
movsbl 0x30(%r14), %ecx
movl 0x38(%r14), %r9d
leaq 0x52fbd(%rip), %rax     # 0x59293
movl 0x8(%rsp), %esi
movl $0x8, %edx
movl 0x14(%rsp), %r8d
pushq $0x70
pushq %rax
callq 0x4ab1f
addq $0x10, %rsp
testl %eax, %eax
cmoveq %r12, %r15
jmp 0x6304
leaq 0x52e26(%rip), %r12     # 0x59125
jmp 0x6361
xorl %r15d, %r15d
testq %r15, %r15
movq 0x28(%rsp), %r8
je 0x635a
leaq 0x54964(%rip), %r12     # 0x5ac79
cmpl $0x0, 0x34(%r14)
je 0x6372
leaq 0x30(%r14), %rdx
addq $0x31, %r14
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rcx
movq %r8, %r14
callq *0x18(%rbx)
movq %r14, %r8
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movq %rcx, 0x8(%rsp)
leaq 0x54931(%rip), %rax     # 0x5ac79
leaq 0x52df2(%rip), %r12     # 0x59141
cmovneq %rax, %r12
jne 0x637b
jmp 0x65c0
leaq 0x52dd1(%rip), %r12     # 0x59132
movq $0x0, 0x8(%rsp)
xorl %r15d, %r15d
jmp 0x65c0
movq $0x0, 0x8(%rsp)
movq %r12, 0x30(%rsp)
leaq 0x18(%r15), %rbx
movl $0x0, 0x18(%rsp)
xorl %r14d, %r14d
movq %rbx, 0x40(%rsp)
movq 0x8(%r8), %rbx
subq %r14, %rbx
jbe 0x65b2
movl $0x8000, %eax           # imm = 0x8000
cmpq %rax, %rbx
cmovaeq %rax, %rbx
movq 0x48(%rsp), %r13
leaq (%r13,%rbx), %r12
movq %r8, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %r8, %rbp
callq *0x10(%r8)
testl %eax, %eax
je 0x6554
addq %r14, %rbx
movq 0x8(%rbp), %rax
movq %rax, 0x50(%rsp)
movq %r13, 0x18(%r15)
subl %r13d, %r12d
movl %r12d, 0x20(%r15)
movl $0x1, 0x1c(%rsp)
xorl %r12d, %r12d
leaq 0x5487e(%rip), %r13     # 0x5ac79
movl $0x0, 0x14(%rsp)
movq %rbx, %rbp
movq 0x40(%rsp), %rbx
movl 0x38(%r15), %eax
movq 0x10(%r15), %r14
xorl %ecx, %ecx
cmpq %rax, %r14
seta %cl
orl %r12d, %ecx
jne 0x643a
cmpl $0x0, 0x20(%r15)
je 0x648a
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4b75d
testl %eax, %eax
je 0x640b
jmp 0x6521
subq %rax, %r14
je 0x646b
movq %r13, 0x38(%rsp)
movq (%r15), %rdi
movq 0x8(%r15), %rdx
leaq (%rdx,%r14), %rcx
movq 0x8(%rsp), %r13
movq %r13, %rsi
callq *0x18(%rdi)
testl %eax, %eax
je 0x64a6
addq %r14, %r13
movq %r13, 0x8(%rsp)
movq 0x38(%rsp), %r13
movq 0x8(%r15), %rax
movq %rax, 0x30(%r15)
movl 0x10(%r15), %eax
movl %eax, 0x38(%r15)
testl %r12d, %r12d
sete %al
testb %al, %al
jne 0x640b
jmp 0x6513
cmpl $0x0, 0x14(%rsp)
jne 0x64cf
movl $0x1, 0x14(%rsp)
cmpq 0x50(%rsp), %rbp
je 0x640b
jmp 0x6513
movq 0x38(%rsp), %r13
cmpb $0x0, (%r13)
leaq 0x52c8a(%rip), %rax     # 0x59141
cmoveq %rax, %r13
movl $0x0, 0x1c(%rsp)
movl $0x1, 0x18(%rsp)
xorl %eax, %eax
jmp 0x6481
movq %rbx, %rdi
movl $0x4, %esi
callq 0x4b75d
xorl %r12d, %r12d
cmpl $0x1, %eax
sete %cl
jbe 0x64ff
cmpb $0x0, (%r13)
leaq 0x52db0(%rip), %rdx     # 0x592a3
cmoveq %rdx, %r13
movl $0x0, 0x1c(%rsp)
movb %cl, %r12b
movl $0x1, 0x14(%rsp)
cmpl $0x2, %eax
jb 0x640b
movq %r13, %rsi
cmpl $0x0, 0x1c(%rsp)
sete %r13b
jmp 0x6537
cmpb $0x0, (%r13)
leaq 0x52d6c(%rip), %rax     # 0x59299
cmoveq %rax, %r13
movq %r13, %rsi
movb $0x1, %r13b
movb $0x1, %r12b
testb %r13b, %r13b
je 0x6563
cmpl $0x0, 0x18(%rsp)
je 0x656a
leaq 0x53ab7(%rip), %rdi     # 0x5a004
callq 0x44e0
jmp 0x6578
leaq 0x52bf8(%rip), %rax     # 0x59153
movq %rbp, %r8
movq %r14, %rbp
jmp 0x6589
movq 0x28(%rsp), %r8
jmp 0x65a6
leaq 0x52d45(%rip), %rdi     # 0x592b6
xorl %eax, %eax
callq 0x4060
leaq 0x52be4(%rip), %rax     # 0x59163
testb %r13b, %r13b
movq 0x28(%rsp), %r8
je 0x65a6
movq 0x30(%rsp), %rcx
cmpb $0x0, (%rcx)
cmoveq %rax, %rcx
movq %rcx, 0x30(%rsp)
movq $0x0, 0x8(%rsp)
xorl %r12d, %r12d
movq %rbp, %r14
testb %r12b, %r12b
jne 0x6394
cmpl $0x0, 0x18(%rsp)
sete %bpl
movq 0x30(%rsp), %r12
testq %r15, %r15
je 0x661d
cmpq $0x0, 0x50(%r15)
je 0x660e
leaq 0x18(%r15), %rdi
callq 0x4adf5
movl %eax, %ebx
movl $0x88, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x41c0
cmpl $-0x3, %ebx
je 0x661d
testl %ebx, %ebx
movq 0x20(%rsp), %rbx
movq 0x8(%rsp), %r14
je 0x6627
cmpb $0x0, (%r12)
leaq 0x52b74(%rip), %rax     # 0x59179
cmoveq %rax, %r12
xorl %r14d, %r14d
jmp 0x6627
movl $0x88, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x41c0
movq 0x20(%rsp), %rbx
movq 0x8(%rsp), %r14
testq %r14, %r14
jne 0x6650
testb %bpl, %bpl
je 0x6644
leaq 0x52b4e(%rip), %rdi     # 0x59186
movq %r12, %rsi
xorl %eax, %eax
callq 0x4060
jmp 0x6650
leaq 0x53952(%rip), %rdi     # 0x59f9d
callq 0x44e0
testq %rbx, %rbx
je 0x665d
movq %rbx, %rdi
callq 0x43b0
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x52b45(%rip), %rdi     # 0x591bb
leaq 0x52b69(%rip), %rsi     # 0x591e6
leaq 0x52b8b(%rip), %rcx     # 0x5920f
movl $0x8d, %edx
callq 0x4200