// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/src/params.cpp
// Function: ococo::params_t::parse_commandline(int, char const**)
void ococo::params_t::parse_commandline(int argc, const char **argv) {
    /* Parse cmd parameters */
    std::stringstream cmd;
    for (int32_t i = 0; i < argc; i++) {
        cmd << argv[i];
        if (i != argc - 1) {
            cmd << " ";
        }
    }
    command=cmd.str();


    if (argc == 1) {
        print_help();
        exit(1);
    }

    const struct option lopts[] = {
        {"version", no_argument, nullptr, 'v'},
        {"help", no_argument, nullptr, 'h'},
        //
        {"input", required_argument, nullptr, 'i'},
        {"fasta-ref", required_argument, nullptr, 'f'},
        {"stats-in", required_argument, nullptr, 's'},
        //
        {"fasta-cons", required_argument, nullptr, 'F'},
        {"stats-out", required_argument, nullptr, 'S'},
        {"vcf-cons", required_argument, nullptr, 'V'},
        {"pileup", required_argument, nullptr, 'P'},
        {"log", required_argument, nullptr, 'L'},
        {"verbose", no_argument, nullptr, 'W'},
        //
        {"counters", required_argument, nullptr, 'x'},
        {"mode", required_argument, nullptr, 'm'},
        {"strategy", required_argument, nullptr, 't'},
        {"min-MQ", required_argument, nullptr, 'q'},
        {"min-BQ", required_argument, nullptr, 'Q'},
        {"ref-weight", required_argument, nullptr, 'w'},
        {"min-cov", required_argument, nullptr, 'c'},
        {"min-coverage", required_argument, nullptr, 'c'},  // deprec
        {"maj-thres", required_argument, nullptr, 'M'},
        {"majority-threshold", required_argument, nullptr, 'M'},  // deprec
        //
        {nullptr, 0, nullptr, 0}};

    int c;
    using std::string;
    while ((c = getopt_long(argc, (char *const *)argv,
                            "vhi:f:s:F:S:V:P:L:W:x:m:t:q:Q:w:c:M:", lopts,
                            nullptr)) >= 0) {
        switch (c) {
            case 'v': {
                print_version();
                exit(0);
                break;
            }
            case 'h': {
                print_help();
                exit(0);
                break;
            }
            case 'i': {
                sam_fn = optarg;
                break;
            }
            case 'f': {
                fasta_in_fn = optarg;
                break;
            }
            case 's': {
                stats_in_fn = optarg;
                break;
            }
            case 'F': {
                fasta_out_fn = optarg;
                break;
            }
            case 'S': {
                stats_out_fn = optarg;
                break;
            }
            case 'V': {
                vcf_fn = optarg;
                break;
            }
            case 'P': {
                pileup_fn = optarg;
                break;
            }
            case 'L': {
                log_fn = optarg;
                break;
            }
            case 'W': {
                verbose = true;
                break;
            }
            case 'x': {
                counters_str = optarg;

                if (counters_str.compare("ococo16") == 0) {
                    counter_configuration = OCOCO16;
                    counters_str_descr =
                        "ococo16 (16 bits per position, 3bits per nucleotide "
                        "counter)";
                } else if (counters_str.compare("ococo32") == 0) {
                    counter_configuration = OCOCO32;
                    counters_str_descr =
                        "ococo32 (32 bits per position, 7bits per nucleotide "
                        "counter)";
                } else if (counters_str.compare("ococo64") == 0) {
                    counter_configuration = OCOCO64;
                    counters_str_descr =
                        "ococo64 (64 bits per position, 15bits per nucleotide "
                        "counter)";
                } else {
                    ococo::error(
                        "Unknown counter configuration '%s'. Possible modes "
                        "are 'ococo16', 'ococo32', and 'ococo64'.\n",
                        counters_str.c_str());
                    exit(1);
                }

                break;
            }
            case 'm': {
                mode_str = optarg;

                if (mode_str.compare("batch") == 0) {
                    mode = ococo::mode_t::BATCH;
                } else if (mode_str.compare("real-time") == 0) {
                    mode = ococo::mode_t::REALTIME;
                } else {
                    ococo::error(
                        "Unknown mode '%s'. Possible modes are 'batch' and "
                        "'real-time'.\n",
                        mode_str.c_str());
                    exit(1);
                }

                break;
            }
            case 't': {
                strategy_str = optarg;

                if (strategy_str.compare("stochastic") == 0) {
                    strategy = ococo::strategy_t::STOCHASTIC;
                } else if (strategy_str.compare("no-updates") == 0) {
                    strategy = ococo::strategy_t::NO_UPDATES;
                } else if (strategy_str.compare("majority") == 0) {
                    strategy = ococo::strategy_t::MAJORITY;
                } else {
                    ococo::error(
                        "Unknown strategy '%s'. Possible strategies are "
                        "'majority', 'stochastic', and 'no-updates'.\n",
                        strategy_str.c_str());
                    exit(1);
                }

                break;
            }
            case 'q': {
                min_mapq = atoi(optarg);
                break;
            }
            case 'Q': {
                min_baseq = atoi(optarg);
                break;
            }
            case 'w': {
                init_ref_weight = atoi(optarg);
                break;
            }
            case 'c': {
                min_coverage = atoi(optarg);
                break;
            }
            case 'M': {
                majority_threshold = atof(optarg);
                break;
            }
            case '?': {
                ococo::error("Unknown error");
                exit(1);
                break;
            }
        }
    }
    if (sam_fn.size()==0){
        ococo::error("SAM/BAM file must be specified (option '-i').\n");
        exit(1);
    }

    if(pileup_fn.size()!=0 && pileup_fn.compare(vcf_fn)==0){
        ococo::error("Pileup and VCF files cannot be the same (both currently '%s').\n", pileup_fn.c_str());
        exit(1);
    }

    ococo::info("Ococo starting: %s\n", counters_str_descr.c_str());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4f8, %rsp            # imm = 0x4F8
movq %rdx, %r14
movl %esi, %ebx
movq %rdi, 0x88(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x4390
movq %rbx, (%rsp)
testl %ebx, %ebx
jle 0xce05
leaq 0xb8(%rsp), %r12
movq (%rsp), %rax
leal -0x1(%rax), %r15d
movl %eax, %ebx
xorl %r13d, %r13d
movq (%r14,%r13,8), %rbp
testq %rbp, %rbp
je 0xcdc5
movq %rbp, %rdi
callq 0x4230
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x45d0
jmp 0xcde4
movq 0xb8(%rsp), %rax
movq -0x18(%rax), %rax
leaq (%r12,%rax), %rdi
movl 0xd8(%rsp,%rax), %esi
orl $0x1, %esi
callq 0x4930
cmpq %r13, %r15
je 0xcdfd
movl $0x1, %edx
movq %r12, %rdi
leaq 0x44e61(%rip), %rsi     # 0x51c59
callq 0x45d0
incq %r13
cmpq %r13, %rbx
jne 0xcda4
leaq 0xc0(%rsp), %rsi
leaq 0x230(%rsp), %rdi
callq 0x4870
movq 0x88(%rsp), %rbx
leaq 0x8(%rbx), %rdi
leaq 0x230(%rsp), %r12
movq %r12, %rsi
callq 0x4660
movq (%r12), %rdi
leaq 0x240(%rsp), %rax
cmpq %rax, %rdi
movq (%rsp), %r13
je 0xce5b
movq 0x240(%rsp), %rsi
incq %rsi
callq 0x4540
cmpl $0x1, %r13d
je 0xd389
leaq 0x56a24(%rip), %rsi     # 0x63890
leaq 0x230(%rsp), %r12
movl $0x2c0, %edx            # imm = 0x2C0
movq %r12, %rdi
callq 0x4420
leaq 0x45760(%rip), %rdx     # 0x525e8
movl %r13d, %edi
movq %r14, %rsi
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x48f0
testl %eax, %eax
js 0xd2fb
leaq 0x1c8(%rbx), %rcx
movq %rcx, 0x8(%rsp)
leaq 0x1e8(%rbx), %rcx
movq %rcx, 0x10(%rsp)
leaq 0x30(%rbx), %rcx
movq %rcx, 0x18(%rsp)
leaq 0x160(%rbx), %rcx
movq %rcx, 0x80(%rsp)
leaq 0x168(%rbx), %rcx
movq %rcx, 0x78(%rsp)
leaq 0x140(%rbx), %rcx
movq %rcx, 0x70(%rsp)
leaq 0x148(%rbx), %rcx
movq %rcx, 0x68(%rsp)
leaq 0xe0(%rbx), %rcx
movq %rcx, 0x60(%rsp)
leaq 0xe8(%rbx), %rcx
movq %rcx, 0x58(%rsp)
leaq 0x120(%rbx), %rcx
movq %rcx, 0x50(%rsp)
leaq 0x128(%rbx), %rcx
movq %rcx, 0x48(%rsp)
leaq 0x100(%rbx), %rcx
movq %rcx, 0x98(%rsp)
leaq 0x108(%rbx), %rcx
movq %rcx, 0x90(%rsp)
leaq 0xb8(%rbx), %rcx
movq %rcx, 0x40(%rsp)
leaq 0xc0(%rbx), %rcx
movq %rcx, 0x38(%rsp)
leaq 0x98(%rbx), %rcx
movq %rcx, 0xa0(%rsp)
leaq 0xa0(%rbx), %r15
leaq 0x78(%rbx), %rcx
movq %rcx, 0x30(%rsp)
leaq 0x80(%rbx), %rcx
movq %rcx, 0x28(%rsp)
leaq 0x50(%rbx), %rcx
movq %rcx, 0x20(%rsp)
leal -0x4c(%rax), %ecx
cmpl $0x2c, %ecx
ja 0xcfc4
leaq 0x44ce2(%rip), %rdx     # 0x51c80
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
movq %r15, %rcx
movq 0xa0(%rsp), %rbp
jmpq *%rax
movq 0x78(%rsp), %rcx
movq 0x80(%rsp), %rbp
jmp 0xd117
movq 0x90(%rsp), %rcx
movq 0x98(%rsp), %rbp
cmpl $0x46, %eax
je 0xd117
cmpl $0x3f, %eax
jne 0xd143
jmp 0xd3a0
movq 0x56fbe(%rip), %rax     # 0x63fb0
movq (%rax), %rdi
callq 0x4840
movl %eax, 0x1b8(%rbx)
jmp 0xd143
movq 0x56fa4(%rip), %rax     # 0x63fb0
movq (%rax), %r12
movq 0x1f0(%rbx), %r13
movq %r12, %rdi
callq 0x4230
movq 0x10(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
movq (%rsp), %r13
movq %r12, %rcx
movq %rax, %r8
callq 0x4820
movq 0x10(%rsp), %r12
movq %r12, %rdi
leaq 0x44d0a(%rip), %rsi     # 0x51d50
callq 0x4160
testl %eax, %eax
je 0xd28f
movq %r12, %rdi
leaq 0x456d5(%rip), %rsi     # 0x52732
callq 0x4160
testl %eax, %eax
jne 0xd3b0
movl $0x1, 0x1a8(%rbx)
jmp 0xd143
movq 0x56f30(%rip), %rax     # 0x63fb0
movq (%rax), %rdi
callq 0x4840
movl %eax, 0x1bc(%rbx)
jmp 0xd143
movq 0x68(%rsp), %rcx
movq 0x70(%rsp), %rbp
jmp 0xd117
movq 0x56f0a(%rip), %rax     # 0x63fb0
movq (%rax), %rdi
callq 0x4840
movl %eax, 0x1b4(%rbx)
jmp 0xd143
movq 0x48(%rsp), %rcx
movq 0x50(%rsp), %rbp
jmp 0xd117
movq 0x58(%rsp), %rcx
movq 0x60(%rsp), %rbp
jmp 0xd117
movq 0x56ed8(%rip), %rax     # 0x63fb0
movq (%rax), %rdi
callq 0x4680
movsd %xmm0, 0x1c0(%rbx)
jmp 0xd143
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rbp
jmp 0xd117
movq 0x56eb3(%rip), %rax     # 0x63fb0
movq (%rax), %rdi
callq 0x4840
movl %eax, 0x1b0(%rbx)
jmp 0xd143
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %rbp
movq 0x56e92(%rip), %rax     # 0x63fb0
movq (%rax), %r13
movq (%rcx), %r12
movq %r13, %rdi
callq 0x4230
movq %rbp, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r13, %rcx
movq (%rsp), %r13
movq %rax, %r8
callq 0x4820
movl %r13d, %edi
movq %r14, %rsi
leaq 0x45498(%rip), %rdx     # 0x525e8
leaq 0x230(%rsp), %rcx
xorl %r8d, %r8d
callq 0x48f0
testl %eax, %eax
jns 0xcf8f
jmp 0xd2fb
movb $0x1, 0xd8(%rbx)
jmp 0xd143
movq 0x56e33(%rip), %rax     # 0x63fb0
movq (%rax), %r12
movq 0x38(%rbx), %r13
movq %r12, %rdi
callq 0x4230
movq 0x18(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
movq (%rsp), %r13
movq %r12, %rcx
movq %rax, %r8
callq 0x4820
movq 0x18(%rsp), %r12
movq %r12, %rdi
leaq 0x45459(%rip), %rsi     # 0x5260d
callq 0x4160
testl %eax, %eax
je 0xd29e
movq %r12, %rdi
leaq 0x44b7d(%rip), %rsi     # 0x51d48
callq 0x4160
testl %eax, %eax
je 0xd2c3
movq %r12, %rdi
leaq 0x454ad(%rip), %rsi     # 0x5268f
callq 0x4160
testl %eax, %eax
jne 0xd3db
movl $0x2, 0x28(%rbx)
movl $0x3d, %r8d
leaq 0x45494(%rip), %rcx     # 0x52697
jmp 0xd2d7
movq 0x56da1(%rip), %rax     # 0x63fb0
movq (%rax), %r12
movq 0x1d0(%rbx), %r13
movq %r12, %rdi
callq 0x4230
movq 0x8(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
movq (%rsp), %r13
movq %r12, %rcx
movq %rax, %r8
callq 0x4820
movq 0x8(%rsp), %r12
movq %r12, %rdi
leaq 0x45533(%rip), %rsi     # 0x5277c
callq 0x4160
testl %eax, %eax
je 0xd2b4
movq %r12, %rdi
leaq 0x4552b(%rip), %rsi     # 0x52787
callq 0x4160
testl %eax, %eax
je 0xd2ec
movq %r12, %rdi
leaq 0x44ae3(%rip), %rsi     # 0x51d56
callq 0x4160
testl %eax, %eax
jne 0xd3ef
movl $0x3, 0x1ac(%rbx)
jmp 0xd143
movl $0x0, 0x1a8(%rbx)
jmp 0xd143
movl $0x0, 0x28(%rbx)
movl $0x3c, %r8d
leaq 0x45363(%rip), %rcx     # 0x52615
jmp 0xd2d7
movl $0x1, 0x1ac(%rbx)
jmp 0xd143
movl $0x1, 0x28(%rbx)
movl $0x3c, %r8d
leaq 0x4537b(%rip), %rcx     # 0x52652
movq 0x58(%rbx), %rdx
movq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x4820
jmp 0xd143
movl $0x0, 0x1ac(%rbx)
jmp 0xd143
cmpq $0x0, 0x80(%rbx)
je 0xd390
cmpq $0x0, 0x148(%rbx)
je 0xd331
leaq 0x140(%rbx), %r14
leaq 0xe0(%rbx), %rsi
movq %r14, %rdi
callq 0x4060
testl %eax, %eax
je 0xd3c8
movq 0x50(%rbx), %rsi
leaq 0x4552f(%rip), %rdi     # 0x5286b
xorl %eax, %eax
callq 0x4cae
movq 0x56c56(%rip), %rsi     # 0x63fa0
leaq 0xa8(%rsp), %rdi
callq 0x43d0
leaq 0x128(%rsp), %rdi
callq 0x41a0
addq $0x4f8, %rsp            # imm = 0x4F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xc508
jmp 0xd382
callq 0xd680
xorl %edi, %edi
callq 0x4630
callq 0xd680
jmp 0xd405
leaq 0x45465(%rip), %rdi     # 0x527fc
xorl %eax, %eax
callq 0x4b3a
jmp 0xd405
leaq 0x45447(%rip), %rdi     # 0x527ee
xorl %eax, %eax
callq 0x4b3a
jmp 0xd405
movq 0x10(%rsp), %rax
movq (%rax), %rsi
leaq 0x4537d(%rip), %rdi     # 0x5273c
xorl %eax, %eax
callq 0x4b3a
jmp 0xd405
movq (%r14), %rsi
leaq 0x45459(%rip), %rdi     # 0x5282b
xorl %eax, %eax
callq 0x4b3a
jmp 0xd405
movq (%r12), %rsi
leaq 0x452ef(%rip), %rdi     # 0x526d5
xorl %eax, %eax
callq 0x4b3a
jmp 0xd405
movq 0x8(%rsp), %rax
movq (%rax), %rsi
leaq 0x45394(%rip), %rdi     # 0x52792
xorl %eax, %eax
callq 0x4b3a
movl $0x1, %edi
callq 0x4630
jmp 0xd417
jmp 0xd417
jmp 0xd417
jmp 0xd417
movq %rax, %rbx
movq 0x56b7f(%rip), %rsi     # 0x63fa0
leaq 0xa8(%rsp), %rdi
callq 0x43d0
leaq 0x128(%rsp), %rdi
callq 0x41a0
movq %rbx, %rdi
callq 0x4970
nop