// File: yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::loadDataStor()
bool MetaStor::loadDataStor() {
    uint64_t reserved_region_length = SuperBlockManager::ReservedRegionLength();

    char *reserved_content = new char[reserved_region_length];
    if ( !sbMgr_->GetReservedContent(reserved_content, reserved_region_length) ) {
        delete[] reserved_content;
        return false;
    }
    if ( !dataStor_->SetSBReservedContent(reserved_content, reserved_region_length) ) {
        delete[] reserved_content;
        return false;
    }
    delete[] reserved_content;

    if (!dataStor_->OpenAllComponents()) {
        __ERROR("Could not Open All Volumes, Maybe device topology is inconsistent");
        return false;
    }

    uint64_t length = dataStor_->GetSSTsLengthOnDisk();
    char *buff = new char[length];
    memset(buff, 0 , length);
    if ((uint64_t) metaDev_->pRead(buff, length, sstOff_) != length) {
        __ERROR("Could not read SST region from device at %ld\n", idxOff_);
        delete[] buff;
        return false;
    }

    if (!dataStor_->SetAllSSTs(buff, length)) {
        __ERROR("Can't Set SST Region, Load Failed!");
        delete[] buff;
        return false;
    }

    delete[] buff;
    return true;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x78(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x50(%rsp)
callq 0x116c0
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rdi
callq 0x8040
movq %rax, %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x68(%rsp)
movq 0x18(%rax), %rdi
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
callq 0x49880
testb $0x1, %al
jne 0x35555
movq 0x68(%rsp), %rax
movq %rax, 0x48(%rsp)
cmpq $0x0, %rax
je 0x35548
movq 0x48(%rsp), %rdi
callq 0x8610
movb $0x0, 0x87(%rsp)
jmp 0x3581c
movq 0x50(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq (%rdi), %rax
callq *0x68(%rax)
testb $0x1, %al
jne 0x35599
movq 0x68(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
je 0x3558c
movq 0x40(%rsp), %rdi
callq 0x8610
movb $0x0, 0x87(%rsp)
jmp 0x3581c
movq 0x68(%rsp), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
je 0x355b3
movq 0x38(%rsp), %rdi
callq 0x8610
movq 0x50(%rsp), %rax
movq 0x28(%rax), %rdi
movq (%rdi), %rax
callq *0x88(%rax)
testb $0x1, %al
jne 0x35646
jmp 0x355cb
movq 0x3ba06(%rip), %rax     # 0x70fd8
movq (%rax), %rax
movq %rax, 0x30(%rsp)
callq 0x8480
movq 0x30(%rsp), %rdi
movq %rax, %rdx
leaq 0x1cec3(%rip), %rsi     # 0x524b1
leaq 0x1e03e(%rip), %rcx     # 0x53633
leaq 0x1dc51(%rip), %r8      # 0x5324d
movl $0x184, %r9d            # imm = 0x184
movb $0x0, %al
callq 0x86f0
movq 0x3b9c8(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x1e026(%rip), %rsi     # 0x53640
movb $0x0, %al
callq 0x86f0
movq 0x3b9b0(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x1d793(%rip), %rsi     # 0x52dc5
movb $0x0, %al
callq 0x86f0
movb $0x0, 0x87(%rsp)
jmp 0x3581c
movq 0x50(%rsp), %rax
movq 0x28(%rax), %rdi
movq (%rdi), %rax
callq *0x98(%rax)
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rdi
callq 0x8040
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rdx
xorl %esi, %esi
callq 0x8280
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq 0x48(%rax), %rcx
movq (%rdi), %rax
callq *0x50(%rax)
cmpq 0x60(%rsp), %rax
je 0x35745
jmp 0x356a7
movq 0x3b92a(%rip), %rax     # 0x70fd8
movq (%rax), %rax
movq %rax, 0x28(%rsp)
callq 0x8480
movq 0x28(%rsp), %rdi
movq %rax, %rdx
leaq 0x1cde7(%rip), %rsi     # 0x524b1
leaq 0x1df62(%rip), %rcx     # 0x53633
leaq 0x1db75(%rip), %r8      # 0x5324d
movl $0x18c, %r9d            # imm = 0x18C
movb $0x0, %al
callq 0x86f0
movq 0x50(%rsp), %rax
movq 0x3b8e7(%rip), %rcx     # 0x70fd8
movq (%rcx), %rdi
movq 0x40(%rax), %rdx
leaq 0x1df83(%rip), %rsi     # 0x53682
movb $0x0, %al
callq 0x86f0
movq 0x3b8cb(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x1d6ae(%rip), %rsi     # 0x52dc5
movb $0x0, %al
callq 0x86f0
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, %rax
je 0x35738
movq 0x20(%rsp), %rdi
callq 0x8610
movb $0x0, 0x87(%rsp)
jmp 0x3581c
movq 0x50(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq (%rdi), %rax
callq *0x78(%rax)
testb $0x1, %al
jne 0x357fa
jmp 0x35768
movq 0x3b869(%rip), %rax     # 0x70fd8
movq (%rax), %rax
movq %rax, 0x18(%rsp)
callq 0x8480
movq 0x18(%rsp), %rdi
movq %rax, %rdx
leaq 0x1cd26(%rip), %rsi     # 0x524b1
leaq 0x1dea1(%rip), %rcx     # 0x53633
leaq 0x1dab4(%rip), %r8      # 0x5324d
movl $0x192, %r9d            # imm = 0x192
movb $0x0, %al
callq 0x86f0
movq 0x3b82b(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x1de59(%rip), %rsi     # 0x53610
movb $0x0, %al
callq 0x86f0
movq 0x3b813(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x1d5f6(%rip), %rsi     # 0x52dc5
movb $0x0, %al
callq 0x86f0
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x357f0
movq 0x10(%rsp), %rdi
callq 0x8610
movb $0x0, 0x87(%rsp)
jmp 0x3581c
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x35814
movq 0x8(%rsp), %rdi
callq 0x8610
movb $0x1, 0x87(%rsp)
movb 0x87(%rsp), %al
andb $0x1, %al
addq $0x88, %rsp
retq
nopl (%rax)