// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_opt_add
int hts_opt_add(hts_opt **opts, const char *c_arg) {
    hts_opt *o, *t;
    char *val;

    if (!c_arg)
        return -1;

    if (!(o =  malloc(sizeof(*o))))
        return -1;

    if (!(o->arg = strdup(c_arg))) {
        free(o);
        return -1;
    }

    if (!(val = strchr(o->arg, '=')))
        val = "1"; // assume boolean
    else
        *val++ = '\0';

    if (strcmp(o->arg, "decode_md") == 0 ||
        strcmp(o->arg, "DECODE_MD") == 0)
        o->opt = CRAM_OPT_DECODE_MD, o->val.i = atoi(val);

    else if (strcmp(o->arg, "verbosity") == 0 ||
             strcmp(o->arg, "VERBOSITY") == 0)
        o->opt = CRAM_OPT_VERBOSITY, o->val.i = atoi(val);

    else if (strcmp(o->arg, "seqs_per_slice") == 0 ||
             strcmp(o->arg, "SEQS_PER_SLICE") == 0)
        o->opt = CRAM_OPT_SEQS_PER_SLICE, o->val.i = atoi(val);

    else if (strcmp(o->arg, "slices_per_container") == 0 ||
             strcmp(o->arg, "SLICES_PER_CONTAINER") == 0)
        o->opt = CRAM_OPT_SLICES_PER_CONTAINER, o->val.i = atoi(val);

    else if (strcmp(o->arg, "embed_ref") == 0 ||
             strcmp(o->arg, "EMBED_REF") == 0)
        o->opt = CRAM_OPT_EMBED_REF, o->val.i = atoi(val);

    else if (strcmp(o->arg, "no_ref") == 0 ||
             strcmp(o->arg, "NO_REF") == 0)
        o->opt = CRAM_OPT_NO_REF, o->val.i = atoi(val);

    else if (strcmp(o->arg, "ignore_md5") == 0 ||
             strcmp(o->arg, "IGNORE_MD5") == 0)
        o->opt = CRAM_OPT_IGNORE_MD5, o->val.i = atoi(val);

    else if (strcmp(o->arg, "use_bzip2") == 0 ||
             strcmp(o->arg, "USE_BZIP2") == 0)
        o->opt = CRAM_OPT_USE_BZIP2, o->val.i = atoi(val);

    else if (strcmp(o->arg, "use_rans") == 0 ||
             strcmp(o->arg, "USE_RANS") == 0)
        o->opt = CRAM_OPT_USE_RANS, o->val.i = atoi(val);

    else if (strcmp(o->arg, "use_lzma") == 0 ||
             strcmp(o->arg, "USE_LZMA") == 0)
        o->opt = CRAM_OPT_USE_LZMA, o->val.i = atoi(val);

    else if (strcmp(o->arg, "reference") == 0 ||
             strcmp(o->arg, "REFERENCE") == 0)
        o->opt = CRAM_OPT_REFERENCE, o->val.s = val;

    else if (strcmp(o->arg, "version") == 0 ||
             strcmp(o->arg, "VERSION") == 0)
        o->opt = CRAM_OPT_VERSION, o->val.s =val;

    else if (strcmp(o->arg, "multi_seq_per_slice") == 0 ||
             strcmp(o->arg, "MULTI_SEQ_PER_SLICE") == 0)
        o->opt = CRAM_OPT_MULTI_SEQ_PER_SLICE, o->val.i = atoi(val);

    else if (strcmp(o->arg, "nthreads") == 0 ||
             strcmp(o->arg, "NTHREADS") == 0)
        o->opt = HTS_OPT_NTHREADS, o->val.i = atoi(val);

    else if (strcmp(o->arg, "required_fields") == 0 ||
             strcmp(o->arg, "REQUIRED_FIELDS") == 0)
        o->opt = CRAM_OPT_REQUIRED_FIELDS, o->val.i = strtol(val, NULL, 0);

    else if (strcmp(o->arg, "lossy_names") == 0 ||
             strcmp(o->arg, "LOSSY_NAMES") == 0)
        o->opt = CRAM_OPT_LOSSY_NAMES, o->val.i = strtol(val, NULL, 0);

    else if (strcmp(o->arg, "name_prefix") == 0 ||
             strcmp(o->arg, "NAME_PREFIX") == 0)
        o->opt = CRAM_OPT_PREFIX, o->val.s = val;

    else {
        fprintf(stderr, "Unknown option '%s'\n", o->arg);
        free(o->arg);
        free(o);
        return -1;
    }

    o->next = NULL;

    // Append; assumes small list.
    if (*opts) {
        t = *opts;
        while (t->next)
            t = t->next;
        t->next = o;
    } else {
        *opts = o;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq $-0x1
popq %rbp
testq %rsi, %rsi
je 0xce95
movq %rsi, %r15
movq %rdi, %r14
pushq $0x20
popq %rdi
callq 0x46f0
testq %rax, %rax
je 0xce95
movq %rax, %rbx
movq %r15, %rdi
callq 0x49a0
movq %rax, (%rbx)
testq %rax, %rax
je 0xce8d
movq %rax, %r12
pushq $0x3d
popq %rsi
movq %rax, %rdi
callq 0x41e0
testq %rax, %rax
je 0xca7e
movq %rax, %r15
incq %r15
movb $0x0, (%rax)
jmp 0xca85
leaq 0x39147(%rip), %r15     # 0x45bcc
leaq 0x37250(%rip), %rsi     # 0x43cdc
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcd9b
leaq 0x37243(%rip), %rsi     # 0x43ce6
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcd9b
leaq 0x37236(%rip), %rsi     # 0x43cf0
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcda1
leaq 0x37229(%rip), %rsi     # 0x43cfa
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcda1
leaq 0x3721c(%rip), %rsi     # 0x43d04
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdaa
leaq 0x37214(%rip), %rsi     # 0x43d13
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdaa
leaq 0x3720c(%rip), %rsi     # 0x43d22
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdb3
leaq 0x3720a(%rip), %rsi     # 0x43d37
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdb3
leaq 0x37208(%rip), %rsi     # 0x43d4c
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdbc
leaq 0x371fb(%rip), %rsi     # 0x43d56
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdbc
leaq 0x371ee(%rip), %rsi     # 0x43d60
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdc5
leaq 0x371de(%rip), %rsi     # 0x43d67
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdc5
leaq 0x371ce(%rip), %rsi     # 0x43d6e
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdce
leaq 0x371c2(%rip), %rsi     # 0x43d79
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdce
leaq 0x371b6(%rip), %rsi     # 0x43d84
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdd7
leaq 0x371a9(%rip), %rsi     # 0x43d8e
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcdd7
leaq 0x3719c(%rip), %rsi     # 0x43d98
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcde0
leaq 0x3718e(%rip), %rsi     # 0x43da1
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcde0
leaq 0x37180(%rip), %rsi     # 0x43daa
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcde9
leaq 0x37172(%rip), %rsi     # 0x43db3
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcde9
leaq 0x37164(%rip), %rsi     # 0x43dbc
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce21
leaq 0x37157(%rip), %rsi     # 0x43dc6
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce21
leaq 0x368b9(%rip), %rsi     # 0x4353f
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce2a
leaq 0x37133(%rip), %rsi     # 0x43dd0
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce2a
leaq 0x37124(%rip), %rsi     # 0x43dd8
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce37
leaq 0x37121(%rip), %rsi     # 0x43dec
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce37
leaq 0x3711e(%rip), %rsi     # 0x43e00
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce40
leaq 0x37110(%rip), %rsi     # 0x43e09
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce40
leaq 0x37102(%rip), %rsi     # 0x43e12
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce49
leaq 0x370fb(%rip), %rsi     # 0x43e22
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce49
leaq 0x370f4(%rip), %rsi     # 0x43e32
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce52
leaq 0x370e9(%rip), %rsi     # 0x43e3e
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xce52
leaq 0x370de(%rip), %rsi     # 0x43e4a
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0xcd8f
leaq 0x370d7(%rip), %rsi     # 0x43e56
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
jne 0xce6a
movl $0x1, 0x8(%rbx)
jmp 0xce31
andl $0x0, 0x8(%rbx)
jmp 0xcdf0
movl $0x2, 0x8(%rbx)
jmp 0xcdf0
movl $0x3, 0x8(%rbx)
jmp 0xcdf0
movl $0x4, 0x8(%rbx)
jmp 0xcdf0
movl $0x7, 0x8(%rbx)
jmp 0xcdf0
movl $0xb, 0x8(%rbx)
jmp 0xcdf0
movl $0x8, 0x8(%rbx)
jmp 0xcdf0
movl $0xc, 0x8(%rbx)
jmp 0xcdf0
movl $0x11, 0x8(%rbx)
jmp 0xcdf0
movl $0x10, 0x8(%rbx)
movq %r15, %rdi
callq 0x4830
movl %eax, 0x10(%rbx)
andq $0x0, 0x18(%rbx)
movq (%r14), %rax
testq %rax, %rax
je 0xce1a
movq %rax, %rcx
movq 0x18(%rax), %rax
testq %rax, %rax
jne 0xce08
movq %rbx, 0x18(%rcx)
jmp 0xce1d
movq %rbx, (%r14)
xorl %ebp, %ebp
jmp 0xce95
movl $0x9, 0x8(%rbx)
jmp 0xce31
movl $0x6, 0x8(%rbx)
movq %r15, 0x10(%rbx)
jmp 0xcdfb
movl $0xa, 0x8(%rbx)
jmp 0xcdf0
movl $0x65, 0x8(%rbx)
jmp 0xcdf0
movl $0x12, 0x8(%rbx)
jmp 0xce59
movl $0x13, 0x8(%rbx)
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4760
movl %eax, 0x10(%rbx)
jmp 0xcdfb
movq 0x4a15f(%rip), %rax     # 0x56fd0
movq (%rax), %rdi
leaq 0x36fe7(%rip), %rsi     # 0x43e62
movq %r12, %rdx
xorl %eax, %eax
callq 0x4770
movq %r12, %rdi
callq 0x4600
movq %rbx, %rdi
callq 0x4600
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq