// 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::BamHeader&, 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(BamHeader & header,
               BamIOContext<TNameStore, TNameStoreCache> & context,
               RecordReader<TStream, SinglePass<TSpec> > & reader,
               Sam const & tag)
{
    typedef typename BamHeader::TSequenceInfo TSequenceInfo;

    BamHeaderRecord record;
    while (nextIs(reader, SamHeader()))
    {
        clear(record);
        int res = readRecord(record, context, reader, tag);
        if (res != 0)
            return res;
        appendValue(header.records, record);

        // Get sequence information from @SQ header.
        if (record.type == BAM_HEADER_REFERENCE)
        {
            CharString sn = "unknown";
            unsigned ln = 0;
            for (unsigned i = 0; i < length(record.tags); ++i)
            {
                if (record.tags[i].i1 == "SN")
                {
                    sn = record.tags[i].i2;
                }
                else if (record.tags[i].i1 == "LN")
                {
                    if (!lexicalCast2<unsigned>(ln, record.tags[i].i2))
                        ln = 0;
                }
            }

            // Add name to name store cache if necessary.
            unsigned contigId = 0;
            if (!getIdByName(nameStore(context), sn, contigId, nameStoreCache(context)))
            {
                contigId = length(nameStore(context));
                appendName(nameStore(context), sn, nameStoreCache(context));
            }

            if (length(header.sequenceInfos) <= contigId)
                resize(header.sequenceInfos, contigId + 1);
            header.sequenceInfos[contigId] = TSequenceInfo(sn, ln);
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x196e0
movq -0x20(%rbp), %rdi
leaq -0x49(%rbp), %rsi
callq 0x19700
movb %al, -0xb5(%rbp)
jmp 0x192f9
movb -0xb5(%rbp), %al
testb $0x1, %al
jne 0x19308
jmp 0x196a1
leaq -0x48(%rbp), %rdi
callq 0x19750
jmp 0x19313
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq -0x48(%rbp), %rdi
callq 0x19770
movl %eax, -0xbc(%rbp)
jmp 0x19330
movl -0xbc(%rbp), %eax
movl %eax, -0x60(%rbp)
cmpl $0x0, -0x60(%rbp)
je 0x19362
movl -0x60(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x64(%rbp)
jmp 0x196af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x196c4
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
leaq -0x48(%rbp), %rsi
callq 0x19cd0
jmp 0x19375
cmpl $0x1, -0x48(%rbp)
jne 0x1969c
leaq 0xf687(%rip), %rsi      # 0x28a0d
leaq -0x80(%rbp), %rdi
callq 0x19d00
jmp 0x19391
movl $0x0, -0x84(%rbp)
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
movq %rax, -0xd0(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x19da0
movq %rax, -0xc8(%rbp)
jmp 0x193c4
movq -0xd0(%rbp), %rax
movq -0xc8(%rbp), %rcx
cmpq %rcx, %rax
jae 0x19504
leaq -0x40(%rbp), %rdi
movl -0x88(%rbp), %esi
callq 0x19e50
movq %rax, -0xd8(%rbp)
jmp 0x193f3
movq -0xd8(%rbp), %rdi
leaq 0xf614(%rip), %rsi      # 0x28a15
callq 0x19de0
movb %al, -0xd9(%rbp)
jmp 0x1940e
movb -0xd9(%rbp), %al
testb $0x1, %al
jne 0x1941a
jmp 0x1945e
leaq -0x40(%rbp), %rdi
movl -0x88(%rbp), %esi
callq 0x19e50
movq %rax, -0xe8(%rbp)
jmp 0x19432
movq -0xe8(%rbp), %rsi
addq $0x18, %rsi
leaq -0x80(%rbp), %rdi
callq 0x16b40
jmp 0x19448
jmp 0x194ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x19691
leaq -0x40(%rbp), %rdi
movl -0x88(%rbp), %esi
callq 0x19e50
movq %rax, -0xf0(%rbp)
jmp 0x19476
movq -0xf0(%rbp), %rdi
leaq 0xf594(%rip), %rsi      # 0x28a18
callq 0x19de0
movb %al, -0xf1(%rbp)
jmp 0x19491
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x1949d
jmp 0x194ec
leaq -0x40(%rbp), %rdi
movl -0x88(%rbp), %esi
callq 0x19e50
movq %rax, -0x100(%rbp)
jmp 0x194b5
movq -0x100(%rbp), %rsi
addq $0x18, %rsi
leaq -0x84(%rbp), %rdi
callq 0x137b0
movb %al, -0x101(%rbp)
jmp 0x194d4
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x194ea
jmp 0x194e0
movl $0x0, -0x84(%rbp)
jmp 0x194ec
jmp 0x194ee
jmp 0x194f0
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x193a5
movl $0x0, -0x8c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x19f30
movq %rax, -0x110(%rbp)
jmp 0x19520
movq -0x18(%rbp), %rdi
callq 0x19f90
movq %rax, -0x118(%rbp)
jmp 0x19532
movq -0x118(%rbp), %rcx
movq -0x110(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x8c(%rbp), %rdx
callq 0x19e80
movb %al, -0x119(%rbp)
jmp 0x19558
movb -0x119(%rbp), %al
testb $0x1, %al
jne 0x195d7
jmp 0x19564
movq -0x18(%rbp), %rdi
callq 0x19f30
movq %rax, -0x128(%rbp)
jmp 0x19576
movq -0x128(%rbp), %rdi
callq 0xcc10
movq %rax, -0x130(%rbp)
jmp 0x1958b
movq -0x130(%rbp), %rax
movl %eax, -0x8c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x19f30
movq %rax, -0x138(%rbp)
jmp 0x195aa
movq -0x18(%rbp), %rdi
callq 0x19f90
movq %rax, -0x140(%rbp)
jmp 0x195bc
movq -0x140(%rbp), %rdx
movq -0x138(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x19ff0
jmp 0x195d5
jmp 0x195d7
movq -0x10(%rbp), %rdi
callq 0x1a050
movq %rax, -0x148(%rbp)
jmp 0x195e9
movq -0x148(%rbp), %rax
movl -0x8c(%rbp), %ecx
cmpq %rcx, %rax
ja 0x19610
movq -0x10(%rbp), %rdi
movl -0x8c(%rbp), %esi
incl %esi
callq 0x1a090
jmp 0x1960e
jmp 0x19610
movl -0x84(%rbp), %eax
movl %eax, -0xb4(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0xb4(%rbp), %rdx
callq 0x1a0c0
jmp 0x19635
movq -0x10(%rbp), %rdi
movl -0x8c(%rbp), %esi
callq 0x1a100
movq %rax, -0x150(%rbp)
jmp 0x1964d
movq -0x150(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x1a130
jmp 0x19662
leaq -0xb0(%rbp), %rdi
callq 0x1a170
leaq -0x80(%rbp), %rdi
callq 0xb7b0
jmp 0x1969c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x1a170
leaq -0x80(%rbp), %rdi
callq 0xb7b0
jmp 0x196c4
jmp 0x192e4
movl $0x0, -0x4(%rbp)
movl $0x1, -0x64(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1a190
movl -0x4(%rbp), %eax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x1a190
movq -0x58(%rbp), %rdi
callq 0x4770
nopw %cs:(%rax,%rax)