// File: zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::CheckBufferSize(char*&, unsigned int&, unsigned int const&)
void BamStandardIndex::CheckBufferSize(char*& buffer,
                                       unsigned int& bufferLength,
                                       const unsigned int& requestedBytes)
{
    try {
        if ( requestedBytes > bufferLength ) {
            bufferLength = requestedBytes + 10;
            delete[] buffer;
            buffer = new char[bufferLength];
        }
    } catch ( std::bad_alloc&  ) {
        stringstream s("");
        s << "out of memory when allocating " << requestedBytes << " bytes";
        throw BamException("BamStandardIndex::CheckBufferSize", s.str());
    }
}

// Assembly:
subq $0x278, %rsp            # imm = 0x278
movq %rdi, 0x270(%rsp)
movq %rsi, 0x268(%rsp)
movq %rdx, 0x260(%rsp)
movq 0x260(%rsp), %rax
movl (%rax), %eax
movq 0x268(%rsp), %rcx
cmpl (%rcx), %eax
jbe 0xb16db
movq 0x260(%rsp), %rax
movl (%rax), %ecx
addl $0xa, %ecx
movq 0x268(%rsp), %rax
movl %ecx, (%rax)
movq 0x270(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
je 0xb1520
movq 0x40(%rsp), %rdi
callq 0x785d0
movq 0x268(%rsp), %rax
movl (%rax), %eax
movl %eax, %edi
callq 0x710e0
movq %rax, 0x38(%rsp)
jmp 0xb1538
movq 0x38(%rsp), %rcx
movq 0x270(%rsp), %rax
movq %rcx, (%rax)
jmp 0xb16db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
movl 0x254(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xb17d5
movq 0x258(%rsp), %rdi
callq 0x72fc0
movq %rax, 0x248(%rsp)
leaq 0x9f(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x7b5f0
movq 0x30(%rsp), %rdx
leaq 0x39b34(%rip), %rsi     # 0xeb0dc
leaq 0xa0(%rsp), %rdi
callq 0x78e70
jmp 0xb15b7
movl $0x10, %edi
movl $0x8, %esi
callq 0x7b8d0
movl %eax, 0x2c(%rsp)
jmp 0xb15cc
movl 0x2c(%rsp), %edx
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x7a4b0
jmp 0xb15e7
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xb15f6
leaq 0x9f(%rsp), %rdi
callq 0x76f80
leaq 0xd0(%rsp), %rdi
leaq 0x39aea(%rip), %rsi     # 0xeb0fc
callq 0x768e0
movq %rax, 0x20(%rsp)
jmp 0xb161e
movq 0x20(%rsp), %rdi
movq 0x260(%rsp), %rax
movl (%rax), %esi
callq 0x78b20
movq %rax, 0x18(%rsp)
jmp 0xb1639
movq 0x18(%rsp), %rdi
leaq 0x3ae66(%rip), %rsi     # 0xec4ab
callq 0x768e0
jmp 0xb164c
movb $0x1, 0x4f(%rsp)
movl $0x28, %edi
callq 0x737c0
movq %rax, 0x8(%rsp)
leaq 0x77(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x7b5f0
movq 0x10(%rsp), %rdx
leaq 0x39aa0(%rip), %rsi     # 0xeb11b
leaq 0x78(%rsp), %rdi
callq 0x78e70
jmp 0xb1687
leaq 0x50(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x76880
jmp 0xb169b
movq 0x8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x79cd0
jmp 0xb16b1
movq 0x8(%rsp), %rdi
movb $0x0, 0x4f(%rsp)
movq 0x6084e(%rip), %rsi     # 0x111f10
movq 0x60897(%rip), %rdx     # 0x111f60
callq 0x7b010
jmp 0xb17ea
addq $0x278, %rsp            # imm = 0x278
retq
jmp 0xb16d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
jmp 0xb1718
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xb1716
jmp 0xb1718
leaq 0x9f(%rsp), %rdi
callq 0x76f80
jmp 0xb17cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
jmp 0xb17bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
jmp 0xb179c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
jmp 0xb178e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x7cce8
jmp 0xb178c
jmp 0xb178e
leaq 0x78(%rsp), %rdi
callq 0x7cce8
jmp 0xb179a
jmp 0xb179c
leaq 0x77(%rsp), %rdi
callq 0x76f80
testb $0x1, 0x4f(%rsp)
jne 0xb17af
jmp 0xb17b9
movq 0x8(%rsp), %rdi
callq 0x74e00
jmp 0xb17bb
leaq 0xc0(%rsp), %rdi
callq 0x74f60
jmp 0xb17ca
jmp 0xb17cc
callq 0x7a790
jmp 0xb17d3
jmp 0xb17d5
movq 0x258(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopw (%rax,%rax)