// File: BGI-Qingdao[P]metaSLR/classify.cpp
// Function: main
int main(int argc ,char ** argv ){
    TestAll();
    static struct option long_options[] = {
        {"hap",  required_argument,  NULL, 'k'},
        {"read", required_argument,  NULL, 'r'},
        {"thread",required_argument, NULL, 't'},
        {"help",  no_argument,       NULL, 'h'},
        {0, 0, 0, 0}
    };
    static char optstring[] = "k:l:r:t:h";
    std::string hap0 , hap1 ;
    std::vector<std::string> haps;
    std::vector<std::string> read;
    int t_num=1;
    while(1){
        int c = getopt_long(argc, argv, optstring, long_options, NULL);
        if (c<0) break;
        switch (c){
            case 'k':
                haps.push_back(std::string(optarg));
                break;
            case 'r':
                read.push_back(std::string(optarg));
                break;
            case 't':
                t_num = atoi(optarg);
                break;
            case 'h':
            default :
                printUsage();
                return -1;
        }
    }
    if( haps.size() < 2 || read.empty() || t_num< 1) {
        printUsage();
        return -1;
    }
    std::cerr<<"__START__"<<std::endl;
    logtime();
    for( int i = 0 ; i < (int)haps.size() ; i++ ) {
        std::cerr<<"__load hap "<<i<<" kmers from file "<<haps[i]<<std::endl;
        load_kmers(haps[i],i);
    }
    InitAdaptor();
    logtime();
    BarcodeCache data;
    for(const auto r : read ){
        std::cerr<<"__process read: "<<r<<std::endl;
        processFastq(r,t_num,data);
        logtime();
        std::cerr<<"__process read done__"<<std::endl;
    }
    std::cerr<<"__print result__"<<std::endl;
    printBarcodeInfos(data,haps);
    logtime();
    std::cerr<<"__END__"<<std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x5c40
leaq -0x30(%rbp), %rdi
callq 0x43d0
leaq -0x50(%rbp), %rdi
callq 0x43d0
leaq -0x68(%rbp), %rdi
callq 0x8400
leaq -0x80(%rbp), %rdi
callq 0x8400
movl $0x1, -0x84(%rbp)
jmp 0x687e
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x1cb14(%rip), %rdx     # 0x233a0
leaq 0x1ca6d(%rip), %rcx     # 0x23300
xorl %eax, %eax
movl %eax, %r8d
callq 0x44f0
movl %eax, -0x88(%rbp)
cmpl $0x0, -0x88(%rbp)
jge 0x68b1
jmp 0x6a99
movl -0x88(%rbp), %eax
addl $-0x68, %eax
movl %eax, %ecx
movq %rcx, -0x160(%rbp)
subl $0xc, %eax
ja 0x6a60
movq -0x160(%rbp), %rax
leaq 0x10736(%rip), %rcx     # 0x17010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1c6ce(%rip), %rax     # 0x22fb8
movq (%rax), %rax
movq %rax, -0x170(%rbp)
leaq -0xa9(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x4560
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0x43b0
jmp 0x6923
leaq -0x68(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x8420
jmp 0x6935
leaq -0xa8(%rbp), %rdi
callq 0x41d0
leaq -0xa9(%rbp), %rdi
callq 0x4320
jmp 0x6a94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x6984
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x41d0
leaq -0xa9(%rbp), %rdi
callq 0x4320
jmp 0x6e51
movq 0x1c61c(%rip), %rax     # 0x22fb8
movq (%rax), %rax
movq %rax, -0x180(%rbp)
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0x4560
movq -0x180(%rbp), %rsi
movq -0x178(%rbp), %rdx
leaq -0xe0(%rbp), %rdi
callq 0x43b0
jmp 0x69d5
leaq -0x80(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x8420
jmp 0x69e7
leaq -0xe0(%rbp), %rdi
callq 0x41d0
leaq -0xe1(%rbp), %rdi
callq 0x4320
jmp 0x6a94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x6a36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x41d0
leaq -0xe1(%rbp), %rdi
callq 0x4320
jmp 0x6e51
movq 0x1c56a(%rip), %rax     # 0x22fb8
movq (%rax), %rdi
callq 0x4480
movl %eax, -0x84(%rbp)
jmp 0x6a94
jmp 0x6a60
callq 0x5bd0
jmp 0x6a67
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xe8(%rbp)
jmp 0x6e15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x6e51
jmp 0x687c
leaq -0x68(%rbp), %rdi
callq 0x8450
cmpq $0x2, %rax
jb 0x6abe
leaq -0x80(%rbp), %rdi
callq 0x8470
testb $0x1, %al
jne 0x6abe
cmpl $0x1, -0x84(%rbp)
jge 0x6adb
callq 0x5bd0
jmp 0x6ac5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xe8(%rbp)
jmp 0x6e15
movq 0x1c50e(%rip), %rdi     # 0x22ff0
leaq 0x109ec(%rip), %rsi     # 0x174d5
callq 0x42c0
movq %rax, -0x188(%rbp)
jmp 0x6af7
movq -0x188(%rbp), %rdi
movq 0x1c4ab(%rip), %rsi     # 0x22fb0
callq 0x4310
jmp 0x6b0c
callq 0x4780
jmp 0x6b13
movl $0x0, -0xec(%rbp)
movl -0xec(%rbp), %eax
movl %eax, -0x18c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x8450
movq %rax, %rcx
movl -0x18c(%rbp), %eax
cmpl %ecx, %eax
jge 0x6c09
movq 0x1c4a6(%rip), %rdi     # 0x22ff0
leaq 0x1098e(%rip), %rsi     # 0x174df
callq 0x42c0
movq %rax, -0x198(%rbp)
jmp 0x6b5f
movq -0x198(%rbp), %rdi
movl -0xec(%rbp), %esi
callq 0x4530
movq %rax, -0x1a0(%rbp)
jmp 0x6b7a
movq -0x1a0(%rbp), %rdi
leaq 0x10963(%rip), %rsi     # 0x174eb
callq 0x42c0
movq %rax, -0x1a8(%rbp)
jmp 0x6b96
movslq -0xec(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x84b0
movq -0x1a8(%rbp), %rdi
movq %rax, %rsi
callq 0x4270
movq %rax, -0x1b0(%rbp)
jmp 0x6bbe
movq -0x1b0(%rbp), %rdi
movq 0x1c3e4(%rip), %rsi     # 0x22fb0
callq 0x4310
jmp 0x6bd3
movslq -0xec(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x84b0
movq %rax, %rdi
movl -0xec(%rbp), %esi
callq 0x47d0
jmp 0x6bf3
jmp 0x6bf5
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
jmp 0x6b1d
callq 0x5550
jmp 0x6c10
callq 0x4780
jmp 0x6c17
leaq -0x120(%rbp), %rdi
callq 0x84d0
leaq -0x80(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rdi
callq 0x84f0
movq %rax, -0x130(%rbp)
movq -0x128(%rbp), %rdi
callq 0x8520
movq %rax, -0x138(%rbp)
leaq -0x130(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x8550
testb $0x1, %al
jne 0x6c70
jmp 0x6d84
leaq -0x130(%rbp), %rdi
callq 0x8590
movq %rax, %rsi
leaq -0x158(%rbp), %rdi
callq 0x4170
jmp 0x6c8d
movq 0x1c35c(%rip), %rdi     # 0x22ff0
leaq 0x10862(%rip), %rsi     # 0x174fd
callq 0x42c0
movq %rax, -0x1b8(%rbp)
jmp 0x6ca9
movq -0x1b8(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x4270
movq %rax, -0x1c0(%rbp)
jmp 0x6cc5
movq -0x1c0(%rbp), %rdi
movq 0x1c2dd(%rip), %rsi     # 0x22fb0
callq 0x4310
jmp 0x6cda
movl -0x84(%rbp), %esi
leaq -0x158(%rbp), %rdi
leaq -0x120(%rbp), %rdx
callq 0x5120
jmp 0x6cf5
callq 0x4780
jmp 0x6cfc
movq 0x1c2ed(%rip), %rdi     # 0x22ff0
leaq 0x10804(%rip), %rsi     # 0x1750e
callq 0x42c0
movq %rax, -0x1c8(%rbp)
jmp 0x6d18
movq -0x1c8(%rbp), %rdi
movq 0x1c28a(%rip), %rsi     # 0x22fb0
callq 0x4310
jmp 0x6d2d
leaq -0x158(%rbp), %rdi
callq 0x41d0
leaq -0x130(%rbp), %rdi
callq 0x85b0
jmp 0x6c54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x6e45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x41d0
jmp 0x6e45
movq 0x1c265(%rip), %rdi     # 0x22ff0
leaq 0x10792(%rip), %rsi     # 0x17524
callq 0x42c0
movq %rax, -0x1d0(%rbp)
jmp 0x6da0
movq -0x1d0(%rbp), %rdi
movq 0x1c202(%rip), %rsi     # 0x22fb0
callq 0x4310
jmp 0x6db5
leaq -0x120(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4e60
jmp 0x6dc7
callq 0x4780
jmp 0x6dce
movq 0x1c21b(%rip), %rdi     # 0x22ff0
leaq 0x10759(%rip), %rsi     # 0x17535
callq 0x42c0
movq %rax, -0x1d8(%rbp)
jmp 0x6dea
movq -0x1d8(%rbp), %rdi
movq 0x1c1b8(%rip), %rsi     # 0x22fb0
callq 0x4310
jmp 0x6dff
leaq -0x120(%rbp), %rdi
callq 0x85d0
movl $0x0, -0xe8(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x85f0
leaq -0x68(%rbp), %rdi
callq 0x85f0
leaq -0x50(%rbp), %rdi
callq 0x41d0
leaq -0x30(%rbp), %rdi
callq 0x41d0
movl -0x4(%rbp), %eax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
leaq -0x120(%rbp), %rdi
callq 0x85d0
leaq -0x80(%rbp), %rdi
callq 0x85f0
leaq -0x68(%rbp), %rdi
callq 0x85f0
leaq -0x50(%rbp), %rdi
callq 0x41d0
leaq -0x30(%rbp), %rdi
callq 0x41d0
movq -0xb8(%rbp), %rdi
callq 0x4550
nopw %cs:(%rax,%rax)