// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/server.c
// Function: call
void call(client *c, int flags) {
    long long dirty, start, duration;
    int client_old_flags = c->flags;

    /* Sent the command to clients in MONITOR mode, only if the commands are
     * not generated from reading an AOF. */
    if (listLength(server.monitors) &&
        !server.loading &&
        !(c->cmd->flags & (CMD_SKIP_MONITOR|CMD_ADMIN)))
    {
        replicationFeedMonitors(c,server.monitors,c->db->id,c->argv,c->argc);
    }

    /* Initialization: clear the flags that must be set by the command on
     * demand, and initialize the array for additional commands propagation. */
    c->flags &= ~(CLIENT_FORCE_AOF|CLIENT_FORCE_REPL|CLIENT_PREVENT_PROP);
    redisOpArrayInit(&server.also_propagate);

#ifdef AOF_NO_COW
    if(server.aof_child_pid != -1 && server.aof_no_cow.enable && c->cmd->flags & CMD_WRITE)
        aofNoCowPrepare(c);
#endif

    /* Call the command. */
    dirty = server.dirty;
    start = ustime();
    c->cmd->proc(c);
    duration = ustime()-start;
    dirty = server.dirty-dirty;
    if (dirty < 0) dirty = 0;

    /* When EVAL is called loading the AOF we don't want commands called
     * from Lua to go into the slowlog or to populate statistics. */
    if (server.loading && c->flags & CLIENT_LUA)
        flags &= ~(CMD_CALL_SLOWLOG | CMD_CALL_STATS);

    /* If the caller is Lua, we want to force the EVAL caller to propagate
     * the script if the command flag or client flag are forcing the
     * propagation. */
    if (c->flags & CLIENT_LUA && server.lua_caller) {
        if (c->flags & CLIENT_FORCE_REPL)
            server.lua_caller->flags |= CLIENT_FORCE_REPL;
        if (c->flags & CLIENT_FORCE_AOF)
            server.lua_caller->flags |= CLIENT_FORCE_AOF;
    }

    /* Log the command into the Slow log if needed, and populate the
     * per-command statistics that we show in INFO commandstats. */
    if (flags & CMD_CALL_SLOWLOG && c->cmd->proc != execCommand) {
        char *latency_event = (c->cmd->flags & CMD_FAST) ?
                              "fast-command" : "command";
        latencyAddSampleIfNeeded(latency_event,duration/1000);
        slowlogPushEntryIfNeeded(c->argv,c->argc,duration);
    }
    if (flags & CMD_CALL_STATS) {
        c->lastcmd->microseconds += duration;
        c->lastcmd->calls++;
    }

    /* Propagate the command into the AOF and replication link */
    if (flags & CMD_CALL_PROPAGATE &&
        (c->flags & CLIENT_PREVENT_PROP) != CLIENT_PREVENT_PROP)
    {
        int propagate_flags = PROPAGATE_NONE;

        /* Check if the command operated changes in the data set. If so
         * set for replication / AOF propagation. */
        if (dirty) propagate_flags |= (PROPAGATE_AOF|PROPAGATE_REPL);

        /* If the client forced AOF / replication of the command, set
         * the flags regardless of the command effects on the data set. */
        if (c->flags & CLIENT_FORCE_REPL) propagate_flags |= PROPAGATE_REPL;
        if (c->flags & CLIENT_FORCE_AOF) propagate_flags |= PROPAGATE_AOF;

        /* However prevent AOF / replication propagation if the command
         * implementatino called preventCommandPropagation() or similar,
         * or if we don't have the call() flags to do so. */
        if (c->flags & CLIENT_PREVENT_REPL_PROP ||
            !(flags & CMD_CALL_PROPAGATE_REPL))
                propagate_flags &= ~PROPAGATE_REPL;
        if (c->flags & CLIENT_PREVENT_AOF_PROP ||
            !(flags & CMD_CALL_PROPAGATE_AOF))
                propagate_flags &= ~PROPAGATE_AOF;

        /* Call propagate() only if at least one of AOF / replication
         * propagation is needed. */
        if (propagate_flags != PROPAGATE_NONE)
            propagate(c->cmd,c->db->id,c->argv,c->argc,propagate_flags);
    }

    /* Restore the old replication flags, since call() can be executed
     * recursively. */
    c->flags &= ~(CLIENT_FORCE_AOF|CLIENT_FORCE_REPL|CLIENT_PREVENT_PROP);
    c->flags |= client_old_flags &
        (CLIENT_FORCE_AOF|CLIENT_FORCE_REPL|CLIENT_PREVENT_PROP);

    /* Handle the alsoPropagate() API to handle commands that want to propagate
     * multiple separated commands. Note that alsoPropagate() is not affected
     * by CLIENT_PREVENT_PROP flag. */
    if (server.also_propagate.numops) {
        int j;
        redisOp *rop;

        if (flags & CMD_CALL_PROPAGATE) {
            for (j = 0; j < server.also_propagate.numops; j++) {
                rop = &server.also_propagate.ops[j];
                int target = rop->target;
                /* Whatever the command wish is, we honor the call() flags. */
                if (!(flags&CMD_CALL_PROPAGATE_AOF)) target &= ~PROPAGATE_AOF;
                if (!(flags&CMD_CALL_PROPAGATE_REPL)) target &= ~PROPAGATE_REPL;
                if (target)
                    propagate(rop->cmd,rop->dbid,rop->argv,rop->argc,target);
            }
        }
        redisOpArrayFree(&server.also_propagate);
    }

#ifdef AOF_NO_COW
    if(server.aof_child_pid != -1 && server.aof_no_cow.enable)
        aofNoCowStep();
#endif

    server.stat_numcommands++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebx
movq %rdi, %r14
movl 0x98(%rdi), %ebp
movq 0xd0adb(%rip), %rsi     # 0x106a40
cmpq $0x0, 0x28(%rsi)
je 0x35f9b
cmpl $0x0, 0xd0c01(%rip)     # 0x106b74
jne 0x35f9b
movq 0x48(%r14), %rax
movzwl 0x20(%rax), %eax
testl $0x810, %eax            # imm = 0x810
jne 0x35f9b
movq 0x10(%r14), %rax
movl 0x30(%rax), %edx
movq 0x40(%r14), %rcx
movl 0x38(%r14), %r8d
movq %r14, %rdi
callq 0x47615
andl $0xffe73fff, 0x98(%r14) # imm = 0xFFE73FFF
movq $0x0, 0xd1027(%rip) # 0x106fd8
movl $0x0, 0xd1025(%rip)     # 0x106fe0
movq 0xd0fa6(%rip), %rax     # 0x106f68
movq %rax, (%rsp)
leaq 0x8(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x26310
movq (%r15), %r12
movq 0x8(%r15), %r13
movq 0x48(%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
leaq 0x8(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x26310
movq (%r15), %rax
subq %r12, %rax
movq 0x8(%r15), %r15
cmpl $0x0, 0xd0b6e(%rip)     # 0x106b74
je 0x36018
movl %ebx, %ecx
andl $-0x4, %ecx
testb $0x1, 0x99(%r14)
cmovnel %ecx, %ebx
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
subq %r13, %r15
movq 0xd0f3f(%rip), %r13     # 0x106f68
movl 0x98(%r14), %edx
movl %edx, %esi
shrl $0x8, %esi
movq 0xd11e4(%rip), %rcx     # 0x107220
testq %rcx, %rcx
setne %dil
andb %sil, %dil
cmpb $0x1, %dil
jne 0x36069
testw %dx, %dx
jns 0x36058
orb $-0x80, 0x99(%rcx)
testb $0x40, 0x99(%r14)
je 0x36069
orb $0x40, 0x99(%rcx)
addq %rax, %r15
testb $0x1, %bl
je 0x360df
movq 0x48(%r14), %rax
movq 0x8(%rax), %rcx
cmpq 0xcbe90(%rip), %rcx     # 0x101f10
je 0x360df
testb $0x20, 0x21(%rax)
leaq 0x8a5a8(%rip), %rax     # 0xc0635
leaq 0x8a557(%rip), %rdi     # 0xc05eb
cmoveq %rax, %rdi
movq 0xd11c1(%rip), %rcx     # 0x107260
testq %rcx, %rcx
je 0x360cf
movabsq $0x20c49ba5e353f7cf, %rdx # imm = 0x20C49BA5E353F7CF
movq %r15, %rax
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
cmpq %rcx, %rdx
jl 0x360cf
movq %rdx, %rsi
callq 0x825dd
movq 0x40(%r14), %rdi
movl 0x38(%r14), %esi
movq %r15, %rdx
callq 0x70e8a
testb $0x2, %bl
je 0x360f0
movq 0x50(%r14), %rax
addq %r15, 0x40(%rax)
incq 0x48(%rax)
testb $0xc, %bl
je 0x36174
movl 0x98(%r14), %eax
movl %eax, %ecx
notl %ecx
testl $0x180000, %ecx         # imm = 0x180000
je 0x36174
xorl %ecx, %ecx
cmpq (%rsp), %r13
setg %cl
leal (%rcx,%rcx,2), %ecx
movl %eax, %r8d
shrl $0xe, %r8d
movl %r8d, %edx
andl $0x2, %edx
andl $0x1, %r8d
orl %edx, %r8d
orl %ecx, %r8d
movl %r8d, %ecx
andl $0x1, %ecx
testl $0x100000, %eax         # imm = 0x100000
cmovnel %ecx, %r8d
testb $0x8, %bl
cmovel %ecx, %r8d
movl %r8d, %ecx
andl $0x2, %ecx
testl $0x80000, %eax          # imm = 0x80000
cmovnel %ecx, %r8d
testb $0x4, %bl
cmovel %ecx, %r8d
testl %r8d, %r8d
je 0x36174
movq 0x48(%r14), %rdi
movq 0x10(%r14), %rax
movl 0x30(%rax), %esi
movq 0x40(%r14), %rdx
movl 0x38(%r14), %ecx
callq 0x35dfb
movl $0xffe73fff, %eax       # imm = 0xFFE73FFF
andl 0x98(%r14), %eax
andl $0x18c000, %ebp         # imm = 0x18C000
orl %eax, %ebp
movl %ebp, 0x98(%r14)
cmpl $0x0, 0xd0e4a(%rip)     # 0x106fe0
je 0x36210
testb $0xc, %bl
je 0x36204
cmpl $0x0, 0xd0e3c(%rip)     # 0x106fe0
jle 0x36204
movl $0x18, %r14d
xorl %r15d, %r15d
movq 0xd0e22(%rip), %rax     # 0x106fd8
movl -0x8(%rax,%r14), %ecx
movl %ecx, %edx
andl $-0x2, %edx
testb $0x4, %bl
cmovnel %ecx, %edx
movl %edx, %r8d
andl $-0x3, %r8d
testb $0x8, %bl
cmovnel %edx, %r8d
testl %r8d, %r8d
je 0x361f1
movq (%rax,%r14), %rdi
movl -0xc(%rax,%r14), %esi
movq -0x18(%rax,%r14), %rdx
movl -0x10(%rax,%r14), %ecx
callq 0x35dfb
incq %r15
movslq 0xd0de5(%rip), %rax     # 0x106fe0
addq $0x20, %r14
cmpq %rax, %r15
jl 0x361af
leaq 0xd0dcd(%rip), %rdi     # 0x106fd8
callq 0x35d5e
incq 0xd09c1(%rip)           # 0x106bd8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq