// File: /workspace/github_cpp_makefile_star2_O1/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 0x6910
movq %rax, %r12
movq (%r13), %rdi
callq 0x6916
movq %rbp, (%rsp)
leaq 0x50(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rax, %rcx
movq %rbx, %r8
movq %r15, %r9
callq 0xa570
leaq 0x90(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0xb3a2
movq 0x88(%rsp), %r15
movq 0x80(%rsp), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0xa7c0
leaq 0x50(%rsp), %rsi
movq %r13, %rdi
callq 0xb406
movq %rax, %rbp
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x58(%rsp), %rax
je 0xb1ac
leaq 0x68(%rsp), %rdi
leaq 0x50(%rsp), %rcx
leaq 0x90(%rsp), %r9
movq %r14, %rsi
movq %r13, %rdx
movq %rbp, %r8
callq 0xc224
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
movaps %xmm0, (%rdi)
movaps 0x10(%rsp), %xmm0
movq 0x20(%rsp), %rax
leaq 0x68(%rsp), %r13
movups (%r13), %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x10(%r13), %rcx
movq %rcx, 0x20(%rsp)
movaps (%rdi), %xmm1
movaps %xmm0, (%rdi)
movq %rax, 0x10(%rdi)
movups %xmm1, (%r13)
movq $0x0, 0x10(%r13)
callq 0xcf40
movq %r13, %rdi
callq 0xcf40
jmp 0xb20c
movq (%r13), %rsi
leaq 0x30(%rsp), %rdi
callq 0x6934
leaq 0x68(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x90(%rsp), %rdx
movq %rbx, %rcx
movq %rbp, %r8
callq 0xb444
leaq 0x10(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0xe9ba
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0xb1f5
callq 0x7d9e
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xb20c
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 0xad0a
leaq 0x10(%rsp), %rdi
callq 0xcf40
leaq 0x90(%rsp), %rdi
callq 0xd5b2
leaq 0x50(%rsp), %rdi
callq 0xcf40
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0xb26c
callq 0x7d9e
jmp 0xb26c
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xb28c
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3280
jmp 0xb28c
jmp 0xb289
jmp 0xb289
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xcf40
jmp 0xb29d
jmp 0xb29a
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xd5b2
leaq 0x50(%rsp), %rdi
callq 0xcf40
movq %rbx, %rdi
callq 0x3460
movq %rax, %rbx
jmp 0xb2aa
nop