// File: sisong[P]ApkDiffPatch/src/../HDiffPatch/decompress_plugin_demo.h
// Function: lzma_open(hpatch_TDecompress*, unsigned long long, hpatch_TStreamInput const*, unsigned long long, unsigned long long)
static hpatch_decompressHandle  _lzma_open(hpatch_TDecompress* decompressPlugin,
                                               hpatch_StreamPos_t dataSize,
                                               const hpatch_TStreamInput* codeStream,
                                               hpatch_StreamPos_t code_begin,
                                               hpatch_StreamPos_t code_end){
        _lzma_TDecompress* self=0;
        SRes ret;
        unsigned char propsSize=0;
        unsigned char props[256];
        //load propsSize
        if (code_end-code_begin<1) _dec_openErr_rt();
        if (!codeStream->read(codeStream,code_begin,&propsSize,&propsSize+1)) return 0;
        ++code_begin;
        if (propsSize>(code_end-code_begin)) _dec_openErr_rt();
        //load props
        if (!codeStream->read(codeStream,code_begin,props,props+propsSize)) return 0;
        code_begin+=propsSize;

        self=(_lzma_TDecompress*)_dec_malloc(sizeof(_lzma_TDecompress));
        if (!self) _dec_memErr_rt();
        memset(self,0,sizeof(_lzma_TDecompress)-kDecompressBufSize);
        self->memAllocBase.Alloc=__lzma1_dec_Alloc;
        *((void**)&self->memAllocBase.Free)=(void*)__dec_free;
        self->codeStream=codeStream;
        self->code_begin=code_begin;
        self->code_end=code_end;
        
        self->decCopyPos=0;
        self->decReadPos=kDecompressBufSize;
        
        LzmaDec_Construct(&self->decEnv);
        ret=LzmaDec_Allocate(&self->decEnv,props,propsSize,&self->memAllocBase);
        if (ret!=SZ_OK){ _dec_onDecErr_up(); free(self); _dec_openErr_rt(); }
        LzmaDec_Init(&self->decEnv);
        return self;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movb $0x0, -0x3d(%rbp)
movq -0x30(%rbp), %rax
subq -0x28(%rbp), %rax
cmpq $0x1, %rax
jae 0x8073
jmp 0x804b
jmp 0x804d
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x8064
movq -0x10(%rbp), %rax
movl $0x2, 0x28(%rax)
jmp 0x8066
movq $0x0, -0x8(%rbp)
jmp 0x8295
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x3d(%rbp), %rcx
addq $0x1, %rcx
leaq -0x3d(%rbp), %rdx
callq *%rax
cmpl $0x0, %eax
jne 0x80a3
movq $0x0, -0x8(%rbp)
jmp 0x8295
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movzbl -0x3d(%rbp), %eax
movq -0x30(%rbp), %rcx
subq -0x28(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x80ea
jmp 0x80c2
jmp 0x80c4
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x80db
movq -0x10(%rbp), %rax
movl $0x2, 0x28(%rax)
jmp 0x80dd
movq $0x0, -0x8(%rbp)
jmp 0x8295
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x140(%rbp), %rdx
leaq -0x140(%rbp), %rcx
movzbl -0x3d(%rbp), %r8d
movslq %r8d, %r8
addq %r8, %rcx
callq *%rax
cmpl $0x0, %eax
jne 0x8127
movq $0x0, -0x8(%rbp)
jmp 0x8295
movzbl -0x3d(%rbp), %eax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x80c0, %edi           # imm = 0x80C0
callq 0x71b0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x8172
jmp 0x814a
jmp 0x814c
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x8163
movq -0x10(%rbp), %rax
movl $0x1, 0x28(%rax)
jmp 0x8165
movq $0x0, -0x8(%rbp)
jmp 0x8295
movq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0xc0, %edx
callq 0x4210
movq -0x38(%rbp), %rax
leaq 0x4a3(%rip), %rcx       # 0x8630
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
leaq -0xd2b(%rip), %rcx      # 0x7470
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0xa8(%rax)
movq -0x38(%rbp), %rax
movq $0x8000, 0xb0(%rax) # imm = 0x8000
movq -0x38(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x38(%rbp), %rdi
addq $0x28, %rdi
leaq -0x140(%rbp), %rsi
movzbl -0x3d(%rbp), %edx
movq -0x38(%rbp), %rcx
callq 0xa78b0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x8280
jmp 0x8220
movq -0x38(%rbp), %rax
cmpl $0x0, 0xb8(%rax)
je 0x8250
jmp 0x822f
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x824c
movq -0x38(%rbp), %rax
movl 0xb8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x824e
jmp 0x8250
jmp 0x8252
movq -0x38(%rbp), %rdi
callq 0x4460
jmp 0x825d
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x8274
movq -0x10(%rbp), %rax
movl $0x2, 0x28(%rax)
jmp 0x8276
movq $0x0, -0x8(%rbp)
jmp 0x8295
movq -0x38(%rbp), %rdi
addq $0x28, %rdi
callq 0xa5cb0
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)