// File: /workspace/github_c_makefile_star2_O2/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
pushq $-0x1
popq %rbp
testb $0xc, 0x88(%rdi)
jne 0x7045
movq %rdi, %rbx
movq %r8, 0x8(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %rcx, (%rsp)
movq %rcx, %rdi
callq 0x7394
testq %rax, %rax
je 0x70bf
movq %rax, %r12
movb (%rax), %r13b
callq 0x3530
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movsbq (%rcx), %rdx
movl (%rax,%rdx,4), %r15d
xorl %r14d, %r14d
cmpl $0x70, %r15d
sete %r14b
addq %rcx, %r14
cmpb $0x24, %r13b
jne 0x6fb7
leaq 0x27b8(%rip), %rsi      # 0x975c
pushq $0xb
popq %rdx
movq %r14, %rdi
callq 0x3360
testl %eax, %eax
je 0x7056
leaq 0x279c(%rip), %rsi      # 0x975a
pushq $0xd
popq %rdx
movq %r14, %rdi
callq 0x3360
testl %eax, %eax
je 0x6ff7
leaq 0x2794(%rip), %rsi      # 0x9768
pushq $0x9
popq %rdx
movq %r14, %rdi
callq 0x3360
movl 0x88(%rbx), %edi
testl %eax, %eax
je 0x7002
andl $0x20, %edi
shrl %edi
orq $0x128, %rdi            # imm = 0x128
jmp 0x7010
testb $0x20, 0x88(%rbx)
jne 0x701d
jmp 0x7045
orl $0x40, %edi
movl %edi, 0x88(%rbx)
movl $0x128, %edi            # imm = 0x128
addq %rbx, %rdi
leaq 0x28(%rsp), %rsi
callq 0x6cca
movq %rbx, %rdi
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x3570
movq 0x100(%rbx), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0x7045
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
xorl %eax, %eax
cmpl $0x70, %r15d
sete %al
orb $0x20, 0x88(%rbx)
leaq 0x148(,%rax,8), %r14
leaq 0x18(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x7394
testq %rax, %rax
je 0x701d
movq %rax, %r12
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x32d0
movq %rax, %r15
movq (%rbx,%r14), %rdi
movq %rax, %rsi
leaq 0x28(%rsp), %rdx
callq 0x741e
testl %eax, %eax
jne 0x7078
movq %r15, %rdi
callq 0x3290
jmp 0x7078
leaq 0x262c(%rip), %rdi      # 0x96f2
leaq 0x2487(%rip), %rsi      # 0x9554
leaq 0x2628(%rip), %rcx      # 0x96fc
movl $0x25a, %edx            # imm = 0x25A
callq 0x31c0