// File: sisong[P]ApkDiffPatch/src/../HDiffPatch/decompress_plugin_demo.h
// Function: lzma2_open(hpatch_TDecompress*, unsigned long long, hpatch_TStreamInput const*, unsigned long long, unsigned long long)
static hpatch_decompressHandle _lzma2_open(hpatch_TDecompress* decompressPlugin,
                                            hpatch_StreamPos_t dataSize,
                                            const hpatch_TStreamInput* codeStream,
                                            hpatch_StreamPos_t code_begin,
                                            hpatch_StreamPos_t code_end){
        _lzma2_TDecompress* self=0;
        SRes ret;
        unsigned char propsSize=0;
        //load propsSize
        if (code_end-code_begin<1) _dec_openErr_rt();
        if (!codeStream->read(codeStream,code_begin,&propsSize,&propsSize+1)) return 0;
        ++code_begin;
        
        self=(_lzma2_TDecompress*)_dec_malloc(sizeof(_lzma2_TDecompress));
        if (!self) _dec_memErr_rt();
        memset(self,0,sizeof(_lzma2_TDecompress)-kDecompressBufSize);
        self->memAllocBase.Alloc=__lzma2_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;
        
        Lzma2Dec_Construct(&self->decEnv);
        ret=Lzma2Dec_Allocate(&self->decEnv,propsSize,&self->memAllocBase);
        if (ret!=SZ_OK){ _dec_onDecErr_up(); free(self); _dec_openErr_rt(); }
        Lzma2Dec_Init(&self->decEnv);
        return self;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
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 0x7a70
jmp 0x7a48
jmp 0x7a4a
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x7a61
movq -0x10(%rbp), %rax
movl $0x2, 0x28(%rax)
jmp 0x7a63
movq $0x0, -0x8(%rbp)
jmp 0x7c09
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 0x7aa0
movq $0x0, -0x8(%rbp)
jmp 0x7c09
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movl $0x80d0, %edi           # imm = 0x80D0
callq 0x71b0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x7aeb
jmp 0x7ac3
jmp 0x7ac5
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x7adc
movq -0x10(%rbp), %rax
movl $0x1, 0x28(%rax)
jmp 0x7ade
movq $0x0, -0x8(%rbp)
jmp 0x7c09
movq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0xd0, %edx
callq 0x4210
movq -0x38(%rbp), %rax
leaq 0x49a(%rip), %rcx       # 0x7fa0
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
leaq -0x6a4(%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, 0xb8(%rax)
movq -0x38(%rbp), %rax
movq $0x8000, 0xc0(%rax) # imm = 0x8000
movq -0x38(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x38(%rbp), %rdi
addq $0x28, %rdi
movb -0x3d(%rbp), %al
movq -0x38(%rbp), %rdx
movzbl %al, %esi
callq 0xab120
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x7bf4
jmp 0x7b94
movq -0x38(%rbp), %rax
cmpl $0x0, 0xc8(%rax)
je 0x7bc4
jmp 0x7ba3
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x7bc0
movq -0x38(%rbp), %rax
movl 0xc8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x7bc2
jmp 0x7bc4
jmp 0x7bc6
movq -0x38(%rbp), %rdi
callq 0x4460
jmp 0x7bd1
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x7be8
movq -0x10(%rbp), %rax
movl $0x2, 0x28(%rax)
jmp 0x7bea
movq $0x0, -0x8(%rbp)
jmp 0x7c09
movq -0x38(%rbp), %rdi
addq $0x28, %rdi
callq 0xab180
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)