// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/pubsub.c
// Function: pubsubCommand
void pubsubCommand(client *c) {
    if (!strcasecmp(c->argv[1]->ptr,"channels") &&
        (c->argc == 2 || c->argc ==3))
    {
        /* PUBSUB CHANNELS [<pattern>] */
        sds pat = (c->argc == 2) ? NULL : c->argv[2]->ptr;
        dictIterator *di = dictGetIterator(server.pubsub_channels);
        dictEntry *de;
        long mblen = 0;
        void *replylen;

        replylen = addDeferredMultiBulkLength(c);
        while((de = dictNext(di)) != NULL) {
            robj *cobj = dictGetKey(de);
            sds channel = cobj->ptr;

            if (!pat || stringmatchlen(pat, sdslen(pat),
                                       channel, sdslen(channel),0))
            {
                addReplyBulk(c,cobj);
                mblen++;
            }
        }
        dictReleaseIterator(di);
        setDeferredMultiBulkLength(c,replylen,mblen);
    } else if (!strcasecmp(c->argv[1]->ptr,"numsub") && c->argc >= 2) {
        /* PUBSUB NUMSUB [Channel_1 ... Channel_N] */
        int j;

        addReplyMultiBulkLen(c,(c->argc-2)*2);
        for (j = 2; j < c->argc; j++) {
            list *l = dictFetchValue(server.pubsub_channels,c->argv[j]);

            addReplyBulk(c,c->argv[j]);
            addReplyLongLong(c,l ? listLength(l) : 0);
        }
    } else if (!strcasecmp(c->argv[1]->ptr,"numpat") && c->argc == 2) {
        /* PUBSUB NUMPAT */
        addReplyLongLong(c,listLength(server.pubsub_patterns));
    } else {
        addReplyErrorFormat(c,
            "Unknown PUBSUB subcommand or wrong number of arguments for '%s'",
            (char*)c->argv[1]->ptr);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xcacdb(%rip), %rsi     # 0x1401a1
callq 0x26300
cmpl $0x0, %eax
jne 0x755f3
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
je 0x754ec
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
jne 0x755f3
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x754fe
xorl %eax, %eax
movq %rax, -0x58(%rbp)
jmp 0x75512
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq 0x102cb7(%rip), %rax    # 0x1781d8
movq 0x988(%rax), %rdi
callq 0x2e400
movq %rax, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x432a0
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x755d4
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x755b6
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0x751b0
movl %eax, -0x64(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rdi
callq 0x751b0
movq -0x70(%rbp), %rdi
movl -0x64(%rbp), %esi
movq -0x60(%rbp), %rdx
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x46ef0
cmpl $0x0, %eax
je 0x755cf
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x43630
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x75546
movq -0x18(%rbp), %rdi
callq 0x2e600
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x43310
jmp 0x75745
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xcaba0(%rip), %rsi     # 0x1401aa
callq 0x26300
cmpl $0x0, %eax
jne 0x756d7
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jl 0x756d7
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
subl $0x2, %eax
shll %eax
movslq %eax, %rsi
callq 0x437f0
movl $0x2, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0x756d5
leaq 0x102b7c(%rip), %rax    # 0x1781d8
movq 0x988(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x2e280
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x43630
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x756b2
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x80(%rbp)
jmp 0x756ba
xorl %eax, %eax
movq %rax, -0x80(%rbp)
jmp 0x756ba
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x43780
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x75645
jmp 0x75743
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xcaac3(%rip), %rsi     # 0x1401b1
callq 0x26300
cmpl $0x0, %eax
jne 0x7571f
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x7571f
movq -0x8(%rbp), %rdi
leaq 0x102acb(%rip), %rax    # 0x1781d8
movq 0x990(%rax), %rax
movq 0x28(%rax), %rsi
callq 0x43780
jmp 0x75741
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdx
leaq 0xcaa7e(%rip), %rsi     # 0x1401b8
movb $0x0, %al
callq 0x42fd0
jmp 0x75743
jmp 0x75745
addq $0x80, %rsp
popq %rbp
retq
nop