// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movl $0xfc3, %edi            # imm = 0xFC3
callq 0x6040
movq %rax, %rbx
movq 0x18(%r14), %rdi
movl $0xfc3, %edx            # imm = 0xFC3
movq %rax, %rsi
callq 0x1ad66
testb %al, %al
je 0x13c65
movq 0x28(%r14), %rdi
movq (%rdi), %rax
movl $0xfc3, %edx            # imm = 0xFC3
movq %rbx, %rsi
callq *0x68(%rax)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x64c0
testb %bpl, %bpl
je 0x13c6d
movq 0x28(%r14), %rdi
movq (%rdi), %rax
callq *0x88(%rax)
testb %al, %al
je 0x13c7a
movq 0x28(%r14), %rdi
movq (%rdi), %rax
callq *0x98(%rax)
movq %rax, %r15
movq %rax, %rdi
callq 0x6040
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x6250
movq 0x10(%r14), %rdi
movq 0x48(%r14), %rcx
movq (%rdi), %rax
movq %rbx, %rsi
movq %r15, %rdx
callq *0x50(%rax)
cmpq %r15, %rax
jne 0x13cd5
movq 0x28(%r14), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movq %r15, %rdx
callq *0x78(%rax)
testb %al, %al
je 0x13d2b
movq %rbx, %rdi
callq 0x64c0
movb $0x1, %bpl
jmp 0x13c6f
movq %rbx, %rdi
callq 0x64c0
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x1e357(%rip), %r14     # 0x31fd8
movq (%r14), %rbx
callq 0x63c0
leaq 0xb615(%rip), %rsi      # 0x1f2a5
leaq 0xc792(%rip), %rcx      # 0x20429
leaq 0xc3a5(%rip), %r8       # 0x20043
xorl %ebp, %ebp
movq %rbx, %rdi
movq %rax, %rdx
movl $0x184, %r9d            # imm = 0x184
xorl %eax, %eax
callq 0x6580
movq (%r14), %rcx
leaq 0xc779(%rip), %rdi      # 0x20436
pushq $0x41
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
jmp 0x13c6f
movq 0x1e2fc(%rip), %r12     # 0x31fd8
movq (%r12), %r15
callq 0x63c0
leaq 0xb5b9(%rip), %rsi      # 0x1f2a5
leaq 0xc736(%rip), %rcx      # 0x20429
leaq 0xc349(%rip), %r8       # 0x20043
xorl %ebp, %ebp
movq %r15, %rdi
movq %rax, %rdx
movl $0x18c, %r9d            # imm = 0x18C
xorl %eax, %eax
callq 0x6580
movq (%r12), %rdi
movq 0x40(%r14), %rdx
leaq 0xc75a(%rip), %rsi      # 0x20478
xorl %eax, %eax
callq 0x6580
movq (%r12), %rsi
jmp 0x13d7c
movq 0x1e2a6(%rip), %r15     # 0x31fd8
movq (%r15), %r14
callq 0x63c0
leaq 0xb564(%rip), %rsi      # 0x1f2a5
leaq 0xc6e1(%rip), %rcx      # 0x20429
leaq 0xc2f4(%rip), %r8       # 0x20043
xorl %ebp, %ebp
movq %r14, %rdi
movq %rax, %rdx
movl $0x192, %r9d            # imm = 0x192
xorl %eax, %eax
callq 0x6580
movq (%r15), %rcx
leaq 0xc698(%rip), %rdi      # 0x20406
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
movq %rbx, %rdi
callq 0x64c0
jmp 0x13c6f
nop