// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x84(%rbp)
movl $0x4, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0x859a6
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xbd68c(%rip), %rsi     # 0x142ff3
callq 0x26300
cmpl $0x0, %eax
jne 0x8597d
movl $0x1, -0x84(%rbp)
jmp 0x85999
movq -0x8(%rbp), %rdi
leaq 0xf32b8(%rip), %rax     # 0x178c40
movq 0x80(%rax), %rsi
callq 0x42cc0
jmp 0x85bb3
jmp 0x8599b
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x85940
cmpl $0x0, -0x84(%rbp)
jne 0x859ea
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x4a6f0
cmpq $0x0, %rax
je 0x859ea
movq -0x8(%rbp), %rdi
leaq 0xf3267(%rip), %rax     # 0x178c40
movq 0xe0(%rax), %rsi
callq 0x42cc0
jmp 0x85bb3
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
leaq -0x10(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49ea0
cmpl $0x0, %eax
je 0x85a11
jmp 0x85bb3
cmpq $0x0, -0x10(%rbp)
jge 0x85a2d
movq -0x8(%rbp), %rdi
leaq 0xbd5d8(%rip), %rsi     # 0x142ffb
callq 0x42f90
jmp 0x85bb3
jmp 0x85a2f
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x7cf60
movq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x857e0
cmpl $-0x1, %eax
jne 0x85a84
movq -0x8(%rbp), %rdi
leaq 0xbd5a1(%rip), %rsi     # 0x14301b
callq 0x42f90
jmp 0x85bb3
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rsi
leaq -0x78(%rbp), %rdi
callq 0x8e5d0
leaq -0x78(%rbp), %rdi
callq 0x54060
movl %eax, -0x80(%rbp)
cmpl $-0x1, %eax
je 0x85ac7
movl -0x80(%rbp), %edi
leaq -0x78(%rbp), %rsi
callq 0x55630
movq %rax, -0x90(%rbp)
cmpq $0x0, %rax
jne 0x85adc
movq -0x8(%rbp), %rdi
leaq 0xbd574(%rip), %rsi     # 0x143046
callq 0x42f90
jmp 0x85bb3
cmpl $0x0, -0x84(%rbp)
je 0x85afe
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x4ac10
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x90(%rbp), %rdx
callq 0x4a7d0
cmpq $0x0, -0x10(%rbp)
je 0x85b66
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0xa0(%rbp)
callq 0x2ff70
movq -0xa8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movq %rax, %rdx
addq -0x10(%rbp), %rdx
callq 0x4c4f0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x4aa60
movq -0x8(%rbp), %rdi
leaq 0xf30b6(%rip), %rax     # 0x178c40
movq 0x8(%rax), %rsi
callq 0x42cc0
leaq 0xf263e(%rip), %rax     # 0x1781d8
movq 0x720(%rax), %rcx
addq $0x1, %rcx
leaq 0xf262c(%rip), %rax     # 0x1781d8
movq %rcx, 0x720(%rax)
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)