// File: /workspace/github_cpp_makefile_star2_O3/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 0x4737a
xorl %ebx, %ebx
testl %eax, %eax
je 0x47360
leaq 0x18(%r14), %r15
leaq 0x48(%r14), %rax
movq %rax, 0x10(%rsp)
leaq 0x1a123(%rip), %rbp     # 0x61374
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
je 0x47358
movq 0x20(%r14), %rsi
movq 0x38(%r14), %rax
subq 0x18(%r14), %rsi
movq 0x40(%r14), %rdx
movq %rax, %rdi
subq %rdx, %rdi
cmpq %rdi, %rsi
je 0x47358
cmpq %rdx, %rax
jne 0x472a1
movq %r15, %rdi
callq 0x43e2c
testl %eax, %eax
je 0x47360
movq 0x38(%r14), %rax
cmpq %rax, 0x40(%r14)
je 0x47360
movq 0x30(%r14), %rcx
testq %rcx, %rcx
je 0x47360
movzbl (%rcx,%rax), %r13d
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
movl $0x2, %edx
callq 0x43f27
testl %eax, %eax
je 0x47360
shrl $0x6, %r13d
movq 0x18(%rsp), %r12
incq %r12
movslq (%rbp,%r13,4), %rax
addq %rbp, %rax
jmpq *%rax
movq %r12, 0x8(%r14)
movb $0x0, 0x10(%r14)
jmp 0x4733c
movq 0x68(%r14), %rcx
cmpq %rcx, 0x70(%r14)
jne 0x47310
movq 0x10(%rsp), %rdi
callq 0x43e2c
movq 0x68(%r14), %rcx
testl %eax, %eax
je 0x47371
cmpq %rcx, 0x70(%r14)
je 0x47371
movq 0x60(%r14), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x68(%r14)
testq %rax, %rax
je 0x47360
movb (%rax,%rcx), %al
movb %al, 0x10(%r14)
movq %r12, 0x8(%r14)
jmp 0x4733c
movq %r12, (%r14)
jmp 0x4733c
movq %r12, 0x8(%r14)
movb $-0x1, 0x10(%r14)
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x4737a
testl %eax, %eax
jne 0x47251
jmp 0x47360
xorl %ebx, %ebx
testq %rcx, %rcx
sete %bl
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incq %rcx
movq %rcx, 0x68(%r14)
jmp 0x47360