// File: /workspace/github_c_makefile_star2_O3/andyfighting[P]hiredis_timer_cmpt/async.c
// Function: _redisAsyncCommand
static int __redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *cmd, size_t len) {
    redisContext *c = &(ac->c);
    redisCallback cb;
    int pvariant, hasnext;
    const char *cstr, *astr;
    size_t clen, alen;
    const char *p;
    sds sname;
    int ret;

    /* Don't accept new commands when the connection is about to be closed. */
    if (c->flags & (REDIS_DISCONNECTING | REDIS_FREEING)) return REDIS_ERR;

    /* Setup callback */
    cb.fn = fn;
    cb.privdata = privdata;

    /* Find out which command will be appended. */
    p = nextArgument(cmd,&cstr,&clen);
    assert(p != NULL);
    hasnext = (p[0] == '$');
    pvariant = (tolower(cstr[0]) == 'p') ? 1 : 0;
    cstr += pvariant;
    clen -= pvariant;

    if (hasnext && strncasecmp(cstr,"subscribe\r\n",11) == 0) {
        c->flags |= REDIS_SUBSCRIBED;

        /* Add every channel/pattern to the list of subscription callbacks. */
        while ((p = nextArgument(p,&astr,&alen)) != NULL) {
            sname = sdsnewlen(astr,alen);
            if (pvariant)
                ret = dictReplace(ac->sub.patterns,sname,&cb);
            else
                ret = dictReplace(ac->sub.channels,sname,&cb);

            if (ret == 0) sdsfree(sname);
        }
    } else if (strncasecmp(cstr,"unsubscribe\r\n",13) == 0) {
        /* It is only useful to call (P)UNSUBSCRIBE when the context is
         * subscribed to one or more channels or patterns. */
        if (!(c->flags & REDIS_SUBSCRIBED)) return REDIS_ERR;

        /* (P)UNSUBSCRIBE does not have its own response: every channel or
         * pattern that is unsubscribed will receive a message. This means we
         * should not append a callback function for this command. */
     } else if(strncasecmp(cstr,"monitor\r\n",9) == 0) {
         /* Set monitor flag and push callback */
         c->flags |= REDIS_MONITORING;
         __redisPushCallback(&ac->replies,&cb);
    } else {
        if (c->flags & REDIS_SUBSCRIBED)
            /* This will likely result in an error reply, but it needs to be
             * received and passed to the callback. */
            __redisPushCallback(&ac->sub.invalid,&cb);
        else
            __redisPushCallback(&ac->replies,&cb);
    }

    __redisAppendCommand(c,cmd,len);

    /* Always schedule a write when the write buffer is non-empty */
    _EL_ADD_WRITE(ac);

    return REDIS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb $0xc, 0x88(%rdi)
jne 0x7bcd
movq %rdi, %rbx
movq %r8, 0x18(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %rcx, 0x10(%rsp)
movq %rcx, %rdi
callq 0x7f08
testq %rax, %rax
je 0x7c5f
movq %rax, %r13
movb (%rax), %r15b
callq 0x3510
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movsbq (%rcx), %rdx
movl (%rax,%rdx,4), %r14d
xorl %r12d, %r12d
cmpl $0x70, %r14d
sete %r12b
addq %rcx, %r12
cmpb $0x24, %r15b
jne 0x7b3a
leaq 0x1c40(%rip), %rsi      # 0x9765
movl $0xb, %edx
movq %r12, %rdi
callq 0x3350
testl %eax, %eax
je 0x7bde
leaq 0x1c22(%rip), %rsi      # 0x9763
movl $0xd, %edx
movq %r12, %rdi
callq 0x3350
testl %eax, %eax
je 0x7b7e
leaq 0x1c18(%rip), %rsi      # 0x9771
movl $0x9, %edx
movq %r12, %rdi
callq 0x3350
movl 0x88(%rbx), %edi
testl %eax, %eax
je 0x7b89
andl $0x20, %edi
shrl %edi
orq $0x128, %rdi            # imm = 0x128
jmp 0x7b97
testb $0x20, 0x88(%rbx)
jne 0x7ba4
jmp 0x7bcd
orl $0x40, %edi
movl %edi, 0x88(%rbx)
movl $0x128, %edi            # imm = 0x128
addq %rbx, %rdi
leaq 0x28(%rsp), %rsi
callq 0x78a3
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x3550
movq 0x100(%rbx), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0x7bcd
movq 0xe8(%rbx), %rdi
callq *%rax
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
orb $0x20, 0x88(%rbx)
leaq 0x8(%rsp), %rsi
movq %rsp, %rdx
movq %r13, %rdi
callq 0x7f08
testq %rax, %rax
je 0x7ba4
movq %rax, %r12
xorl %eax, %eax
cmpl $0x70, %r14d
sete %al
leaq 0x148(,%rax,8), %r13
leaq 0x8(%rsp), %rbp
movq %rsp, %r14
movq 0x8(%rsp), %rdi
movq (%rsp), %rsi
callq 0x32c0
movq %rax, %r15
movq (%rbx,%r13), %rdi
movq %rax, %rsi
leaq 0x28(%rsp), %rdx
callq 0x7f98
testl %eax, %eax
jne 0x7c44
movq %r15, %rdi
callq 0x3280
movq %r12, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x7f08
movq %rax, %r12
testq %rax, %rax
jne 0x7c16
jmp 0x7ba4
leaq 0x1a95(%rip), %rdi      # 0x96fb
leaq 0x18f0(%rip), %rsi      # 0x955d
leaq 0x1a91(%rip), %rcx      # 0x9705
movl $0x25a, %edx            # imm = 0x25A
callq 0x31b0