// File: yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::writeDataImmediately(hlkvds::KVSlice&)
Status FastTier::writeDataImmediately(KVSlice& slice){
    uint32_t seg_id = 0;
    bool ret = false;

    ret = allocSegment(seg_id);
    if (!ret) {
        __ERROR("Cann't get a new Empty Segment.\n");
        return Status::Aborted("Can't allocate a Empty Segment.");
    }

    SegLatencyFriendly *seg = new SegLatencyFriendly(vol_, idxMgr_);
    seg->Put(&slice);
    seg->SegSegId(seg_id);
    ret = seg->WriteSegToDevice();
    if(!ret) {
        __ERROR("Write batch segment to device failed");
        vol_->FreeForFailed(seg_id);
        delete seg;
        return Status::IOError("could not write batch segment to device ");
    }
    uint32_t free_size = seg->GetFreeSize();
    vol_->Use(seg_id, free_size);
    seg->UpdateToIndex();
    delete seg;
    return Status::OK();

}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x28(%rsp)
movq %rdi, %rax
movq %rax, 0x30(%rsp)
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movq 0x68(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movl $0x0, 0x5c(%rsp)
movb $0x0, 0x5b(%rsp)
leaq 0x5c(%rsp), %rsi
callq 0x4b110
andb $0x1, %al
movb %al, 0x5b(%rsp)
testb $0x1, 0x5b(%rsp)
jne 0x4ab28
jmp 0x4aaa4
movq 0x2652d(%rip), %rax     # 0x70fd8
movq (%rax), %rax
movq %rax, 0x20(%rsp)
callq 0x8480
movq 0x20(%rsp), %rdi
movq %rax, %rdx
leaq 0x79ea(%rip), %rsi      # 0x524b1
leaq 0x7dc8(%rip), %rcx      # 0x52896
leaq 0x9a0d(%rip), %r8       # 0x544e2
movl $0x172, %r9d            # imm = 0x172
movb $0x0, %al
callq 0x86f0
movq 0x264ef(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x7bd4(%rip), %rsi      # 0x526c7
movb $0x0, %al
callq 0x86f0
movq 0x264d7(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x82ba(%rip), %rsi      # 0x52dc5
movb $0x0, %al
callq 0x86f0
movq 0x28(%rsp), %rdi
leaq 0x7bca(%rip), %rsi      # 0x526e8
callq 0x163e0
jmp 0x4acca
movl $0x48, %edi
callq 0x84f0
movq %rax, %rdi
movq 0x38(%rsp), %rax
movq %rdi, %rcx
movq %rcx, 0x18(%rsp)
movq 0x10(%rax), %rdx
movq 0x1d8(%rax), %rsi
callq 0x43600
jmp 0x4ab54
movq 0x18(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x43700
movq 0x50(%rsp), %rdi
movl 0x5c(%rsp), %esi
callq 0x168c0
movq 0x50(%rsp), %rdi
callq 0x438f0
andb $0x1, %al
movb %al, 0x5b(%rsp)
testb $0x1, 0x5b(%rsp)
jne 0x4ac6c
jmp 0x4ab98
movq 0x26439(%rip), %rax     # 0x70fd8
movq (%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8480
movq 0x10(%rsp), %rdi
movq %rax, %rdx
leaq 0x78f6(%rip), %rsi      # 0x524b1
leaq 0x7cd4(%rip), %rcx      # 0x52896
leaq 0x9919(%rip), %r8       # 0x544e2
movl $0x17b, %r9d            # imm = 0x17B
movb $0x0, %al
callq 0x86f0
movq 0x263fb(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x7b66(%rip), %rsi      # 0x5274d
movb $0x0, %al
callq 0x86f0
movq 0x263e3(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x81c6(%rip), %rsi      # 0x52dc5
movb $0x0, %al
callq 0x86f0
movq 0x38(%rsp), %rax
movq 0x1d8(%rax), %rdi
movl 0x5c(%rsp), %esi
callq 0x511c0
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x4ac3f
movq 0x8(%rsp), %rdi
callq 0x434f0
movq 0x8(%rsp), %rdi
callq 0x84b0
movq 0x28(%rsp), %rdi
leaq 0x7b27(%rip), %rsi      # 0x52772
callq 0x16510
jmp 0x4acca
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
callq 0x84b0
jmp 0x4acd4
movq 0x50(%rsp), %rdi
callq 0x168e0
movl %eax, %ecx
movq 0x38(%rsp), %rax
movl %ecx, 0x40(%rsp)
movq 0x1d8(%rax), %rdi
movl 0x5c(%rsp), %esi
movl 0x40(%rsp), %edx
callq 0x51220
movq 0x50(%rsp), %rdi
callq 0x44190
movq 0x50(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x4acc0
movq (%rsp), %rdi
callq 0x434f0
movq (%rsp), %rdi
callq 0x84b0
movq 0x28(%rsp), %rdi
callq 0x16560
movq 0x30(%rsp), %rax
addq $0x78, %rsp
retq
movq 0x48(%rsp), %rdi
callq 0x8820
nop