// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::CreateAllComponents(unsigned long)
bool DS_MultiVolume_Impl::CreateAllComponents(uint64_t sst_offset) {
    segSize_ = options_.segment_size;

    uint32_t align_bit = log2(ALIGNED_SIZE);
    if (segSize_ != (segSize_ >> align_bit) << align_bit) {
        __ERROR("Segment Size is not page aligned!");
        return false;
    }

    maxValueLen_ = segSize_ - SegBase::SizeOfSegOnDisk() - IndexManager::SizeOfHashEntryOnDisk();
    volNum_ = bdVec_.size();

    //Create Pure Volumes
    if (volNum_ > 1) {
        for (uint32_t i = 1; i < volNum_; i++ ) {
            BlockDevice * bdev = bdVec_[i];
            uint64_t device_capacity = bdev->GetDeviceCapacity();
            uint32_t seg_num = calcSegNumForPureVolume(device_capacity, segSize_);
            segTotalNum_ += seg_num;
            Volume *vol = new Volume(bdev, idxMgr_, options_, i, 0, segSize_, seg_num, 0);
            volMap_.insert( pair<int, Volume *>(i, vol) );
        }
    }

    //Create Meta Volumes
    BlockDevice * bdev = bdVec_[0];
    uint64_t device_capacity = bdev->GetDeviceCapacity();
    uint32_t seg_num = calcSegNumForMetaVolume(device_capacity, sst_offset, segTotalNum_, segSize_);
    segTotalNum_ += seg_num;
    sstLengthOnDisk_ = calcSSTsLengthOnDiskBySegNum(segTotalNum_);
    uint64_t start_off = sst_offset + sstLengthOnDisk_;
    Volume *vol = new Volume(bdev, idxMgr_, options_, 0, start_off, segSize_, seg_num, 0);
    volMap_.insert( make_pair(0, vol) );

    initSBReservedContentForCreate();

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x8(%rdi), %rax
movl 0x44(%rax), %ebp
movl %ebp, 0xd8(%rdi)
testl $0xfff, %ebp            # imm = 0xFFF
jne 0xd65a
movq %rsi, %r15
movq %rdi, %rbx
leal -0x4a(%rbp), %eax
movl %eax, 0xdc(%rdi)
movq 0x10(%rdi), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
movl %ecx, 0xe0(%rdi)
cmpl $0x2, %ecx
jb 0xd584
movq %r15, (%rsp)
movq %rbp, 0x8(%rsp)
leaq 0x28(%rbx), %rax
movq %rax, 0x10(%rsp)
movl $0x1, %r13d
movq 0x10(%rbx), %rax
movq (%rax), %rax
movq (%rax,%r13,8), %r14
movq (%r14), %rax
movq %r14, %rdi
callq *0x30(%rax)
movl 0xd8(%rbx), %r12d
xorl %edx, %edx
divq %r12
movq %rax, %rbp
addl %ebp, 0xe4(%rbx)
movl $0x58, %edi
callq 0x6410
movq %rax, %r15
movq 0x8(%rbx), %rcx
movq 0x20(%rbx), %rdx
subq $0x8, %rsp
movq %rax, %rdi
movq %r14, %rsi
movl %r13d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %rbp
pushq %r12
callq 0x20af4
addq $0x20, %rsp
movl %r13d, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xf9ec
incq %r13
movl 0xe0(%rbx), %eax
cmpq %rax, %r13
jb 0xd4ed
movq 0x10(%rbx), %rax
movq (%rax), %rax
movq 0x8(%rsp), %rbp
movq (%rsp), %r15
movq (%rax), %r12
movq (%r12), %rax
movq %r12, %rdi
callq *0x30(%rax)
movl 0xd8(%rbx), %r8d
movl 0xe4(%rbx), %ecx
movq %rax, %rsi
movq %r15, %rdx
callq 0xd682
movl %eax, %r13d
movl 0xe4(%rbx), %eax
addl %r13d, %eax
movl %eax, 0xe4(%rbx)
leaq (%rax,%rax,2), %rax
leaq 0x8(,%rax,4), %r14
callq 0x66a0
movslq %eax, %rcx
movq %r14, %rax
xorl %edx, %edx
divq %rcx
leaq 0x1(%rax), %r14
imulq %rcx, %r14
movq %r14, 0xe8(%rbx)
addq %r15, %r14
movl $0x58, %edi
callq 0x6410
movq %rax, %r15
movq 0x8(%rbx), %rcx
movq 0x20(%rbx), %rdx
movl 0xd8(%rbx), %eax
subq $0x8, %rsp
movq %r15, %rdi
movq %r12, %rsi
xorl %r8d, %r8d
movq %r14, %r9
pushq $0x0
pushq %r13
pushq %rax
callq 0x20af4
addq $0x20, %rsp
leaq 0x28(%rbx), %rdi
leaq 0x18(%rsp), %rsi
movl $0x0, (%rsi)
movq %r15, 0x8(%rsi)
callq 0xf9ec
movq %rbx, %rdi
callq 0xd71e
testl $0xfff, %ebp            # imm = 0xFFF
sete %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6ead
jmp 0xd642
jmp 0xd663
movq %rax, %rbx
movq %r15, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6670