// File: /workspace/github_cpp_makefile_star2_O1/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 0x1cdea
movq %rsi, %rbx
movl %edi, %ebp
movl $0xffffffff, 0x48(%rsp) # imm = 0xFFFFFFFF
xorl %r13d, %r13d
movl $0x1, %r14d
leaq 0xa25e(%rip), %r15      # 0x26ed5
movq $0x0, (%rsp)
movq (%rbx,%r14,8), %r12
testq %r12, %r12
je 0x1cc96
movzbl (%r12), %eax
cmpl $0x2d, %eax
je 0x1ccc4
testl %eax, %eax
jne 0x1ccf4
leaq 0xa1da(%rip), %rdi      # 0x26e77
callq 0x2310
movq %r15, %rdi
callq 0x2310
movl $0x1, %eax
testb $0x3, %al
jne 0x1d4ff
incq %r14
cmpq %rbp, %r14
jne 0x1cc7f
jmp 0x1cdf3
movzbl 0x1(%r12), %eax
cmpl $0x70, %eax
je 0x1cd15
cmpl $0x76, %eax
jne 0x1cda5
cmpl $-0x1, 0x48(%rsp)
jne 0x1cceb
cmpb $0x0, 0x2(%r12)
je 0x1cdb1
leaq 0xa1aa(%rip), %rdi      # 0x26e9c
jmp 0x1cc9d
cmpl $0x5, %r13d
jge 0x1cd0c
movslq %r13d, %rax
movq %r12, 0x70(%rsp,%rax,8)
incl %r13d
movl $0x4, %eax
jmp 0x1ccaf
leaq 0xa1ad(%rip), %rdi      # 0x26ec0
jmp 0x1cc9d
cmpq $0x0, (%rsp)
jne 0x1cdde
cmpb $0x2d, 0x2(%r12)
jne 0x1cdde
addq $0x3, %r12
movq %r12, %rdi
callq 0x20e0
movb $0x1, %sil
testq %rax, %rax
je 0x1cdcc
cmpq $0x1, %rax
je 0x1cd51
cmpb $0x30, (%r12)
je 0x1cdcc
xorl %edx, %edx
xorl %ecx, %ecx
movzbl (%r12,%rdx), %esi
leal -0x30(%rsi), %edi
cmpb $0x9, %dil
ja 0x1cd87
addq $-0x30, %rsi
movabsq $0x1999999999999999, %rdi # imm = 0x1999999999999999
cmpq %rdi, %rcx
jb 0x1cd8b
setne %dil
cmpq $0x6, %rsi
setae %r8b
orb %dil, %r8b
je 0x1cd8b
xorl %esi, %esi
jmp 0x1cd96
leaq (%rcx,%rcx,4), %rcx
leaq (%rsi,%rcx,2), %rcx
movb $0x1, %sil
testb %sil, %sil
je 0x1cdc0
incq %rdx
cmpq %rdx, %rax
jne 0x1cd55
jmp 0x1cdc4
leaq 0xa102(%rip), %rdi      # 0x26eae
jmp 0x1cc9d
xorl %eax, %eax
movl $0x1, 0x48(%rsp)
jmp 0x1ccaf
movq (%rsp), %rcx
xorb $0x1, %sil
movq %rcx, (%rsp)
testb %sil, %sil
jne 0x1cdde
xorl %eax, %eax
cmpq $0x0, (%rsp)
jne 0x1ccaf
leaq 0xa0a3(%rip), %rdi      # 0x26e88
jmp 0x1cc9d
xorl %ebp, %ebp
movb $0x1, %al
xorl %r13d, %r13d
jmp 0x1ce03
movl 0x48(%rsp), %eax
incl %eax
cmpl $0x2, %eax
setb %al
movq (%rsp), %rbp
testb %al, %al
jne 0x1ce1c
leaq 0x9fd4(%rip), %rdi      # 0x26de2
callq 0x2310
testl %r13d, %r13d
je 0x1cf56
movl $0x100, %ebx            # imm = 0x100
cmpq %rbx, %rbp
cmovbq %rbp, %rbx
cmpl $0x5, %r13d
je 0x1ceb9
cmpl $0x3, %r13d
jne 0x1cf4a
movq 0x70(%rsp), %r14
movq 0x78(%rsp), %rax
movq %rax, (%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x48(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x9e9b(%rip), %rsi      # 0x26d08
leaq 0x9ea0(%rip), %rdx      # 0x26d14
leaq 0x8(%rsp), %rdi
callq 0x1d5ec
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x23f0
leaq 0x60(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1cf5d
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x1cf66
movq 0x70(%rsp), %r14
movq 0x78(%rsp), %rax
movq %rax, (%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x88(%rsp), %r12
movq %r12, %rdi
callq 0x20e0
testq %rax, %rax
je 0x1d2d1
movzbl -0x1(%r12,%rax), %edx
xorl %ecx, %ecx
addl $-0x47, %edx
cmpl $0x26, %edx
ja 0x1d433
movabsq $0x100000001, %rsi      # imm = 0x100000001
btq %rdx, %rsi
jb 0x1d42b
movabsq $0x1000000010, %rsi     # imm = 0x1000000010
btq %rdx, %rsi
jb 0x1d421
movabsq $0x4000000040, %rsi     # imm = 0x4000000040
btq %rdx, %rsi
jae 0x1d433
decq %rax
movl $0x14, %ecx
jmp 0x1d433
leaq 0x9f6f(%rip), %rdi      # 0x26ec0
jmp 0x1d4ee
xorl %ebx, %ebx
jmp 0x1d504
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq %r14, 0xa0(%rsp)
movq 0x8(%rax), %rdx
leaq 0x50(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x9d84(%rip), %rsi      # 0x26d15
callq 0x23f0
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1cfbd
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x1cfc6
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
callq 0xcbc0
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x1cfff
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d016
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1d032
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x9cd2(%rip), %rsi      # 0x26d18
leaq 0x9cd7(%rip), %rdx      # 0x26d24
callq 0x1d5ec
leaq 0x8(%rsp), %rdi
movq (%rsp), %rsi
callq 0x23f0
movq %r15, 0x50(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d083
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x1d08c
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x50(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x9c66(%rip), %rsi      # 0x26d15
callq 0x23f0
movq %r14, 0x28(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d0d7
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x1d0e0
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
callq 0xcbc0
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d119
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d130
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1d14c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x9bc5(%rip), %rsi      # 0x26d25
leaq 0x9bca(%rip), %rdx      # 0x26d31
callq 0x1d5ec
leaq 0x8(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x23f0
movq %r15, 0x50(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d19e
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x1d1a7
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x50(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x9b4b(%rip), %rsi      # 0x26d15
callq 0x23f0
movq %r14, 0x28(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d1f2
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x1d1fb
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
callq 0xcbc0
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d234
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d24b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1d267
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
testq %r13, %r13
je 0x1d3a4
leaq 0x9abb(%rip), %rdi      # 0x26d32
movq %r12, %rsi
xorl %eax, %eax
callq 0x2040
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x9ab6(%rip), %rsi      # 0x26d4b
leaq 0x9ac7(%rip), %rdx      # 0x26d63
callq 0x1d5ec
leaq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x23f0
movq %r15, 0x50(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d2db
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x1d2e4
movb $0x1, %al
xorl %r12d, %r12d
jmp 0x1d4c2
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x50(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x9a0e(%rip), %rsi      # 0x26d15
callq 0x23f0
movq %r14, 0x28(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d32f
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x1d338
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
callq 0xcbc0
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d371
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d388
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1d3a4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
callq 0x1d594
movsd %xmm0, 0x98(%rsp)
testq %rbp, %rbp
movl $0x1, %r9d
cmovnel %ebx, %r9d
movq 0xa0(%rsp), %rdi
movq (%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x18ed1
movl %eax, %ebx
callq 0x1d594
movsd %xmm0, (%rsp)
testl %ebx, %ebx
leaq 0x9a72(%rip), %rax      # 0x26e62
leaq 0x9a53(%rip), %rdi      # 0x26e4a
cmoveq %rax, %rdi
callq 0x2310
movsd (%rsp), %xmm0
subsd 0x98(%rsp), %xmm0
leaq 0x994f(%rip), %rdi      # 0x26d64
movb $0x1, %al
callq 0x2040
jmp 0x1d504
decq %rax
movl $0xa, %ecx
jmp 0x1d433
decq %rax
movl $0x1e, %ecx
movb $0x1, %sil
testq %rax, %rax
je 0x1d4a3
cmpq $0x1, %rax
je 0x1d448
cmpb $0x30, (%r12)
je 0x1d4a3
movabsq $0x1999999999999999, %rdi # imm = 0x1999999999999999
decq %rax
xorl %r8d, %r8d
xorl %edx, %edx
movzbl (%r12,%r8), %r9d
leal -0x30(%r9), %r10d
movb $0x1, %sil
cmpb $0x9, %r10b
ja 0x1d490
addq $-0x30, %r9
cmpq %rdi, %rdx
jb 0x1d486
setne %r10b
cmpq $0x6, %r9
setae %r11b
orb %r10b, %r11b
jne 0x1d490
leaq (%rdx,%rdx,4), %rdx
leaq (%r9,%rdx,2), %rdx
xorl %esi, %esi
testb %sil, %sil
jne 0x1d4a3
leaq 0x1(%r8), %r9
cmpq %r8, %rax
movq %r9, %r8
jne 0x1d45a
jmp 0x1d4a3
movq $-0x1, %rax
shrq %cl, %rax
cmpq %rax, %rdx
seta %al
orb %sil, %al
shlq %cl, %rdx
xorl %r12d, %r12d
testb %al, %al
cmoveq %rdx, %r12
testb %al, %al
je 0x1d4cf
leaq 0x9934(%rip), %rdi      # 0x26e01
jmp 0x1d4ee
movq 0x90(%rsp), %r13
testq %r13, %r13
je 0x1d4e7
cmpb $0x0, (%r13)
jne 0x1ce5d
leaq 0x9936(%rip), %rdi      # 0x26e24
callq 0x2310
leaq 0x99db(%rip), %rdi      # 0x26ed5
callq 0x2310
movl $0x1, %ebx
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1d530
jmp 0x1d54c
jmp 0x1d568
jmp 0x1d589
jmp 0x1d530
jmp 0x1d54c
jmp 0x1d568
jmp 0x1d589
jmp 0x1d530
jmp 0x1d54c
jmp 0x1d568
jmp 0x1d589
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d54f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x1d54f
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d56b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x1d56b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1d58c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x1d58c
movq %rax, %rbx
movq %rbx, %rdi
callq 0x23a0