// File: sisong[P]ApkDiffPatch/src/../HDiffPatch/decompress_plugin_demo.h
// Function: zlib_decompress_open_at(hpatch_TDecompress*, hpatch_TStreamInput const*, unsigned long long, unsigned long long, int, _zlib_TDecompress*, unsigned long)
static _zlib_TDecompress*  _zlib_decompress_open_at(hpatch_TDecompress* decompressPlugin,
                                                        const hpatch_TStreamInput* codeStream,
                                                        hpatch_StreamPos_t code_begin,
                                                        hpatch_StreamPos_t code_end,
                                                        int  isSavedWindowBits,
                                                        _zlib_TDecompress* self,size_t _self_and_buf_size){
        int ret;
        signed char kWindowBits=-MAX_WBITS;
        assert(_self_and_buf_size>sizeof(_zlib_TDecompress));
        if (isSavedWindowBits){//load kWindowBits
            if (code_end-code_begin<1) _dec_openErr_rt();
            if (!codeStream->read(codeStream,code_begin,(unsigned char*)&kWindowBits,
                                  (unsigned char*)&kWindowBits+1)) return 0;
            ++code_begin;
        }
        
        memset(self,0,sizeof(_zlib_TDecompress));
        self->dec_buf=((unsigned char*)self)+sizeof(_zlib_TDecompress);
        self->dec_buf_size=_self_and_buf_size-sizeof(_zlib_TDecompress);
        self->codeStream=codeStream;
        self->code_begin=code_begin;
        self->code_end=code_end;
        self->windowBits=kWindowBits;
        self->d_stream.zalloc=__zlib_dec_Alloc;
        self->d_stream.zfree=__dec_free;
        self->d_stream.opaque=self;
        ret = inflateInit2(&self->d_stream,self->windowBits);
        if (ret!=Z_OK) { _dec_onDecErr_up(); _dec_openErr_rt(); }
        return self;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq %r9, -0x38(%rbp)
movb $-0xf, -0x3d(%rbp)
cmpq $0xa0, 0x10(%rbp)
jbe 0x7254
jmp 0x7273
leaq 0xa5afa(%rip), %rdi     # 0xacd55
leaq 0xa5b20(%rip), %rsi     # 0xacd82
movl $0x6c, %edx
leaq 0xa5b3f(%rip), %rcx     # 0xacdad
callq 0x4270
cmpl $0x0, -0x2c(%rbp)
je 0x72ed
movq -0x28(%rbp), %rax
subq -0x20(%rbp), %rax
cmpq $0x1, %rax
jae 0x72b1
jmp 0x7289
jmp 0x728b
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x72a2
movq -0x10(%rbp), %rax
movl $0x2, 0x28(%rax)
jmp 0x72a4
movq $0x0, -0x8(%rbp)
jmp 0x740d
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x3d(%rbp), %rcx
addq $0x1, %rcx
leaq -0x3d(%rbp), %rdx
callq *%rax
cmpl $0x0, %eax
jne 0x72e1
movq $0x0, -0x8(%rbp)
jmp 0x740d
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0xa0, %edx
callq 0x4210
movq -0x38(%rbp), %rcx
addq $0xa0, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq 0x10(%rbp), %rcx
subq $0xa0, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movb -0x3d(%rbp), %cl
movq -0x38(%rbp), %rax
movb %cl, 0x98(%rax)
movq -0x38(%rbp), %rax
leaq 0xc2(%rip), %rcx        # 0x7420
movq %rcx, 0x68(%rax)
movq -0x38(%rbp), %rax
leaq 0x103(%rip), %rcx       # 0x7470
movq %rcx, 0x70(%rax)
movq -0x38(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x38(%rbp), %rdi
addq $0x28, %rdi
movq -0x38(%rbp), %rax
movsbl 0x98(%rax), %esi
leaq 0xa5858(%rip), %rdx     # 0xacbef
movl $0x70, %ecx
callq 0x9af90
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x7405
jmp 0x73ac
movq -0x38(%rbp), %rax
cmpl $0x0, 0x9c(%rax)
je 0x73dc
jmp 0x73bb
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x73d8
movq -0x38(%rbp), %rax
movl 0x9c(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x73da
jmp 0x73dc
jmp 0x73de
jmp 0x73e0
jmp 0x73e2
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl $0x0, %eax
jne 0x73f9
movq -0x10(%rbp), %rax
movl $0x2, 0x28(%rax)
jmp 0x73fb
movq $0x0, -0x8(%rbp)
jmp 0x740d
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)