// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r15
leaq 0x78(%rsp), %rax
andq $0x0, (%rax)
leaq 0x70(%rsp), %rax
orq $-0x1, (%rax)
leaq 0x48(%rsp), %rax
andq $0x0, (%rax)
andq $0x0, 0xd0(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0xc0(%rsp)
movslq %edi, %r12
pushq $-0x1
popq %rax
xorl %esi, %esi
pushq $0x1
popq %r14
pushq $-0x1
popq %rcx
movq %rcx, 0x40(%rsp)
pushq $0x1
popq %rbp
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
xorl %ebx, %ebx
movl %eax, 0x20(%rsp)
movl %eax, 0x1c(%rsp)
movl %eax, 0x28(%rsp)
movl %eax, 0x30(%rsp)
cmpq %r12, %r14
jge 0x4ce3
movq (%r15,%r14,8), %r13
testq %r13, %r13
je 0x4cd7
movzbl (%r13), %eax
cmpl $0x2d, %eax
je 0x48a4
testl %eax, %eax
je 0x4cd7
cmpl $0x3, %ebx
jge 0x4d2f
movslq %ebx, %rax
movq %r13, 0xc0(%rsp,%rax,8)
incl %ebx
incq %r14
jmp 0x4861
movzbl 0x1(%r13), %eax
leal -0x6d(%rax), %ecx
cmpl $0x9, %ecx
ja 0x493b
leaq 0x4975c(%rip), %rdx     # 0x4e018
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
cmpb $0x2d, 0x2(%r13)
jne 0x5164
cmpq $-0x1, 0x40(%rsp)
jne 0x516d
movl %ebx, 0x38(%rsp)
movq %r12, %rbx
movq %r15, %r12
movl %ebp, %r15d
movq %rsi, %rbp
addq $0x3, %r13
movq %r13, %rdi
callq 0x4150
movq %r13, %rdi
movq %rax, %rsi
leaq 0x70(%rsp), %rdx
callq 0x527c
testl %eax, %eax
je 0x5171
movq 0x70(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x401, %rax            # imm = 0x401
movq %rbp, %rsi
movl %r15d, %ebp
movq %r12, %r15
movq %rbx, %r12
movl 0x38(%rsp), %ebx
jb 0x489f
jmp 0x5185
cmpl $0x53, %eax
je 0x49fe
cmpl $0x63, %eax
je 0x4a87
cmpl $0x64, %eax
jne 0x515b
cmpl $-0x1, 0x30(%rsp)
jne 0x4fb9
cmpb $0x0, 0x2(%r13)
movl %ebp, 0x30(%rsp)
je 0x489f
jmp 0x4fb9
cmpl $-0x1, 0x28(%rsp)
jne 0x4fa1
cmpb $0x0, 0x2(%r13)
movl %ebp, 0x28(%rsp)
je 0x489f
jmp 0x4fa1
cmpl $-0x1, 0x20(%rsp)
jne 0x4fad
cmpb $0x0, 0x2(%r13)
movl %ebp, 0x20(%rsp)
je 0x489f
jmp 0x4fad
testq %rsi, %rsi
jne 0x4fd8
cmpb $0x2d, 0x2(%r13)
jne 0x4fd8
addq $0x3, %r13
movq %r13, %rdi
callq 0x4150
movq %r13, %rdi
movq %rax, %rsi
leaq 0x48(%rsp), %rdx
callq 0x532b
testl %eax, %eax
je 0x516f
movq 0x48(%rsp), %rsi
testq %rsi, %rsi
jne 0x489f
jmp 0x517c
cmpl $-0x1, 0x1c(%rsp)
jne 0x4fcc
cmpb $0x44, 0x2(%r13)
jne 0x4fcc
movzbl 0x3(%r13), %eax
testl %eax, %eax
je 0x4b3d
cmpl $0x2d, %eax
jne 0x4fcc
movl %ebx, 0x38(%rsp)
movq %r12, %rbx
movq %r15, %r12
movl %ebp, %r15d
movq %rsi, %rbp
addq $0x4, %r13
movq %r13, %rdi
callq 0x4150
movq %r13, %rdi
movq %rax, %rsi
leaq 0x78(%rsp), %rdx
callq 0x527c
testl %eax, %eax
je 0x51a9
cmpq $0xfff, 0x78(%rsp)      # imm = 0xFFF
movl %r15d, 0x1c(%rsp)
movq %rbp, %rsi
movl %r15d, %ebp
movq %r12, %r15
movq %rbx, %r12
movl 0x38(%rsp), %ebx
ja 0x489f
jmp 0x51ab
cmpq $0x0, 0x8(%rsp)
jne 0x4fdd
cmpb $0x2d, 0x2(%r13)
jne 0x4fdd
movq %rsi, 0x38(%rsp)
addq $0x3, %r13
movq %r13, %rdi
callq 0x538b
andq $0x0, 0x50(%rsp)
andq $0x0, 0x80(%rsp)
movq %rax, %rbp
andq $0x0, 0xa0(%rsp)
subq $0x30, %rsp
xorpd %xmm0, %xmm0
movupd %xmm0, 0x18(%rsp)
movupd %xmm0, 0x8(%rsp)
movq $0x9, (%rsp)
leaq 0x80(%rsp), %rdi
movq %r13, %rsi
movq %rax, %rdx
leaq 0x497f6(%rip), %rcx     # 0x4e2f1
leaq 0xb0(%rsp), %r8
pushq $0x1
popq %r9
callq 0x5614
addq $0x30, %rsp
testb %al, %al
je 0x5173
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4b32
leaq 0x497c8(%rip), %rsi     # 0x4e2f1
callq 0x4450
testl %eax, %eax
je 0x4b4f
movq $0x0, 0x8(%rsp)
jmp 0x4b7e
movq $0x200000, 0x78(%rsp)   # imm = 0x200000
movl %ebp, 0x1c(%rsp)
jmp 0x489f
movl 0x80(%rsp), %eax
movl %eax, 0x7089c(%rip)     # 0x753f8
movl $0x8, 0x70896(%rip)     # 0x753fc
leaq 0x70863(%rip), %rax     # 0x753d0
movq %rax, 0x8(%rsp)
leaq 0x70897(%rip), %rax     # 0x75410
movq %rax, 0x10(%rsp)
subq $0x8, %rsp
leaq 0x58(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
leaq 0x49586(%rip), %rcx     # 0x4e11a
leaq 0x88(%rsp), %r8
xorl %r9d, %r9d
pushq $0x400000               # imm = 0x400000
pushq $0x60000000             # imm = 0x60000000
pushq $0x1000                 # imm = 0x1000
leaq 0xc0(%rsp), %rax
pushq %rax
pushq $0x7
callq 0x5614
addq $0x30, %rsp
testb %al, %al
je 0x518e
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4c16
leaq 0x4953f(%rip), %rsi     # 0x4e11a
callq 0x4450
testl %eax, %eax
jne 0x4c16
movl 0x80(%rsp), %eax
movl %eax, 0x70877(%rip)     # 0x75468
movl 0xa0(%rsp), %eax
movl %eax, 0x7086e(%rip)     # 0x7546c
leaq 0x7083b(%rip), %rax     # 0x75440
movq %rax, 0x8(%rsp)
leaq 0x7078f(%rip), %rax     # 0x753a0
movq %rax, 0x10(%rsp)
subq $0x8, %rsp
leaq 0x58(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
leaq 0x494f3(%rip), %rcx     # 0x4e11f
leaq 0x88(%rsp), %r8
xorl %r9d, %r9d
pushq $0x400000               # imm = 0x400000
pushq $0x60000000             # imm = 0x60000000
pushq $0x1000                 # imm = 0x1000
leaq 0xc0(%rsp), %rax
pushq %rax
pushq $0x7
callq 0x5614
addq $0x30, %rsp
testb %al, %al
je 0x5197
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4c7c
leaq 0x494ac(%rip), %rsi     # 0x4e11f
callq 0x4450
testl %eax, %eax
je 0x4c98
cmpq $0x0, 0x8(%rsp)
pushq $0x1
popq %rbp
je 0x51a0
cmpq $0x0, 0x10(%rsp)
jne 0x4ccd
jmp 0x51a0
movl 0x80(%rsp), %eax
movl %eax, 0x707fb(%rip)     # 0x754a0
movl 0xa0(%rsp), %eax
movl %eax, 0x707f2(%rip)     # 0x754a4
leaq 0x707bf(%rip), %rax     # 0x75478
movq %rax, 0x8(%rsp)
leaq 0x707eb(%rip), %rax     # 0x754b0
movq %rax, 0x10(%rsp)
pushq $0x1
popq %rbp
movq 0x38(%rsp), %rsi
jmp 0x489f
leaq 0x49bb4(%rip), %rdi     # 0x4e892
jmp 0x51b2
movq 0x8(%rsp), %r12
testq %r12, %r12
movq 0x10(%rsp), %r15
jne 0x4d11
movabsq $0x40000000000007, %rax # imm = 0x40000000000007
movq %rax, 0x7068d(%rip)     # 0x75390
leaq 0x7065e(%rip), %r12     # 0x75368
leaq 0x7068f(%rip), %r15     # 0x753a0
testq %rsi, %rsi
je 0x4d34
cmpq $0x101, %rsi            # imm = 0x101
jb 0x4d40
movq $0x100, 0x48(%rsp)      # imm = 0x100
movl $0x100, %esi            # imm = 0x100
jmp 0x4d40
jmp 0x4f95
movq $0x4, 0x48(%rsp)
pushq $0x4
popq %rsi
movq %r12, %rdi
callq *0x10(%r12)
movq 0x70(%rsp), %rax
cmpq $-0x1, %rax
pushq $0x3
popq %r13
cmovneq %rax, %r13
movq %r13, 0x70(%rsp)
movl 0x28(%rsp), %eax
incl %eax
cmpl $0x2, %eax
jb 0x4d7d
leaq 0x49956(%rip), %rdi     # 0x4e6c6
callq 0x4510
testl %ebx, %ebx
je 0x4fc5
movq %r15, 0x10(%rsp)
movl 0x30(%rsp), %edx
movl %edx, %eax
xorl $0x1, %eax
movl 0x20(%rsp), %esi
movl %esi, %ecx
notl %ecx
xorl %r14d, %r14d
orl %eax, %ecx
cmovnel %esi, %r14d
movl %edx, %eax
notl %eax
movl %r14d, %ecx
xorl $0x1, %ecx
orl %eax, %ecx
setne %bpl
testl %edx, %edx
setne %r15b
orl %r14d, %edx
je 0x51d3
cmpl $0x3, %ebx
jne 0x4f95
movq 0xc0(%rsp), %rbx
movq 0xc8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x492aa(%rip), %rsi     # 0x4e097
leaq 0xa0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x67ee
leaq 0x80(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movq %rbx, 0x30(%rsp)
movq %rbx, %rdx
callq 0x67cf
leaq 0x49280(%rip), %rdx     # 0x4e0a3
leaq 0x50(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x67cf
movq 0x50(%rsp), %rdi
callq 0x3e2f4
leaq 0x50(%rsp), %rdi
callq 0x4170
leaq 0x80(%rsp), %rdi
callq 0x4170
leaq 0xa0(%rsp), %rdi
callq 0x4170
leaq 0x4923c(%rip), %rsi     # 0x4e0a6
leaq 0xa0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x67ee
leaq 0x80(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x67cf
leaq 0x49206(%rip), %rdx     # 0x4e0a3
leaq 0x50(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x67cf
movq 0x50(%rsp), %rdi
callq 0x3e2f4
andb %bpl, %r15b
leaq 0x50(%rsp), %rdi
callq 0x4170
leaq 0x80(%rsp), %rdi
callq 0x4170
leaq 0xa0(%rsp), %rdi
callq 0x4170
leaq 0x491cb(%rip), %rax     # 0x4e0b2
leaq 0x491d0(%rip), %rsi     # 0x4e0be
testb %r15b, %r15b
cmovneq %rax, %rsi
leaq 0xa0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x67ee
leaq 0x80(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x67cf
leaq 0x4917b(%rip), %rdx     # 0x4e0a3
leaq 0x50(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x67cf
movq 0x50(%rsp), %rdi
callq 0x3e2f4
leaq 0x50(%rsp), %rbp
movq %rbp, %rdi
callq 0x4170
leaq 0x80(%rsp), %rdi
callq 0x4170
leaq 0xa0(%rsp), %rdi
callq 0x4170
callq 0x55c1
movsd %xmm0, 0x40(%rsp)
movb $0x1, (%rbp)
testb %r15b, %r15b
je 0x503c
movl 0x1c(%rsp), %eax
incl %eax
cmpl $0x2, %eax
jb 0x4fe9
movq 0x78(%rsp), %rax
jmp 0x4feb
leaq 0x499c4(%rip), %rdi     # 0x4e960
jmp 0x51b2
leaq 0x4991f(%rip), %rdi     # 0x4e8c7
jmp 0x51b2
leaq 0x49901(%rip), %rdi     # 0x4e8b5
jmp 0x51b2
leaq 0x498e3(%rip), %rdi     # 0x4e8a3
jmp 0x51b2
xorl %ebp, %ebp
jmp 0x51bf
leaq 0x49906(%rip), %rdi     # 0x4e8d9
jmp 0x51b2
jmp 0x517c
leaq 0x4991d(%rip), %rdi     # 0x4e901
jmp 0x51b2
xorl %eax, %eax
movl 0x48(%rsp), %r10d
subq $0x8, %rsp
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %r12, %rcx
movq 0x18(%rsp), %r8
movl %r13d, %r9d
pushq %r10
pushq %rbp
pushq %rax
callq 0x9538
addq $0x20, %rsp
testb %al, %al
je 0x514d
callq 0x55c1
subsd 0x40(%rsp), %xmm0
leaq 0x49095(%rip), %rdi     # 0x4e0ca
movb $0x1, %al
callq 0x4060
testl %r14d, %r14d
je 0x513b
movb %r15b, 0x10(%rsp)
leaq 0x496a2(%rip), %rdi     # 0x4e6f3
callq 0x4510
pushq $0x1
popq %r14
xorl %ebp, %ebp
leaq 0x497dd(%rip), %rbx     # 0x4e840
leaq 0x49076(%rip), %r13     # 0x4e0e0
leaq 0x48f93(%rip), %r15     # 0x4e004
cmpl $0x4, %r14d
ja 0x5119
callq 0x55c1
movsd %xmm0, 0x8(%rsp)
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movl %r14d, %ecx
callq 0xa43c
xorl %ebp, %ebp
cmpl $0x2, %eax
setae %r12b
cmpl $0x4, %eax
ja 0x50e9
movl %eax, %eax
movslq (%r15,%rax,4), %rax
addq %r15, %rax
movq %rbx, %rdi
jmpq *%rax
leaq 0x4973d(%rip), %rdi     # 0x4e7fd
jmp 0x50f0
leaq 0x49671(%rip), %rdi     # 0x4e73a
jmp 0x50f0
leaq 0x496a6(%rip), %rdi     # 0x4e778
callq 0x4510
leaq 0x496cc(%rip), %rdi     # 0x4e7aa
jmp 0x50f0
leaq 0x49669(%rip), %rdi     # 0x4e750
jmp 0x50f0
leaq 0x4977f(%rip), %rdi     # 0x4e86f
movb %r12b, %bpl
callq 0x4510
callq 0x55c1
subsd 0x8(%rsp), %xmm0
movq %r13, %rdi
movl %r14d, %esi
movb $0x1, %al
callq 0x4060
shll $0x2, %r14d
jmp 0x5071
cmpb $0x0, 0x10(%rsp)
je 0x513d
callq 0x55c1
subsd 0x40(%rsp), %xmm0
leaq 0x48fd1(%rip), %rdi     # 0x4e103
movb $0x1, %al
callq 0x4060
jmp 0x513d
xorl %ebp, %ebp
cmpb $0x0, 0x50(%rsp)
jne 0x51bf
leaq 0x495b7(%rip), %rdi     # 0x4e702
jmp 0x5154
leaq 0x49590(%rip), %rdi     # 0x4e6e4
callq 0x4510
jmp 0x51bc
leaq 0x497ec(%rip), %rdi     # 0x4e94e
jmp 0x51b2
leaq 0x497bc(%rip), %rdi     # 0x4e927
jmp 0x51b2
jmp 0x5185
jmp 0x517c
jmp 0x5185
leaq 0x49d90(%rip), %rdi     # 0x4ef0a
jmp 0x51a7
leaq 0x49790(%rip), %rdi     # 0x4e913
jmp 0x51b2
leaq 0x497ae(%rip), %rdi     # 0x4e93a
jmp 0x51b2
leaq 0x49d8e(%rip), %rdi     # 0x4ef23
jmp 0x51a7
leaq 0x49d9e(%rip), %rdi     # 0x4ef3c
jmp 0x51a7
leaq 0x49daf(%rip), %rdi     # 0x4ef56
jmp 0x51b2
jmp 0x51ab
leaq 0x4973a(%rip), %rdi     # 0x4e8ec
callq 0x4510
callq 0x5270
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x48e6e(%rip), %rdi     # 0x4e048
leaq 0x48e7c(%rip), %rsi     # 0x4e05d
leaq 0x48e86(%rip), %rcx     # 0x4e06e
movl $0x160, %edx            # imm = 0x160
callq 0x4230
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x4170
jmp 0x5204
movq %rax, %rbx
jmp 0x521c
jmp 0x522b
jmp 0x5265
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x4170
jmp 0x521c
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x4170
jmp 0x5256
movq %rax, %rbx
jmp 0x5256
jmp 0x5265
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x4170
jmp 0x5244
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x4170
jmp 0x5256
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x4170
jmp 0x5268
movq %rax, %rbx
movq %rbx, %rdi
callq 0x4600