// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/src/zip_diff.cpp
// Function: tryGetCompressSet(char const**, char const*, char const*, char const*, char const*, unsigned long*, unsigned long, unsigned long, unsigned long, unsigned long*, unsigned long, unsigned long, unsigned long)
static bool _tryGetCompressSet(const char** isMatchedType,const char* ptype,const char* ptypeEnd,
                               const char* cmpType,const char* cmpType2=0,
                               size_t* compressLevel=0,size_t levelMin=0,size_t levelMax=0,size_t levelDefault=0,
                               size_t* dictSize=0,size_t dictSizeMin=0,size_t dictSizeMax=0,size_t dictSizeDefault=0){
    if (*isMatchedType) return true; //ok
    const size_t ctypeLen=strlen(cmpType);
    const size_t ctype2Len=(cmpType2!=0)?strlen(cmpType2):0;
    if ( ((ctypeLen==(size_t)(ptypeEnd-ptype))&&(0==strncmp(ptype,cmpType,ctypeLen)))
        || ((cmpType2!=0)&&(ctype2Len==(size_t)(ptypeEnd-ptype))&&(0==strncmp(ptype,cmpType2,ctype2Len))) )
        *isMatchedType=cmpType; //ok
    else
        return true;//type mismatch
    
    if ((compressLevel)&&(ptypeEnd[0]=='-')){
        const char* plevel=ptypeEnd+1;
        const char* plevelEnd=findUntilEnd(plevel,'-');
        if (!a_to_size(plevel,plevelEnd-plevel,compressLevel)) return false; //error
        if (*compressLevel<levelMin) *compressLevel=levelMin;
        else if (*compressLevel>levelMax) *compressLevel=levelMax;
        if ((dictSize)&&(plevelEnd[0]=='-')){
            const char* pdictSize=plevelEnd+1;
            const char* pdictSizeEnd=findUntilEnd(pdictSize,'-');
            if (!kmg_to_size(pdictSize,pdictSizeEnd-pdictSize,dictSize)) return false; //error
            if (*dictSize<dictSizeMin) *dictSize=dictSizeMin;
            else if (*dictSize>dictSizeMax) *dictSize=dictSizeMax;
        }else{
            if (plevelEnd[0]!='\0') return false; //error
            if (dictSize) *dictSize=dictSizeDefault;
        }
    }else{
        if (ptypeEnd[0]!='\0') return false; //error
        if (compressLevel) *compressLevel=levelDefault;
        if (dictSize) *dictSize=dictSizeDefault;
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movb $0x1, %bpl
cmpq $0x0, (%rdi)
jne 0x5fe3
movq %r8, %r14
movq %rcx, %r13
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movq %r9, (%rsp)
movq %rcx, %rdi
callq 0x4140
movq %r12, %rcx
subq %r15, %rcx
cmpq %rcx, %rax
jne 0x5fe3
movq %r15, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x4180
testl %eax, %eax
je 0x5ff7
movb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x60(%rsp), %r15
movq 0x48(%rsp), %rcx
movq %r13, (%rbx)
movzbl (%r12), %eax
testq %r14, %r14
je 0x6130
testl %eax, %eax
je 0x613b
cmpl $0x2d, %eax
jne 0x6134
movq %rcx, %rbx
leaq 0x1(%r12), %rbp
movq %rbp, %rdi
movl $0x2d, %esi
callq 0x4100
movq %rax, %r13
testq %rax, %rax
jne 0x604e
movq %rbp, %rdi
callq 0x4140
movq %rax, %r13
addq %rbp, %r13
movq %r13, %rax
subq %rbp, %rax
je 0x6134
cmpq $0x1, %rax
je 0x606a
cmpb $0x30, (%rbp)
je 0x6134
movq 0x58(%rsp), %r10
movq 0x50(%rsp), %r11
movabsq $0x1999999999999999, %rcx # imm = 0x1999999999999999
movq %r13, %rdx
subq %r12, %rdx
movl $0x1, %esi
xorl %eax, %eax
movq (%rsp), %r9
xorl %ebp, %ebp
movzbl (%r12,%rsi), %edi
leal -0x30(%rdi), %r8d
cmpb $0x9, %r8b
ja 0x6134
addq $-0x30, %rdi
cmpq %rcx, %rax
jb 0x60c0
cmpq %rcx, %rax
jne 0x5fe6
cmpq $0x5, %rdi
ja 0x5fe6
leaq (%rax,%rax,4), %rax
leaq (%rdi,%rax,2), %rax
incq %rsi
cmpq %rsi, %rdx
jne 0x6091
movq %rax, (%r14)
cmpq %r9, %rax
jb 0x60e4
movl $0x9, %r9d
cmpq $0xa, %rax
jb 0x60e7
movq %r9, (%r14)
movzbl (%r13), %eax
testq %rbx, %rbx
je 0x6154
testl %eax, %eax
je 0x6168
cmpl $0x2d, %eax
jne 0x6134
movq %r11, %r12
movq %r10, %r15
incq %r13
movq %r13, %rdi
callq 0x5cd7
subq %r13, %rax
movq %r13, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x5c0c
testl %eax, %eax
je 0x6134
movq (%rbx), %rax
cmpq %r12, %rax
jae 0x615f
movq %r12, (%rbx)
jmp 0x5fe3
testl %eax, %eax
je 0x6143
xorl %ebp, %ebp
jmp 0x5fe6
movq 0x40(%rsp), %rax
movq %rax, (%r14)
testq %rcx, %rcx
je 0x5fe6
movq %r15, (%rcx)
jmp 0x5fe3
testl %eax, %eax
sete %bpl
jmp 0x5fe6
cmpq %r15, %rax
jbe 0x5fe3
movq %r15, (%rbx)
jmp 0x5fe3