// File: /workspace/github_c_makefile_star2_O3/samtools[P]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, %rbx
movq %rsp, %r14
xorl %r13d, %r13d
movq %r14, %rsi
xorl %edx, %edx
callq 0x46d0
cmpq %rbx, (%r14)
je 0x2f1c0
movl %eax, %r13d
jmp 0x2f3b5
cmpb $0x0, (%rbx)
je 0x2f3b5
xorl %r12d, %r12d
leaq 0x68ca6(%rip), %r14     # 0x97e79
xorl %ebp, %ebp
leaq (%rbx,%rbp), %rax
movq %rax, (%rsp)
movzbl (%rbx,%rbp), %r15d
testl %r15d, %r15d
je 0x2f1f2
cmpl $0x2c, %r15d
je 0x2f1f2
incq %rbp
jmp 0x2f1d5
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x6, %rbp
jne 0x2f213
movl $0x1, %ecx
testl %eax, %eax
je 0x2f3a0
leaq 0x68c66(%rip), %rdi     # 0x97e80
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0xb, %rbp
jne 0x2f238
movl $0x2, %ecx
testl %eax, %eax
je 0x2f3a0
leaq 0x68c4e(%rip), %rdi     # 0x97e8d
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x5, %rbp
jne 0x2f25d
movl $0x4, %ecx
testl %eax, %eax
je 0x2f3a0
leaq 0x68c28(%rip), %rdi     # 0x97e8c
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x6, %rbp
jne 0x2f282
movl $0x8, %ecx
testl %eax, %eax
je 0x2f3a0
leaq 0x68c0b(%rip), %rdi     # 0x97e94
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x7, %rbp
jne 0x2f2a7
movl $0x10, %ecx
testl %eax, %eax
je 0x2f3a0
leaq 0x68be5(%rip), %rdi     # 0x97e93
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x8, %rbp
jne 0x2f2cc
movl $0x20, %ecx
testl %eax, %eax
je 0x2f3a0
leaq 0x68bc9(%rip), %rdi     # 0x97e9c
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x5, %rbp
jne 0x2f2f1
movl $0x40, %ecx
testl %eax, %eax
je 0x2f3a0
leaq 0x68baa(%rip), %rdi     # 0x97ea2
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x5, %rbp
jne 0x2f316
movl $0x80, %ecx
testl %eax, %eax
je 0x2f3a0
leaq 0x68b8b(%rip), %rdi     # 0x97ea8
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x9, %rbp
jne 0x2f337
movl $0x100, %ecx            # imm = 0x100
testl %eax, %eax
je 0x2f3a0
leaq 0x68b74(%rip), %rdi     # 0x97eb2
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x6, %rbp
jne 0x2f358
movl $0x200, %ecx            # imm = 0x200
testl %eax, %eax
je 0x2f3a0
leaq 0x68b5a(%rip), %rdi     # 0x97eb9
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x3, %rbp
jne 0x2f379
movl $0x400, %ecx            # imm = 0x400
testl %eax, %eax
je 0x2f3a0
leaq 0x68b3d(%rip), %rdi     # 0x97ebd
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4650
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpq $0xd, %rbp
jne 0x2f3b5
movl $0x800, %ecx            # imm = 0x800
testl %eax, %eax
jne 0x2f3b5
orl %ecx, %r12d
addq %rbp, %rbx
incq %rbx
movl %r12d, %r13d
testb %r15b, %r15b
jne 0x2f1d3
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq