// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/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 {
        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 0x47519
movq %rsi, %r15
movq %rdi, %r14
pushq $0x20
popq %rdi
callq 0x69d0
testq %rax, %rax
je 0x47519
movq %rax, %rbx
movq %r15, %rdi
callq 0x6dd0
movq %rax, (%rbx)
testq %rax, %rax
je 0x47511
movq %rax, %r12
pushq $0x3d
popq %rsi
movq %rax, %rdi
callq 0x6270
testq %rax, %rax
je 0x47173
movq %rax, %r15
incq %r15
movb $0x0, (%rax)
jmp 0x4717a
leaq 0x40d3a(%rip), %r15     # 0x87eb4
leaq 0x402e1(%rip), %rsi     # 0x87462
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47440
leaq 0x402d4(%rip), %rsi     # 0x8746c
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47440
leaq 0x402c7(%rip), %rsi     # 0x87476
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47446
leaq 0x402ba(%rip), %rsi     # 0x87480
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47446
leaq 0x402ad(%rip), %rsi     # 0x8748a
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x4744f
leaq 0x402a5(%rip), %rsi     # 0x87499
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x4744f
leaq 0x4029d(%rip), %rsi     # 0x874a8
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47458
leaq 0x4029b(%rip), %rsi     # 0x874bd
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47458
leaq 0x40299(%rip), %rsi     # 0x874d2
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47461
leaq 0x4028c(%rip), %rsi     # 0x874dc
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47461
leaq 0x4027f(%rip), %rsi     # 0x874e6
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x4746a
leaq 0x4026f(%rip), %rsi     # 0x874ed
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x4746a
leaq 0x4025f(%rip), %rsi     # 0x874f4
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47473
leaq 0x40253(%rip), %rsi     # 0x874ff
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47473
leaq 0x40247(%rip), %rsi     # 0x8750a
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x4747c
leaq 0x4023a(%rip), %rsi     # 0x87514
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x4747c
leaq 0x4022d(%rip), %rsi     # 0x8751e
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47485
leaq 0x4021f(%rip), %rsi     # 0x87527
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47485
leaq 0x40211(%rip), %rsi     # 0x87530
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x4748e
leaq 0x40203(%rip), %rsi     # 0x87539
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x4748e
leaq 0x401f5(%rip), %rsi     # 0x87542
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x474c6
leaq 0x401e8(%rip), %rsi     # 0x8754c
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x474c6
leaq 0x3badd(%rip), %rsi     # 0x82e58
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x474cf
leaq 0x401c4(%rip), %rsi     # 0x87556
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x474cf
leaq 0x401b5(%rip), %rsi     # 0x8755e
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x474dc
leaq 0x401b2(%rip), %rsi     # 0x87572
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x474dc
leaq 0x401af(%rip), %rsi     # 0x87586
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x474e5
leaq 0x401a1(%rip), %rsi     # 0x8758f
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x474e5
leaq 0x40193(%rip), %rsi     # 0x87598
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
je 0x47428
leaq 0x40190(%rip), %rsi     # 0x875a8
movq %r12, %rdi
callq 0x6a50
testl %eax, %eax
jne 0x474ee
movl $0x12, 0x8(%rbx)
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6a60
movl %eax, 0x10(%rbx)
jmp 0x474a0
andl $0x0, 0x8(%rbx)
jmp 0x47495
movl $0x2, 0x8(%rbx)
jmp 0x47495
movl $0x3, 0x8(%rbx)
jmp 0x47495
movl $0x4, 0x8(%rbx)
jmp 0x47495
movl $0x7, 0x8(%rbx)
jmp 0x47495
movl $0xb, 0x8(%rbx)
jmp 0x47495
movl $0x8, 0x8(%rbx)
jmp 0x47495
movl $0xc, 0x8(%rbx)
jmp 0x47495
movl $0x11, 0x8(%rbx)
jmp 0x47495
movl $0x10, 0x8(%rbx)
movq %r15, %rdi
callq 0x6bd0
movl %eax, 0x10(%rbx)
andq $0x0, 0x18(%rbx)
movq (%r14), %rax
testq %rax, %rax
je 0x474bf
movq %rax, %rcx
movq 0x18(%rax), %rax
testq %rax, %rax
jne 0x474ad
movq %rbx, 0x18(%rcx)
jmp 0x474c2
movq %rbx, (%r14)
xorl %ebp, %ebp
jmp 0x47519
movl $0x9, 0x8(%rbx)
jmp 0x474d6
movl $0x6, 0x8(%rbx)
movq %r15, 0x10(%rbx)
jmp 0x474a0
movl $0xa, 0x8(%rbx)
jmp 0x47495
movl $0x65, 0x8(%rbx)
jmp 0x47495
movq 0x6bae3(%rip), %rax     # 0xb2fd8
movq (%rax), %rdi
leaq 0x400b9(%rip), %rsi     # 0x875b8
movq %r12, %rdx
xorl %eax, %eax
callq 0x6a90
movq %r12, %rdi
callq 0x68a0
movq %rbx, %rdi
callq 0x68a0
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq