// File: sisong[P]ApkDiffPatch/src/normalized/normalized.cpp
// Function: removeNonEmptyDirs(UnZipper const*, std::vector<TFileValue, std::allocator<TFileValue>>&)
static int removeNonEmptyDirs(const UnZipper* zip,std::vector<TFileValue>& files){
    int fileCount=UnZipper_fileCount(zip);
    {
        std::vector<TFileValue*> rfiles(fileCount);
        for (int i=0; i<fileCount; ++i)
            rfiles[i]=&files[i];
        std::sort(rfiles.begin(),rfiles.end(),TFileValue::TCmpByName());
        for (int i=0;i<fileCount-1;++i) {
            if (UnZipper_file_uncompressedSize(zip,rfiles[i]->fileIndex)>0) continue;
            const std::string& nx=rfiles[i]->fileName;
            const std::string& ny=rfiles[i+1]->fileName;
            const size_t nL=nx.size();
            if (nL>ny.size()) continue;
            if (0!=memcmp(nx.c_str(),ny.c_str(),nL)) continue;
            if (((nL>0)&&TFileValue::isDirTag(nx[nL-1]))||
              ((nL<ny.size())&&TFileValue::isDirTag(ny[nL])))
                rfiles[i]->fileIndex=-1; //need remove
        }
    }
    int insert=0;
    for (int i=0; i<fileCount; ++i){
        if (files[i].fileIndex<0) continue;
        if (i!=insert){
            files[insert].fileIndex=files[i].fileIndex;
            files[insert].fileName.swap(files[i].fileName);
        }
        ++insert;
    }
    files.resize(insert);
    return fileCount-insert;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x186a0
movl %eax, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x7020
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x7040
jmp 0x5853
leaq -0x31(%rbp), %rdi
callq 0x70b0
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x58bb
movq -0x10(%rbp), %rdi
movslq -0x48(%rbp), %rsi
callq 0x5e30
movq %rax, -0x98(%rbp)
movslq -0x48(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x70d0
movq -0x98(%rbp), %rcx
movq %rcx, (%rax)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x5863
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x70b0
jmp 0x5b72
leaq -0x30(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x7130
movq -0xa0(%rbp), %rdi
movq %rax, -0x50(%rbp)
callq 0x7160
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x70f0
jmp 0x58ee
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x5aa3
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movslq -0x60(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x70d0
movq -0xb0(%rbp), %rdi
movq (%rax), %rax
movl 0x20(%rax), %esi
callq 0x1a090
movl %eax, -0xa4(%rbp)
jmp 0x5938
movl -0xa4(%rbp), %eax
cmpl $0x0, %eax
jbe 0x5962
jmp 0x5a95
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x71d0
jmp 0x5b72
movslq -0x60(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x70d0
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x70d0
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rdi
callq 0x32b0
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x70(%rbp), %rdi
callq 0x32b0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
cmpq %rcx, %rax
jbe 0x59c4
jmp 0x5a95
movq -0x68(%rbp), %rdi
callq 0x3150
movq %rax, -0xc0(%rbp)
movq -0x70(%rbp), %rdi
callq 0x3150
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
movq -0x78(%rbp), %rdx
callq 0x3190
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x59fd
jmp 0x5a95
cmpq $0x0, -0x78(%rbp)
jbe 0x5a30
movq -0x68(%rbp), %rdi
movq -0x78(%rbp), %rsi
decq %rsi
callq 0x33f0
movsbl (%rax), %edi
callq 0x7190
movb %al, -0xc1(%rbp)
jmp 0x5a24
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0x5a7c
jmp 0x5a30
movq -0x78(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x70(%rbp), %rdi
callq 0x32b0
movq %rax, %rcx
movq -0xd0(%rbp), %rax
cmpq %rcx, %rax
jae 0x5a93
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x33f0
movsbl (%rax), %edi
callq 0x7190
movb %al, -0xd1(%rbp)
jmp 0x5a70
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x5a7c
jmp 0x5a93
movslq -0x60(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x70d0
movq (%rax), %rax
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
jmp 0x5a95
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x58f5
leaq -0x30(%rbp), %rdi
callq 0x71d0
movl $0x0, -0x7c(%rbp)
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x5b56
movq -0x10(%rbp), %rdi
movslq -0x80(%rbp), %rsi
callq 0x5e30
cmpl $0x0, 0x20(%rax)
jge 0x5adb
jmp 0x5b48
movl -0x80(%rbp), %eax
cmpl -0x7c(%rbp), %eax
je 0x5b3f
movq -0x10(%rbp), %rdi
movslq -0x80(%rbp), %rsi
callq 0x5e30
movl 0x20(%rax), %eax
movl %eax, -0xe4(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x7c(%rbp), %rsi
callq 0x5e30
movl -0xe4(%rbp), %ecx
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rdi
movslq -0x7c(%rbp), %rsi
callq 0x5e30
movq %rax, -0xe0(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x80(%rbp), %rsi
callq 0x5e30
movq -0xe0(%rbp), %rdi
movq %rax, %rsi
callq 0x32d0
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x5aba
movq -0x10(%rbp), %rdi
movslq -0x7c(%rbp), %rsi
callq 0x6440
movl -0x14(%rbp), %eax
subl -0x7c(%rbp), %eax
addq $0xf0, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x35e0
nopl (%rax,%rax)