// File: karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_parse_format
int hts_parse_format(htsFormat *format, const char *str) {
    char fmt[8];
    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, "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 {
        return -1;
    }

    return hts_parse_opt_list(format, cp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rdx
movl $0x2c, %esi
movl $0x8, %ecx
callq 0x13eb0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movw $0x0, 0xa(%rax)
movq -0x10(%rbp), %rax
movw $0x0, 0x8(%rax)
leaq -0x20(%rbp), %rdi
leaq 0x67284(%rip), %rsi     # 0x7afbe
callq 0x4810
cmpl $0x0, %eax
jne 0x13d73
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
movq -0x10(%rbp), %rax
movl $0x3, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x10(%rbp), %rax
movw $0x0, 0x10(%rax)
jmp 0x13e8e
leaq -0x20(%rbp), %rdi
leaq 0x67244(%rip), %rsi     # 0x7afc2
callq 0x4810
cmpl $0x0, %eax
jne 0x13db7
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
movq -0x10(%rbp), %rax
movl $0x4, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x2, 0xc(%rax)
movq -0x10(%rbp), %rax
movw $0xffff, 0x10(%rax)     # imm = 0xFFFF
jmp 0x13e8c
leaq -0x20(%rbp), %rdi
leaq 0x67204(%rip), %rsi     # 0x7afc6
callq 0x4810
cmpl $0x0, %eax
jne 0x13dfb
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
movq -0x10(%rbp), %rax
movl $0x6, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x3, 0xc(%rax)
movq -0x10(%rbp), %rax
movw $0xffff, 0x10(%rax)     # imm = 0xFFFF
jmp 0x13e8a
leaq -0x20(%rbp), %rdi
leaq 0x67228(%rip), %rsi     # 0x7b02e
callq 0x4810
cmpl $0x0, %eax
jne 0x13e3c
movq -0x10(%rbp), %rax
movl $0x2, (%rax)
movq -0x10(%rbp), %rax
movl $0x8, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x10(%rbp), %rax
movw $0x0, 0x10(%rax)
jmp 0x13e88
leaq -0x20(%rbp), %rdi
leaq 0x671ec(%rip), %rsi     # 0x7b033
callq 0x4810
cmpl $0x0, %eax
jne 0x13e7d
movq -0x10(%rbp), %rax
movl $0x2, (%rax)
movq -0x10(%rbp), %rax
movl $0x9, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x2, 0xc(%rax)
movq -0x10(%rbp), %rax
movw $0xffff, 0x10(%rax)     # imm = 0xFFFF
jmp 0x13e86
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x13e9e
jmp 0x13e88
jmp 0x13e8a
jmp 0x13e8c
jmp 0x13e8e
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x13b30
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)