// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/src/../HDiffPatch/compress_plugin_demo.h
// Function: lzma_compress(hdiff_TCompress const*, hpatch_TStreamOutput const*, hpatch_TStreamInput const*)
static hpatch_StreamPos_t _lzma_compress(const hdiff_TCompress* compressPlugin,
                                             const hpatch_TStreamOutput* out_code,
                                             const hpatch_TStreamInput*  in_data){
        const TCompressPlugin_lzma* plugin=(const TCompressPlugin_lzma*)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 CLzmaEncHandle   s=0;
#else
        CLzmaEncHandle          s=0;
#endif
        CLzmaEncProps      props;
        unsigned char      properties_buf[LZMA_PROPS_SIZE+1];
        SizeT              properties_size=LZMA_PROPS_SIZE;
        SRes               ret;
        hpatch_uint32_t    dictSize=plugin->dict_size;
        if (!s) s=LzmaEnc_Create(&__lzma_enc_alloc);
        if (!s) _compress_error_return("LzmaEnc_Create()");
        LzmaEncProps_Init(&props);
        props.level=plugin->compress_level;
        props.dictSize=dictSize;
        props.reduceSize=in_data->streamSize;
        props.numThreads=plugin->thread_num;
        LzmaEncProps_Normalize(&props);
        if (SZ_OK!=LzmaEnc_SetProps(s,&props)) _compress_error_return("LzmaEnc_SetProps()");
#       if (IS_NOTICE_compress_canceled)
        printf("  (used one lzma dictSize: %" PRIu64 "  (input data: %" PRIu64 "))\n",
               (hpatch_StreamPos_t)props.dictSize,in_data->streamSize);
#       endif
        
        //save properties_size+properties
        assert(LZMA_PROPS_SIZE<256);
        if (SZ_OK!=LzmaEnc_WriteProperties(s,properties_buf+1,&properties_size))
            _compress_error_return("LzmaEnc_WriteProperties()");
        properties_buf[0]=(unsigned char)properties_size;
        
        if (1+properties_size!=__lzma_SeqOutStream_Write(&outStream.base,properties_buf,1+properties_size))
            _compress_error_return("out_code->write()");
        
        ret=LzmaEnc_Encode(s,&outStream.base,&inStream.base,0,&__lzma_enc_alloc,&__lzma_enc_alloc);
        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("LzmaEnc_Encode()");
        }
    clear:
#if (!IS_REUSE_compress_handle)
        if (s) { LzmaEnc_Destroy(s,&__lzma_enc_alloc,&__lzma_enc_alloc); s=0; }
#endif
        _check_compress_result(result,outStream.isCanceled,"_lzma_compress()",errAt);
        return result;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
leaq 0xd40(%rip), %rax       # 0x6aa5
movq %rax, 0x18(%rsp)
movq %rsi, 0x20(%rsp)
xorl %eax, %eax
movq %rax, 0x28(%rsp)
movl $0x0, 0x30(%rsp)
leaq 0xd60(%rip), %rcx       # 0x6ae5
movq %rcx, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movq $0x5, 0x10(%rsp)
movl 0x2c(%rdi), %ebp
leaq 0x76729(%rip), %rdi     # 0x7c4d0
callq 0x3320b
testq %rax, %rax
je 0x5dff
movq %rax, %rbx
leaq 0x50(%rsp), %r13
movq %r13, %rdi
callq 0x32ccc
movl 0x28(%r12), %eax
movl %eax, (%r13)
movl %ebp, 0x4(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x38(%r13)
movl 0x30(%r12), %eax
movl %eax, 0x30(%r13)
movq %r13, %rdi
callq 0x32d02
movq %rbx, %rdi
movq %r13, %rsi
callq 0x330d9
testl %eax, %eax
je 0x5e08
leaq 0x5375d(%rip), %r14     # 0x5955a
jmp 0x5e3b
leaq 0x535ff(%rip), %r14     # 0x59405
jmp 0x5e4d
movl 0x54(%rsp), %esi
movq 0x8(%r15), %rdx
leaq 0x53756(%rip), %rdi     # 0x5956d
xorl %eax, %eax
callq 0x4060
leaq 0xb(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x3630f
testl %eax, %eax
je 0x5e8e
leaq 0x53768(%rip), %r14     # 0x595a3
leaq 0x7668e(%rip), %rdx     # 0x7c4d0
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x33340
cmpl $0x0, 0x30(%rsp)
je 0x5e65
leaq 0x5410f(%rip), %rdi     # 0x59f6a
callq 0x44e0
xorl %r15d, %r15d
jmp 0x5e79
leaq 0x53762(%rip), %rdi     # 0x595ce
xorl %r15d, %r15d
movq %r14, %rsi
xorl %eax, %eax
callq 0x4060
movq %r15, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %r15
movb %r15b, 0xa(%rsp)
incq %r15
je 0x5eb7
leaq (%rsp,%r15), %rcx
addq $0xa, %rcx
leaq 0xa(%rsp), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq *0x18(%r14)
testl %eax, %eax
je 0x5f2b
leaq 0x18(%rsp), %rsi
movq %r15, 0x10(%rsi)
leaq 0x76609(%rip), %r8      # 0x7c4d0
leaq 0x38(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
movq %r8, %r9
callq 0x3623a
testl %eax, %eax
je 0x5eff
cmpl $0x8, %eax
je 0x5ef3
cmpl $0x9, %eax
je 0x5f33
leaq 0x536cf(%rip), %r14     # 0x595bd
jmp 0x5e3b
leaq 0x53259(%rip), %r14     # 0x59153
jmp 0x5e3b
movq 0x28(%rsp), %r15
leaq 0x765c5(%rip), %rdx     # 0x7c4d0
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x33340
testq %r15, %r15
jne 0x5e79
leaq 0x54d53(%rip), %r14     # 0x5ac79
jmp 0x5e4d
movl $0x1, 0x30(%rsp)
leaq 0x53207(%rip), %r14     # 0x59141
jmp 0x5e3b