// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_parse_format
int hts_parse_format(htsFormat *format, const char *str) {
    char fmt[9];
    const char *cp = scan_keyword(str, ',', fmt, sizeof fmt);

    format->version.minor = 0; // unknown
    format->version.major = 0; // unknown

    if (strcmp(fmt, "sam") == 0) {
        format->category          = sequence_data;
        format->format            = sam;
        format->compression       = no_compression;
        format->compression_level = 0;
    } else if (strcmp(fmt, "sam.gz") == 0) {
        format->category          = sequence_data;
        format->format            = sam;
        format->compression       = bgzf;
        format->compression_level = -1;
    } else if (strcmp(fmt, "bam") == 0) {
        format->category          = sequence_data;
        format->format            = bam;
        format->compression       = bgzf;
        format->compression_level = -1;
    } else if (strcmp(fmt, "cram") == 0) {
        format->category          = sequence_data;
        format->format            = cram;
        format->compression       = custom;
        format->compression_level = -1;
    } else if (strcmp(fmt, "vcf") == 0) {
        format->category          = variant_data;
        format->format            = vcf;
        format->compression       = no_compression;
        format->compression_level = 0;
    } else if (strcmp(fmt, "bcf") == 0) {
        format->category          = variant_data;
        format->format            = bcf;
        format->compression       = bgzf;
        format->compression_level = -1;
    } else if (strcmp(fmt, "fastq") == 0 || strcmp(fmt, "fq") == 0) {
        format->category          = sequence_data;
        format->format            = fastq_format;
        format->compression       = no_compression;
        format->compression_level = 0;
    } else if (strcmp(fmt, "fastq.gz") == 0 || strcmp(fmt, "fq.gz") == 0) {
        format->category          = sequence_data;
        format->format            = fastq_format;
        format->compression       = bgzf;
        format->compression_level = 0;
    } else if (strcmp(fmt, "fasta") == 0 || strcmp(fmt, "fa") == 0) {
        format->category          = sequence_data;
        format->format            = fasta_format;
        format->compression       = no_compression;
        format->compression_level = 0;
    } else if (strcmp(fmt, "fasta.gz") == 0 || strcmp(fmt, "fa.gz") == 0) {
        format->category          = sequence_data;
        format->format            = fasta_format;
        format->compression       = bgzf;
        format->compression_level = 0;
    } else {
        return -1;
    }

    return hts_parse_opt_list(format, cp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movzbl (%rbx), %eax
testl %eax, %eax
je 0x12193
cmpl $0x2c, %eax
je 0x12193
cmpq $0x7, %r15
ja 0x1218e
movsbl %al, %edi
callq 0x10297
movb %al, 0xf(%rsp,%r15)
incq %r15
incq %rbx
jmp 0x1216c
cmpb $0x1, %al
sbbq $-0x1, %rbx
movb $0x0, 0xf(%rsp,%r15)
andl $0x0, 0x8(%r14)
movsd 0x65544(%rip), %xmm0    # 0x776f0
cmpl $0x6d6173, 0xf(%rsp)    # imm = 0x6D6173
je 0x1234a
leaq 0x6606e(%rip), %rsi     # 0x7822f
leaq 0xf(%rsp), %rdi
pushq $0x7
popq %rdx
callq 0x44d0
movw $0xffff, %r15w          # imm = 0xFFFF
pushq $0x2
popq %rbp
testl %eax, %eax
je 0x12321
cmpl $0x6d6162, 0xf(%rsp)    # imm = 0x6D6162
je 0x1232b
leaq 0x663d0(%rip), %rsi     # 0x785c3
leaq 0xf(%rsp), %rdi
pushq $0x5
popq %rdx
callq 0x44d0
testl %eax, %eax
je 0x12335
cmpl $0x666376, 0xf(%rsp)    # imm = 0x666376
je 0x12342
cmpl $0x666362, 0xf(%rsp)    # imm = 0x666362
je 0x12371
leaq 0x6600f(%rip), %rsi     # 0x7823a
leaq 0xf(%rsp), %rdi
pushq $0x6
popq %rdx
callq 0x44d0
movsd 0x65500(%rip), %xmm0    # 0x77740
testl %eax, %eax
je 0x1234a
leaq 0x65ff1(%rip), %rsi     # 0x78240
leaq 0xf(%rsp), %rdi
pushq $0x3
popq %rdx
callq 0x44d0
testl %eax, %eax
je 0x1237b
leaq 0x65fd8(%rip), %rsi     # 0x78243
leaq 0xf(%rsp), %rdi
pushq $0x9
popq %rdx
callq 0x44d0
testl %eax, %eax
je 0x1237d
leaq 0x65fc5(%rip), %rsi     # 0x7824c
leaq 0xf(%rsp), %rdi
pushq $0x6
popq %rdx
callq 0x44d0
xorl %r15d, %r15d
testl %eax, %eax
je 0x12380
leaq 0x65fac(%rip), %rsi     # 0x78252
leaq 0xf(%rsp), %rdi
pushq $0x6
popq %rdx
callq 0x44d0
movsd 0x65495(%rip), %xmm0    # 0x77750
testl %eax, %eax
je 0x1238a
leaq 0x65f8e(%rip), %rsi     # 0x78258
leaq 0xf(%rsp), %rdi
pushq $0x3
popq %rdx
callq 0x44d0
testl %eax, %eax
je 0x1238e
leaq 0x65f75(%rip), %rsi     # 0x7825b
leaq 0xf(%rsp), %rdi
pushq $0x9
popq %rdx
callq 0x44d0
testl %eax, %eax
je 0x12390
leaq 0x65f62(%rip), %rsi     # 0x78264
leaq 0xf(%rsp), %rdi
pushq $0x6
popq %rdx
callq 0x44d0
testl %eax, %eax
je 0x12390
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movsd 0x653c7(%rip), %xmm0    # 0x776f0
jmp 0x1234f
movsd 0x653cd(%rip), %xmm0    # 0x77700
jmp 0x1234f
movsd 0x653d3(%rip), %xmm0    # 0x77710
pushq $0x3
popq %rbp
jmp 0x1234f
movsd 0x653d6(%rip), %xmm0    # 0x77720
xorl %ebp, %ebp
xorl %r15d, %r15d
movlps %xmm0, (%r14)
movl %ebp, 0xc(%r14)
movw %r15w, 0x10(%r14)
movq %r14, %rdi
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x120ae
movsd 0x653b7(%rip), %xmm0    # 0x77730
jmp 0x1234f
xorl %ebp, %ebp
xorl %r15d, %r15d
movsd 0x653b8(%rip), %xmm0    # 0x77740
jmp 0x1234f
xorl %ebp, %ebp
jmp 0x1234f
xorl %ebp, %ebp
xorl %r15d, %r15d
movsd 0x653b5(%rip), %xmm0    # 0x77750
jmp 0x1234f