// File: /workspace/github_c_makefile_star2_O3/erikdubbelboer[P]discnt/src/cluster.c
// Function: clusterSendAck
void clusterSendAck(clusterNode *node, uint32_t revision, const sds name) {
    unsigned char buf[sizeof(clusterMsg) + 64], *payload;
    clusterMsg *hdr = (clusterMsg*) buf;
    uint32_t totlen;

    if (node->link == NULL) return;

    totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
    totlen += sizeof(clusterMsgDataAck) - sizeof(hdr->data.ack.about.name);
    totlen += sdslen(name);

    clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_ACK);
    hdr->totlen = htonl(totlen);

    hdr->data.ack.about.revision    = intrev32ifbe(revision);
    hdr->data.ack.about.name_length = intrev16ifbe(sdslen(name));

    if (totlen < sizeof(buf)) {
        payload = buf;
    } else {
        payload = zmalloc(totlen);
        memcpy(payload,buf,sizeof(clusterMsg));
        hdr = (clusterMsg*) payload;

        serverLog(LL_DEBUG,"Need to resize payload buffer to %u bytes for ack for %s",
            totlen, name);
    }

    memcpy(hdr->data.ack.about.name, name, sdslen(name));

    clusterSendMessage(node->link,payload,totlen);

    if (totlen >= sizeof(buf)) {
        zfree(payload);
    }
}

// Assembly:
cmpq $0x0, 0x88(%rdi)
je 0x2e9a9
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdx, %r14
movzbl -0x1(%rdx), %ebp
movl %ebp, %r12d
andl $0x7, %r12d
cmpl $0x4, %r12d
movq %rdi, 0x8(%rsp)
movl %esi, 0x4(%rsp)
ja 0x2e816
leaq 0x281ca(%rip), %rax     # 0x569b4
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl %ebp, %r15d
shrl $0x3, %r15d
jmp 0x2e819
movq -0x11(%r14), %r15
jmp 0x2e819
movzwl -0x5(%r14), %r15d
jmp 0x2e819
movl -0x9(%r14), %r15d
jmp 0x2e819
movzbl -0x3(%r14), %r15d
jmp 0x2e819
xorl %r15d, %r15d
addl $0x66, %r15d
leaq 0x10(%rsp), %r13
xorl %ebx, %ebx
movl $0xc8, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x12380
movl $0x5a756244, (%r13)     # imm = 0x5A756244
movw $0x500, 0xc(%r13)       # imm = 0x500
movq 0x54d57(%rip), %rax     # 0x835a0
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm0, 0x10(%r13)
movaps %xmm1, 0x20(%r13)
movq 0x20(%rax), %rcx
movq %rcx, 0x30(%r13)
leaq 0x4081f(%rip), %rcx     # 0x6f088
movzwl 0xb4(%rcx), %edx
rolw $0x8, %dx
movw %dx, 0x58(%r13)
movzwl 0x30(%rax), %eax
rolw $0x8, %ax
movw %ax, 0x5a(%r13)
movq 0x668(%rcx), %rax
movb 0x8(%rax), %al
movb %al, 0x5c(%r13)
movl %r15d, %eax
bswapl %eax
movl %eax, 0x4(%r13)
movl 0x4(%rsp), %eax
movl %eax, 0x60(%r13)
cmpl $0x4, %r12d
ja 0x2e8dd
movl %r12d, %eax
leaq 0x28113(%rip), %rcx     # 0x569c8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %ebp, %ebx
shrl $0x3, %ebx
jmp 0x2e8dd
movq -0x11(%r14), %rbx
jmp 0x2e8dd
movzwl -0x5(%r14), %ebx
jmp 0x2e8dd
movl -0x9(%r14), %ebx
jmp 0x2e8dd
movzbl -0x3(%r14), %ebx
movw %bx, 0x74(%rsp)
movl %r15d, %ebx
cmpl $0x108, %r15d           # imm = 0x108
jb 0x2e926
movq %rbx, %rdi
callq 0x1fbbd
movq %rax, %r13
leaq 0x10(%rsp), %rsi
movl $0xc8, %edx
movq %rax, %rdi
callq 0x12510
leaq 0x28a8e(%rip), %rsi     # 0x573a0
xorl %edi, %edi
movl %r15d, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x19c06
movzbl -0x1(%r14), %ebp
leaq 0x66(%r13), %rdi
movl %ebp, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x2e963
leaq 0x280a1(%rip), %rcx     # 0x569dc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %ebp
jmp 0x2e965
movq -0x11(%r14), %rbp
jmp 0x2e965
movzwl -0x5(%r14), %ebp
jmp 0x2e965
movl -0x9(%r14), %ebp
jmp 0x2e965
movzbl -0x3(%r14), %ebp
jmp 0x2e965
xorl %ebp, %ebp
movq %r14, %rsi
movq %rbp, %rdx
callq 0x12510
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x2d8da
cmpl $0x108, %r15d           # imm = 0x108
jb 0x2e998
movq %r13, %rdi
callq 0x1fd17
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq