// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: restoreCommand
void restoreCommand(client *c) {
    long long ttl;
    rio payload;
    int j, type, replace = 0;
    robj *obj;

    /* Parse additional options */
    for (j = 4; j < c->argc; j++) {
        if (!strcasecmp(c->argv[j]->ptr,"replace")) {
            replace = 1;
        } else {
            addReply(c,shared.syntaxerr);
            return;
        }
    }

    /* Make sure this key does not already exist here... */
    if (!replace && lookupKeyWrite(c->db,c->argv[1]) != NULL) {
        addReply(c,shared.busykeyerr);
        return;
    }

    /* Check if the TTL value makes sense */
    if (getLongLongFromObjectOrReply(c,c->argv[2],&ttl,NULL) != C_OK) {
        return;
    } else if (ttl < 0) {
        addReplyError(c,"Invalid TTL value, must be >= 0");
        return;
    }

    /* Verify RDB version and data checksum. */
    if (verifyDumpPayload(c->argv[3]->ptr,sdslen(c->argv[3]->ptr)) == C_ERR)
    {
        addReplyError(c,"DUMP payload version or checksum are wrong");
        return;
    }

    rioInitWithBuffer(&payload,c->argv[3]->ptr);
    if (((type = rdbLoadObjectType(&payload)) == -1) ||
        ((obj = rdbLoadObject(type,&payload)) == NULL))
    {
        addReplyError(c,"Bad data format");
        return;
    }

    /* Remove the old key if needed. */
    if (replace) dbDelete(c->db,c->argv[1]);

    /* Create the key and set the TTL if any */
    dbAdd(c->db,c->argv[1],obj);
    if (ttl) setExpire(c->db,c->argv[1],mstime()+ttl);
    signalModifiedKey(c->db,c->argv[1]);
    addReply(c,shared.ok);
    server.dirty++;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
movslq 0x38(%rdi), %r15
cmpq $0x5, %r15
jge 0x6b9c6
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x41ad6
testq %rax, %rax
je 0x6b9f9
leaq 0x96956(%rip), %rax     # 0x102310
movq 0xe0(%rax), %rsi
jmp 0x6ba5a
movq 0x40(%rbx), %r12
movl $0x4, %r13d
leaq 0x5d59b(%rip), %r14     # 0xc8f72
movq (%r12,%r13,8), %rax
movq 0x8(%rax), %rdi
movq %r14, %rsi
callq 0x262f0
testl %eax, %eax
jne 0x6ba4c
incq %r13
cmpq %r13, %r15
jne 0x6b9d7
cmpl $0x4, %r15d
jle 0x6b99d
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x416bb
testl %eax, %eax
jne 0x6bb85
cmpq $0x0, (%rsp)
js 0x6ba6f
movq 0x40(%rbx), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rdi
movzbl -0x1(%rdi), %esi
movl %esi, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x6ba92
leaq 0x5bb02(%rip), %rcx     # 0xc7540
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %esi
jmp 0x6ba94
leaq 0x968bd(%rip), %rax     # 0x102310
movq 0x80(%rax), %rsi
movq %rbx, %rdi
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3c854
leaq 0x5d504(%rip), %rsi     # 0xc8f7a
jmp 0x6bb7d
movq -0x11(%rdi), %rsi
jmp 0x6ba94
movzwl -0x5(%rdi), %esi
jmp 0x6ba94
movl -0x9(%rdi), %esi
jmp 0x6ba94
movzbl -0x3(%rdi), %esi
jmp 0x6ba94
xorl %esi, %esi
callq 0x6b8cc
cmpl $-0x1, %eax
je 0x6bb76
movq 0x40(%rbx), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x726a0
movq %r14, %rdi
callq 0x48b10
cmpl $-0x1, %eax
je 0x6bb6d
leaq 0x8(%rsp), %rsi
movl %eax, %edi
callq 0x499b2
testq %rax, %rax
je 0x6bb6d
movq %rax, %r14
cmpl $0x5, %r15d
jl 0x6bafb
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x41e5f
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdx
callq 0x41b77
cmpq $0x0, (%rsp)
je 0x6bb39
movq 0x10(%rbx), %r14
movq 0x40(%rbx), %rax
movq 0x8(%rax), %r15
callq 0x2ffce
addq (%rsp), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x430b0
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x41d90
leaq 0x967bf(%rip), %rax     # 0x102310
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x3c854
leaq 0x95d44(%rip), %rax     # 0x1018a8
incq 0x720(%rax)
jmp 0x6bb85
leaq 0x5d451(%rip), %rsi     # 0xc8fc5
jmp 0x6bb7d
leaq 0x5d41d(%rip), %rsi     # 0xc8f9a
movq %rbx, %rdi
callq 0x3cc06
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq