// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x40(%rdi), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %r14
leaq 0x6569a(%rip), %rsi     # 0xc5ddd
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x6076d
movl 0x38(%rbx), %eax
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x2, %ecx
jne 0x6076d
cmpl $0x2, %eax
jne 0x60869
xorl %r14d, %r14d
jmp 0x60871
leaq 0x65672(%rip), %rsi     # 0xc5de6
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x60806
movl 0x38(%rbx), %eax
cmpl $0x2, %eax
jl 0x60806
leal -0x4(,%rax,2), %esi
movq %rbx, %rdi
callq 0x3d274
cmpl $0x3, 0x38(%rbx)
jl 0x607f7
movl $0x2, %r15d
leaq 0xa10fa(%rip), %r12     # 0x1018a8
movq 0x988(%r12), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
callq 0x2ef19
movq %rax, %r14
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq %rbx, %rdi
callq 0x3d170
testq %r14, %r14
je 0x607e1
movq 0x28(%r14), %rsi
jmp 0x607e3
xorl %esi, %esi
movq %rbx, %rdi
callq 0x3d23f
incq %r15
movslq 0x38(%rbx), %rax
cmpq %rax, %r15
jl 0x607ae
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x655e0(%rip), %rsi     # 0xc5ded
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x60847
cmpl $0x2, 0x38(%rbx)
jne 0x60847
leaq 0xa1082(%rip), %rax     # 0x1018a8
movq 0x990(%rax), %rax
movq 0x28(%rax), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3d23f
leaq 0x655a6(%rip), %rsi     # 0xc5df4
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3cc2d
movq 0x10(%r15), %rax
movq 0x8(%rax), %r14
leaq 0xa1030(%rip), %rax     # 0x1018a8
movq 0x988(%rax), %rdi
callq 0x2efbb
movq %rax, %r15
movq %rbx, %rdi
callq 0x3cee9
movq %rax, (%rsp)
movq %r15, %rdi
callq 0x2f015
xorl %r13d, %r13d
testq %rax, %rax
je 0x60961
leaq 0x654fe(%rip), %r12     # 0xc5dac
movq (%rax), %rbp
testq %r14, %r14
je 0x60942
movzbl -0x1(%r14), %esi
movl %esi, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x608f1
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
shrl $0x3, %esi
jmp 0x608f3
movq -0x11(%r14), %rsi
jmp 0x608f3
movzwl -0x5(%r14), %esi
jmp 0x608f3
movl -0x9(%r14), %esi
jmp 0x608f3
movzbl -0x3(%r14), %esi
jmp 0x608f3
xorl %esi, %esi
movq 0x8(%rbp), %rdx
movzbl -0x1(%rdx), %ecx
movl %ecx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x60931
leaq 0x654b4(%rip), %rdi     # 0xc5dc0
movslq (%rdi,%rax,4), %rax
addq %rdi, %rax
jmpq *%rax
shrl $0x3, %ecx
jmp 0x60933
movq -0x11(%rdx), %rcx
jmp 0x60933
movzwl -0x5(%rdx), %ecx
jmp 0x60933
movl -0x9(%rdx), %ecx
jmp 0x60933
movzbl -0x3(%rdx), %ecx
jmp 0x60933
xorl %ecx, %ecx
movq %r14, %rdi
xorl %r8d, %r8d
callq 0x3fa30
testl %eax, %eax
je 0x60950
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x3d170
incq %r13
movq %r15, %rdi
callq 0x2f015
testq %rax, %rax
jne 0x608ae
movq %r15, %rdi
callq 0x2f0dd
movq %rbx, %rdi
movq (%rsp), %rsi
movq %r13, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3cf25
nop