// File: yangwanyuan[P]HLKVDS/src/Kvdb_Impl.cc
// Function: hlkvds::KVDS::Insert(char const*, unsigned int, char const*, unsigned short, bool)
Status KVDS::Insert(const char* key, uint32_t key_len, const char* data,
                      uint16_t length, bool immediately) {
    if (key == NULL || key[0] == '\0') {
        return Status::InvalidArgument("Key is null or empty.");
    }

    KVSlice slice(key, key_len, data, length);

    Status s = dataStor_->WriteData(slice, immediately);

    if (s.ok()) {
        if(!options_.disable_cache && !slice.GetDataLen()){
            rdCache_->Put(slice.GetKeyStr(),slice.GetDataStr());
        }
    }

    return s;
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movl %r9d, %eax
movl %ecx, 0x24(%rsp)
movq %rdx, %rcx
movl 0x24(%rsp), %edx
movq %rcx, 0x28(%rsp)
movq %rsi, %rcx
movq 0x28(%rsp), %rsi
movq %rcx, 0x30(%rsp)
movq %rdi, %r9
movq 0x30(%rsp), %rdi
movq %r9, 0x38(%rsp)
movw %ax, %cx
movq %r9, %rax
movq %rax, 0x40(%rsp)
movb 0x120(%rsp), %al
movq %r9, 0x110(%rsp)
movq %rdi, 0x108(%rsp)
movq %rsi, 0x100(%rsp)
movl %edx, 0xfc(%rsp)
movq %r8, 0xf0(%rsp)
movw %cx, 0xee(%rsp)
andb $0x1, %al
movb %al, 0xed(%rsp)
movq 0x108(%rsp), %rax
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x100(%rsp)
je 0x2c7a6
movq 0x100(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x2c7bc
movq 0x38(%rsp), %rdi
leaq 0x2694c(%rip), %rsi     # 0x530fe
callq 0x2d710
jmp 0x2c988
movq 0x100(%rsp), %rsi
movl 0xfc(%rsp), %edx
movq 0xf0(%rsp), %rcx
movzwl 0xee(%rsp), %r8d
leaq 0xa8(%rsp), %rdi
movq %rdi, 0x18(%rsp)
xorl %r9d, %r9d
callq 0x40eb0
movq 0x48(%rsp), %rax
movq 0x38(%rsp), %rdi
movq 0x18(%rsp), %rdx
movb $0x0, 0xa7(%rsp)
movq 0x48(%rax), %rsi
movq (%rsi), %rax
movq 0x40(%rax), %rax
movzbl 0xed(%rsp), %ecx
andl $0x1, %ecx
callq *%rax
jmp 0x2c822
movq 0x38(%rsp), %rdi
callq 0xa890
movb %al, 0x17(%rsp)
jmp 0x2c832
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x2c83f
jmp 0x2c944
movq 0x48(%rsp), %rax
testb $0x1, 0x50(%rax)
jne 0x2c942
leaq 0xa8(%rsp), %rdi
callq 0x163a0
movw %ax, 0x14(%rsp)
jmp 0x2c862
movw 0x14(%rsp), %ax
cmpw $0x0, %ax
jne 0x2c942
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x8(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x411e0
jmp 0x2c893
leaq 0x50(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x41270
jmp 0x2c8a7
movq 0x8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x37640
jmp 0x2c8bd
leaq 0x50(%rsp), %rdi
callq 0x8928
leaq 0x70(%rsp), %rdi
callq 0x8928
jmp 0x2c942
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x98(%rsp)
movl %eax, 0x94(%rsp)
jmp 0x2c979
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x98(%rsp)
movl %eax, 0x94(%rsp)
jmp 0x2c96f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x98(%rsp)
movl %eax, 0x94(%rsp)
jmp 0x2c936
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x98(%rsp)
movl %eax, 0x94(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x8928
leaq 0x70(%rsp), %rdi
callq 0x8928
jmp 0x2c96f
jmp 0x2c944
movb $0x1, 0xa7(%rsp)
testb $0x1, 0xa7(%rsp)
jne 0x2c960
movq 0x38(%rsp), %rdi
callq 0xa8b0
leaq 0xa8(%rsp), %rdi
callq 0x40c40
jmp 0x2c988
movq 0x38(%rsp), %rdi
callq 0xa8b0
leaq 0xa8(%rsp), %rdi
callq 0x40c40
jmp 0x2c995
movq 0x40(%rsp), %rax
addq $0x118, %rsp            # imm = 0x118
retq
movq 0x98(%rsp), %rdi
callq 0x8820
nopw %cs:(%rax,%rax)