// File: /workspace/github_cpp_makefile_star2_O2/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 %rsi, %r14
leaq 0x54e(%rip), %rax       # 0x6073
movq %rax, 0x20(%rsp)
movq %rsi, 0x28(%rsp)
andq $0x0, 0x30(%rsp)
andl $0x0, 0x38(%rsp)
movq %rdx, %r15
leaq 0x56f(%rip), %rax       # 0x60b3
movq %rax, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
andq $0x0, 0x50(%rsp)
movq %rdi, %r12
movb $0x0, 0x1f(%rsp)
movl 0x2c(%rdi), %ebp
leaq 0x6f97a(%rip), %rdi     # 0x754e0
movq %rdi, %rsi
callq 0x2a3b4
testq %rax, %rax
je 0x5bc9
movq %rax, %rbx
leaq 0x58(%rsp), %r13
movq %r13, %rdi
callq 0x2a1fc
movl 0x28(%r12), %eax
movl %eax, (%r13)
movl %ebp, 0x4(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x38(%r13)
andq $0x0, 0x48(%r13)
movl 0x30(%r12), %eax
movl %eax, 0x58(%r13)
movq %r13, %rdi
callq 0x2a215
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2a50d
testl %eax, %eax
je 0x5be9
leaq 0x48852(%rip), %r15     # 0x4e416
jmp 0x5c89
leaq 0x48835(%rip), %r15     # 0x4e405
leaq 0x4889d(%rip), %rdi     # 0x4e474
xorl %r14d, %r14d
movq %r15, %rsi
xorl %eax, %eax
callq 0x4060
jmp 0x5cb3
movl 0x5c(%rsp), %esi
movq 0x8(%r15), %rdx
leaq 0x48832(%rip), %rdi     # 0x4e42a
xorl %eax, %eax
callq 0x4060
movq %rbx, %rdi
callq 0x2a56d
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 0x5c68
leaq 0x20(%rsp), %rsi
movq $0x1, 0x10(%rsi)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
xorl %r14d, %r14d
leaq 0x40(%rsp), %r8
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x2a59b
cmpl $0x9, %eax
je 0x5c70
cmpl $0x8, %eax
je 0x5c79
testl %eax, %eax
jne 0x5c82
leaq 0x4a018(%rip), %r15     # 0x4fc79
movq 0x30(%rsp), %r14
jmp 0x5c8c
movl $0x1, 0x38(%rsp)
leaq 0x484ca(%rip), %r15     # 0x4e141
jmp 0x5c89
leaq 0x484d3(%rip), %r15     # 0x4e153
jmp 0x5c8c
leaq 0x487d8(%rip), %r15     # 0x4e461
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x2a449
testq %r14, %r14
jne 0x5cb3
cmpl $0x0, 0x38(%rsp)
je 0x5bd0
leaq 0x49325(%rip), %rdi     # 0x4efd0
callq 0x4510
xorl %r14d, %r14d
movq %r14, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq