// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/pubsub.c
// Function: pubsubPublishMessage
int pubsubPublishMessage(robj *channel, robj *message) {
    int receivers = 0;
    dictEntry *de;
    listNode *ln;
    listIter li;

    /* Send to clients listening for that channel */
    de = dictFind(server.pubsub_channels,channel);
    if (de) {
        list *list = dictGetVal(de);
        listNode *ln;
        listIter li;

        listRewind(list,&li);
        while ((ln = listNext(&li)) != NULL) {
            client *c = ln->value;

            addReply(c,shared.mbulkhdr[3]);
            addReply(c,shared.messagebulk);
            addReplyBulk(c,channel);
            addReplyBulk(c,message);
            receivers++;
        }
    }
    /* Send to clients listening to matching channels */
    if (listLength(server.pubsub_patterns)) {
        listRewind(server.pubsub_patterns,&li);
        channel = getDecodedObject(channel);
        while ((ln = listNext(&li)) != NULL) {
            pubsubPattern *pat = ln->value;

            if (stringmatchlen((char*)pat->pattern->ptr,
                                sdslen(pat->pattern->ptr),
                                (char*)channel->ptr,
                                sdslen(channel->ptr),0)) {
                addReply(pat->client,shared.mbulkhdr[4]);
                addReply(pat->client,shared.pmessagebulk);
                addReplyBulk(pat->client,pat->pattern);
                addReplyBulk(pat->client,channel);
                addReplyBulk(pat->client,message);
                receivers++;
            }
        }
        decrRefCount(channel);
    }
    return receivers;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xa1517(%rip), %r15     # 0x1018a8
movq 0x988(%r15), %rdi
movq %r14, %rsi
callq 0x2ebca
testq %rax, %rax
je 0x60421
movq 0x8(%rax), %rdi
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x2b3b7
movq %r15, %rdi
callq 0x2b3d4
xorl %ebp, %ebp
testq %rax, %rax
je 0x60418
leaq 0xa1f44(%rip), %r13     # 0x102310
leaq 0x8(%rsp), %r15
movq 0x10(%rax), %r12
movq 0x13a48(%r13), %rsi
movq %r12, %rdi
callq 0x3c854
movq 0xf8(%r13), %rsi
movq %r12, %rdi
callq 0x3c854
movq %r12, %rdi
movq %r14, %rsi
callq 0x3d170
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3d170
incl %ebp
movq %r15, %rdi
callq 0x2b3d4
testq %rax, %rax
jne 0x603d1
leaq 0xa1489(%rip), %r15     # 0x1018a8
jmp 0x60423
xorl %ebp, %ebp
movq 0x990(%r15), %rdi
cmpq $0x0, 0x28(%rdi)
je 0x6055d
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x2b3b7
movq %r14, %rdi
callq 0x41026
movq %rax, %r14
movq %r15, %rdi
callq 0x2b3d4
testq %rax, %rax
je 0x60555
leaq 0x6591f(%rip), %r15     # 0xc5d84
movq 0x10(%rax), %r12
movq 0x8(%r12), %rax
movq 0x8(%rax), %rdi
movzbl -0x1(%rdi), %esi
movl %esi, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x604a5
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
shrl $0x3, %esi
jmp 0x604a7
movq -0x11(%rdi), %rsi
jmp 0x604a7
movzwl -0x5(%rdi), %esi
jmp 0x604a7
movl -0x9(%rdi), %esi
jmp 0x604a7
movzbl -0x3(%rdi), %esi
jmp 0x604a7
xorl %esi, %esi
movq 0x8(%r14), %rdx
movzbl -0x1(%rdx), %ecx
movl %ecx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x604e5
leaq 0x658d8(%rip), %r8      # 0xc5d98
movslq (%r8,%rax,4), %rax
addq %r8, %rax
jmpq *%rax
shrl $0x3, %ecx
jmp 0x604e7
movq -0x11(%rdx), %rcx
jmp 0x604e7
movzwl -0x5(%rdx), %ecx
jmp 0x604e7
movl -0x9(%rdx), %ecx
jmp 0x604e7
movzbl -0x3(%rdx), %ecx
jmp 0x604e7
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3fa30
testl %eax, %eax
je 0x60542
movq (%r12), %rdi
leaq 0xa1e12(%rip), %r13     # 0x102310
movq 0x13a50(%r13), %rsi
callq 0x3c854
movq (%r12), %rdi
movq 0x100(%r13), %rsi
callq 0x3c854
movq (%r12), %rdi
movq 0x8(%r12), %rsi
callq 0x3d170
movq (%r12), %rdi
movq %r14, %rsi
callq 0x3d170
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x3d170
incl %ebp
leaq 0x8(%rsp), %rdi
callq 0x2b3d4
testq %rax, %rax
jne 0x60465
movq %r14, %rdi
callq 0x40c8f
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq