// File: mshabbirhasan[P]ups-indel/include/seqan/bam_io/read_sam.h
// Function: int seqan::readRecord<std::istream, void, seqan::StringSet<seqan::String<char, seqan::Alloc<void>>, seqan::Owner<seqan::Tag<seqan::Default_>>>, seqan::NameStoreCache<seqan::StringSet<seqan::String<char, seqan::Alloc<void>>, seqan::Owner<seqan::Tag<seqan::Default_>>>, seqan::String<char, seqan::Alloc<void>>>>(seqan::BamHeaderRecord&, seqan::BamIOContext<seqan::StringSet<seqan::String<char, seqan::Alloc<void>>, seqan::Owner<seqan::Tag<seqan::Default_>>>, seqan::NameStoreCache<seqan::StringSet<seqan::String<char, seqan::Alloc<void>>, seqan::Owner<seqan::Tag<seqan::Default_>>>, seqan::String<char, seqan::Alloc<void>>>>&, seqan::RecordReader<std::istream, seqan::SinglePass<void>>&, seqan::Tag<seqan::Sam_> const&)
int readRecord(BamHeaderRecord & record,
               BamIOContext<TNameStore, TNameStoreCache> & context,
               RecordReader<TStream, SinglePass<TSpec> > & reader,
               Sam const & /*tag*/)
{
    clear(record);

    // Make sure the first character is '@'.
    char c = value(reader);
    if (c != '@')
        return SAM_INVALID_RECORD;
    if (goNext(reader))
        return SAM_INVALID_RECORD;

    // Read the header tag.
    char c1 = value(reader);
    if (goNext(reader))
        return SAM_INVALID_RECORD;
    char c2 = value(reader);
    if (goNext(reader))
        return SAM_INVALID_RECORD;
    // Determine header type.
    if (c1 == 'H' && c2 == 'D')
        record.type = BAM_HEADER_FIRST;
    else if (c1 == 'S' && c2 == 'Q')
        record.type = BAM_HEADER_REFERENCE;
    else if (c1 == 'R' && c2 == 'G')
        record.type = BAM_HEADER_READ_GROUP;
    else if (c1 == 'P' && c2 == 'G')
        record.type = BAM_HEADER_PROGRAM;
    else if (c1 == 'C' && c2 == 'O')
        record.type = BAM_HEADER_COMMENT;
    else
        return SAM_INVALID_RECORD;

    if (record.type == BAM_HEADER_COMMENT)
    {
        int res = skipChar(reader, '\t');
        if (res != 0)
            return res;
        CharString &buffer = context.buffer;
        clear(buffer);
        res = readLine(buffer, reader);
        if (res != 0)
            return res;
        appendValue(record.tags, Pair<CharString>(CharString(), buffer));
        return 0;  // done, do not skip line a second time below
    }
    else
    {
        // Read the rest of the line into the tag field of record.
        int res = 0;
        CharString key, val;
        while (!atEnd(reader) && value(reader) == '\t')
        {
            clear(key);
            clear(val);

            res = skipChar(reader, '\t');
            if (res != 0)
                return res;
            res = readUntilChar(key, reader, ':');
            if (res != 0)
                return res;
            if (goNext(reader))
                return SAM_INVALID_RECORD;
            res = readUntilOneOf(val, reader, '\t', '\r', '\n');
            if (res != 0 && res != EOF_BEFORE_SUCCESS)
                return res;

            appendValue(record.tags, Pair<CharString>(key, val));
        }
    }

    // Skip remaining line break.
    int res = skipLine(reader);
    if (res != 0 && res != EOF_BEFORE_SUCCESS)
        return res;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x19750
movq -0x20(%rbp), %rdi
callq 0x1a3f0
movb %al, -0x29(%rbp)
movsbl -0x29(%rbp), %eax
cmpl $0x40, %eax
je 0x197b5
movl $0x800, -0x4(%rbp)      # imm = 0x800
jmp 0x19cb7
movq -0x20(%rbp), %rdi
callq 0x1a660
testb $0x1, %al
jne 0x197c4
jmp 0x197d0
movl $0x800, -0x4(%rbp)      # imm = 0x800
jmp 0x19cb7
movq -0x20(%rbp), %rdi
callq 0x1a3f0
movb %al, -0x2a(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1a660
testb $0x1, %al
jne 0x197eb
jmp 0x197f7
movl $0x800, -0x4(%rbp)      # imm = 0x800
jmp 0x19cb7
movq -0x20(%rbp), %rdi
callq 0x1a3f0
movb %al, -0x2b(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1a660
testb $0x1, %al
jne 0x19812
jmp 0x1981e
movl $0x800, -0x4(%rbp)      # imm = 0x800
jmp 0x19cb7
movsbl -0x2a(%rbp), %eax
cmpl $0x48, %eax
jne 0x1983f
movsbl -0x2b(%rbp), %eax
cmpl $0x44, %eax
jne 0x1983f
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
jmp 0x198cb
movsbl -0x2a(%rbp), %eax
cmpl $0x53, %eax
jne 0x1985d
movsbl -0x2b(%rbp), %eax
cmpl $0x51, %eax
jne 0x1985d
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
jmp 0x198c9
movsbl -0x2a(%rbp), %eax
cmpl $0x52, %eax
jne 0x1987b
movsbl -0x2b(%rbp), %eax
cmpl $0x47, %eax
jne 0x1987b
movq -0x10(%rbp), %rax
movl $0x2, (%rax)
jmp 0x198c7
movsbl -0x2a(%rbp), %eax
cmpl $0x50, %eax
jne 0x19899
movsbl -0x2b(%rbp), %eax
cmpl $0x47, %eax
jne 0x19899
movq -0x10(%rbp), %rax
movl $0x3, (%rax)
jmp 0x198c5
movsbl -0x2a(%rbp), %eax
cmpl $0x43, %eax
jne 0x198b7
movsbl -0x2b(%rbp), %eax
cmpl $0x4f, %eax
jne 0x198b7
movq -0x10(%rbp), %rax
movl $0x4, (%rax)
jmp 0x198c3
movl $0x800, -0x4(%rbp)      # imm = 0x800
jmp 0x19cb7
jmp 0x198c5
jmp 0x198c7
jmp 0x198c9
jmp 0x198cb
movq -0x10(%rbp), %rax
cmpl $0x4, (%rax)
jne 0x199d2
movq -0x20(%rbp), %rdi
movl $0x9, %esi
callq 0x1a700
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x198fa
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x19cb7
movq -0x18(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x13670
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1a760
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x19930
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x19cb7
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x110(%rbp)
leaq -0x80(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0xb3a0
movq -0x108(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x1a8b0
jmp 0x19965
movq -0x110(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x1a880
jmp 0x19977
leaq -0x68(%rbp), %rdi
callq 0x1a630
leaq -0x80(%rbp), %rdi
callq 0xb7b0
movl $0x0, -0x4(%rbp)
jmp 0x19cb7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x199c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x1a630
leaq -0x80(%rbp), %rdi
callq 0xb7b0
jmp 0x19cc3
movl $0x0, -0x90(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0xb3a0
leaq -0xc0(%rbp), %rdi
callq 0xb3a0
jmp 0x199f6
jmp 0x199f8
movq -0x20(%rbp), %rdi
callq 0x18f10
movb %al, -0x111(%rbp)
jmp 0x19a09
movb -0x111(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x112(%rbp)
jne 0x19a44
jmp 0x19a1e
movq -0x20(%rbp), %rdi
callq 0x1a3f0
movb %al, -0x113(%rbp)
jmp 0x19a2f
movb -0x113(%rbp), %al
movsbl %al, %eax
cmpl $0x9, %eax
sete %al
movb %al, -0x112(%rbp)
movb -0x112(%rbp), %al
testb $0x1, %al
jne 0x19a53
jmp 0x19c35
leaq -0xa8(%rbp), %rdi
callq 0x13670
jmp 0x19a61
leaq -0xc0(%rbp), %rdi
callq 0x13670
jmp 0x19a6f
movq -0x20(%rbp), %rdi
movl $0x9, %esi
callq 0x1a700
movl %eax, -0x118(%rbp)
jmp 0x19a85
movl -0x118(%rbp), %eax
movl %eax, -0x90(%rbp)
cmpl $0x0, -0x90(%rbp)
je 0x19ae0
movl -0x90(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0xc4(%rbp)
jmp 0x19c3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x19c73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x19c67
movq -0x20(%rbp), %rsi
movb $0x3a, -0xc5(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0xc5(%rbp), %rdx
callq 0x1a910
movl %eax, -0x11c(%rbp)
jmp 0x19b06
movl -0x11c(%rbp), %eax
movl %eax, -0x90(%rbp)
cmpl $0x0, -0x90(%rbp)
je 0x19b33
movl -0x90(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0xc4(%rbp)
jmp 0x19c3f
movq -0x20(%rbp), %rdi
callq 0x1a660
movb %al, -0x11d(%rbp)
jmp 0x19b44
movb -0x11d(%rbp), %al
testb $0x1, %al
jne 0x19b50
jmp 0x19b66
movl $0x800, -0x4(%rbp)      # imm = 0x800
movl $0x1, -0xc4(%rbp)
jmp 0x19c3f
movq -0x20(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
movl $0x9, %edx
movl $0xd, %ecx
movl $0xa, %r8d
callq 0x1a9a0
movl %eax, -0x124(%rbp)
jmp 0x19b8e
movl -0x124(%rbp), %eax
movl %eax, -0x90(%rbp)
cmpl $0x0, -0x90(%rbp)
je 0x19bc4
cmpl $0x400, -0x90(%rbp)     # imm = 0x400
je 0x19bc4
movl -0x90(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0xc4(%rbp)
jmp 0x19c3f
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x130(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x1a8b0
jmp 0x19bef
movq -0x130(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x1a880
jmp 0x19c04
leaq -0xf8(%rbp), %rdi
callq 0x1a630
jmp 0x199f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x1a630
jmp 0x19c67
movl $0x0, -0xc4(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0xb7b0
leaq -0xa8(%rbp), %rdi
callq 0xb7b0
movl -0xc4(%rbp), %eax
testl %eax, %eax
je 0x19c65
jmp 0x19c63
jmp 0x19cb7
jmp 0x19c81
leaq -0xc0(%rbp), %rdi
callq 0xb7b0
leaq -0xa8(%rbp), %rdi
callq 0xb7b0
jmp 0x19cc3
movq -0x20(%rbp), %rdi
callq 0x1aa50
movl %eax, -0xfc(%rbp)
cmpl $0x0, -0xfc(%rbp)
je 0x19cb0
cmpl $0x400, -0xfc(%rbp)     # imm = 0x400
je 0x19cb0
movl -0xfc(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x19cb7
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x4770
nop