// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x1140, %rsp           # imm = 0x1140
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x10f0(%rbp), %rax
movq %rax, -0x1100(%rbp)
movq -0x10(%rbp), %rdi
callq 0x494f0
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rdi
callq 0x494f0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x7cf60
movl %eax, -0x1108(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x7cf60
movl %eax, -0x110c(%rbp)
movq -0x1100(%rbp), %rdi
movl $0x4, %esi
callq 0x811d0
movl $0x8a0, -0x1104(%rbp)   # imm = 0x8A0
movl -0x1108(%rbp), %eax
movl %eax, %ecx
addq $0x8, %rcx
movl -0x110c(%rbp), %eax
addq %rax, %rcx
movl -0x1104(%rbp), %eax
addq %rcx, %rax
movl %eax, -0x1104(%rbp)
movl -0x1108(%rbp), %edi
callq 0x26b20
movl %eax, %ecx
movq -0x1100(%rbp), %rax
movl %ecx, 0x8a0(%rax)
movl -0x110c(%rbp), %edi
callq 0x26b20
movl %eax, %ecx
movq -0x1100(%rbp), %rax
movl %ecx, 0x8a4(%rax)
movl -0x1104(%rbp), %edi
callq 0x26b20
movl %eax, %ecx
movq -0x1100(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x1104(%rbp), %eax
cmpq $0x10d0, %rax           # imm = 0x10D0
jae 0x816bd
leaq -0x10f0(%rbp), %rax
movq %rax, -0x10f8(%rbp)
jmp 0x816f7
movl -0x1104(%rbp), %eax
movl %eax, %edi
callq 0x3acd0
movq %rax, -0x10f8(%rbp)
movq -0x10f8(%rbp), %rdi
movq -0x1100(%rbp), %rsi
movl $0x10d0, %edx           # imm = 0x10D0
callq 0x26c60
movq -0x10f8(%rbp), %rax
movq %rax, -0x1100(%rbp)
movq -0x1100(%rbp), %rax
addq $0x8a0, %rax            # imm = 0x8A0
addq $0x8, %rax
movq %rax, -0x1138(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1130(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x7cf60
movq -0x1138(%rbp), %rdi
movq -0x1130(%rbp), %rsi
movq %rax, %rdx
callq 0x26c60
movq -0x1100(%rbp), %rax
addq $0x8a0, %rax            # imm = 0x8A0
addq $0x8, %rax
movq %rax, -0x1128(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x7cf60
movq %rax, %rcx
movq -0x1128(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x1120(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1118(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x7cf60
movq -0x1120(%rbp), %rdi
movq -0x1118(%rbp), %rsi
movq %rax, %rdx
callq 0x26c60
cmpq $0x0, -0x8(%rbp)
je 0x817cd
movq -0x8(%rbp), %rdi
movq -0x10f8(%rbp), %rsi
movl -0x1104(%rbp), %eax
movl %eax, %edx
callq 0x81090
jmp 0x817e1
movq -0x10f8(%rbp), %rdi
movl -0x1104(%rbp), %eax
movl %eax, %esi
callq 0x81130
movq -0x10(%rbp), %rdi
callq 0x48f70
movq -0x18(%rbp), %rdi
callq 0x48f70
movq -0x10f8(%rbp), %rax
leaq -0x10f0(%rbp), %rcx
cmpq %rcx, %rax
je 0x81812
movq -0x10f8(%rbp), %rdi
callq 0x3afa0
addq $0x1140, %rsp           # imm = 0x1140
popq %rbp
retq
nopl (%rax,%rax)