// File: zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::SaveAlignmentChunkToBin(std::map<unsigned int, std::vector<BamTools::Internal::BaiAlignmentChunk, std::allocator<BamTools::Internal::BaiAlignmentChunk>>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, std::vector<BamTools::Internal::BaiAlignmentChunk, std::allocator<BamTools::Internal::BaiAlignmentChunk>>>>>&, unsigned int const&, unsigned long const&, unsigned long const&)
void BamStandardIndex::SaveAlignmentChunkToBin(BaiBinMap& binMap,
                                               const uint32_t& currentBin,
                                               const uint64_t& currentOffset,
                                               const uint64_t& lastOffset)
{
    // create new alignment chunk
    BaiAlignmentChunk newChunk(currentOffset, lastOffset);

    // if no entry exists yet for this bin, create one and store alignment chunk
    BaiBinMap::iterator binIter = binMap.find(currentBin);
    if ( binIter == binMap.end() ) {
        BaiAlignmentChunkVector newChunks;
        newChunks.push_back(newChunk);
        binMap.insert( pair<uint32_t, BaiAlignmentChunkVector>(currentBin, newChunks));
    }

    // otherwise, just append alignment chunk
    else {
        BaiAlignmentChunkVector& binChunks = (*binIter).second;
        binChunks.push_back( newChunk );
    }
}

// Assembly:
subq $0xe8, %rsp
movq %rdi, 0xe0(%rsp)
movq %rsi, 0xd8(%rsp)
movq %rdx, 0xd0(%rsp)
movq %rcx, 0xc8(%rsp)
movq %r8, 0xc0(%rsp)
movq 0xc8(%rsp), %rsi
movq 0xc0(%rsp), %rdx
leaq 0xb0(%rsp), %rdi
callq 0x78ee0
movq 0xd8(%rsp), %rdi
movq 0xd0(%rsp), %rsi
callq 0x79410
movq %rax, 0xa8(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x76fc0
movq %rax, 0xa0(%rsp)
leaq 0xa8(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x77860
testb $0x1, %al
jne 0xb368c
jmp 0xb37a6
leaq 0x88(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x72150
movq 0x18(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x775d0
jmp 0xb36b2
movq 0xd8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0xd0(%rsp), %rsi
leaq 0x38(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x71420
jmp 0xb36db
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x74ee0
jmp 0xb36ec
movq 0x10(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x75430
movb %dl, 0x7(%rsp)
movq %rax, 0x8(%rsp)
jmp 0xb3706
movb 0x7(%rsp), %al
movq 0x8(%rsp), %rcx
movq %rcx, 0x28(%rsp)
movb %al, 0x30(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x77da0
jmp 0xb3724
leaq 0x38(%rsp), %rdi
callq 0x75d90
jmp 0xb3730
leaq 0x88(%rsp), %rdi
callq 0x77ee0
jmp 0xb37ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
jmp 0xb3795
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
jmp 0xb3787
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x77da0
jmp 0xb3785
jmp 0xb3787
leaq 0x38(%rsp), %rdi
callq 0x75d90
jmp 0xb3793
jmp 0xb3795
leaq 0x88(%rsp), %rdi
callq 0x77ee0
jmp 0xb37a4
jmp 0xb37d6
leaq 0xa8(%rsp), %rdi
callq 0x7b3d0
addq $0x8, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x775d0
addq $0xe8, %rsp
retq
movq 0x80(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopl (%rax,%rax)