// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/src/../HDiffPatch/compress_plugin_demo.h
// Function: lzma2_compress(hdiff_TCompress const*, hpatch_TStreamOutput const*, hpatch_TStreamInput const*)
static hpatch_StreamPos_t _lzma2_compress(const hdiff_TCompress* compressPlugin,
                                              const hpatch_TStreamOutput* out_code,
                                              const hpatch_TStreamInput*  in_data){
        const TCompressPlugin_lzma2* plugin=(const TCompressPlugin_lzma2*)compressPlugin;
        struct __lzma_SeqOutStream_t outStream={{__lzma_SeqOutStream_Write},out_code,0,0};
        struct __lzma_SeqInStream_t  inStream={{__lzma_SeqInStream_Read},in_data,0};
        hpatch_StreamPos_t result=0;
        const char*        errAt="";
#if (IS_REUSE_compress_handle)
        static CLzma2EncHandle  s=0;
#else
        CLzma2EncHandle         s=0;
#endif
        CLzma2EncProps     props;
        Byte               properties_size=0;
        SRes               ret;
        hpatch_uint32_t    dictSize=plugin->dict_size;
        if (!s) s=Lzma2Enc_Create(&__lzma_enc_alloc,&__lzma_enc_alloc);
        if (!s) _compress_error_return("LzmaEnc_Create()");
        Lzma2EncProps_Init(&props);
        props.lzmaProps.level=plugin->compress_level;
        props.lzmaProps.dictSize=dictSize;
        props.lzmaProps.reduceSize=in_data->streamSize;
        props.blockSize=LZMA2_ENC_PROPS_BLOCK_SIZE_AUTO;
        props.numTotalThreads=plugin->thread_num;
        Lzma2EncProps_Normalize(&props);
        if (SZ_OK!=Lzma2Enc_SetProps(s,&props)) _compress_error_return("Lzma2Enc_SetProps()");
#       if (IS_NOTICE_compress_canceled)
        printf("  (used one lzma2 dictSize: %" PRIu64 "  (input data: %" PRIu64 "))\n",
               (hpatch_StreamPos_t)props.lzmaProps.dictSize,in_data->streamSize);
#       endif
        
        //save properties_size+properties
        assert(LZMA_PROPS_SIZE<256);
        properties_size=Lzma2Enc_WriteProperties(s);
        
        if (1!=__lzma_SeqOutStream_Write(&outStream.base,&properties_size,1))
            _compress_error_return("out_code->write()");
        
        ret=Lzma2Enc_Encode2(s,&outStream.base,0,0,&inStream.base,0,0,0);
        if (SZ_OK==ret){
            result=outStream.writeToPos;
        }else{//fail
            if (ret==SZ_ERROR_READ)
                _compress_error_return("in_data->read()");
            else if (ret==SZ_ERROR_WRITE)
                _compress_error_return("out_code->write()");
            else
                _compress_error_return("Lzma2Enc_Encode2()");
        }
    clear:
#if (!IS_REUSE_compress_handle)
        if (s) { Lzma2Enc_Destroy(s); s=0; }
#endif
        _check_compress_result(result,outStream.isCanceled,"_lzma2_compress()",errAt);
        return result;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
leaq 0x540(%rip), %rax       # 0x6aa5
movq %rax, 0x20(%rsp)
movq %rsi, 0x28(%rsp)
xorl %eax, %eax
movq %rax, 0x30(%rsp)
movl $0x0, 0x38(%rsp)
leaq 0x560(%rip), %rcx       # 0x6ae5
movq %rcx, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
movq %rax, 0x50(%rsp)
movb $0x0, 0x1f(%rsp)
movl 0x2c(%rdi), %ebp
leaq 0x75f2d(%rip), %rdi     # 0x7c4d0
movq %rdi, %rsi
callq 0x320be
testq %rax, %rax
je 0x6609
movq %rax, %rbx
leaq 0x58(%rsp), %r13
movq %r13, %rdi
callq 0x31ef0
movl 0x28(%r12), %eax
movl %eax, (%r13)
movl %ebp, 0x4(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x38(%r13)
movq $0x0, 0x48(%r13)
movl 0x30(%r12), %eax
movl %eax, 0x58(%r13)
movq %r13, %rdi
callq 0x31f12
movq %rbx, %rdi
movq %r13, %rsi
callq 0x32229
testl %eax, %eax
je 0x6615
leaq 0x52e12(%rip), %r14     # 0x59416
jmp 0x66a4
leaq 0x52df5(%rip), %r14     # 0x59405
jmp 0x66ac
movl 0x5c(%rsp), %esi
movq 0x8(%r15), %rdx
leaq 0x52e06(%rip), %rdi     # 0x5942a
xorl %eax, %eax
callq 0x4060
movq %rbx, %rdi
callq 0x3228d
leaq 0x20(%rsp), %rcx
movb %al, -0x1(%rcx)
leaq 0x1f(%rsp), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq *0x18(%r14)
testl %eax, %eax
je 0x668c
leaq 0x20(%rsp), %rsi
movq $0x1, 0x10(%rsi)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
leaq 0x40(%rsp), %r8
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x322be
testl %eax, %eax
je 0x66ed
cmpl $0x8, %eax
je 0x669d
cmpl $0x9, %eax
je 0x6694
leaq 0x52dd7(%rip), %r14     # 0x59461
jmp 0x66a4
movl $0x1, 0x38(%rsp)
leaq 0x52aa6(%rip), %r14     # 0x59141
jmp 0x66a4
leaq 0x52aaf(%rip), %r14     # 0x59153
movq %rbx, %rdi
callq 0x32178
cmpl $0x0, 0x38(%rsp)
je 0x66c4
leaq 0x53916(%rip), %rdi     # 0x59fd0
callq 0x44e0
xorl %r15d, %r15d
jmp 0x66d8
leaq 0x52da9(%rip), %rdi     # 0x59474
xorl %r15d, %r15d
movq %r14, %rsi
xorl %eax, %eax
callq 0x4060
movq %r15, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%rsp), %r15
movq %rbx, %rdi
callq 0x32178
testq %r15, %r15
jne 0x66d8
leaq 0x54573(%rip), %r14     # 0x5ac79
jmp 0x66ac