// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
leaq 0x20(%rsp), %rax
movq %rsi, (%rax)
leaq 0x10(%rsp), %rsi
movq %rdx, (%rsi)
movq %rax, %rdx
callq 0x4801d
testl %eax, %eax
je 0x48002
leaq 0x18(%rbx), %r14
leaq 0x48(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x8(%rsp), %r12
leaq 0x193f5(%rip), %r15     # 0x612f4
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
je 0x48006
movq 0x20(%rbx), %rax
subq 0x18(%rbx), %rax
movq 0x38(%rbx), %rdx
subq 0x40(%rbx), %rdx
cmpq %rdx, %rax
je 0x48006
movq 0x40(%rbx), %rax
cmpq 0x38(%rbx), %rax
jne 0x47f4a
movq %r14, %rdi
callq 0x445b4
testl %eax, %eax
je 0x47f46
movq 0x40(%rbx), %rax
cmpq 0x38(%rbx), %rax
jne 0x47f4a
xorl %eax, %eax
jmp 0x47f52
movq 0x30(%rbx), %rax
addq 0x38(%rbx), %rax
testq %rax, %rax
je 0x48002
movzbl (%rax), %ebp
movq %r14, %rdi
movq %r12, %rsi
movl $0x2, %edx
callq 0x44699
testl %eax, %eax
je 0x48002
shrl $0x6, %ebp
movq 0x8(%rsp), %r13
incq %r13
movq %r13, 0x8(%rsp)
movslq (%r15,%rbp,4), %rax
addq %r15, %rax
jmpq *%rax
movq %r13, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
jmp 0x47fe8
movq 0x70(%rbx), %rax
cmpq 0x68(%rbx), %rax
jne 0x47fce
movq 0x18(%rsp), %rdi
callq 0x445b4
testl %eax, %eax
je 0x47fbb
movq 0x70(%rbx), %rax
cmpq 0x68(%rbx), %rax
jne 0x47fce
xorl %eax, %eax
jmp 0x47fd6
movq %r13, (%rbx)
jmp 0x47fe8
movq %r13, 0x8(%rbx)
movb $-0x1, 0x10(%rbx)
jmp 0x47fe8
movq 0x60(%rbx), %rax
addq 0x68(%rbx), %rax
incq 0x68(%rbx)
testq %rax, %rax
je 0x48002
movb (%rax), %al
movb %al, 0x10(%rbx)
movq %r13, 0x8(%rbx)
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x4801d
testl %eax, %eax
jne 0x47eff
xorl %eax, %eax
jmp 0x4800e
xorl %eax, %eax
testq %rcx, %rcx
sete %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq