// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rsp, %r15
xorl %ebx, %ebx
movq %r15, %rsi
xorl %edx, %edx
callq 0x46d0
cmpq %r14, (%r15)
je 0x26833
movl %eax, %ebx
jmp 0x26a14
movb (%r14), %r13b
leaq 0x53597(%rip), %r15     # 0x79dd4
testb %r13b, %r13b
je 0x26a12
xorl %ebp, %ebp
leaq (%r14,%rbp), %rax
movq %rax, (%rsp)
movzbl (%r14,%rbp), %r12d
testl %r12d, %r12d
je 0x26865
cmpl $0x2c, %r12d
je 0x26865
incq %rbp
jmp 0x26848
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x6, %rbp
jne 0x26884
pushq $0x1
popq %rcx
testl %eax, %eax
je 0x269ff
leaq 0x53550(%rip), %rdi     # 0x79ddb
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0xb, %rbp
jne 0x268a7
pushq $0x2
popq %rcx
testl %eax, %eax
je 0x269ff
leaq 0x5353a(%rip), %rdi     # 0x79de8
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x5, %rbp
jne 0x268ca
pushq $0x4
popq %rcx
testl %eax, %eax
je 0x269ff
leaq 0x53516(%rip), %rdi     # 0x79de7
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x6, %rbp
jne 0x268ed
pushq $0x8
popq %rcx
testl %eax, %eax
je 0x269ff
leaq 0x534fb(%rip), %rdi     # 0x79def
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x7, %rbp
jne 0x26910
pushq $0x10
popq %rcx
testl %eax, %eax
je 0x269ff
leaq 0x534d7(%rip), %rdi     # 0x79dee
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x8, %rbp
jne 0x26933
pushq $0x20
popq %rcx
testl %eax, %eax
je 0x269ff
leaq 0x534bd(%rip), %rdi     # 0x79df7
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x5, %rbp
jne 0x26956
pushq $0x40
popq %rcx
testl %eax, %eax
je 0x269ff
leaq 0x534a0(%rip), %rdi     # 0x79dfd
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x5, %rbp
jne 0x2697b
movl $0x80, %ecx
testl %eax, %eax
je 0x269ff
leaq 0x53481(%rip), %rdi     # 0x79e03
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x9, %rbp
jne 0x2699c
movl $0x100, %ecx            # imm = 0x100
testl %eax, %eax
je 0x269ff
leaq 0x5346a(%rip), %rdi     # 0x79e0d
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x6, %rbp
jne 0x269bd
movl $0x200, %ecx            # imm = 0x200
testl %eax, %eax
je 0x269ff
leaq 0x53450(%rip), %rdi     # 0x79e14
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0x3, %rbp
jne 0x269de
movl $0x400, %ecx            # imm = 0x400
testl %eax, %eax
je 0x269ff
leaq 0x53433(%rip), %rdi     # 0x79e18
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4650
cmpq $0xd, %rbp
jne 0x26a25
movl $0x800, %ecx            # imm = 0x800
testl %eax, %eax
jne 0x26a25
orl %ecx, %ebx
addq %rbp, %r14
incq %r14
testb %r12b, %r12b
jne 0x2683d
jmp 0x26a14
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 0x26a14