// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::WriteBlock(BamTools::Internal::BtiBlock const&)
void BamToolsIndex::WriteBlock(const BtiBlock& block) {

    // copy entry data
    int32_t maxEndPosition = block.MaxEndPosition;
    int64_t startOffset    = block.StartOffset;
    int32_t startPosition  = block.StartPosition;

    // swap endian-ness if necessary
    if ( m_isBigEndian ) {
        SwapEndian_32(maxEndPosition);
        SwapEndian_64(startOffset);
        SwapEndian_32(startPosition);
    }

    // write the reference index entry
    int64_t numBytesWritten = 0;
    numBytesWritten += m_resources.Device->Write((const char*)&maxEndPosition, sizeof(maxEndPosition));
    numBytesWritten += m_resources.Device->Write((const char*)&startOffset,    sizeof(startOffset));
    numBytesWritten += m_resources.Device->Write((const char*)&startPosition,  sizeof(startPosition));

    // check block written ok
    const int expectedBytes = sizeof(maxEndPosition) +
                              sizeof(startOffset) +
                              sizeof(startPosition);
    if ( numBytesWritten != expectedBytes )
        throw BamException("BamToolsIndex::WriteBlock", "could not write BTI block");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
movl (%rsi), %edi
movl %edi, 0x4(%rsp)
movq 0x8(%rsi), %rcx
movq %rcx, 0x8(%rsp)
movl 0x10(%rsi), %eax
movl %eax, (%rsp)
cmpb $0x1, 0x30(%rbx)
jne 0x44cfb
movl %edi, %r8d
sarl $0x18, %r8d
movl %edi, %r9d
shll $0x8, %r9d
movl $0xff0000, %edx         # imm = 0xFF0000
andl %edx, %r9d
movl %edi, %r10d
shrl $0x8, %r10d
movl $0xff00, %esi           # imm = 0xFF00
andl %esi, %r10d
shll $0x18, %edi
orl %r8d, %edi
orl %r9d, %edi
orl %r10d, %edi
movl %edi, 0x4(%rsp)
movq %rcx, %rdi
sarq $0x38, %rdi
movl $0xff00, %r9d           # imm = 0xFF00
movq %rcx, %r8
andq %r9, %r8
shlq $0x28, %r8
movl $0xff0000, %r11d        # imm = 0xFF0000
movq %rcx, %r14
andq %r11, %r14
shlq $0x18, %r14
movl %ecx, %r10d
andl $0xff000000, %r10d      # imm = 0xFF000000
shlq $0x8, %r10
orq %r14, %r10
movq %rcx, %r14
shrq $0x8, %r14
andl $0xff000000, %r14d      # imm = 0xFF000000
movq %rcx, %r15
shrq $0x18, %r15
andq %r11, %r15
orq %r14, %r15
movq %rcx, %r11
shrq $0x28, %r11
andq %r9, %r11
orq %r15, %r11
shlq $0x38, %rcx
orq %rdi, %rcx
orq %r8, %rcx
orq %r10, %rcx
orq %r11, %rcx
movq %rcx, 0x8(%rsp)
movl %eax, %ecx
sarl $0x18, %ecx
movl %eax, %edi
shll $0x8, %edi
andl %edx, %edi
movl %eax, %edx
shrl $0x8, %edx
andl %esi, %edx
shll $0x18, %eax
orl %ecx, %eax
orl %edi, %eax
orl %edx, %eax
movl %eax, (%rsp)
movq 0x60(%rbx), %rdi
movq (%rdi), %rax
leaq 0x4(%rsp), %rsi
movl $0x4, %edx
callq *0x40(%rax)
movq %rax, %r14
movq 0x60(%rbx), %rdi
movq (%rdi), %rax
leaq 0x8(%rsp), %rsi
movl $0x8, %edx
callq *0x40(%rax)
movq %rax, %r15
addq %r14, %r15
movq 0x60(%rbx), %rdi
movq (%rdi), %rax
movq %rsp, %rsi
movl $0x4, %edx
callq *0x40(%rax)
addq %r15, %rax
cmpq $0x10, %rax
jne 0x44d54
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x269d0
movq %rax, %rbx
leaq 0x40(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x11ac0(%rip), %rsi     # 0x56831
leaq 0x11ad2(%rip), %rdx     # 0x5684a
leaq 0x30(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x11ab8(%rip), %rsi     # 0x5684b
leaq 0x11aca(%rip), %rdx     # 0x56864
leaq 0x10(%rsp), %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x26176(%rip), %rsi     # 0x6af38
movq 0x261af(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x44deb
callq 0x27560
jmp 0x44deb
movq %rax, %r14
movb $0x1, %bpl
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x44e02
callq 0x27560
jmp 0x44e02
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x44e0f
movq %rbx, %rdi
callq 0x27070
movq %r14, %rdi
callq 0x28c20
nop