// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelSendHello
int sentinelSendHello(sentinelRedisInstance *ri) {
    char ip[NET_IP_STR_LEN];
    char payload[NET_IP_STR_LEN+1024];
    int retval;
    char *announce_ip;
    int announce_port;
    sentinelRedisInstance *master = (ri->flags & SRI_MASTER) ? ri : ri->master;
    sentinelAddr *master_addr = sentinelGetCurrentMasterAddress(master);

    if (ri->link->disconnected) return C_ERR;

    /* Use the specified announce address if specified, otherwise try to
     * obtain our own IP address. */
    if (sentinel.announce_ip) {
        announce_ip = sentinel.announce_ip;
    } else {
        if (anetSockName(ri->link->cc->c.fd,ip,sizeof(ip),NULL) == -1)
            return C_ERR;
        announce_ip = ip;
    }
    announce_port = sentinel.announce_port ?
                    sentinel.announce_port : server.port;

    /* Format and send the Hello message. */
    snprintf(payload,sizeof(payload),
        "%s,%d,%s,%llu," /* Info about this sentinel. */
        "%s,%s,%d,%llu", /* Info about current master. */
        announce_ip, announce_port, sentinel.myid,
        (unsigned long long) sentinel.current_epoch,
        /* --- */
        master->name,master_addr->ip,master_addr->port,
        (unsigned long long) master->config_epoch);
    retval = redisAsyncCommand(ri->link->cc,
        sentinelPublishReplyCallback, ri, "PUBLISH %s %s",
            SENTINEL_HELLO_CHANNEL,payload);
    if (retval != C_OK) return C_ERR;
    ri->link->pending_commands++;
    return C_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x468, %rsp            # imm = 0x468
movq %rdi, %rbx
movl (%rdi), %eax
movq %rdi, %r12
testb $0x1, %al
jne 0x7a1d5
movq 0xb8(%rbx), %r12
movl (%r12), %eax
testb $0x40, %al
je 0x7a1f1
movq 0x118(%r12), %rax
testq %rax, %rax
je 0x7a1f1
cmpl $0x4, 0xf0(%r12)
jg 0x7a1f4
movq %r12, %rax
movq 0x28(%rbx), %rcx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x0, 0x4(%rcx)
jne 0x7a2d4
movq 0x20(%rax), %r13
movq 0x9c526(%rip), %r14     # 0x116738
testq %r14, %r14
jne 0x7a23c
movq 0x10(%rcx), %rax
movl 0x84(%rax), %edi
movq %rsp, %r14
movl $0x2e, %edx
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x2e428
cmpl $-0x1, %eax
je 0x7a2d4
leaq 0x9c495(%rip), %r9      # 0x1166d8
movl 0x9c4f6(%rip), %r8d     # 0x116740
testl %r8d, %r8d
jne 0x7a25d
leaq 0x87652(%rip), %rax     # 0x1018a8
movl 0xa0(%rax), %r8d
movl 0x8(%r13), %r10d
subq $0x8, %rsp
leaq 0x529a0(%rip), %rdx     # 0xccc0c
leaq 0x38(%rsp), %r15
movl $0x42e, %esi            # imm = 0x42E
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
pushq 0x18(%r12)
pushq %r10
pushq (%r13)
pushq 0x8(%r12)
pushq 0x9c474(%rip)           # 0x116708
callq 0x26120
addq $0x30, %rsp
movq 0x28(%rbx), %rax
movq 0x10(%rax), %rdi
leaq -0x450(%rip), %rsi      # 0x79e5c
leaq 0x52975(%rip), %rcx     # 0xccc28
leaq 0x52737(%rip), %r8      # 0xcc9f1
movq %rbx, %rdx
movq %r15, %r9
xorl %eax, %eax
callq 0x82c47
testl %eax, %eax
jne 0x7a2d4
movq 0x28(%rbx), %rax
incl 0x8(%rax)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq