// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/src/zip_patch.cpp
// Function: zippatch_cmd_line(int, char const**)
int zippatch_cmd_line(int argc, const char * argv[]) {
    const char* oldZipPath=0;
    const char* zipDiffPath=0;
    const char* outNewZipPath=0;
    size_t      maxUncompressMemory=0;
    const char* tempUncompressFileName=0;
    hpatch_BOOL isOutputVersion=_kNULL_VALUE;
    size_t      threadNum = _THREAD_NUMBER_NULL;
    #define kMax_arg_values_size 5
    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 'v':{
                _options_check((isOutputVersion==_kNULL_VALUE)&&(op[2]=='\0'),"-v");
                isOutputVersion=hpatch_TRUE;
            } 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
            default: {
                _options_check(hpatch_FALSE,"-?");
            } break;
        }//swich
    }
    if (isOutputVersion==_kNULL_VALUE)
        isOutputVersion=hpatch_FALSE;
    if (isOutputVersion){
        printf("ApkDiffPatch::ZipPatch v" APKDIFFPATCH_VERSION_STRING "\n\n");
        if (arg_values_size==0)
            return 0; //ok
    }
    if (threadNum==_THREAD_NUMBER_NULL)
        threadNum=_THREAD_NUMBER_MIN;
    else if (threadNum>_THREAD_NUMBER_MAX)
        threadNum=_THREAD_NUMBER_MAX;
    
    if(arg_values_size==3){
        oldZipPath   =arg_values[0];
        zipDiffPath  =arg_values[1];
        outNewZipPath=arg_values[2];
    }else if(arg_values_size==5){
        oldZipPath   =arg_values[0];
        zipDiffPath  =arg_values[1];
        outNewZipPath=arg_values[2];
        _options_check(kmg_to_size(arg_values[3],strlen(arg_values[3]),
                                   &maxUncompressMemory),"maxUncompressMemory");
        tempUncompressFileName=arg_values[4];
        _options_check((tempUncompressFileName!=0)
                       &&(strlen(tempUncompressFileName)>0),"tempUncompressFileName");
    }else{
        _options_check(false,"count");
    }
    hpatch_printPath_utf8((std::string("oldZip   : \"")+oldZipPath+"\"\n").c_str());
    hpatch_printPath_utf8((std::string("zipDiff  : \"")+zipDiffPath+"\"\n").c_str());
    hpatch_printPath_utf8((std::string("outNewZip: \"")+outNewZipPath+"\"\n").c_str());
    if (tempUncompressFileName!=0){
        printf("maxUncompressMemory:%" PRSizeT "\n",maxUncompressMemory);
        hpatch_printPath_utf8((std::string("tempUncompressFileName:\"")+tempUncompressFileName+"\"\n").c_str());
    }
    
    double time0=clock_s();
    int exitCode=ZipPatch(oldZipPath,zipDiffPath,outNewZipPath,
                          maxUncompressMemory,tempUncompressFileName,(int)threadNum);
    double time1=clock_s();
    if (exitCode==PATCH_SUCCESS)
        printf("  zip file patch ok!\n");
    else
        printf("  zip file patch error!\n");
    printf("\nZipPatch time: %.3f s\n",(time1-time0));
    return exitCode;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
xorpd %xmm0, %xmm0
movapd %xmm0, 0x80(%rsp)
movapd %xmm0, 0x70(%rsp)
movq $0x0, 0x90(%rsp)
cmpl $0x2, %edi
jl 0x1cf78
movl %edi, %r15d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %r12d, %r12d
movl $0x1, %r13d
movabsq $0x1999999999999999, %r8 # imm = 0x1999999999999999
xorl %ebp, %ebp
movq (%rsi,%r13,8), %r14
testq %r14, %r14
je 0x1cf90
movzbl (%r14), %eax
cmpl $0x2d, %eax
je 0x1cdeb
testl %eax, %eax
je 0x1cf90
cmpl $0x5, %r12d
jge 0x1cf78
movslq %r12d, %rax
movq %r14, 0x70(%rsp,%rax,8)
incl %r12d
jmp 0x1ceb4
movzbl 0x1(%r14), %eax
cmpl $0x70, %eax
je 0x1ce1c
cmpl $0x76, %eax
jne 0x1cfa8
cmpl $-0x1, %ebx
jne 0x1cf9c
movl $0x1, %ebx
cmpb $0x0, 0x2(%r14)
je 0x1ceb4
jmp 0x1cf9c
testq %rbp, %rbp
jne 0x1cf84
cmpb $0x2d, 0x2(%r14)
jne 0x1cf84
movq %rsi, 0x40(%rsp)
addq $0x3, %r14
movq %r14, %rdi
movq %r8, %rbp
callq 0x20e0
testq %rax, %rax
je 0x1cf84
movq %rbp, %r8
cmpq $0x1, %rax
je 0x1ce60
cmpb $0x30, (%r14)
je 0x1cf84
xorl %ecx, %ecx
xorl %ebp, %ebp
movzbl (%r14,%rcx), %edx
leal -0x30(%rdx), %esi
cmpb $0x9, %sil
ja 0x1cf84
addq $-0x30, %rdx
cmpq %r8, %rbp
jb 0x1ce8f
jne 0x1cf84
cmpq $0x5, %rdx
ja 0x1cf84
leaq (,%rbp,4), %rsi
addq %rbp, %rsi
leaq (%rdx,%rsi,2), %rbp
incq %rcx
cmpq %rcx, %rax
jne 0x1ce64
testq %rbp, %rbp
movq 0x40(%rsp), %rsi
je 0x1cf84
incq %r13
cmpq %r15, %r13
jne 0x1cdb3
incl %ebx
cmpl $0x2, %ebx
jb 0x1cee2
leaq 0x9fcc(%rip), %rdi      # 0x26e9a
movq %r8, %rbx
callq 0x2310
movq %rbx, %r8
testl %r12d, %r12d
je 0x1d04e
movl $0x100, %ebx            # imm = 0x100
cmpq %rbx, %rbp
cmovbq %rbp, %rbx
cmpl $0x5, %r12d
je 0x1cfb4
cmpl $0x3, %r12d
jne 0x1cf78
movq 0x70(%rsp), %r15
movq 0x78(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x68(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x9e90(%rip), %rsi      # 0x26dc0
leaq 0x9e95(%rip), %rdx      # 0x26dcc
movq %rsp, %rdi
callq 0x1d688
movq %rsp, %rdi
movq %r15, %rsi
callq 0x23f0
leaq 0x58(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d055
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x1d05e
leaq 0x9ff9(%rip), %rdi      # 0x26f78
jmp 0x1d51f
leaq 0x9fb5(%rip), %rdi      # 0x26f40
jmp 0x1d51f
leaq 0x9f98(%rip), %rdi      # 0x26f2f
jmp 0x1d51f
leaq 0x9fb1(%rip), %rdi      # 0x26f54
jmp 0x1d51f
leaq 0x9fb7(%rip), %rdi      # 0x26f66
jmp 0x1d51f
movq 0x70(%rsp), %r15
movq 0x78(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x88(%rsp), %r13
movq %r13, %rdi
movq %r8, %r14
callq 0x20e0
testq %rax, %rax
je 0x1d518
movq %r14, %r8
movzbl -0x1(%r13,%rax), %edx
xorl %ecx, %ecx
addl $-0x47, %edx
cmpl $0x26, %edx
ja 0x1d50b
movabsq $0x100000001, %rsi      # imm = 0x100000001
btq %rdx, %rsi
jb 0x1d4fe
movl $0xa, %esi
movabsq $0x1000000010, %rdi     # imm = 0x1000000010
btq %rdx, %rdi
jb 0x1d503
movabsq $0x4000000040, %rsi     # imm = 0x4000000040
btq %rdx, %rsi
jae 0x1d50b
movl $0x14, %esi
jmp 0x1d503
xorl %ebx, %ebx
jmp 0x1d535
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq %r15, 0xa0(%rsp)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x9d44(%rip), %rsi      # 0x26dcd
callq 0x23f0
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d0b5
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x1d0be
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x20(%rsp), %rdi
callq 0xc354
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d0f7
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d10e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1d129
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x9c95(%rip), %rsi      # 0x26dd0
leaq 0x9c9a(%rip), %rdx      # 0x26ddc
callq 0x1d688
movq %rsp, %rdi
movq 0x40(%rsp), %rsi
callq 0x23f0
movq %r14, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d177
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x1d180
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x9c2a(%rip), %rsi      # 0x26dcd
callq 0x23f0
movq %r15, 0x20(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d1cb
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x1d1d4
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x20(%rsp), %rdi
callq 0xc354
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d20d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d224
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1d23f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x9b8c(%rip), %rsi      # 0x26ddd
leaq 0x9b91(%rip), %rdx      # 0x26de9
callq 0x1d688
movq %rsp, %rdi
movq 0x68(%rsp), %rsi
callq 0x23f0
movq %r14, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d28d
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x1d296
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x9b14(%rip), %rsi      # 0x26dcd
callq 0x23f0
movq %r15, 0x20(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d2e1
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x1d2ea
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x20(%rsp), %rdi
callq 0xc354
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d323
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d33a
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1d355
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2200
testq %r13, %r13
je 0x1d481
leaq 0x9a85(%rip), %rdi      # 0x26dea
movq %r12, %rsi
xorl %eax, %eax
callq 0x2040
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x9a82(%rip), %rsi      # 0x26e03
leaq 0x9a93(%rip), %rdx      # 0x26e1b
callq 0x1d688
movq %rsp, %rdi
movq %r13, %rsi
callq 0x23f0
movq %r14, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d3bb
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x1d3c4
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x99e6(%rip), %rsi      # 0x26dcd
callq 0x23f0
movq %r15, 0x20(%rsp)
movq (%rax), %rdi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdi
je 0x1d40f
movq %rdi, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x1d41b
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq %r15, %rdi
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0xc354
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d44f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d466
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1d481
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2200
callq 0x1d62f
movsd %xmm0, 0x98(%rsp)
testq %rbp, %rbp
movl $0x1, %r9d
cmovnel %ebx, %r9d
movq 0xa0(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x190e9
movl %eax, %ebx
callq 0x1d62f
movsd %xmm0, 0x40(%rsp)
testl %ebx, %ebx
leaq 0x9a4b(%rip), %rax      # 0x26f1a
leaq 0x9a2c(%rip), %rdi      # 0x26f02
cmoveq %rax, %rdi
callq 0x2310
movsd 0x40(%rsp), %xmm0
subsd 0x98(%rsp), %xmm0
leaq 0x9927(%rip), %rdi      # 0x26e1c
movb $0x1, %al
callq 0x2040
jmp 0x1d535
movl $0x1e, %esi
movq %rsi, %rcx
decq %rax
je 0x1d518
cmpq $0x1, %rax
je 0x1d549
cmpb $0x30, (%r13)
jne 0x1d549
leaq 0x999a(%rip), %rdi      # 0x26eb9
callq 0x2310
leaq 0x9a62(%rip), %rdi      # 0x26f8d
callq 0x2310
movl $0x1, %ebx
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edx, %edx
xorl %r12d, %r12d
movzbl (%r13,%rdx), %esi
leal -0x30(%rsi), %edi
cmpb $0x9, %dil
ja 0x1d518
addq $-0x30, %rsi
cmpq %r8, %r12
jb 0x1d56e
jne 0x1d518
cmpq $0x5, %rsi
ja 0x1d518
leaq (%r12,%r12,4), %rdi
leaq (%rsi,%rdi,2), %r12
incq %rdx
cmpq %rdx, %rax
jne 0x1d54e
movq $-0x1, %rax
shrq %cl, %rax
cmpq %rax, %r12
ja 0x1d518
movq 0x90(%rsp), %r13
testq %r13, %r13
je 0x1d5a8
shlq %cl, %r12
cmpb $0x0, (%r13)
jne 0x1cf20
leaq 0x992d(%rip), %rdi      # 0x26edc
jmp 0x1d51f
jmp 0x1d5cc
jmp 0x1d5e8
jmp 0x1d604
jmp 0x1d624
jmp 0x1d5cc
jmp 0x1d5e8
jmp 0x1d604
jmp 0x1d624
jmp 0x1d5cc
jmp 0x1d5e8
jmp 0x1d604
jmp 0x1d624
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d5eb
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x1d5eb
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d607
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x1d607
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1d627
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x1d627
movq %rax, %rbx
movq %rbx, %rdi
callq 0x23a0