// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x90, %rsp
leaq 0xc6b(%rip), %rax       # 0x6073
movq %rax, 0x10(%rsp)
movq %rsi, 0x18(%rsp)
andq $0x0, 0x20(%rsp)
andl $0x0, 0x28(%rsp)
movq %rdx, %r14
leaq 0xc8c(%rip), %rax       # 0x60b3
movq %rax, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
andq $0x0, 0x40(%rsp)
movq %rdi, %r15
movq $0x5, (%rsp)
movl 0x2c(%rdi), %ebp
leaq 0x70094(%rip), %rdi     # 0x754e0
callq 0x2b457
testq %rax, %rax
je 0x54a8
movq %rax, %rbx
leaq 0x48(%rsp), %r12
movq %r12, %rdi
callq 0x2af30
movl 0x28(%r15), %eax
movl %eax, (%r12)
movl %ebp, 0x4(%r12)
movq 0x8(%r14), %rax
movq %rax, 0x38(%r12)
movl 0x30(%r15), %eax
movl %eax, 0x30(%r12)
movq %r12, %rdi
callq 0x2af63
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2b32f
testl %eax, %eax
je 0x54c5
leaq 0x490b7(%rip), %r15     # 0x4e55a
xorl %r14d, %r14d
jmp 0x54f9
leaq 0x48f56(%rip), %r15     # 0x4e405
leaq 0x49118(%rip), %rdi     # 0x4e5ce
xorl %r14d, %r14d
movq %r15, %rsi
xorl %eax, %eax
callq 0x4060
jmp 0x5526
movl 0x4c(%rsp), %esi
movq 0x8(%r14), %rdx
leaq 0x49099(%rip), %rdi     # 0x4e56d
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x4060
leaq 0xb(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x2e0ba
testl %eax, %eax
je 0x5539
leaq 0x490aa(%rip), %r15     # 0x4e5a3
leaq 0x6ffe0(%rip), %rdx     # 0x754e0
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x2b578
testq %r14, %r14
jne 0x5526
cmpl $0x0, 0x28(%rsp)
je 0x54af
leaq 0x49a4c(%rip), %rdi     # 0x4ef6a
callq 0x4510
xorl %r14d, %r14d
movq %r14, %rax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %r14
leaq 0xa(%rsp), %rsi
movb %r14b, (%rsi)
incq %r14
leaq 0x10(%rsp), %rdi
movq %r14, %rdx
callq 0x6073
leaq 0x48be5(%rip), %r15     # 0x4e141
cmpq %rax, %r14
jne 0x54a3
leaq 0x6ff74(%rip), %r8      # 0x754e0
xorl %r14d, %r14d
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
movq %r8, %r9
callq 0x2e004
cmpl $0x9, %eax
je 0x54a3
cmpl $0x8, %eax
je 0x55a9
testl %eax, %eax
jne 0x55b5
leaq 0x4a6da(%rip), %r15     # 0x4fc79
movq 0x20(%rsp), %r14
jmp 0x54f9
leaq 0x48ba3(%rip), %r15     # 0x4e153
jmp 0x54f9
leaq 0x49001(%rip), %r15     # 0x4e5bd
jmp 0x54a3