// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/t_string.c
// Function: appendCommand
void appendCommand(client *c) {
    size_t totlen;
    robj *o, *append;

    o = lookupKeyWrite(c->db,c->argv[1]);
    if (o == NULL) {
        /* Create the key */
        c->argv[2] = tryObjectEncoding(c->argv[2]);
        dbAdd(c->db,c->argv[1],c->argv[2]);
        incrRefCount(c->argv[2]);
        totlen = stringObjectLen(c->argv[2]);
    } else {
        /* Key exists, check type */
        if (checkType(c,o,OBJ_STRING))
            return;

        /* "append" is an argument, so always an sds */
        append = c->argv[2];
        totlen = stringObjectLen(o)+sdslen(append->ptr);
        if (checkStringLength(c,totlen) != C_OK)
            return;

        /* Append the value */
        o = dbUnshareStringValue(c->db,c->argv[1],o);
        o->ptr = sdscatlen(o->ptr,append->ptr,sdslen(append->ptr));
        totlen = sdslen(o->ptr);
    }
    signalModifiedKey(c->db,c->argv[1]);
    notifyKeyspaceEvent(NOTIFY_STRING,"append",c->argv[1],c->db->id);
    server.dirty++;
    addReplyLongLong(c,totlen);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x44f66
testq %rax, %rax
je 0x4f8d4
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x441ab
testl %eax, %eax
je 0x4f96a
popq %rbx
popq %r14
popq %r15
retq
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x4426d
movq 0x40(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x45007
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x43c0c
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x446f9
movq %rax, %r14
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x45220
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x6fbe7(%rip), %rsi     # 0xbf529
movl $0x8, %edi
callq 0x800c9
leaq 0xb6f05(%rip), %rax     # 0x106858
incq 0x710(%rax)
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x40606
movq 0x40(%rbx), %rax
movq 0x10(%rax), %r15
movq %r14, %rdi
callq 0x446f9
movq 0x8(%r15), %rdx
movzbl -0x1(%rdx), %ecx
movl %ecx, %esi
andl $0x7, %esi
cmpl $0x4, %esi
ja 0x4f9b8
leaq 0x767cd(%rip), %rdi     # 0xc6160
movslq (%rdi,%rsi,4), %rsi
addq %rdi, %rsi
jmpq *%rsi
shrl $0x3, %ecx
jmp 0x4f9ba
movq -0x11(%rdx), %rcx
jmp 0x4f9ba
movzwl -0x5(%rdx), %ecx
jmp 0x4f9ba
movl -0x9(%rdx), %ecx
jmp 0x4f9ba
movzbl -0x3(%rdx), %ecx
jmp 0x4f9ba
xorl %ecx, %ecx
addq %rax, %rcx
cmpq $0x20000001, %rcx       # imm = 0x20000001
jge 0x4fa08
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdx
callq 0x453b8
movq %rax, %r14
movq 0x8(%rax), %rdi
movq 0x8(%r15), %rsi
movzbl -0x1(%rsi), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x4fa33
leaq 0x7677a(%rip), %rcx     # 0xc6174
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x4fa35
leaq 0x7682f(%rip), %rsi     # 0xc623e
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3ffcb
movq -0x11(%rsi), %rdx
jmp 0x4fa35
movzwl -0x5(%rsi), %edx
jmp 0x4fa35
movl -0x9(%rsi), %edx
jmp 0x4fa35
movzbl -0x3(%rsi), %edx
jmp 0x4fa35
xorl %edx, %edx
callq 0x39a56
movq %rax, 0x8(%r14)
movzbl -0x1(%rax), %r14d
movl %r14d, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x4fa8d
leaq 0x76733(%rip), %rdx     # 0xc6188
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %r14d
jmp 0x4f91b
movq -0x11(%rax), %r14
jmp 0x4f91b
movzwl -0x5(%rax), %r14d
jmp 0x4f91b
movl -0x9(%rax), %r14d
jmp 0x4f91b
movzbl -0x3(%rax), %r14d
jmp 0x4f91b
xorl %r14d, %r14d
jmp 0x4f91b