// File: /workspace/github_cpp_makefile_star2_O2/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HPatch/patch.c
// Function: TBytesRle_load_stream_decode_add
static hpatch_BOOL _TBytesRle_load_stream_decode_add(_TBytesRle_load_stream* loader,
                                                     TByte* out_data,hpatch_size_t decodeSize){
    if (!_TBytesRle_load_stream_mem_add(loader,&decodeSize,&out_data))
        return _hpatch_FALSE;

    while ((decodeSize>0)&&(!_TStreamCacheClip_isFinish(&loader->ctrlClip))){
        enum TByteRleType type;
        hpatch_StreamPos_t length;
        const TByte* pType=_TStreamCacheClip_accessData(&loader->ctrlClip,1);
        if (pType==0) return _hpatch_FALSE;
        type=(enum TByteRleType)((*pType)>>(8-kByteRleType_bit));
        _clip_unpackUIntWithTagTo(&length,&loader->ctrlClip,kByteRleType_bit);
        ++length;
        switch (type){
            case kByteRleType_rle0:{
                loader->memSetLength=length;
                loader->memSetValue=0;
            }break;
            case kByteRleType_rle255:{
                loader->memSetLength=length;
                loader->memSetValue=255;
            }break;
            case kByteRleType_rle:{
                const TByte* pSetValue=_TStreamCacheClip_readData(&loader->rleCodeClip,1);
                if (pSetValue==0) return _hpatch_FALSE;
                loader->memSetValue=*pSetValue;
                loader->memSetLength=length;
            }break;
            case kByteRleType_unrle:{
                loader->memCopyLength=length;
            }break;
        }
        if (!_TBytesRle_load_stream_mem_add(loader,&decodeSize,&out_data)) return _hpatch_FALSE;
    }

    if (decodeSize==0)
        return hpatch_TRUE;
    else
        return _hpatch_FALSE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
leaq 0x20(%rsp), %rax
movq %rsi, (%rax)
leaq 0x8(%rsp), %rsi
movq %rdx, (%rsi)
movq %rax, %rdx
callq 0x3e0b1
xorl %ecx, %ecx
testl %eax, %eax
je 0x3e0a0
leaq 0x18(%r14), %r15
leaq 0x48(%r14), %rax
movq %rax, 0x10(%rsp)
pushq $0x1
popq %r13
leaq 0x18434(%rip), %rbp     # 0x56414
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x3e098
movq 0x20(%r14), %rcx
subq 0x18(%r14), %rcx
movq 0x38(%r14), %rdx
subq 0x40(%r14), %rdx
cmpq %rdx, %rcx
je 0x3e098
movq %r15, %rdi
movq %r13, %rsi
callq 0x3ae6c
testq %rax, %rax
je 0x3e094
movzbl (%rax), %ebx
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
pushq $0x2
popq %rdx
callq 0x3af7d
testl %eax, %eax
je 0x3e094
shrl $0x6, %ebx
movq 0x18(%rsp), %r12
incq %r12
movslq (%rbp,%rbx,4), %rax
addq %rbp, %rax
jmpq *%rax
movq %r12, 0x8(%r14)
movb $0x0, 0x10(%r14)
jmp 0x3e07a
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x3b0db
testq %rax, %rax
je 0x3e094
movb (%rax), %al
movb %al, 0x10(%r14)
movq %r12, 0x8(%r14)
jmp 0x3e07a
movq %r12, (%r14)
jmp 0x3e07a
movq %r12, 0x8(%r14)
movb $-0x1, 0x10(%r14)
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x3e0b1
testl %eax, %eax
jne 0x3dfe0
xorl %ecx, %ecx
jmp 0x3e0a0
xorl %ecx, %ecx
testq %rax, %rax
sete %cl
movl %ecx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq