// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSendPublish
void clusterSendPublish(clusterLink *link, robj *channel, robj *message) {
    unsigned char buf[sizeof(clusterMsg)], *payload;
    clusterMsg *hdr = (clusterMsg*) buf;
    uint32_t totlen;
    uint32_t channel_len, message_len;

    channel = getDecodedObject(channel);
    message = getDecodedObject(message);
    channel_len = sdslen(channel->ptr);
    message_len = sdslen(message->ptr);

    clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_PUBLISH);
    totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
    totlen += sizeof(clusterMsgDataPublish) - 8 + channel_len + message_len;

    hdr->data.publish.msg.channel_len = htonl(channel_len);
    hdr->data.publish.msg.message_len = htonl(message_len);
    hdr->totlen = htonl(totlen);

    /* Try to use the local buffer if possible */
    if (totlen < sizeof(buf)) {
        payload = buf;
    } else {
        payload = zmalloc(totlen);
        memcpy(payload,hdr,sizeof(*hdr));
        hdr = (clusterMsg*) payload;
    }
    memcpy(hdr->data.publish.msg.bulk_data,channel->ptr,sdslen(channel->ptr));
    memcpy(hdr->data.publish.msg.bulk_data+sdslen(channel->ptr),
        message->ptr,sdslen(message->ptr));

    if (link)
        clusterSendMessage(link,payload,totlen);
    else
        clusterBroadcastMessage(payload,totlen);

    decrRefCount(channel);
    decrRefCount(message);
    if (payload != buf) zfree(payload);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10e8, %rsp           # imm = 0x10E8
movq %rdx, %r14
movq %rdi, %r15
movq %rsi, %rdi
callq 0x41026
movq %rax, %rbx
movq %r14, %rdi
callq 0x41026
movq 0x8(%rbx), %rsi
movzbl -0x1(%rsi), %ebp
movl %ebp, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x68dbd
leaq 0x5e73f(%rip), %rdx     # 0xc74c8
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq %r15, %r14
shrl $0x3, %ebp
jmp 0x68dc2
movq %r15, %r14
movq -0x11(%rsi), %rbp
jmp 0x68dc2
movq %r15, %r14
movzwl -0x5(%rsi), %ebp
jmp 0x68dc2
movq %r15, %r14
movl -0x9(%rsi), %ebp
jmp 0x68dc2
movq %r15, %r14
movzbl -0x3(%rsi), %ebp
jmp 0x68dc2
movq %r15, %r14
xorl %ebp, %ebp
movq 0x8(%rax), %rsi
movzbl -0x1(%rsi), %r15d
movl %r15d, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
movq %rax, 0x8(%rsp)
ja 0x68e0b
leaq 0x5e6fa(%rip), %rdx     # 0xc74dc
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %r15d
jmp 0x68e0e
movq -0x11(%rsi), %r15
jmp 0x68e0e
movzwl -0x5(%rsi), %r15d
jmp 0x68e0e
movl -0x9(%rsi), %r15d
jmp 0x68e0e
movzbl -0x3(%rsi), %r15d
jmp 0x68e0e
xorl %r15d, %r15d
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movl $0x4, %esi
callq 0x68b27
leal (%r15,%rbp), %r13d
addl $0x8a8, %r13d           # imm = 0x8A8
bswapl %ebp
movl %ebp, 0x8a0(%r12)
bswapl %r15d
movl %r15d, 0x8a4(%r12)
movl %r13d, %eax
bswapl %eax
movl %eax, 0x4(%r12)
cmpl $0x10d0, %r13d          # imm = 0x10D0
jb 0x68e70
movq %r13, %rdi
callq 0x382d1
movq %rax, %r12
leaq 0x10(%rsp), %rsi
movl $0x10d0, %edx           # imm = 0x10D0
movq %rax, %rdi
callq 0x26c50
leaq 0x8a8(%r12), %rbp
movq 0x8(%rbx), %rsi
movzbl -0x1(%rsi), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x68eb6
leaq 0x5e65f(%rip), %rcx     # 0xc74f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x68eb8
movq -0x11(%rsi), %rdx
jmp 0x68eb8
movzwl -0x5(%rsi), %edx
jmp 0x68eb8
movl -0x9(%rsi), %edx
jmp 0x68eb8
movzbl -0x3(%rsi), %edx
jmp 0x68eb8
xorl %edx, %edx
movq %rbp, %rdi
callq 0x26c50
movq 0x8(%rbx), %rcx
movzbl -0x1(%rcx), %eax
movl %eax, %edx
andl $0x7, %edx
cmpl $0x4, %edx
ja 0x68f03
leaq 0x5e62b(%rip), %rsi     # 0xc7504
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
movq 0x8(%rsp), %rsi
jmpq *%rdx
shrl $0x3, %eax
jmp 0x68f0a
movq -0x11(%rcx), %rax
jmp 0x68f0a
movzwl -0x5(%rcx), %eax
jmp 0x68f0a
movl -0x9(%rcx), %eax
jmp 0x68f0a
movzbl -0x3(%rcx), %eax
jmp 0x68f0a
xorl %eax, %eax
movq 0x8(%rsp), %rsi
addq %rax, %rbp
movq 0x8(%rsi), %rsi
movzbl -0x1(%rsi), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x68f4b
leaq 0x5e5f2(%rip), %rcx     # 0xc7518
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x68f4d
movq -0x11(%rsi), %rdx
jmp 0x68f4d
movzwl -0x5(%rsi), %edx
jmp 0x68f4d
movl -0x9(%rsi), %edx
jmp 0x68f4d
movzbl -0x3(%rsi), %edx
jmp 0x68f4d
xorl %edx, %edx
movq %rbp, %rdi
callq 0x26c50
testq %r14, %r14
je 0x68f6a
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x68a1a
jmp 0x68f75
movq %r12, %rdi
movq %r13, %rsi
callq 0x68ac2
movq %rbx, %rdi
callq 0x40c8f
movq 0x8(%rsp), %rdi
callq 0x40c8f
leaq 0x10(%rsp), %rax
cmpq %rax, %r12
je 0x68f99
movq %r12, %rdi
callq 0x38413
addq $0x10e8, %rsp           # imm = 0x10E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq