// File: sisong[P]ApkDiffPatch/src/patch/Zipper.cpp
// Function: searchID_in_block(hpatch_TStreamInput const*, unsigned int, unsigned int, unsigned int, unsigned int*, unsigned int*)
static bool _searchID_in_block(const hpatch_TStreamInput* stream,ZipFilePos_t nodePos,ZipFilePos_t sumNodeSize,
                               hpatch_uint32_t searchID,ZipFilePos_t* out_IDNodePos,ZipFilePos_t* out_IDNodeSize){
    *out_IDNodePos=0;
    *out_IDNodeSize=0;
    TByte buf[8];
    while (sumNodeSize>0) {
        check(8+4<=sumNodeSize); //sizeof(size+ID)
        check(stream->read(stream,nodePos,buf,buf+8));
        hpatch_StreamPos_t nodeSize=readUInt64(buf);
        check(4<=nodeSize);
        check(8+nodeSize<=sumNodeSize);
        check(stream->read(stream,nodePos+8,buf,buf+4));
        hpatch_uint32_t ID=readUInt32(buf);
        if (ID==searchID){
            *out_IDNodePos=nodePos+8; //pos to ID
            *out_IDNodeSize=(ZipFilePos_t)nodeSize;
            return true;
        }
        //next node
        nodePos+=8+(ZipFilePos_t)nodeSize;
        sumNodeSize-=8+(ZipFilePos_t)nodeSize;
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
cmpl $0x0, -0x18(%rbp)
jbe 0x7ea7a
movl $0xc, %eax
cmpl -0x18(%rbp), %eax
jbe 0x7e934
leaq 0x2e954(%rip), %rdi     # 0xad270
leaq 0x35067(%rip), %rsi     # 0xb398a
movl $0x93, %edx
leaq 0x35a7f(%rip), %rcx     # 0xb43ae
callq 0x4270
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %ecx
movl %ecx, %esi
leaq -0x38(%rbp), %rdx
leaq -0x38(%rbp), %rcx
addq $0x8, %rcx
callq *%rax
cmpl $0x0, %eax
jne 0x7e977
leaq 0x2e911(%rip), %rdi     # 0xad270
leaq 0x35024(%rip), %rsi     # 0xb398a
movl $0x94, %edx
leaq 0x35a3c(%rip), %rcx     # 0xb43ae
callq 0x4270
leaq -0x38(%rbp), %rdi
callq 0x7e890
movq %rax, -0x40(%rbp)
movl $0x4, %eax
cmpq -0x40(%rbp), %rax
jbe 0x7e9ae
leaq 0x2e8da(%rip), %rdi     # 0xad270
leaq 0x34fed(%rip), %rsi     # 0xb398a
movl $0x96, %edx
leaq 0x35a05(%rip), %rcx     # 0xb43ae
callq 0x4270
movq -0x40(%rbp), %rax
addq $0x8, %rax
movl -0x18(%rbp), %ecx
cmpq %rcx, %rax
jbe 0x7e9dd
leaq 0x2e8ab(%rip), %rdi     # 0xad270
leaq 0x34fbe(%rip), %rsi     # 0xb398a
movl $0x97, %edx
leaq 0x359d6(%rip), %rcx     # 0xb43ae
callq 0x4270
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %ecx
addl $0x8, %ecx
movl %ecx, %ecx
movl %ecx, %esi
leaq -0x38(%rbp), %rdx
leaq -0x38(%rbp), %rcx
addq $0x4, %rcx
callq *%rax
cmpl $0x0, %eax
jne 0x7ea25
leaq 0x2e863(%rip), %rdi     # 0xad270
leaq 0x34f76(%rip), %rsi     # 0xb398a
movl $0x98, %edx
leaq 0x3598e(%rip), %rcx     # 0xb43ae
callq 0x4270
leaq -0x38(%rbp), %rdi
callq 0x804b0
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x7ea57
movl -0x14(%rbp), %ecx
addl $0x8, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x40(%rbp), %rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x7ea7e
movq -0x40(%rbp), %rax
addl $0x8, %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x40(%rbp), %rax
movl %eax, %ecx
addl $0x8, %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
jmp 0x7e901
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)