// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: bam_str2flag
int bam_str2flag(const char *str)
{
    char *end, *beg = (char*) str;
    long int flag = strtol(str, &end, 0);
    if ( end!=str ) return flag;    // the conversion was successful
    flag = 0;
    while ( *str )
    {
        end = beg;
        while ( *end && *end!=',' ) end++;
        if ( !STRNCMP("PAIRED",beg,end-beg) ) flag |= BAM_FPAIRED;
        else if ( !STRNCMP("PROPER_PAIR",beg,end-beg) ) flag |= BAM_FPROPER_PAIR;
        else if ( !STRNCMP("UNMAP",beg,end-beg) ) flag |= BAM_FUNMAP;
        else if ( !STRNCMP("MUNMAP",beg,end-beg) ) flag |= BAM_FMUNMAP;
        else if ( !STRNCMP("REVERSE",beg,end-beg) ) flag |= BAM_FREVERSE;
        else if ( !STRNCMP("MREVERSE",beg,end-beg) ) flag |= BAM_FMREVERSE;
        else if ( !STRNCMP("READ1",beg,end-beg) ) flag |= BAM_FREAD1;
        else if ( !STRNCMP("READ2",beg,end-beg) ) flag |= BAM_FREAD2;
        else if ( !STRNCMP("SECONDARY",beg,end-beg) ) flag |= BAM_FSECONDARY;
        else if ( !STRNCMP("QCFAIL",beg,end-beg) ) flag |= BAM_FQCFAIL;
        else if ( !STRNCMP("DUP",beg,end-beg) ) flag |= BAM_FDUP;
        else if ( !STRNCMP("SUPPLEMENTARY",beg,end-beg) ) flag |= BAM_FSUPPLEMENTARY;
        else return -1;
        if ( !*end ) break;
        beg = end + 1;
    }
    return flag;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq %rsp, %r15
xorl %ebx, %ebx
movq %r15, %rsi
xorl %edx, %edx
callq 0x4760
cmpq %r14, (%r15)
je 0x14255
movl %eax, %ebx
jmp 0x14436
movb (%r14), %r13b
leaq 0x30472(%rip), %r15     # 0x446d1
testb %r13b, %r13b
je 0x14434
xorl %ebp, %ebp
leaq (%r14,%rbp), %rax
movq %rax, (%rsp)
movzbl (%r14,%rbp), %r12d
testl %r12d, %r12d
je 0x14287
cmpl $0x2c, %r12d
je 0x14287
incq %rbp
jmp 0x1426a
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0x6, %rbp
jne 0x142a6
pushq $0x1
popq %rcx
testl %eax, %eax
je 0x14421
leaq 0x3042b(%rip), %rdi     # 0x446d8
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0xb, %rbp
jne 0x142c9
pushq $0x2
popq %rcx
testl %eax, %eax
je 0x14421
leaq 0x30415(%rip), %rdi     # 0x446e5
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0x5, %rbp
jne 0x142ec
pushq $0x4
popq %rcx
testl %eax, %eax
je 0x14421
leaq 0x303f1(%rip), %rdi     # 0x446e4
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0x6, %rbp
jne 0x1430f
pushq $0x8
popq %rcx
testl %eax, %eax
je 0x14421
leaq 0x303d6(%rip), %rdi     # 0x446ec
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0x7, %rbp
jne 0x14332
pushq $0x10
popq %rcx
testl %eax, %eax
je 0x14421
leaq 0x303b2(%rip), %rdi     # 0x446eb
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0x8, %rbp
jne 0x14355
pushq $0x20
popq %rcx
testl %eax, %eax
je 0x14421
leaq 0x30398(%rip), %rdi     # 0x446f4
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0x5, %rbp
jne 0x14378
pushq $0x40
popq %rcx
testl %eax, %eax
je 0x14421
leaq 0x3037b(%rip), %rdi     # 0x446fa
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0x5, %rbp
jne 0x1439d
movl $0x80, %ecx
testl %eax, %eax
je 0x14421
leaq 0x3035c(%rip), %rdi     # 0x44700
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0x9, %rbp
jne 0x143be
movl $0x100, %ecx            # imm = 0x100
testl %eax, %eax
je 0x14421
leaq 0x30345(%rip), %rdi     # 0x4470a
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0x6, %rbp
jne 0x143df
movl $0x200, %ecx            # imm = 0x200
testl %eax, %eax
je 0x14421
leaq 0x3032b(%rip), %rdi     # 0x44711
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0x3, %rbp
jne 0x14400
movl $0x400, %ecx            # imm = 0x400
testl %eax, %eax
je 0x14421
leaq 0x3030e(%rip), %rdi     # 0x44715
movq %r14, %rsi
movq %rbp, %rdx
callq 0x46a0
cmpq $0xd, %rbp
jne 0x14447
movl $0x800, %ecx            # imm = 0x800
testl %eax, %eax
jne 0x14447
orl %ecx, %ebx
addq %rbp, %r14
incq %r14
testb %r12b, %r12b
jne 0x1425f
jmp 0x14436
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $-0x1
popq %rax
movl %eax, %ebx
jmp 0x14436