// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movq %rsp, %r14
xorl %r13d, %r13d
movq %r14, %rsi
xorl %edx, %edx
callq 0x4760
cmpq %rbx, (%r14)
je 0x1a6bd
movl %eax, %r13d
jmp 0x1a8b7
movb (%rbx), %r12b
testb %r12b, %r12b
je 0x1a8b7
xorl %r15d, %r15d
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %ebp, %ebp
leaq (%rbx,%rbp), %rax
movq %rax, (%rsp)
movzbl (%rbx,%rbp), %r14d
testl %r14d, %r14d
je 0x1a6f1
cmpl $0x2c, %r14d
je 0x1a6f1
incq %rbp
jmp 0x1a6d4
leaq 0x3903d(%rip), %rdi     # 0x53735
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0x6, %rbp
jne 0x1a716
movl $0x1, %ecx
testl %eax, %eax
je 0x1a89d
leaq 0x3901f(%rip), %rdi     # 0x5373c
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0xb, %rbp
jne 0x1a73b
movl $0x2, %ecx
testl %eax, %eax
je 0x1a89d
leaq 0x39007(%rip), %rdi     # 0x53749
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0x5, %rbp
jne 0x1a760
movl $0x4, %ecx
testl %eax, %eax
je 0x1a89d
leaq 0x38fe1(%rip), %rdi     # 0x53748
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0x6, %rbp
jne 0x1a785
movl $0x8, %ecx
testl %eax, %eax
je 0x1a89d
leaq 0x38fc4(%rip), %rdi     # 0x53750
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0x7, %rbp
jne 0x1a7aa
movl $0x10, %ecx
testl %eax, %eax
je 0x1a89d
leaq 0x38f9e(%rip), %rdi     # 0x5374f
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0x8, %rbp
jne 0x1a7cf
movl $0x20, %ecx
testl %eax, %eax
je 0x1a89d
leaq 0x38f82(%rip), %rdi     # 0x53758
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0x5, %rbp
jne 0x1a7f4
movl $0x40, %ecx
testl %eax, %eax
je 0x1a89d
leaq 0x38f63(%rip), %rdi     # 0x5375e
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0x5, %rbp
jne 0x1a819
movl $0x80, %ecx
testl %eax, %eax
je 0x1a89d
leaq 0x38f44(%rip), %rdi     # 0x53764
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0x9, %rbp
jne 0x1a83a
movl $0x100, %ecx            # imm = 0x100
testl %eax, %eax
je 0x1a89d
leaq 0x38f2d(%rip), %rdi     # 0x5376e
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0x6, %rbp
jne 0x1a85b
movl $0x200, %ecx            # imm = 0x200
testl %eax, %eax
je 0x1a89d
leaq 0x38f13(%rip), %rdi     # 0x53775
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0x3, %rbp
jne 0x1a87c
movl $0x400, %ecx            # imm = 0x400
testl %eax, %eax
je 0x1a89d
leaq 0x38ef6(%rip), %rdi     # 0x53779
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x46b0
cmpq $0xd, %rbp
jne 0x1a8b7
movl $0x800, %ecx            # imm = 0x800
testl %eax, %eax
jne 0x1a8b7
orq %rcx, %r15
testb %r14b, %r14b
je 0x1a8b4
addq %rbp, %rbx
incq %rbx
testb %r12b, %r12b
jne 0x1a6d2
movl %r15d, %r13d
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq