// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x132b3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x13958
movl $0x20, %edi
callq 0x47a0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x132d3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x13958
movq -0x18(%rbp), %rdi
callq 0x4aa0
movq -0x20(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x132fe
movq -0x20(%rbp), %rdi
callq 0x46a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x13958
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movl $0x3d, %esi
callq 0x41e0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x13326
leaq 0x69c74(%rip), %rax     # 0x7cf94
movq %rax, -0x30(%rbp)
jmp 0x13338
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb $0x0, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67add(%rip), %rsi     # 0x7ae23
callq 0x4810
cmpl $0x0, %eax
je 0x13368
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67acf(%rip), %rsi     # 0x7ae2d
callq 0x4810
cmpl $0x0, %eax
jne 0x1338a
movq -0x20(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138fe
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67a9f(%rip), %rsi     # 0x7ae37
callq 0x4810
cmpl $0x0, %eax
je 0x133ba
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67a91(%rip), %rsi     # 0x7ae41
callq 0x4810
cmpl $0x0, %eax
jne 0x133dc
movq -0x20(%rbp), %rax
movl $0x2, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138fc
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67a61(%rip), %rsi     # 0x7ae4b
callq 0x4810
cmpl $0x0, %eax
je 0x1340c
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67a58(%rip), %rsi     # 0x7ae5a
callq 0x4810
cmpl $0x0, %eax
jne 0x1342e
movq -0x20(%rbp), %rax
movl $0x3, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138fa
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67a2d(%rip), %rsi     # 0x7ae69
callq 0x4810
cmpl $0x0, %eax
je 0x1345e
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67a2a(%rip), %rsi     # 0x7ae7e
callq 0x4810
cmpl $0x0, %eax
jne 0x13480
movq -0x20(%rbp), %rax
movl $0x4, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138f8
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67a05(%rip), %rsi     # 0x7ae93
callq 0x4810
cmpl $0x0, %eax
je 0x134b0
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x679f7(%rip), %rsi     # 0x7ae9d
callq 0x4810
cmpl $0x0, %eax
jne 0x134d2
movq -0x20(%rbp), %rax
movl $0x7, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138f6
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x679c7(%rip), %rsi     # 0x7aea7
callq 0x4810
cmpl $0x0, %eax
je 0x13502
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x679b6(%rip), %rsi     # 0x7aeae
callq 0x4810
cmpl $0x0, %eax
jne 0x13524
movq -0x20(%rbp), %rax
movl $0xb, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138f4
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67983(%rip), %rsi     # 0x7aeb5
callq 0x4810
cmpl $0x0, %eax
je 0x13554
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67976(%rip), %rsi     # 0x7aec0
callq 0x4810
cmpl $0x0, %eax
jne 0x13576
movq -0x20(%rbp), %rax
movl $0x8, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138f2
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67947(%rip), %rsi     # 0x7aecb
callq 0x4810
cmpl $0x0, %eax
je 0x135a6
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67939(%rip), %rsi     # 0x7aed5
callq 0x4810
cmpl $0x0, %eax
jne 0x135c8
movq -0x20(%rbp), %rax
movl $0xc, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138f0
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67909(%rip), %rsi     # 0x7aedf
callq 0x4810
cmpl $0x0, %eax
je 0x135f8
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x678fa(%rip), %rsi     # 0x7aee8
callq 0x4810
cmpl $0x0, %eax
jne 0x1361a
movq -0x20(%rbp), %rax
movl $0x11, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138ee
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x678c9(%rip), %rsi     # 0x7aef1
callq 0x4810
cmpl $0x0, %eax
je 0x1364a
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x678ba(%rip), %rsi     # 0x7aefa
callq 0x4810
cmpl $0x0, %eax
jne 0x1366c
movq -0x20(%rbp), %rax
movl $0x10, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138ec
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67889(%rip), %rsi     # 0x7af03
callq 0x4810
cmpl $0x0, %eax
je 0x1369c
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x6787b(%rip), %rsi     # 0x7af0d
callq 0x4810
cmpl $0x0, %eax
jne 0x136b8
movq -0x20(%rbp), %rax
movl $0x9, 0x8(%rax)
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x138ea
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67021(%rip), %rsi     # 0x7a6e7
callq 0x4810
cmpl $0x0, %eax
je 0x136e8
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67839(%rip), %rsi     # 0x7af17
callq 0x4810
cmpl $0x0, %eax
jne 0x13704
movq -0x20(%rbp), %rax
movl $0x6, 0x8(%rax)
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x138e8
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x6780d(%rip), %rsi     # 0x7af1f
callq 0x4810
cmpl $0x0, %eax
je 0x13734
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x67809(%rip), %rsi     # 0x7af33
callq 0x4810
cmpl $0x0, %eax
jne 0x13756
movq -0x20(%rbp), %rax
movl $0xa, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138e6
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x677e3(%rip), %rsi     # 0x7af47
callq 0x4810
cmpl $0x0, %eax
je 0x13786
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x677d4(%rip), %rsi     # 0x7af50
callq 0x4810
cmpl $0x0, %eax
jne 0x137a8
movq -0x20(%rbp), %rax
movl $0x65, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0x4910
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138e4
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x677a3(%rip), %rsi     # 0x7af59
callq 0x4810
cmpl $0x0, %eax
je 0x137d8
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x6779b(%rip), %rsi     # 0x7af69
callq 0x4810
cmpl $0x0, %eax
jne 0x13800
movq -0x20(%rbp), %rax
movl $0x12, 0x8(%rax)
movq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x4820
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138e2
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x6776b(%rip), %rsi     # 0x7af79
callq 0x4810
cmpl $0x0, %eax
je 0x13830
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x6775f(%rip), %rsi     # 0x7af85
callq 0x4810
cmpl $0x0, %eax
jne 0x13858
movq -0x20(%rbp), %rax
movl $0x13, 0x8(%rax)
movq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x4820
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x138e0
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x6772b(%rip), %rsi     # 0x7af91
callq 0x4810
cmpl $0x0, %eax
je 0x13888
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq 0x6771f(%rip), %rsi     # 0x7af9d
callq 0x4810
cmpl $0x0, %eax
jne 0x138a1
movq -0x20(%rbp), %rax
movl $0x1, 0x8(%rax)
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x138de
movq 0x76728(%rip), %rax     # 0x89fd0
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rdx
leaq 0x676f0(%rip), %rsi     # 0x7afa9
movb $0x0, %al
callq 0x4830
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x46a0
movq -0x20(%rbp), %rdi
callq 0x46a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x13958
jmp 0x138e0
jmp 0x138e2
jmp 0x138e4
jmp 0x138e6
jmp 0x138e8
jmp 0x138ea
jmp 0x138ec
jmp 0x138ee
jmp 0x138f0
jmp 0x138f2
jmp 0x138f4
jmp 0x138f6
jmp 0x138f8
jmp 0x138fa
jmp 0x138fc
jmp 0x138fe
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x13946
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x13938
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x1391f
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x13951
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)