// File: cybozu[P]yrmcds/src/memcache/object.cpp
// Function: yrmcds::memcache::object::prepend(char const*, unsigned long)
void object::prepend(const char* p, std::size_t len) {
    ++ m_cas;
    m_gc_old = 0;
    if( len == 0 ) return;

    std::size_t new_size = m_length + len;
    if( new_size > g_config.heap_data_limit() ) {
        if( m_file.get() == nullptr ) {
            m_file = std::unique_ptr<tempfile>(new tempfile);
            m_file->write(p, len);
            if( m_length > 0 )
                m_file->write(m_data.data(), m_length);
            m_data.reset();
        } else {
            cybozu::dynbuf buf(new_size);
            buf.append(p, len);
            m_file->read_contents(buf);
            m_file->clear();
            m_file->write(buf.data(), new_size);
        }
    } else {
        cybozu::dynbuf buf(new_size);
        buf.append(p, len);
        buf.append(m_data.data(), m_length);
        m_data.swap(buf);
    }
    m_length = new_size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq 0x48(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x48(%rax)
movl $0x0, 0x50(%rax)
cmpq $0x0, -0x18(%rbp)
jne 0x400f1
jmp 0x403a2
movq -0x90(%rbp), %rax
movq (%rax), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq 0x6fbeb(%rip), %rdi     # 0xafd00
callq 0xafc0
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
jbe 0x402fb
movq -0x90(%rbp), %rdi
addq $0x30, %rdi
callq 0x40980
cmpq $0x0, %rax
jne 0x40238
movl $0x10, %edi
callq 0x8640
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xa0(%rbp)
callq 0x408c0
jmp 0x40165
movq -0xa0(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x40900
movq -0x90(%rbp), %rdi
addq $0x30, %rdi
leaq -0x28(%rbp), %rsi
callq 0x40930
leaq -0x28(%rbp), %rdi
callq 0x3f180
movq -0x90(%rbp), %rdi
addq $0x30, %rdi
callq 0x40960
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x54f90
movq -0x90(%rbp), %rax
cmpq $0x0, (%rax)
jbe 0x40223
movq -0x90(%rbp), %rdi
addq $0x30, %rdi
callq 0x40960
movq -0x90(%rbp), %rdi
movq %rax, -0xa8(%rbp)
addq $0x8, %rdi
callq 0x33dd0
movq -0xa8(%rbp), %rdi
movq %rax, %rsi
movq -0x90(%rbp), %rax
movq (%rax), %rdx
callq 0x54f90
jmp 0x40223
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x10, %esi
callq 0x8650
jmp 0x403ab
movq -0x90(%rbp), %rdi
addq $0x8, %rdi
callq 0x263d0
jmp 0x402f6
movq -0x20(%rbp), %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
xorl %edx, %edx
callq 0x22f90
movq -0xb0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x33d60
jmp 0x40264
movq -0x90(%rbp), %rdi
addq $0x30, %rdi
callq 0x40960
movq %rax, %rdi
leaq -0x60(%rbp), %rsi
callq 0x550a0
jmp 0x40282
movq -0x90(%rbp), %rdi
addq $0x30, %rdi
callq 0x40960
movq %rax, %rdi
callq 0x55020
jmp 0x4029c
movq -0x90(%rbp), %rdi
addq $0x30, %rdi
callq 0x40960
movq %rax, -0xb8(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x33dd0
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
movq -0x20(%rbp), %rdx
callq 0x54f90
jmp 0x402d1
leaq -0x60(%rbp), %rdi
callq 0xc580
jmp 0x402f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xc580
jmp 0x403ab
jmp 0x40394
movq -0x20(%rbp), %rsi
leaq -0x88(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
xorl %edx, %edx
callq 0x22f90
movq -0xc0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x33d60
jmp 0x4032a
movq -0x90(%rbp), %rdi
addq $0x8, %rdi
callq 0x33dd0
movq %rax, %rsi
movq -0x90(%rbp), %rax
movq (%rax), %rdx
leaq -0x88(%rbp), %rdi
callq 0x33d60
jmp 0x40355
movq -0x90(%rbp), %rdi
addq $0x8, %rdi
leaq -0x88(%rbp), %rsi
callq 0x409e0
leaq -0x88(%rbp), %rdi
callq 0xc580
jmp 0x40394
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xc580
jmp 0x403ab
movq -0x90(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, (%rax)
addq $0xc0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x8bc0
nopw %cs:(%rax,%rax)