// File: /workspace/github_c_makefile_star2_O3/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), %r14d
cmpl $0x2, %r14d
jne 0x6ffcd
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %r15
leaq 0x5a50d(%rip), %rsi     # 0xca46e
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
je 0x700a1
leaq 0x545e3(%rip), %rsi     # 0xc455b
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
je 0x7003d
leaq 0x50361(%rip), %rsi     # 0xc02f0
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x70023
leaq 0x91902(%rip), %rax     # 0x1018a8
cmpq $0x0, 0x9d8(%rax)
je 0x70117
cmpl $0x0, 0x9f8(%rax)
je 0x70151
leaq 0x5a4da(%rip), %rdi     # 0xca4a2
jmp 0x7011e
jl 0x70023
movq 0x40(%rbx), %r12
movq 0x8(%r12), %rax
movq 0x8(%rax), %r15
leaq 0x54578(%rip), %rsi     # 0xc455b
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
je 0x7003d
cmpl $0x3, %r14d
jne 0x70023
leaq 0x56665(%rip), %rsi     # 0xc6661
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
je 0x700d8
leaq 0x63822(%rip), %rsi     # 0xd3835
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
je 0x70139
leaq 0x5a587(%rip), %rsi     # 0xca5b1
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3cc06
addl $-0x2, %r14d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3d274
cmpl $0x3, 0x38(%rbx)
jl 0x700cc
movl $0x2, %r14d
leaq 0x91849(%rip), %r15     # 0x1018a8
leaq 0x922aa(%rip), %r12     # 0x102310
movq 0x9e0(%r15), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x8(%rax), %rsi
callq 0x2ebca
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
movq 0x20(%r12,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x3c854
incq %r14
movslq 0x38(%rbx), %rax
cmpq %rax, %r14
jl 0x70066
jmp 0x700cc
callq 0x6f3dd
leaq 0x92263(%rip), %rax     # 0x102310
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x3c854
callq 0x44c36
leaq 0x917e3(%rip), %rax     # 0x1018a8
incq 0x720(%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x2(%rsp), %r14
movw $0x5f66, -0x2(%r14)     # imm = 0x5F66
movq 0x10(%r12), %rax
movq 0x8(%rax), %rsi
movzbl -0x1(%rsi), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x701ed
leaq 0x5969e(%rip), %rcx     # 0xc97a4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x701ef
leaq 0x5a356(%rip), %rdi     # 0xca474
callq 0x362b0
movq %rbx, %rdi
movq %rax, %rsi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3ca86
movq %rbx, %rdi
callq 0x3c29e
testl %eax, %eax
je 0x70179
leaq 0x5a419(%rip), %rsi     # 0xca565
jmp 0x7002a
movl $0x1, 0xa10(%rax)
leaq 0x921ae(%rip), %rax     # 0x102310
movq 0x8(%rax), %rsi
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3c854
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %r14
leaq 0x5a422(%rip), %rsi     # 0xca5ae
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x7027a
leaq 0x50172(%rip), %rsi     # 0xc0315
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x70286
leaq 0x5ad16(%rip), %rsi     # 0xcaed0
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x70293
leaq 0x5a3c3(%rip), %rsi     # 0xca594
jmp 0x7002a
movq -0x11(%rsi), %rdx
jmp 0x701ef
movzwl -0x5(%rsi), %edx
jmp 0x701ef
movl -0x9(%rsi), %edx
jmp 0x701ef
movzbl -0x3(%rsi), %edx
jmp 0x701ef
xorl %edx, %edx
movq %r14, %rdi
callq 0x6d614
movl $0x28, %esi
movq %r14, %rdi
callq 0x36178
movq %rax, %r15
leaq 0x9169a(%rip), %r12     # 0x1018a8
movq 0x9e0(%r12), %rdi
movq %rax, %rsi
callq 0x2ebca
testq %rax, %rax
jne 0x70243
movq 0x9c8(%r12), %rsi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rcx
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x6f4b1
cmpl $-0x1, %eax
je 0x7026d
movl $0x28, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3d346
movq %r15, %rdi
callq 0x36330
movq %rbx, %rdi
movl $0x3, %esi
callq 0x32e87
jmp 0x700cc
movq %r15, %rdi
callq 0x36330
jmp 0x700cc
andb $-0x7, 0x9b(%rbx)
jmp 0x7015b
movq %rbx, %rdi
callq 0x702c2
jmp 0x7015b
movq %rbx, %rdi
callq 0x702c2
leaq 0x9206e(%rip), %rax     # 0x102310
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x3c854
orb $0x4, 0x9b(%rbx)
jmp 0x700cc