// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::OpenAllComponents()
bool DS_MultiVolume_Impl::OpenAllComponents() {
    volNum_ = sbResHeader_.volume_num;
    segSize_ = sbResHeader_.segment_size;
    maxValueLen_ = segSize_ - SegBase::SizeOfSegOnDisk() - IndexManager::SizeOfHashEntryOnDisk();
    sstLengthOnDisk_ = sbMgr_->GetSSTRegionLength();

    BlockDevice *meta_bdev = bdVec_[0];
    uint32_t meta_seg_num = sbResVolVec_[0].segment_num;
    uint32_t meta_cur_seg_id = sbResVolVec_[0].cur_seg_id;

    if (!verifyTopology()) {
        __ERROR("The Device Topoloygy is inconsistent");
        return false;
    }

    //Create Meta Volume
    uint64_t start_off = sbMgr_->GetSSTRegionOffset() + sstLengthOnDisk_;

    Volume *meta_vol = new Volume(meta_bdev, idxMgr_, options_, 0, start_off, segSize_, meta_seg_num, meta_cur_seg_id);
    volMap_.insert( pair<int, Volume *>(0, meta_vol) );

    segTotalNum_ += meta_seg_num;

    //Create Pure Volumes
    if (volNum_ > 1) {
        for (uint32_t i = 1 ; i < volNum_; i++) {
            BlockDevice *bdev = bdVec_[i];
            uint32_t seg_num = sbResVolVec_[i].segment_num;
            uint32_t cur_seg_id = sbResVolVec_[i].cur_seg_id;
            Volume *vol = new Volume(bdev, idxMgr_, options_, i, 0, segSize_, seg_num, cur_seg_id);
            volMap_.insert( pair<int, Volume *>(i, vol) );

            segTotalNum_ += seg_num;
        }
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl 0x124(%rdi), %eax
movl %eax, 0xe0(%rdi)
movl 0x120(%rdi), %eax
movl %eax, 0xd8(%rdi)
addl $-0x4a, %eax
movl %eax, 0xdc(%rdi)
movq 0x10(%rdi), %rax
movq 0x18(%rdi), %rcx
movq 0x24(%rcx), %rcx
movq %rcx, 0xe8(%rdi)
movq (%rax), %rax
movq (%rax), %r14
movq 0x128(%rdi), %rax
movl 0x100(%rax), %r13d
movl 0x104(%rax), %ebp
callq 0xda3e
movb %al, 0x7(%rsp)
testb %al, %al
je 0xda1b
movq 0x18(%rbx), %rax
movq 0xe8(%rbx), %r12
addq 0x1c(%rax), %r12
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 %r14, %rsi
xorl %r8d, %r8d
movq %r12, %r9
pushq %rbp
pushq %r13
pushq %rax
callq 0x20af4
addq $0x20, %rsp
leaq 0x28(%rbx), %rdi
leaq 0x18(%rsp), %rsi
movl $0x0, (%rsi)
movq %r15, 0x8(%rsi)
movq %rdi, 0x8(%rsp)
callq 0xf9ec
addl %r13d, 0xe4(%rbx)
cmpl $0x2, 0xe0(%rbx)
jb 0xda08
movl $0x1, %r15d
movl $0x20c, %r12d           # imm = 0x20C
movq 0x10(%rbx), %rax
movq 0x128(%rbx), %rcx
movq (%rax), %rax
movq (%rax,%r15,8), %rbp
movl -0x4(%rcx,%r12), %r14d
movl (%rcx,%r12), %eax
movq %rax, 0x10(%rsp)
movl $0x58, %edi
callq 0x6410
movq %rax, %r13
movq 0x8(%rbx), %rcx
movq 0x20(%rbx), %rdx
movl 0xd8(%rbx), %eax
subq $0x8, %rsp
movq %r13, %rdi
movq %rbp, %rsi
movl %r15d, %r8d
xorl %r9d, %r9d
pushq 0x18(%rsp)
pushq %r14
pushq %rax
callq 0x20af4
addq $0x20, %rsp
movl %r15d, 0x18(%rsp)
movq %r13, 0x20(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xf9ec
addl %r14d, 0xe4(%rbx)
incq %r15
movl 0xe0(%rbx), %eax
addq $0x108, %r12            # imm = 0x108
cmpq %rax, %r15
jb 0xd974
movb 0x7(%rsp), %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6f0f
jmp 0xda08
movq %rax, %rbx
movq %r15, %rdi
jmp 0xda30
movq %rax, %rbx
movq %r13, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6670
nop