// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/scripting.c
// Function: scriptCommand
void scriptCommand(client *c) {
    if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"flush")) {
        scriptingReset();
        addReply(c,shared.ok);
        replicationScriptCacheFlush();
        server.dirty++; /* Propagating this command is a good idea. */
    } else if (c->argc >= 2 && !strcasecmp(c->argv[1]->ptr,"exists")) {
        int j;

        addReplyMultiBulkLen(c, c->argc-2);
        for (j = 2; j < c->argc; j++) {
            if (dictFind(server.lua_scripts,c->argv[j]->ptr))
                addReply(c,shared.cone);
            else
                addReply(c,shared.czero);
        }
    } else if (c->argc == 3 && !strcasecmp(c->argv[1]->ptr,"load")) {
        char funcname[43];
        sds sha;

        funcname[0] = 'f';
        funcname[1] = '_';
        sha1hex(funcname+2,c->argv[2]->ptr,sdslen(c->argv[2]->ptr));
        sha = sdsnewlen(funcname+2,40);
        if (dictFind(server.lua_scripts,sha) == NULL) {
            if (luaCreateFunction(c,server.lua,funcname,c->argv[2])
                    == C_ERR) {
                sdsfree(sha);
                return;
            }
        }
        addReplyBulkCBuffer(c,funcname+2,40);
        sdsfree(sha);
        forceCommandPropagation(c,PROPAGATE_REPL|PROPAGATE_AOF);
    } else if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"kill")) {
        if (server.lua_caller == NULL) {
            addReplySds(c,sdsnew("-NOTBUSY No scripts in execution right now.\r\n"));
        } else if (server.lua_write_dirty) {
            addReplySds(c,sdsnew("-UNKILLABLE Sorry the script already executed write commands against the dataset. You can either wait the script termination or kill the server in a hard way using the SHUTDOWN NOSAVE command.\r\n"));
        } else {
            server.lua_kill = 1;
            addReply(c,shared.ok);
        }
    } else if (c->argc == 3 && !strcasecmp(c->argv[1]->ptr,"debug")) {
        if (clientHasPendingReplies(c)) {
            addReplyError(c,"SCRIPT DEBUG must be called outside a pipeline");
            return;
        }
        if (!strcasecmp(c->argv[2]->ptr,"no")) {
            ldbDisable(c);
            addReply(c,shared.ok);
        } else if (!strcasecmp(c->argv[2]->ptr,"yes")) {
            ldbEnable(c);
            addReply(c,shared.ok);
        } else if (!strcasecmp(c->argv[2]->ptr,"sync")) {
            ldbEnable(c);
            addReply(c,shared.ok);
            c->flags |= CLIENT_LUA_DEBUG_SYNC;
        } else {
            addReplyError(c,"Use SCRIPT DEBUG yes/sync/no");
        }
    } else {
        addReplyError(c, "Unknown SCRIPT subcommand or wrong # of args.");
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movl 0x38(%rdi), %r15d
cmpl $0x2, %r15d
jne 0x64a28
movq 0x40(%rbx), %r12
movq 0x8(%r12), %rax
movq 0x8(%rax), %r14
leaq 0x568b2(%rip), %rsi     # 0xbb29e
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x64a3b
callq 0x63fff
leaq 0x9590c(%rip), %rax     # 0xfa310
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x36987
callq 0x3d949
leaq 0x94e8c(%rip), %rax     # 0xf98a8
incq 0x720(%rax)
jmp 0x64bd3
jl 0x64b1f
movq 0x40(%rbx), %r12
movq 0x8(%r12), %rax
movq 0x8(%rax), %r14
leaq 0x50ecd(%rip), %rsi     # 0xb590f
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x64aa2
cmpl $0x3, %r15d
jne 0x64b02
leaq 0x52e3e(%rip), %rsi     # 0xb789d
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x64b39
leaq 0x5f897(%rip), %rsi     # 0xc430d
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x64b1f
movq %rbx, %rdi
callq 0x3655e
testl %eax, %eax
je 0x64c06
leaq 0x568f8(%rip), %rsi     # 0xbb395
jmp 0x64b26
addl $-0x2, %r15d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x370d9
pushq $0x2
popq %r14
leaq 0x94dec(%rip), %r15     # 0xf98a8
leaq 0x9584d(%rip), %r12     # 0xfa310
movslq 0x38(%rbx), %rax
cmpq %rax, %r14
jge 0x64bd3
movq 0x9e0(%r15), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x8(%rax), %rsi
callq 0x2a5f9
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
movq 0x20(%r12,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x36987
incq %r14
jmp 0x64ac3
cmpl $0x2, %r15d
jne 0x64b1f
leaq 0x4d185(%rip), %rsi     # 0xb1c94
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x64bdf
leaq 0x568bb(%rip), %rsi     # 0xbb3e1
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x36b6f
leaq 0x2(%rsp), %r14
movw $0x5f66, -0x2(%r14)     # imm = 0x5F66
movq 0x10(%r12), %rax
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x63370
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x623fc
pushq $0x28
popq %rsi
movq %r14, %rdi
callq 0x31018
movq %rax, %r15
leaq 0x94d2f(%rip), %r12     # 0xf98a8
movq 0x9e0(%r12), %rdi
movq %rax, %rsi
callq 0x2a5f9
testq %rax, %rax
jne 0x64bb2
movq 0x9c8(%r12), %rsi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rcx
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x6408f
cmpl $-0x1, %eax
je 0x64c79
pushq $0x28
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3716c
movq %r15, %rdi
callq 0x311c8
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x2e213
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x94cc2(%rip), %rax     # 0xf98a8
cmpq $0x0, 0x9d8(%rax)
je 0x64c57
cmpl $0x0, 0x9f8(%rax)
je 0x64c86
leaq 0x566ce(%rip), %rdi     # 0xbb2d2
jmp 0x64c5e
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %r14
leaq 0x567c5(%rip), %rsi     # 0xbb3de
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x64c92
leaq 0x4d08d(%rip), %rsi     # 0xb1cb9
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x64c9b
leaq 0x570c1(%rip), %rsi     # 0xbbd00
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x64cc1
leaq 0x56772(%rip), %rsi     # 0xbb3c4
jmp 0x64b26
leaq 0x56646(%rip), %rdi     # 0xbb2a4
callq 0x3115a
movq %rbx, %rdi
movq %rax, %rsi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x36a9d
movq %r15, %rdi
callq 0x311c8
jmp 0x64bd3
movl $0x1, 0xa10(%rax)
jmp 0x64ca3
andb $-0x7, 0x9b(%rbx)
jmp 0x64ca3
movq %rbx, %rdi
callq 0x64cf0
leaq 0x95666(%rip), %rax     # 0xfa310
movq 0x8(%rax), %rsi
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x36987
movq %rbx, %rdi
callq 0x64cf0
leaq 0x95640(%rip), %rax     # 0xfa310
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x36987
orb $0x4, 0x9b(%rbx)
jmp 0x64bd3