// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movzbl (%rbx), %r12d
testl %r12d, %r12d
je 0x14f7e
cmpl $0x2c, %r12d
je 0x14f7e
cmpq $0x7, %r15
ja 0x14f79
callq 0x40c0
movq (%rax), %rax
movb (%rax,%r12,4), %al
movb %al, 0xf(%rsp,%r15)
incq %r15
incq %rbx
jmp 0x14f50
movb $0x0, 0xf(%rsp,%r15)
cmpq $0x1, %r12
sbbq $-0x1, %rbx
movl $0x0, 0x8(%r14)
movsd 0x807a4(%rip), %xmm0    # 0x95740
cmpl $0x6d6173, 0xf(%rsp)    # imm = 0x6D6173
je 0x15115
movl $0x2e6d6173, %edx       # imm = 0x2E6D6173
xorl 0xf(%rsp), %edx
movl $0x7a672e, %esi         # imm = 0x7A672E
xorl 0x12(%rsp), %esi
movw $0xffff, %cx            # imm = 0xFFFF
movl $0x2, %eax
orl %edx, %esi
je 0x15119
cmpl $0x6d6162, 0xf(%rsp)    # imm = 0x6D6162
je 0x150f4
movl $0x6d617263, %edx       # imm = 0x6D617263
xorl 0xf(%rsp), %edx
movzbl 0x13(%rsp), %esi
orl %edx, %esi
je 0x150fe
cmpl $0x666376, 0xf(%rsp)    # imm = 0x666376
je 0x1510d
cmpl $0x666362, 0xf(%rsp)    # imm = 0x666362
je 0x1513c
movl $0x74736166, %ecx       # imm = 0x74736166
xorl 0xf(%rsp), %ecx
movzwl 0x13(%rsp), %edx
xorl $0x71, %edx
movsd 0x8076a(%rip), %xmm0    # 0x95790
orl %ecx, %edx
je 0x15115
movzwl 0xf(%rsp), %ecx
xorl $0x7166, %ecx           # imm = 0x7166
movzbl 0x11(%rsp), %edx
orw %cx, %dx
je 0x15115
movabsq $0x7a672e7174736166, %rcx # imm = 0x7A672E7174736166
xorq 0xf(%rsp), %rcx
movzbl 0x17(%rsp), %edx
orq %rcx, %rdx
je 0x15117
movl $0x672e7166, %edx       # imm = 0x672E7166
xorl 0xf(%rsp), %edx
movzwl 0x13(%rsp), %esi
xorl $0x7a, %esi
xorl %ecx, %ecx
orl %edx, %esi
je 0x15119
movl $0x74736166, %edx       # imm = 0x74736166
xorl 0xf(%rsp), %edx
movzwl 0x13(%rsp), %esi
xorl $0x61, %esi
movsd 0x80708(%rip), %xmm0    # 0x957a0
orl %edx, %esi
je 0x15146
movzwl 0xf(%rsp), %ecx
xorl $0x6166, %ecx           # imm = 0x6166
movzbl 0x11(%rsp), %edx
orw %cx, %dx
je 0x15115
movabsq $0x7a672e6174736166, %rcx # imm = 0x7A672E6174736166
xorq 0xf(%rsp), %rcx
movzbl 0x17(%rsp), %edx
orq %rcx, %rdx
je 0x15117
movl $0x672e6166, %ecx       # imm = 0x672E6166
xorl 0xf(%rsp), %ecx
movzwl 0x13(%rsp), %edx
xorl $0x7a, %edx
orl %ecx, %edx
je 0x15117
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movsd 0x80654(%rip), %xmm0    # 0x95750
jmp 0x15119
movsd 0x8065a(%rip), %xmm0    # 0x95760
movl $0x3, %eax
jmp 0x15119
movsd 0x8065b(%rip), %xmm0    # 0x95770
xorl %eax, %eax
xorl %ecx, %ecx
movlps %xmm0, (%r14)
movl %eax, 0xc(%r14)
movw %cx, 0x10(%r14)
movq %r14, %rdi
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x14e8c
movsd 0x8063c(%rip), %xmm0    # 0x95780
jmp 0x15119
xorl %eax, %eax
jmp 0x15119