// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/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 0x41ad6
testq %rax, %rax
je 0x4c162
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x40d47
testl %eax, %eax
je 0x4c1f8
popq %rbx
popq %r14
popq %r15
retq
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x40e09
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 0x41b77
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x407a8
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x41270
movq %rax, %r14
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x41d90
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x703a9(%rip), %rsi     # 0xbc579
movl $0x8, %edi
callq 0x7c665
leaq 0xb56c7(%rip), %rax     # 0x1018a8
incq 0x720(%rax)
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x3d23f
movq 0x40(%rbx), %rax
movq 0x10(%rax), %r15
movq %r14, %rdi
callq 0x41270
movq 0x8(%r15), %rdx
movzbl -0x1(%rdx), %ecx
movl %ecx, %esi
andl $0x7, %esi
cmpl $0x4, %esi
ja 0x4c246
leaq 0x76fbf(%rip), %rdi     # 0xc31e0
movslq (%rdi,%rsi,4), %rsi
addq %rdi, %rsi
jmpq *%rsi
shrl $0x3, %ecx
jmp 0x4c248
movq -0x11(%rdx), %rcx
jmp 0x4c248
movzwl -0x5(%rdx), %ecx
jmp 0x4c248
movl -0x9(%rdx), %ecx
jmp 0x4c248
movzbl -0x3(%rdx), %ecx
jmp 0x4c248
xorl %ecx, %ecx
addq %rax, %rcx
cmpq $0x20000001, %rcx       # imm = 0x20000001
jl 0x4c268
leaq 0x77063(%rip), %rsi     # 0xc32be
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3cc06
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdx
callq 0x41f24
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 0x4c2c1
leaq 0x76f58(%rip), %rcx     # 0xc31f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x4c2c3
movq -0x11(%rsi), %rdx
jmp 0x4c2c3
movzwl -0x5(%rsi), %edx
jmp 0x4c2c3
movl -0x9(%rsi), %edx
jmp 0x4c2c3
movzbl -0x3(%rsi), %edx
jmp 0x4c2c3
xorl %edx, %edx
callq 0x36ad1
movq %rax, 0x8(%r14)
movzbl -0x1(%rax), %r14d
movl %r14d, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x4c31b
leaq 0x76f25(%rip), %rdx     # 0xc3208
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %r14d
jmp 0x4c1a9
movq -0x11(%rax), %r14
jmp 0x4c1a9
movzwl -0x5(%rax), %r14d
jmp 0x4c1a9
movl -0x9(%rax), %r14d
jmp 0x4c1a9
movzbl -0x3(%rax), %r14d
jmp 0x4c1a9
xorl %r14d, %r14d
jmp 0x4c1a9