// File: /workspace/github_c_makefile_star2_O1/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 0x1550a
cmpl $0x2c, %r12d
je 0x1550a
cmpq $0x7, %r15
ja 0x15505
callq 0x40c0
movq (%rax), %rax
movb (%rax,%r12,4), %al
movb %al, 0xf(%rsp,%r15)
incq %r15
incq %rbx
jmp 0x154dc
movb $0x0, 0xf(%rsp,%r15)
cmpq $0x1, %r12
sbbq $-0x1, %rbx
movl $0x0, 0x8(%r14)
movl $0x3, %edx
movl $0x1, %eax
cmpl $0x6d6173, 0xf(%rsp)    # imm = 0x6D6173
je 0x1568a
movl $0x2e6d6173, %edi       # imm = 0x2E6D6173
xorl 0xf(%rsp), %edi
movl $0x7a672e, %r8d         # imm = 0x7A672E
xorl 0x12(%rsp), %r8d
movw $0xffff, %si            # imm = 0xFFFF
movl $0x2, %ecx
orl %edi, %r8d
je 0x156bb
cmpl $0x6d6162, 0xf(%rsp)    # imm = 0x6D6162
je 0x15690
movl $0x6d617263, %ecx       # imm = 0x6D617263
xorl 0xf(%rsp), %ecx
movzbl 0x13(%rsp), %edx
orl %ecx, %edx
je 0x15697
cmpl $0x666376, 0xf(%rsp)    # imm = 0x666376
je 0x156a3
movl $0x2, %ecx
cmpl $0x666362, 0xf(%rsp)    # imm = 0x666362
je 0x156b1
movl $0x74736166, %esi       # imm = 0x74736166
xorl 0xf(%rsp), %esi
movzwl 0x13(%rsp), %edi
xorl $0x71, %edi
movl $0x11, %edx
orl %esi, %edi
je 0x1568a
movzwl 0xf(%rsp), %esi
xorl $0x7166, %esi           # imm = 0x7166
movzbl 0x11(%rsp), %edi
orw %si, %di
je 0x1568a
movabsq $0x7a672e7174736166, %rsi # imm = 0x7A672E7174736166
xorq 0xf(%rsp), %rsi
movzbl 0x17(%rsp), %edi
orq %rsi, %rdi
je 0x1568c
movl $0x672e7166, %edi       # imm = 0x672E7166
xorl 0xf(%rsp), %edi
movzwl 0x13(%rsp), %r8d
xorl $0x7a, %r8d
xorl %esi, %esi
orl %edi, %r8d
je 0x156bb
movl $0x74736166, %edi       # imm = 0x74736166
xorl 0xf(%rsp), %edi
movzwl 0x13(%rsp), %r8d
xorl $0x61, %r8d
movl $0x10, %edx
orl %edi, %r8d
je 0x156e1
movzwl 0xf(%rsp), %esi
xorl $0x6166, %esi           # imm = 0x6166
movzbl 0x11(%rsp), %edi
orw %si, %di
je 0x1568a
movabsq $0x7a672e6174736166, %rsi # imm = 0x7A672E6174736166
xorq 0xf(%rsp), %rsi
movzbl 0x17(%rsp), %edi
orq %rsi, %rdi
je 0x1568c
movl $0x672e6166, %esi       # imm = 0x672E6166
xorl 0xf(%rsp), %esi
movzwl 0x13(%rsp), %edi
xorl $0x7a, %edi
orl %esi, %edi
je 0x1568c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
xorl %ecx, %ecx
xorl %esi, %esi
jmp 0x156bb
movl $0x4, %edx
jmp 0x156bb
movl $0x3, %ecx
movl $0x6, %edx
jmp 0x156bb
xorl %ecx, %ecx
movl $0x8, %edx
movl $0x2, %eax
jmp 0x1568c
movl $0x9, %edx
movl $0x2, %eax
movl %eax, (%r14)
movl %edx, 0x4(%r14)
movl %ecx, 0xc(%r14)
movw %si, 0x10(%r14)
movq %r14, %rdi
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x15429
xorl %ecx, %ecx
jmp 0x156bb