// File: /workspace/github_cpp_makefile_star2_O3/xx01cyx[P]LSM-Tree/kvstore.cc
// Function: KVStore::compactOneSST(std::shared_ptr<SSTable> const&, unsigned long)
void KVStore::compactOneSST(const SSTPtr& sst, size_t lowerLevel) {

    int64_t minOverlapIndex = -1;
    int64_t maxOverlapIndex = -1;
    vector<SSTPtr> overlapSSTs = getOverlapSSTs(sst->getMinKey(), sst->getMaxKey(), lowerLevel,
                                                minOverlapIndex, maxOverlapIndex);

    KVPair data = getCompactionData(sst, overlapSSTs);

    reconstructLowerLevelDisk(minOverlapIndex, maxOverlapIndex, lowerLevel);

    TimeStamp maxTimeStamp = getMaxTimeStamp(sst, overlapSSTs);
    vector<SSTPtr> mergedSSTs;

    if (overlapSSTs.empty())                 // no overlapping
        mergedSSTs.push_back(generateNewSST(sst->getKeys(), data, lowerLevel, maxTimeStamp));
    else                                     // does overlap
        mergedSSTs = mergeAndWriteToDisk(sst, overlapSSTs, maxTimeStamp, data);

    reconstructLowerLevelMemory(minOverlapIndex, maxOverlapIndex, mergedSSTs, lowerLevel);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
movq $-0x1, %rax
leaq 0x88(%rsp), %r15
movq %rax, (%r15)
leaq 0x80(%rsp), %rbp
movq %rax, (%rbp)
movq (%rsi), %rdi
callq 0x6866
movq %rax, %r12
movq (%r13), %rdi
callq 0x686c
movq %rbp, (%rsp)
leaq 0x48(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rax, %rcx
movq %rbx, %r8
movq %r15, %r9
callq 0xa3de
leaq 0x90(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0xb22e
movq 0x88(%rsp), %r15
movq 0x80(%rsp), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0xa630
leaq 0x48(%rsp), %rsi
movq %r13, %rdi
callq 0xb292
movq %rax, %rbp
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x48(%rsp), %rax
cmpq 0x50(%rsp), %rax
je 0xb038
leaq 0x60(%rsp), %rdi
leaq 0x48(%rsp), %rcx
leaq 0x90(%rsp), %r9
movq %r14, %rsi
movq %r13, %rdx
movq %rbp, %r8
callq 0xc0ec
movq 0x20(%rsp), %rax
leaq 0x60(%rsp), %r13
movaps (%r13), %xmm0
movq 0x10(%r13), %rcx
movq %rcx, 0x20(%rsp)
movaps 0x10(%rsp), %xmm1
movaps %xmm0, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r13)
movq $0x0, 0x10(%r13)
callq 0xce64
movq %r13, %rdi
callq 0xce64
jmp 0xb098
movq (%r13), %rsi
leaq 0x30(%rsp), %rdi
callq 0x688a
leaq 0x60(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x90(%rsp), %rdx
movq %rbx, %rcx
movq %rbp, %r8
callq 0xb2d0
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0xe8a0
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0xb081
callq 0x7c76
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xb098
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3280
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %r8
callq 0xaba2
leaq 0x10(%rsp), %rdi
callq 0xce64
leaq 0x90(%rsp), %rdi
callq 0xd4ca
leaq 0x48(%rsp), %rdi
callq 0xce64
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0xb0f8
callq 0x7c76
jmp 0xb0f8
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xb118
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3280
jmp 0xb118
jmp 0xb115
jmp 0xb115
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xce64
jmp 0xb129
jmp 0xb126
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xd4ca
leaq 0x48(%rsp), %rdi
callq 0xce64
movq %rbx, %rdi
callq 0x3460
movq %rax, %rbx
jmp 0xb136
nop