// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x73a0f
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x599d4(%rip), %rsi     # 0xcd3d6
callq 0x26300
testl %eax, %eax
je 0x73ac1
cmpl $0x2, %r14d
jl 0x73a35
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x53ac7(%rip), %rsi     # 0xc74ef
callq 0x26300
testl %eax, %eax
je 0x73af1
cmpl $0x3, %r14d
jne 0x73a5b
movq 0x40(%rbx), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %rdi
leaq 0x55bb7(%rip), %rsi     # 0xc9605
callq 0x26300
testl %eax, %eax
je 0x73b5c
cmpl $0x2, %r14d
jne 0x73a81
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x4f834(%rip), %rsi     # 0xc32a8
callq 0x26300
testl %eax, %eax
je 0x73b9a
cmpl $0x3, %r14d
jne 0x73aa7
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x6393e(%rip), %rsi     # 0xd73d8
callq 0x26300
testl %eax, %eax
je 0x73bc1
leaq 0x59a6b(%rip), %rsi     # 0xcd519
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3ffcb
callq 0x72e7c
leaq 0x937e3(%rip), %rax     # 0x1072b0
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x3fc19
callq 0x47e38
leaq 0x92d73(%rip), %rax     # 0x106858
incq 0x710(%rax)
jmp 0x73cf9
addl $-0x2, %r14d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4063b
cmpl $0x3, 0x38(%rbx)
jl 0x73cf9
movl $0x2, %r14d
leaq 0x92d41(%rip), %r15     # 0x106858
leaq 0x93792(%rip), %r12     # 0x1072b0
movq 0x9d0(%r15), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x8(%rax), %rsi
callq 0x31cca
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
movq 0x20(%r12,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x3fc19
incq %r14
movslq 0x38(%rbx), %rax
cmpq %rax, %r14
jl 0x73b1e
jmp 0x73cf9
leaq 0x2(%rsp), %r14
movw $0x5f66, -0x2(%r14)     # imm = 0x5F66
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
movzbl -0x1(%rsi), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x73c7e
leaq 0x58b97(%rip), %rcx     # 0xcc720
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x73c80
leaq 0x92cb7(%rip), %rax     # 0x106858
cmpq $0x0, 0x9c8(%rax)
je 0x73bd9
cmpl $0x0, 0x9e8(%rax)
je 0x73c58
leaq 0x5984b(%rip), %rdi     # 0xcd40a
jmp 0x73be0
movq %rbx, %rdi
callq 0x3f665
testl %eax, %eax
je 0x73bfb
leaq 0x598f9(%rip), %rsi     # 0xcd4cd
jmp 0x73aae
leaq 0x597fc(%rip), %rdi     # 0xcd3dc
callq 0x39245
movq %rbx, %rdi
movq %rax, %rsi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3fe4b
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %r14
leaq 0x59908(%rip), %rsi     # 0xcd516
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x73d0f
leaq 0x4f6a8(%rip), %rsi     # 0xc32cd
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x73d18
leaq 0x5a1fc(%rip), %rsi     # 0xcde38
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x73d3e
leaq 0x598a9(%rip), %rsi     # 0xcd4fc
jmp 0x73aae
movl $0x1, 0xa00(%rax)
jmp 0x73d20
movq -0x11(%rsi), %rdx
jmp 0x73c80
movzwl -0x5(%rsi), %edx
jmp 0x73c80
movl -0x9(%rsi), %edx
jmp 0x73c80
movzbl -0x3(%rsi), %edx
jmp 0x73c80
xorl %edx, %edx
movq %r14, %rdi
callq 0x710ec
movl $0x28, %esi
movq %r14, %rdi
callq 0x3910c
movq %rax, %r15
leaq 0x92bb9(%rip), %r12     # 0x106858
movq 0x9d0(%r12), %rdi
movq %rax, %rsi
callq 0x31cca
testq %rax, %rax
jne 0x73cd4
movq 0x9b8(%r12), %rsi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rcx
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x72f50
cmpl $-0x1, %eax
je 0x73d05
movl $0x28, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4070f
movq %r15, %rdi
callq 0x392b6
movq %rbx, %rdi
movl $0x3, %esi
callq 0x35f12
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r15, %rdi
callq 0x392b6
jmp 0x73cf9
andb $-0x7, 0x9b(%rbx)
jmp 0x73d20
movq %rbx, %rdi
callq 0x73d6a
leaq 0x93589(%rip), %rax     # 0x1072b0
movq 0x8(%rax), %rsi
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3fc19
movq %rbx, %rdi
callq 0x73d6a
leaq 0x93563(%rip), %rax     # 0x1072b0
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x3fc19
orb $0x4, 0x9b(%rbx)
jmp 0x73cf9