// File: sisong[P]ApkDiffPatch/src/zip_diff.cpp
// Function: zipdiff_cmd_line(int, char const**)
int zipdiff_cmd_line(int argc, const char * argv[]) {
    const char* oldZipPath     =0;
    const char* newZipPath     =0;
    const char* outDiffFileName=0;
    hpatch_BOOL isDiff=_kNULL_VALUE;
    hpatch_BOOL isSingleCompressedDiff=_kNULL_VALUE;
    size_t      patchStepMemSize=0;
    hpatch_BOOL isPatchCheck   = _kNULL_VALUE;
    hpatch_BOOL isOutputVersion= _kNULL_VALUE;
    size_t      diffMatchScore = _kNULL_SIZE;
    size_t      threadNum = _THREAD_NUMBER_NULL;
    hdiff_TCompress*        compressPlugin=0;
    hpatch_TDecompress*     decompressPlugin=0;
#define kMax_arg_values_size 3
    const char * arg_values[kMax_arg_values_size]={0};
    int          arg_values_size=0;
    int         i;
    for (i=1; i<argc; ++i) {
        const char* op=argv[i];
        _options_check((op!=0)&&(strlen(op)>0),"?");
        if (op[0]!='-'){
            _options_check(arg_values_size<kMax_arg_values_size,"count");
            arg_values[arg_values_size]=op;
            ++arg_values_size;
            continue;
        }
        _options_check((op!=0)&&(op[0]=='-'),"?");
        switch (op[1]) {
            case 'm':{
                if (op[2]=='-'){
                    _options_check(diffMatchScore==_kNULL_SIZE,"-m-?")
                    const char* pnum=op+3;
                    _options_check(kmg_to_size(pnum,strlen(pnum),&diffMatchScore),"-m-?");
                    const size_t kMaxDiffMatchScore=1024;
                    _options_check((0<=diffMatchScore)&&(diffMatchScore<=kMaxDiffMatchScore),"-m-?");
                }else{
                    _options_check(hpatch_FALSE,"-m?");
                }
            } break;
#if (_IS_USED_MULTITHREAD)
            case 'p':{
                _options_check((threadNum==_THREAD_NUMBER_NULL)&&(op[2]=='-'),"-p-?");
                const char* pnum=op+3;
                _options_check(a_to_size(pnum,strlen(pnum),&threadNum),"-p-?");
                _options_check(threadNum>=_THREAD_NUMBER_MIN,"-p-?");
            } break;
#endif
            case 'c':{
                _options_check((compressPlugin==0)&&(op[2]=='-'),"-c");
                const char* ptype=op+3;
                const char* ptypeEnd=findUntilEnd(ptype,'-');
                int result=_checkSetCompress(&compressPlugin,&decompressPlugin,ptype,ptypeEnd);
                if (0!=result)
                    return result;
            } break;
            case 'S':{
                _options_check((isSingleCompressedDiff==_kNULL_VALUE)
                               &&(op[2]=='D')&&((op[3]=='\0')||(op[3]=='-')),"-SD");
                isSingleCompressedDiff=hpatch_TRUE;
                if (op[3]=='-'){
                    const char* pnum=op+4;
                    _options_check(kmg_to_size(pnum,strlen(pnum),&patchStepMemSize),"-SD-?");
                    _options_check((patchStepMemSize>=hpatch_kStreamCacheSize),"-SD-?");
                }else{
                    patchStepMemSize=kDefaultApkPatchStepMemSize;
                }
            } break;
            case 'v':{
                _options_check((isOutputVersion==_kNULL_VALUE)&&(op[2]=='\0'),"-v");
                isOutputVersion=hpatch_TRUE;
            } break;
            case 't':{
                _options_check((isPatchCheck==_kNULL_VALUE)&&(op[2]=='\0'),"-t");
                isPatchCheck=hpatch_TRUE; //test diffFile
            } break;
            case 'd':{
                _options_check((isDiff==_kNULL_VALUE)&&(op[2]=='\0'),"-d");
                isDiff=hpatch_TRUE; //diff only
            } break;
            default: {
                _options_check(hpatch_FALSE,"-?");
            } break;
        }//swich
    }
    if (compressPlugin==0){
#ifdef _CompressPlugin_lzma
        static TCompressPlugin_lzma myLzmaCompressPlugin=lzmaCompressPlugin;
        myLzmaCompressPlugin.compress_level=7;
        myLzmaCompressPlugin.dict_size=kDefaultLzmaDictSize;
        compressPlugin=&myLzmaCompressPlugin.base;
        decompressPlugin=&lzmaDecompressPlugin;
#else
        static TCompressPlugin_zlib myZlibCompressPlugin=zlibCompressPlugin;
        myZlibCompressPlugin.compress_level=9;
        myZlibCompressPlugin.mem_level=kDefaultZlibCompressMemLevel;
        compressPlugin=&myZlibCompressPlugin.base;
        decompressPlugin=&zlibDecompressPlugin;
#endif
    }
    if (threadNum==_THREAD_NUMBER_NULL)
        threadNum=_THREAD_NUMBER_DEFUALT;
    else if (threadNum>_THREAD_NUMBER_MAX)
        threadNum=_THREAD_NUMBER_MAX;
    if (compressPlugin!=0){
        compressPlugin->setParallelThreadNumber(compressPlugin,(int)threadNum);
    }
    
    if (isSingleCompressedDiff==_kNULL_VALUE)
        isSingleCompressedDiff=hpatch_FALSE;
    if (diffMatchScore==_kNULL_SIZE)
        diffMatchScore=kDefaultDiffMatchScore;
    if (isOutputVersion==_kNULL_VALUE)
        isOutputVersion=hpatch_FALSE;
    if (isOutputVersion){
        printf("ApkDiffPatch::ZipDiff v" APKDIFFPATCH_VERSION_STRING "\n\n");
        if (arg_values_size==0)
            return 0; //ok
    }
    
    if ((isDiff==hpatch_TRUE)&&(isPatchCheck==_kNULL_VALUE))
        isPatchCheck=hpatch_FALSE;
    if ((isDiff==_kNULL_VALUE)&&(isPatchCheck==hpatch_TRUE))
        isDiff=hpatch_FALSE;
    if (isDiff==_kNULL_VALUE)
        isDiff=hpatch_TRUE;
    if (isPatchCheck==_kNULL_VALUE)
        isPatchCheck=hpatch_TRUE;
    assert(isPatchCheck||isDiff);

    _options_check(arg_values_size==3,"count");
    
    oldZipPath      =arg_values[0];
    newZipPath      =arg_values[1];
    outDiffFileName =arg_values[2];
    hpatch_printPath_utf8((std::string("oldZip  : \"")+oldZipPath+"\"\n").c_str());
    hpatch_printPath_utf8((std::string("newZip  : \"")+newZipPath+"\"\n").c_str());
    hpatch_printPath_utf8((std::string(isDiff?
                                       "outDiff : \"":
                                       "testDiff: \"")+outDiffFileName+"\"\n").c_str());
    double time0=clock_s();
    bool   isNewZipApkV2SignNoError=true;
    if (isDiff){
        if (!ZipDiff(oldZipPath,newZipPath,outDiffFileName,compressPlugin,decompressPlugin,
                     (int)diffMatchScore,isSingleCompressedDiff?patchStepMemSize:0,
                     &isNewZipApkV2SignNoError,(int)threadNum)){
            printf("ZipDiff error!\n");
            return 1;
        }//else
        printf("ZipDiff time: %.3f s\n",(clock_s()-time0));
    }
    
    int exitCode=0;
    if (isPatchCheck){
        printf("\nrun ZipPatch:\n");
        for (int threadNum=1;threadNum<=4;threadNum*=4){
#if (_IS_USED_MULTITHREAD)
#else
            if (threadNum>1) break;
#endif
            double time2=clock_s();
            TCheckZipDiffResult rt=checkZipDiff(oldZipPath,newZipPath,outDiffFileName,threadNum);
            exitCode=((rt==CHECK_BYTE_BY_BYTE_EQUAL_TRUE)||(rt==CHECK_SAME_LIKE_TRUE__BYTE_BY_BYTE_EQUAL_FALSE))?0:1;
            switch (rt) {
                case CHECK_BYTE_BY_BYTE_EQUAL_TRUE:{
                    printf("  check ZipPatch result Byte By Byte Equal ok!\n");
                } break;
                case CHECK_SAME_LIKE_TRUE__BYTE_BY_BYTE_EQUAL_FALSE:{
                    printf("  check ZipPatch result Same Like ok! (but not Byte By Byte Equal)\n");
                } break;
                case CHECK_SAME_LIKE_TRUE__BYTE_BY_BYTE_EQUAL_ERROR:{
                    printf("  check ZipPatch result Byte By Byte Equal ERROR!\n");
                    printf("  (did newZip=AndroidSDK#apksigner(ApkNormalized(newZip)) before running ZipDiff?)\n");
                } break;
                case CHECK_SAME_LIKE_ERROR:{
                    printf("  check ZipPatch result zip data ERROR!\n");
                } break;
                case CHECK_ZIPPATCH_ERROR:{
                    printf("  run ZipPatch ERROR!\n");
                } break;
                default: { //CHECK_OTHER_ERROR
                    printf("  run check ZipPatch result ERROR!\n");
                }
            }
            printf("  patch time: %.3f s (thread==%d)\n",(clock_s()-time2),threadNum);
        }
    }
    if (isPatchCheck && isDiff)
        printf("\nall     time: %.3f s\n",(clock_s()-time0));
    if (!isNewZipApkV2SignNoError){ //safe check
        exitCode=1;
        printf("\nnewZip used ApkV2Sign, but not complete, as an ERROR!\n\n");
    }
    return exitCode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2f0, %rsp            # imm = 0x2F0
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x38(%rbp)
movl $0xffffffff, -0x3c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
movq $-0x1, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x4210
movl $0x0, -0x84(%rbp)
movl $0x1, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4f3d
movq -0x10(%rbp), %rax
movslq -0x88(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
je 0x49f3
movq -0x90(%rbp), %rdi
callq 0x4180
cmpq $0x0, %rax
ja 0x4a12
leaq 0xa76b6(%rip), %rdi     # 0xac0b0
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movq -0x90(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x4a70
cmpl $0x3, -0x84(%rbp)
jl 0x4a49
leaq 0xa7691(%rip), %rdi     # 0xac0c2
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movq -0x90(%rbp), %rcx
movslq -0x84(%rbp), %rax
movq %rcx, -0x80(%rbp,%rax,8)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x4f29
cmpq $0x0, -0x90(%rbp)
je 0x4a89
movq -0x90(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x4aa8
leaq 0xa7620(%rip), %rdi     # 0xac0b0
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movq -0x90(%rbp), %rax
movsbl 0x1(%rax), %eax
addl $-0x53, %eax
movl %eax, %ecx
movq %rcx, -0x240(%rbp)
subl $0x23, %eax
ja 0x4f08
movq -0x240(%rbp), %rax
leaq 0xa7542(%rip), %rcx     # 0xac018
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x90(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x2d, %eax
jne 0x4bba
cmpq $-0x1, -0x48(%rbp)
je 0x4b19
leaq 0xa75d7(%rip), %rdi     # 0xac0d8
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movq -0x90(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x248(%rbp)
movq -0x98(%rbp), %rdi
callq 0x4180
movq -0x248(%rbp), %rdi
movq %rax, %rsi
leaq -0x48(%rbp), %rdx
callq 0x5780
cmpl $0x0, %eax
jne 0x4b7c
leaq 0xa7574(%rip), %rdi     # 0xac0d8
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movq $0x400, -0xa0(%rbp) # imm = 0x400
xorl %eax, %eax
cmpq -0x48(%rbp), %rax
ja 0x4b99
cmpq $0x400, -0x48(%rbp)     # imm = 0x400
jbe 0x4bb8
leaq 0xa7538(%rip), %rdi     # 0xac0d8
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
jmp 0x4bd9
leaq 0xa752c(%rip), %rdi     # 0xac0ed
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
jmp 0x4f27
cmpq $0x0, -0x50(%rbp)
jne 0x4bf5
movq -0x90(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x2d, %eax
je 0x4c14
leaq 0xa7505(%rip), %rdi     # 0xac101
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movq -0x90(%rbp), %rax
addq $0x3, %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x4180
movq -0x250(%rbp), %rdi
movq %rax, %rsi
leaq -0x50(%rbp), %rdx
callq 0x58b0
cmpl $0x0, %eax
jne 0x4c77
leaq 0xa74a2(%rip), %rdi     # 0xac101
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
cmpq $0x1, -0x50(%rbp)
jae 0x4c9d
leaq 0xa747c(%rip), %rdi     # 0xac101
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
jmp 0x4f27
cmpq $0x0, -0x58(%rbp)
jne 0x4cb9
movq -0x90(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x2d, %eax
je 0x4cd8
leaq 0xa7456(%rip), %rdi     # 0xac116
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movq -0x90(%rbp), %rax
addq $0x3, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
movl $0x2d, %esi
callq 0x5a10
movq %rax, -0xb8(%rbp)
movq -0xb0(%rbp), %rdx
movq -0xb8(%rbp), %rcx
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5a70
movl %eax, -0xbc(%rbp)
xorl %eax, %eax
cmpl -0xbc(%rbp), %eax
je 0x4d3b
movl -0xbc(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x5743
jmp 0x4f27
cmpl $-0x1, -0x30(%rbp)
jne 0x4d76
movq -0x90(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x44, %eax
jne 0x4d76
movq -0x90(%rbp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x0, %eax
je 0x4d95
movq -0x90(%rbp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x2d, %eax
je 0x4d95
leaq 0xa73ac(%rip), %rdi     # 0xac129
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movl $0x1, -0x30(%rbp)
movq -0x90(%rbp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x2d, %eax
jne 0x4e3e
movq -0x90(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x258(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x4180
movq -0x258(%rbp), %rdi
movq %rax, %rsi
leaq -0x38(%rbp), %rdx
callq 0x5780
cmpl $0x0, %eax
jne 0x4e13
leaq 0xa7342(%rip), %rdi     # 0xac13d
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
cmpq $0x1000, -0x38(%rbp)    # imm = 0x1000
jae 0x4e3c
leaq 0xa7319(%rip), %rdi     # 0xac13d
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
jmp 0x4e46
movq $0x200000, -0x38(%rbp)  # imm = 0x200000
jmp 0x4f27
cmpl $-0x1, -0x40(%rbp)
jne 0x4e61
movq -0x90(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x4e80
leaq 0xa72eb(%rip), %rdi     # 0xac153
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movl $0x1, -0x40(%rbp)
jmp 0x4f27
cmpl $-0x1, -0x3c(%rbp)
jne 0x4ea2
movq -0x90(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x4ec1
leaq 0xa72bd(%rip), %rdi     # 0xac166
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movl $0x1, -0x3c(%rbp)
jmp 0x4f27
cmpl $-0x1, -0x2c(%rbp)
jne 0x4ee0
movq -0x90(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x4eff
leaq 0xa7292(%rip), %rdi     # 0xac179
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movl $0x1, -0x2c(%rbp)
jmp 0x4f27
leaq 0xa727d(%rip), %rdi     # 0xac18c
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
jmp 0x4f29
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x49b2
cmpq $0x0, -0x58(%rbp)
jne 0x4f6e
movl $0x7, 0xe149a(%rip)     # 0xe63e8
movl $0x400000, 0xe1494(%rip) # imm = 0x400000
leaq 0xe1461(%rip), %rax     # 0xe63c0
movq %rax, -0x58(%rbp)
leaq 0xe148e(%rip), %rax     # 0xe63f8
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x4f7f
movq $0x4, -0x50(%rbp)
jmp 0x4f93
cmpq $0x100, -0x50(%rbp)     # imm = 0x100
jbe 0x4f91
movq $0x100, -0x50(%rbp)     # imm = 0x100
jmp 0x4f93
cmpq $0x0, -0x58(%rbp)
je 0x4fae
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rcx
movl %ecx, %esi
callq *%rax
cmpl $-0x1, -0x30(%rbp)
jne 0x4fbb
movl $0x0, -0x30(%rbp)
cmpq $-0x1, -0x48(%rbp)
jne 0x4fca
movq $0x3, -0x48(%rbp)
cmpl $-0x1, -0x40(%rbp)
jne 0x4fd7
movl $0x0, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
je 0x5002
leaq 0xa71bb(%rip), %rdi     # 0xac19f
movb $0x0, %al
callq 0x4060
cmpl $0x0, -0x84(%rbp)
jne 0x5000
movl $0x0, -0x4(%rbp)
jmp 0x5743
jmp 0x5002
cmpl $0x1, -0x2c(%rbp)
jne 0x5015
cmpl $-0x1, -0x3c(%rbp)
jne 0x5015
movl $0x0, -0x3c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x5028
cmpl $0x1, -0x3c(%rbp)
jne 0x5028
movl $0x0, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x5035
movl $0x1, -0x2c(%rbp)
cmpl $-0x1, -0x3c(%rbp)
jne 0x5042
movl $0x1, -0x3c(%rbp)
movb $0x1, %al
cmpl $0x0, -0x3c(%rbp)
movb %al, -0x259(%rbp)
jne 0x505d
cmpl $0x0, -0x2c(%rbp)
setne %al
movb %al, -0x259(%rbp)
movb -0x259(%rbp), %al
testb $0x1, %al
jne 0x5069
jmp 0x506b
jmp 0x508a
leaq 0xa714c(%rip), %rdi     # 0xac1be
leaq 0xa715a(%rip), %rsi     # 0xac1d3
movl $0x160, %edx            # imm = 0x160
leaq 0xa715f(%rip), %rcx     # 0xac1e4
callq 0x4270
cmpl $0x3, -0x84(%rbp)
je 0x50b2
leaq 0xa7028(%rip), %rdi     # 0xac0c2
movb $0x0, %al
callq 0x4060
callq 0x5760
movl $0x1, -0x4(%rbp)
jmp 0x5743
movq -0x80(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq -0x129(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x4690
movq -0x268(%rbp), %rdx
leaq 0xa7122(%rip), %rsi     # 0xac20d
leaq -0x128(%rbp), %rdi
callq 0x86c0
jmp 0x50f9
movq -0x18(%rbp), %rdx
leaq -0x108(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x8670
jmp 0x5112
leaq 0xa7100(%rip), %rdx     # 0xac219
leaq -0xe8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x8670
jmp 0x512e
leaq -0xe8(%rbp), %rdi
callq 0x4160
movq %rax, %rdi
callq 0x8cf20
jmp 0x5144
leaq -0xe8(%rbp), %rdi
callq 0x4260
leaq -0x108(%rbp), %rdi
callq 0x4260
leaq -0x128(%rbp), %rdi
callq 0x4260
leaq -0x129(%rbp), %rdi
callq 0x43f0
leaq -0x1a1(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x4690
movq -0x270(%rbp), %rdx
leaq 0xa7087(%rip), %rsi     # 0xac21c
leaq -0x1a0(%rbp), %rdi
callq 0x86c0
jmp 0x51a3
movq -0x20(%rbp), %rdx
leaq -0x180(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x8670
jmp 0x51bc
leaq 0xa7056(%rip), %rdx     # 0xac219
leaq -0x160(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x8670
jmp 0x51d8
leaq -0x160(%rbp), %rdi
callq 0x4160
movq %rax, %rdi
callq 0x8cf20
jmp 0x51ee
leaq -0x160(%rbp), %rdi
callq 0x4260
leaq -0x180(%rbp), %rdi
callq 0x4260
leaq -0x1a0(%rbp), %rdi
callq 0x4260
leaq -0x1a1(%rbp), %rdi
callq 0x43f0
cmpl $0x0, -0x2c(%rbp)
je 0x5234
leaq 0xa6ffd(%rip), %rax     # 0xac228
movq %rax, -0x278(%rbp)
jmp 0x5244
leaq 0xa6ff9(%rip), %rax     # 0xac234
movq %rax, -0x278(%rbp)
jmp 0x5244
movq -0x278(%rbp), %rax
movq %rax, -0x288(%rbp)
leaq -0x209(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x4690
movq -0x288(%rbp), %rsi
movq -0x280(%rbp), %rdx
leaq -0x208(%rbp), %rdi
callq 0x86c0
jmp 0x5281
movq -0x28(%rbp), %rdx
leaq -0x1e8(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x8670
jmp 0x529a
leaq 0xa6f78(%rip), %rdx     # 0xac219
leaq -0x1c8(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x8670
jmp 0x52b6
leaq -0x1c8(%rbp), %rdi
callq 0x4160
movq %rax, %rdi
callq 0x8cf20
jmp 0x52cc
leaq -0x1c8(%rbp), %rdi
callq 0x4260
leaq -0x1e8(%rbp), %rdi
callq 0x4260
leaq -0x208(%rbp), %rdi
callq 0x4260
leaq -0x209(%rbp), %rdi
callq 0x43f0
callq 0x6170
movsd %xmm0, -0x218(%rbp)
movb $0x1, -0x219(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x558d
movq -0x18(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x2b0(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x2a8(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x2a0(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x298(%rbp)
movq -0x48(%rbp), %rax
movl %eax, -0x28c(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x536e
movq -0x38(%rbp), %rax
movq %rax, -0x2c0(%rbp)
jmp 0x5379
xorl %eax, %eax
movq %rax, -0x2c0(%rbp)
jmp 0x5379
movl -0x28c(%rbp), %r9d
movq -0x298(%rbp), %r8
movq -0x2a0(%rbp), %rcx
movq -0x2a8(%rbp), %rdx
movq -0x2b0(%rbp), %rsi
movq -0x2b8(%rbp), %rdi
movq -0x2c0(%rbp), %r11
movq -0x50(%rbp), %rax
leaq -0x219(%rbp), %r10
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x12720
testb $0x1, %al
jne 0x5572
leaq 0xa6e6a(%rip), %rdi     # 0xac240
movb $0x0, %al
callq 0x4060
movl $0x1, -0x4(%rbp)
jmp 0x5743
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
jmp 0x545b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
jmp 0x544f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
jmp 0x5443
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4260
leaq -0x108(%rbp), %rdi
callq 0x4260
leaq -0x128(%rbp), %rdi
callq 0x4260
leaq -0x129(%rbp), %rdi
callq 0x43f0
jmp 0x574f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
jmp 0x54de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
jmp 0x54d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
jmp 0x54c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x4260
leaq -0x180(%rbp), %rdi
callq 0x4260
leaq -0x1a0(%rbp), %rdi
callq 0x4260
leaq -0x1a1(%rbp), %rdi
callq 0x43f0
jmp 0x574f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
jmp 0x5561
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
jmp 0x5555
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
jmp 0x5549
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x4260
leaq -0x1e8(%rbp), %rdi
callq 0x4260
leaq -0x208(%rbp), %rdi
callq 0x4260
leaq -0x209(%rbp), %rdi
callq 0x43f0
jmp 0x574f
callq 0x6170
subsd -0x218(%rbp), %xmm0
leaq 0xa6cca(%rip), %rdi     # 0xac250
movb $0x1, %al
callq 0x4060
movl $0x0, -0x220(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x56f2
leaq 0xa6cbe(%rip), %rdi     # 0xac266
movb $0x0, %al
callq 0x4060
movl $0x1, -0x224(%rbp)
cmpl $0x4, -0x224(%rbp)
jg 0x56f0
callq 0x6170
movsd %xmm0, -0x230(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl -0x224(%rbp), %ecx
callq 0x13ba0
movl %eax, -0x234(%rbp)
movb $0x1, %al
cmpl $0x0, -0x234(%rbp)
movb %al, -0x2c1(%rbp)
je 0x5611
cmpl $0x1, -0x234(%rbp)
sete %al
movb %al, -0x2c1(%rbp)
movb -0x2c1(%rbp), %al
notb %al
movzbl %al, %eax
andl $0x1, %eax
movl %eax, -0x220(%rbp)
movl -0x234(%rbp), %eax
movq %rax, -0x2d0(%rbp)
subq $0x4, %rax
ja 0x56ad
movq -0x2d0(%rbp), %rax
leaq 0xa69be(%rip), %rcx     # 0xac004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xa6c20(%rip), %rdi     # 0xac276
movb $0x0, %al
callq 0x4060
jmp 0x56bb
leaq 0xa6c40(%rip), %rdi     # 0xac2a6
movb $0x0, %al
callq 0x4060
jmp 0x56bb
leaq 0xa6c74(%rip), %rdi     # 0xac2ea
movb $0x0, %al
callq 0x4060
leaq 0xa6c99(%rip), %rdi     # 0xac31d
movb $0x0, %al
callq 0x4060
jmp 0x56bb
leaq 0xa6cdd(%rip), %rdi     # 0xac371
movb $0x0, %al
callq 0x4060
jmp 0x56bb
leaq 0xa6cf6(%rip), %rdi     # 0xac39a
movb $0x0, %al
callq 0x4060
jmp 0x56bb
leaq 0xa6cfd(%rip), %rdi     # 0xac3b1
movb $0x0, %al
callq 0x4060
callq 0x6170
subsd -0x230(%rbp), %xmm0
movl -0x224(%rbp), %esi
leaq 0xa6d00(%rip), %rdi     # 0xac3d5
movb $0x1, %al
callq 0x4060
movl -0x224(%rbp), %eax
shll $0x2, %eax
movl %eax, -0x224(%rbp)
jmp 0x55b9
jmp 0x56f2
cmpl $0x0, -0x3c(%rbp)
je 0x5719
cmpl $0x0, -0x2c(%rbp)
je 0x5719
callq 0x6170
subsd -0x218(%rbp), %xmm0
leaq 0xa6ce6(%rip), %rdi     # 0xac3f8
movb $0x1, %al
callq 0x4060
testb $0x1, -0x219(%rbp)
jne 0x573a
movl $0x1, -0x220(%rbp)
leaq 0xa6cdc(%rip), %rdi     # 0xac40f
movb $0x0, %al
callq 0x4060
movl -0x220(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbp
retq
movq -0x138(%rbp), %rdi
callq 0x4680
nopl (%rax,%rax)