// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0xb0, %rsp
movq %rdx, %r15
movq %rdi, %r12
leaq 0x53c(%rip), %rax       # 0x6bfd
movq %rax, 0x18(%rsp)
movq %rsi, 0x20(%rsp)
xorl %r14d, %r14d
movq %r14, 0x28(%rsp)
movl $0x0, 0x30(%rsp)
leaq 0x55b(%rip), %rax       # 0x6c3d
movq %rax, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movq %r14, 0x48(%rsp)
movb $0x0, 0x17(%rsp)
movl 0x2c(%rdi), %ebp
leaq 0x75dd0(%rip), %rdi     # 0x7c4d0
movq %rdi, %rsi
callq 0x3248e
movq %rax, %rbx
testq %rax, %rax
je 0x6765
leaq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0x322bc
movl 0x28(%r12), %eax
movl %eax, (%r14)
movl %ebp, 0x4(%r14)
movq 0x8(%r15), %rax
movq %rax, 0x38(%r14)
movq $0x0, 0x48(%r14)
movl 0x30(%r12), %eax
movl %eax, 0x58(%r14)
movq %r14, %rdi
callq 0x322de
movq %rbx, %rdi
movq %r14, %rsi
callq 0x325fd
testl %eax, %eax
je 0x6793
leaq 0x52cb6(%rip), %r15     # 0x59416
xorl %r14d, %r14d
jmp 0x676c
leaq 0x52c99(%rip), %r15     # 0x59405
testq %rbx, %rbx
je 0x6779
movq %rbx, %rdi
callq 0x3254c
testq %r14, %r14
jne 0x67e7
cmpl $0x0, 0x30(%rsp)
je 0x67d6
leaq 0x53844(%rip), %rdi     # 0x59fd0
callq 0x44e0
jmp 0x67e7
movl 0x54(%rsp), %esi
movq 0x8(%r15), %rdx
leaq 0x52c88(%rip), %rdi     # 0x5942a
xorl %eax, %eax
callq 0x4060
movq %rbx, %rdi
callq 0x32661
leaq 0x18(%rsp), %rcx
movb %al, -0x1(%rcx)
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
leaq 0x17(%rsp), %rdx
callq *0x18(%rdi)
testl %eax, %eax
je 0x67fa
incq 0x28(%rsp)
jmp 0x6802
leaq 0x52c97(%rip), %rdi     # 0x59474
movq %r15, %rsi
xorl %eax, %eax
callq 0x4060
movq %r14, %rax
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, 0x30(%rsp)
leaq 0x52938(%rip), %r15     # 0x59141
testl %eax, %eax
je 0x6760
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
xorl %r14d, %r14d
leaq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %r8
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x32692
cmpl $0x9, %eax
je 0x6760
cmpl $0x8, %eax
je 0x6857
testl %eax, %eax
jne 0x6863
leaq 0x5442c(%rip), %r15     # 0x5ac79
movq 0x28(%rsp), %r14
jmp 0x676c
leaq 0x528f5(%rip), %r15     # 0x59153
jmp 0x676c
leaq 0x52bf7(%rip), %r15     # 0x59461
jmp 0x6760