// File: sisong[P]ApkDiffPatch/src/normalized/normalized.cpp
// Function: ZipNormalized(char const*, char const*, int, int, bool, unsigned long, bool, int*)
bool ZipNormalized(const char* srcApk,const char* dstApk,int ZipAlignSize,int compressLevel,
                   bool isNotCompressEmptyFile,size_t pageAlignSoFile,bool pageAlignCompatible,int* out_apkFilesRemoved){
    bool result=true;
    bool _isInClear=false;
    int  fileCount=0;
    bool isHaveApkV2Sign=false;
    bool isHaveApkV3Sign=false;
    int  jarSignFileCount=0;
    std::vector<int>   fileIndexs;
    std::vector<std::string>  removedFiles;
    std::vector<std::string> _compressedEmptyFiles; //only for WARNING
    UnZipper unzipper;
    Zipper   zipper;
    UnZipper_init(&unzipper);
    Zipper_init(&zipper);
    
    check(UnZipper_openFile(&unzipper,srcApk));
    fileCount=UnZipper_fileCount(&unzipper);
    check(Zipper_openFile(&zipper,dstApk,fileCount,ZipAlignSize,compressLevel,kDefaultZlibCompressMemLevel,
                          pageAlignSoFile,pageAlignCompatible,kPageAlign_inNormalize));
    isHaveApkV2Sign=UnZipper_isHaveApkV2Sign(&unzipper);
    isHaveApkV3Sign=UnZipper_isHaveApkV3Sign(&unzipper);
    {
        int apkFilesRemoved=0;
        std::vector<TFileValue> files;
        getAllFiles(&unzipper,files);
        apkFilesRemoved=removeNonEmptyDirs(&unzipper,files);
        fileCount=(int)files.size();
        std::sort(files.begin(),files.end(),TFileValue::TCmp(UnZipper_fileCount(&unzipper)));
        for (int i=0; i<fileCount; ++i) {
            int fileIndex=files[i].fileIndex;
            if (UnZipper_file_isApkV1Sign(&unzipper,fileIndex)){
                ++jarSignFileCount;
                if (isHaveApkV2Sign){
                    ++apkFilesRemoved;
                    removedFiles.push_back(files[i].fileName);
                    continue; //remove JarSign(ApkV1Sign) when found ApkV2Sign
                }
            }
            if (UnZipper_file_isStampCertFile(&unzipper,fileIndex)){
                ++apkFilesRemoved;
                removedFiles.push_back(files[i].fileName);
                continue; //remove stamp cert file
            }

            fileIndexs.push_back(fileIndex);
        }
        if (out_apkFilesRemoved)
            *out_apkFilesRemoved=apkFilesRemoved;
    }
    
    printf("\n");
    for (int i=0; i<(int)fileIndexs.size(); ++i) {
        int fileIndex=fileIndexs[i];
        std::string fileName=zipFile_name(&unzipper,fileIndex);
        if (g_isPrintNormalizingFileName)
            hpatch_printPath_utf8(("\""+fileName+"\"\n").c_str());
        if (compressLevel==0){
            check(Zipper_file_append_set_new_isCompress(&zipper,false));
        } else if (isCompressedEmptyFile(&unzipper,fileIndex)){
            if (isNotCompressEmptyFile){
                check(Zipper_file_append_set_new_isCompress(&zipper,false));
                hpatch_printPath_utf8(("NOTE: \""+fileName+"\"").c_str());
                printf(" is a compressed empty file, change to uncompressed!\n");
            }else{
                _compressedEmptyFiles.push_back(fileName);
             }
        }
        bool isAlwaysReCompress=true;
        check(Zipper_file_append_copy(&zipper,&unzipper,fileIndex,isAlwaysReCompress));
    }
    printf("\n");

    //no run: check(Zipper_copyExtra_before_fileHeader(&zipper,&unzipper));
    for (int i=0; i<(int)fileIndexs.size(); ++i) {
        int fileIndex=fileIndexs[i];
        if (compressLevel==0){
            check(Zipper_file_append_set_new_isCompress(&zipper,false));
        } else if (isNotCompressEmptyFile&&isCompressedEmptyFile(&unzipper,fileIndex)){
            check(Zipper_fileHeader_append_set_new_isCompress(&zipper,false));
        }
        check(Zipper_fileHeader_append(&zipper,&unzipper,fileIndex));
    }
    check(Zipper_endCentralDirectory_append(&zipper,&unzipper));
    
    for (int i=0;i<(int)_compressedEmptyFiles.size();++i){
        hpatch_printPath_utf8(("WARNING: \""+_compressedEmptyFiles[i]).c_str());
        printf(" is a compressed empty file, can't patch by old(version<v1.3.5) ZipPatch!)\n");
    }
    if (jarSignFileCount>0){
        if (isHaveApkV2Sign){
            printf("WARNING: src removed JarSign(ApkV1Sign) (%d file, need re-sign)\n",jarSignFileCount);
        }else{
            printf("WARNING: src JarSign(ApkV1Sign) (%d file) has been Normalized, Don't re-sign!\n",jarSignFileCount);
        }
    }
    for (size_t i=0;i<removedFiles.size();++i)
        hpatch_printPath_utf8((std::string("WARNING:   removed file: \"")+removedFiles[i]+"\"\n").c_str());
    if (isHaveApkV2Sign){
        printf(isHaveApkV3Sign?
                "WARNING: src removed ApkV2Sign & ApkV3Sign  data (%d Byte, need re-sign)\n"
               :"WARNING: src removed ApkV2Sign data (%d Byte, need re-sign)\n",
                (int)UnZipper_ApkV2SignSize(&unzipper));
    }
    printf("src fileCount: %d  (filseSize: %" PRIu64 ")\n"
            "out fileCount: %d  (filseSize: %" PRIu64 ")\n\n",
            fileCount,unzipper._fileStream.base.streamSize,
            (int)fileIndexs.size(),zipper._fileStream.out_length);

clear:
    _isInClear=true;
    check(UnZipper_close(&unzipper));
    check(Zipper_close(&zipper));
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4d0, %rsp            # imm = 0x4D0
movl %r8d, %eax
movl %ecx, -0x440(%rbp)
movl %edx, %ecx
movl -0x440(%rbp), %edx
movl %ecx, -0x43c(%rbp)
movq %rsi, %rcx
movl -0x43c(%rbp), %esi
movq %rcx, -0x438(%rbp)
movq %rdi, %r8
movq -0x438(%rbp), %rdi
movb %al, %cl
movq 0x18(%rbp), %rax
movb 0x10(%rbp), %al
movq %r8, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movl %edx, -0x20(%rbp)
andb $0x1, %cl
movb %cl, -0x21(%rbp)
movq %r9, -0x30(%rbp)
andb $0x1, %al
movb %al, -0x31(%rbp)
movb $0x1, -0x32(%rbp)
movb $0x0, -0x33(%rbp)
movl $0x0, -0x38(%rbp)
movb $0x0, -0x39(%rbp)
movb $0x0, -0x3a(%rbp)
movl $0x0, -0x40(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5cd0
leaq -0x70(%rbp), %rdi
callq 0x5cf0
leaq -0x88(%rbp), %rdi
callq 0x5cf0
leaq -0x138(%rbp), %rdi
callq 0x18f70
jmp 0x4a2c
leaq -0x298(%rbp), %rdi
callq 0x1ab00
jmp 0x4a3a
movq -0x10(%rbp), %rsi
leaq -0x138(%rbp), %rdi
xorl %r8d, %r8d
movl %r8d, %edx
movl %r8d, %ecx
callq 0x19da0
movb %al, -0x441(%rbp)
jmp 0x4a5b
movb -0x441(%rbp), %al
testb $0x1, %al
jne 0x4a9f
jmp 0x4a67
leaq 0x39405(%rip), %rdi     # 0x3de73
xorl %eax, %eax
callq 0x3050
jmp 0x4a77
movb $0x0, -0x32(%rbp)
testb $0x1, -0x33(%rbp)
jne 0x4a9d
jmp 0x5647
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x5705
jmp 0x4a9f
leaq -0x138(%rbp), %rdi
callq 0x186a0
movl %eax, -0x448(%rbp)
jmp 0x4ab3
movl -0x448(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x18(%rbp), %rsi
movl -0x38(%rbp), %edx
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
movq -0x30(%rbp), %rdi
movzbl -0x31(%rbp), %r9d
andl $0x1, %r9d
movq %rsp, %rax
movl %r9d, 0x8(%rax)
movq %rdi, (%rax)
movl $0x1, 0x10(%rax)
leaq -0x298(%rbp), %rdi
movl $0x8, %r9d
callq 0x1b290
movb %al, -0x449(%rbp)
jmp 0x4b02
movb -0x449(%rbp), %al
testb $0x1, %al
jne 0x4b2f
jmp 0x4b0e
leaq 0x3938a(%rip), %rdi     # 0x3de9f
xorl %eax, %eax
callq 0x3050
jmp 0x4b1e
movb $0x0, -0x32(%rbp)
testb $0x1, -0x33(%rbp)
jne 0x4b2d
jmp 0x5647
jmp 0x4b2f
leaq -0x138(%rbp), %rdi
callq 0x5730
movb %al, -0x44a(%rbp)
jmp 0x4b43
movb -0x44a(%rbp), %al
andb $0x1, %al
movb %al, -0x39(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x18f30
movb %al, -0x44b(%rbp)
jmp 0x4b62
movb -0x44b(%rbp), %al
andb $0x1, %al
movb %al, -0x3a(%rbp)
movl $0x0, -0x2a8(%rbp)
leaq -0x2c0(%rbp), %rdi
movq %rdi, -0x458(%rbp)
callq 0x5d10
movq -0x458(%rbp), %rsi
leaq -0x138(%rbp), %rdi
callq 0x5760
jmp 0x4b9f
leaq -0x138(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x5800
movl %eax, -0x45c(%rbp)
jmp 0x4bba
movl -0x45c(%rbp), %eax
movl %eax, -0x2a8(%rbp)
leaq -0x2c0(%rbp), %rdi
movq %rdi, -0x468(%rbp)
callq 0x5d30
movq -0x468(%rbp), %rdi
movl %eax, -0x38(%rbp)
callq 0x5db0
movq -0x468(%rbp), %rdi
movq %rax, -0x2c8(%rbp)
callq 0x5de0
movq %rax, -0x2d0(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x186a0
movl %eax, -0x460(%rbp)
jmp 0x4c16
movl -0x460(%rbp), %esi
leaq -0x2d4(%rbp), %rdi
callq 0x5e10
jmp 0x4c2a
movq -0x2c8(%rbp), %rdi
movq -0x2d0(%rbp), %rsi
movl -0x2d4(%rbp), %edx
callq 0x5d60
jmp 0x4c45
movl $0x0, -0x2d8(%rbp)
movl -0x2d8(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x4d87
movslq -0x2d8(%rbp), %rsi
leaq -0x2c0(%rbp), %rdi
callq 0x5e30
movl 0x20(%rax), %eax
movl %eax, -0x2dc(%rbp)
movl -0x2dc(%rbp), %esi
leaq -0x138(%rbp), %rdi
callq 0x18900
movb %al, -0x469(%rbp)
jmp 0x4c94
movb -0x469(%rbp), %al
testb $0x1, %al
jne 0x4ca0
jmp 0x4d08
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
testb $0x1, -0x39(%rbp)
je 0x4d06
movl -0x2a8(%rbp), %eax
incl %eax
movl %eax, -0x2a8(%rbp)
movslq -0x2d8(%rbp), %rsi
leaq -0x2c0(%rbp), %rdi
callq 0x5e30
movq %rax, %rsi
leaq -0x70(%rbp), %rdi
callq 0x5e50
jmp 0x4cde
jmp 0x4d73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x5f30
jmp 0x5705
jmp 0x4d08
movl -0x2dc(%rbp), %esi
leaq -0x138(%rbp), %rdi
callq 0x5b80
movb %al, -0x46a(%rbp)
jmp 0x4d22
movb -0x46a(%rbp), %al
testb $0x1, %al
jne 0x4d2e
jmp 0x4d5f
movl -0x2a8(%rbp), %eax
incl %eax
movl %eax, -0x2a8(%rbp)
movslq -0x2d8(%rbp), %rsi
leaq -0x2c0(%rbp), %rdi
callq 0x5e30
movq %rax, %rsi
leaq -0x70(%rbp), %rdi
callq 0x5e50
jmp 0x4d5d
jmp 0x4d73
leaq -0x58(%rbp), %rdi
leaq -0x2dc(%rbp), %rsi
callq 0x5ec0
jmp 0x4d71
jmp 0x4d73
movl -0x2d8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2d8(%rbp)
jmp 0x4c4f
cmpq $0x0, 0x18(%rbp)
je 0x4d9a
movl -0x2a8(%rbp), %ecx
movq 0x18(%rbp), %rax
movl %ecx, (%rax)
leaq -0x2c0(%rbp), %rdi
callq 0x5f30
leaq 0x394f4(%rip), %rdi     # 0x3e2a1
xorl %eax, %eax
callq 0x3050
jmp 0x4db6
movl $0x0, -0x2e0(%rbp)
movl -0x2e0(%rbp), %eax
movl %eax, -0x470(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5f90
movq %rax, %rcx
movl -0x470(%rbp), %eax
cmpl %ecx, %eax
jge 0x515f
movslq -0x2e0(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x5fb0
movl (%rax), %eax
movl %eax, -0x2e4(%rbp)
movl -0x2e4(%rbp), %edx
leaq -0x308(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x5bb0
jmp 0x4e19
testb $0x1, 0x55548(%rip)     # 0x5a368
je 0x4ee8
leaq 0x39c9f(%rip), %rsi     # 0x3eacc
leaq -0x348(%rbp), %rdi
leaq -0x308(%rbp), %rdx
callq 0x5fd0
jmp 0x4e42
leaq 0x383b7(%rip), %rdx     # 0x3d200
leaq -0x328(%rbp), %rdi
leaq -0x348(%rbp), %rsi
callq 0x45e0
jmp 0x4e5e
leaq -0x328(%rbp), %rdi
callq 0x3150
movq %rax, %rdi
callq 0x26e90
jmp 0x4e74
leaq -0x328(%rbp), %rdi
callq 0x3260
leaq -0x348(%rbp), %rdi
callq 0x3260
jmp 0x4ee8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x514e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x4ed7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x3260
leaq -0x348(%rbp), %rdi
callq 0x3260
jmp 0x514e
cmpl $0x0, -0x20(%rbp)
jne 0x4f40
leaq -0x298(%rbp), %rdi
xorl %esi, %esi
callq 0x1db30
movb %al, -0x471(%rbp)
jmp 0x4f04
movb -0x471(%rbp), %al
testb $0x1, %al
jne 0x4f3b
jmp 0x4f10
leaq 0x3902e(%rip), %rdi     # 0x3df45
xorl %eax, %eax
callq 0x3050
jmp 0x4f20
movb $0x0, -0x32(%rbp)
testb $0x1, -0x33(%rbp)
jne 0x4f39
movl $0x2, -0x390(%rbp)
jmp 0x5106
jmp 0x4f3b
jmp 0x5096
movl -0x2e4(%rbp), %esi
leaq -0x138(%rbp), %rdi
callq 0x5c60
movb %al, -0x472(%rbp)
jmp 0x4f5a
movb -0x472(%rbp), %al
testb $0x1, %al
jne 0x4f69
jmp 0x5094
testb $0x1, -0x21(%rbp)
je 0x507b
leaq -0x298(%rbp), %rdi
xorl %esi, %esi
callq 0x1db30
movb %al, -0x473(%rbp)
jmp 0x4f89
movb -0x473(%rbp), %al
testb $0x1, %al
jne 0x4fc0
jmp 0x4f95
leaq 0x38fa9(%rip), %rdi     # 0x3df45
xorl %eax, %eax
callq 0x3050
jmp 0x4fa5
movb $0x0, -0x32(%rbp)
testb $0x1, -0x33(%rbp)
jne 0x4fbe
movl $0x2, -0x390(%rbp)
jmp 0x5106
jmp 0x4fc0
leaq 0x38fbb(%rip), %rsi     # 0x3df82
leaq -0x388(%rbp), %rdi
leaq -0x308(%rbp), %rdx
callq 0x5fd0
jmp 0x4fdc
leaq 0x39ae9(%rip), %rdx     # 0x3eacc
leaq -0x368(%rbp), %rdi
leaq -0x388(%rbp), %rsi
callq 0x45e0
jmp 0x4ff8
leaq -0x368(%rbp), %rdi
callq 0x3150
movq %rax, %rdi
callq 0x26e90
jmp 0x500e
leaq -0x368(%rbp), %rdi
callq 0x3260
leaq -0x388(%rbp), %rdi
callq 0x3260
leaq 0x38f5d(%rip), %rdi     # 0x3df8a
xorl %eax, %eax
callq 0x3050
jmp 0x5036
jmp 0x5092
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x506a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
leaq -0x368(%rbp), %rdi
callq 0x3260
leaq -0x388(%rbp), %rdi
callq 0x3260
jmp 0x514e
leaq -0x88(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x5e50
jmp 0x5090
jmp 0x5092
jmp 0x5094
jmp 0x5096
movb $0x1, -0x389(%rbp)
movl -0x2e4(%rbp), %edx
movzbl -0x389(%rbp), %ecx
andl $0x1, %ecx
leaq -0x298(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x1d420
movb %al, -0x474(%rbp)
jmp 0x50c8
movb -0x474(%rbp), %al
testb $0x1, %al
jne 0x50fc
jmp 0x50d4
leaq 0x38ee5(%rip), %rdi     # 0x3dfc0
xorl %eax, %eax
callq 0x3050
jmp 0x50e4
movb $0x0, -0x32(%rbp)
testb $0x1, -0x33(%rbp)
jne 0x50fa
movl $0x2, -0x390(%rbp)
jmp 0x5106
jmp 0x50fc
movl $0x0, -0x390(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x3260
movl -0x390(%rbp), %eax
movl %eax, -0x478(%rbp)
testl %eax, %eax
je 0x5138
jmp 0x5124
movl -0x478(%rbp), %eax
subl $0x2, %eax
je 0x5647
jmp 0x56d9
jmp 0x513a
movl -0x2e0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2e0(%rbp)
jmp 0x4dc0
leaq -0x308(%rbp), %rdi
callq 0x3260
jmp 0x5705
leaq 0x3913b(%rip), %rdi     # 0x3e2a1
xorl %eax, %eax
callq 0x3050
jmp 0x516f
movl $0x0, -0x394(%rbp)
movl -0x394(%rbp), %eax
movl %eax, -0x47c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5f90
movq %rax, %rcx
movl -0x47c(%rbp), %eax
cmpl %ecx, %eax
jge 0x52d9
movslq -0x394(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x5fb0
movl (%rax), %eax
movl %eax, -0x398(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0x5202
leaq -0x298(%rbp), %rdi
xorl %esi, %esi
callq 0x1db30
movb %al, -0x47d(%rbp)
jmp 0x51d3
movb -0x47d(%rbp), %al
testb $0x1, %al
jne 0x5200
jmp 0x51df
leaq 0x38d5f(%rip), %rdi     # 0x3df45
xorl %eax, %eax
callq 0x3050
jmp 0x51ef
movb $0x0, -0x32(%rbp)
testb $0x1, -0x33(%rbp)
jne 0x51fe
jmp 0x5647
jmp 0x5200
jmp 0x5275
testb $0x1, -0x21(%rbp)
je 0x5273
movl -0x398(%rbp), %esi
leaq -0x138(%rbp), %rdi
callq 0x5c60
movb %al, -0x47e(%rbp)
jmp 0x5222
movb -0x47e(%rbp), %al
testb $0x1, %al
jne 0x522e
jmp 0x5273
leaq -0x298(%rbp), %rdi
xorl %esi, %esi
callq 0x1dba0
movb %al, -0x47f(%rbp)
jmp 0x5244
movb -0x47f(%rbp), %al
testb $0x1, %al
jne 0x5271
jmp 0x5250
leaq 0x38db9(%rip), %rdi     # 0x3e010
xorl %eax, %eax
callq 0x3050
jmp 0x5260
movb $0x0, -0x32(%rbp)
testb $0x1, -0x33(%rbp)
jne 0x526f
jmp 0x5647
jmp 0x5271
jmp 0x5273
jmp 0x5275
movl -0x398(%rbp), %edx
leaq -0x298(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x1d610
movb %al, -0x480(%rbp)
jmp 0x5296
movb -0x480(%rbp), %al
testb $0x1, %al
jne 0x52c3
jmp 0x52a2
leaq 0x38daa(%rip), %rdi     # 0x3e053
xorl %eax, %eax
callq 0x3050
jmp 0x52b2
movb $0x0, -0x32(%rbp)
testb $0x1, -0x33(%rbp)
jne 0x52c1
jmp 0x5647
jmp 0x52c3
jmp 0x52c5
movl -0x394(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x394(%rbp)
jmp 0x5179
leaq -0x298(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x1d6b0
movb %al, -0x481(%rbp)
jmp 0x52f4
movb -0x481(%rbp), %al
testb $0x1, %al
jne 0x5321
jmp 0x5300
leaq 0x38d8a(%rip), %rdi     # 0x3e091
xorl %eax, %eax
callq 0x3050
jmp 0x5310
movb $0x0, -0x32(%rbp)
testb $0x1, -0x33(%rbp)
jne 0x531f
jmp 0x5647
jmp 0x5321
movl $0x0, -0x39c(%rbp)
movl -0x39c(%rbp), %eax
movl %eax, -0x488(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x60e0
movq %rax, %rcx
movl -0x488(%rbp), %eax
cmpl %ecx, %eax
jge 0x53ea
movslq -0x39c(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x6100
movq %rax, %rdx
leaq 0x38d5d(%rip), %rsi     # 0x3e0ce
leaq -0x3c0(%rbp), %rdi
callq 0x5fd0
jmp 0x537f
leaq -0x3c0(%rbp), %rdi
callq 0x3150
movq %rax, %rdi
callq 0x26e90
jmp 0x5395
leaq -0x3c0(%rbp), %rdi
callq 0x3260
leaq 0x38d31(%rip), %rdi     # 0x3e0d9
xorl %eax, %eax
callq 0x3050
jmp 0x53b1
jmp 0x53b3
movl -0x39c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x39c(%rbp)
jmp 0x532b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
leaq -0x3c0(%rbp), %rdi
callq 0x3260
jmp 0x5705
cmpl $0x0, -0x40(%rbp)
jle 0x5422
testb $0x1, -0x39(%rbp)
je 0x540b
movl -0x40(%rbp), %esi
leaq 0x38d25(%rip), %rdi     # 0x3e125
xorl %eax, %eax
callq 0x3050
jmp 0x5409
jmp 0x5420
movl -0x40(%rbp), %esi
leaq 0x38d51(%rip), %rdi     # 0x3e166
xorl %eax, %eax
callq 0x3050
jmp 0x541e
jmp 0x5420
jmp 0x5422
movq $0x0, -0x3c8(%rbp)
movq -0x3c8(%rbp), %rax
movq %rax, -0x490(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x60e0
movq %rax, %rcx
movq -0x490(%rbp), %rax
cmpq %rcx, %rax
jae 0x55aa
leaq -0x429(%rbp), %rdi
movq %rdi, -0x498(%rbp)
callq 0x35f0
movq -0x498(%rbp), %rdx
leaq 0x38d3d(%rip), %rsi     # 0x3e1b5
leaq -0x428(%rbp), %rdi
callq 0x4630
jmp 0x5486
movq -0x3c8(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x6100
movq %rax, %rdx
leaq -0x408(%rbp), %rdi
leaq -0x428(%rbp), %rsi
callq 0x6120
jmp 0x54ae
leaq 0x37d4b(%rip), %rdx     # 0x3d200
leaq -0x3e8(%rbp), %rdi
leaq -0x408(%rbp), %rsi
callq 0x45e0
jmp 0x54ca
leaq -0x3e8(%rbp), %rdi
callq 0x3150
movq %rax, %rdi
callq 0x26e90
jmp 0x54e0
leaq -0x3e8(%rbp), %rdi
callq 0x3260
leaq -0x408(%rbp), %rdi
callq 0x3260
leaq -0x428(%rbp), %rdi
callq 0x3260
leaq -0x429(%rbp), %rdi
callq 0x33d0
movq -0x3c8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x3c8(%rbp)
jmp 0x542d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x5599
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x558d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x5581
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x3260
leaq -0x408(%rbp), %rdi
callq 0x3260
leaq -0x428(%rbp), %rdi
callq 0x3260
leaq -0x429(%rbp), %rdi
callq 0x33d0
jmp 0x5705
testb $0x1, -0x39(%rbp)
je 0x55ff
movb -0x3a(%rbp), %dl
leaq 0x38c16(%rip), %rcx     # 0x3e1d0
leaq 0x38c59(%rip), %rax     # 0x3e21a
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x4a8(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x5cb0
movq %rax, -0x4a0(%rbp)
jmp 0x55e4
movq -0x4a8(%rbp), %rdi
movq -0x4a0(%rbp), %rax
movl %eax, %esi
xorl %eax, %eax
callq 0x3050
jmp 0x55fd
jmp 0x55ff
movl -0x38(%rbp), %eax
movl %eax, -0x4b4(%rbp)
movq -0x128(%rbp), %rax
movq %rax, -0x4b0(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5f90
movl -0x4b4(%rbp), %esi
movq -0x4b0(%rbp), %rdx
movl %eax, %ecx
movq -0x248(%rbp), %r8
leaq 0x38c1b(%rip), %rdi     # 0x3e257
xorl %eax, %eax
callq 0x3050
jmp 0x5645
jmp 0x5647
movb $0x1, -0x33(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x18fa0
movb %al, -0x4b5(%rbp)
jmp 0x565f
movb -0x4b5(%rbp), %al
testb $0x1, %al
jne 0x5689
jmp 0x566b
leaq 0x38c31(%rip), %rdi     # 0x3e2a3
xorl %eax, %eax
callq 0x3050
jmp 0x567b
movb $0x0, -0x32(%rbp)
testb $0x1, -0x33(%rbp)
jne 0x5687
jmp 0x5647
jmp 0x5689
leaq -0x298(%rbp), %rdi
callq 0x1ab30
movb %al, -0x4b6(%rbp)
jmp 0x569d
movb -0x4b6(%rbp), %al
testb $0x1, %al
jne 0x56c7
jmp 0x56a9
leaq 0x38c15(%rip), %rdi     # 0x3e2c5
xorl %eax, %eax
callq 0x3050
jmp 0x56b9
movb $0x0, -0x32(%rbp)
testb $0x1, -0x33(%rbp)
jne 0x56c5
jmp 0x5647
jmp 0x56c7
movb -0x32(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movl $0x1, -0x390(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x6170
leaq -0x70(%rbp), %rdi
callq 0x6170
leaq -0x58(%rbp), %rdi
callq 0x61d0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x4d0, %rsp            # imm = 0x4D0
popq %rbp
retq
leaq -0x88(%rbp), %rdi
callq 0x6170
leaq -0x70(%rbp), %rdi
callq 0x6170
leaq -0x58(%rbp), %rdi
callq 0x61d0
movq -0x2a0(%rbp), %rdi
callq 0x35e0
nop