// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x4d0, %rsp            # imm = 0x4D0
movq %rdi, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x997dd
movq -0x20(%rbp), %rax
movq %rax, -0x4b0(%rbp)
jmp 0x997ef
movq -0x20(%rbp), %rax
movq 0xb8(%rax), %rax
movq %rax, -0x4b0(%rbp)
movq -0x4b0(%rbp), %rax
movq %rax, -0x4a0(%rbp)
movq -0x4a0(%rbp), %rdi
callq 0x96bc0
movq %rax, -0x4a8(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
cmpl $0x0, 0x4(%rax)
je 0x9982a
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
jmp 0x99996
cmpq $0x0, 0xf3836(%rip)     # 0x18d068
je 0x99844
movq 0xf382d(%rip), %rax     # 0x18d068
movq %rax, -0x490(%rbp)
jmp 0x99884
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x10(%rax), %rax
movl 0x84(%rax), %edi
leaq -0x50(%rbp), %rsi
movl $0x2e, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2ce80
cmpl $-0x1, %eax
jne 0x99879
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
jmp 0x99996
leaq -0x50(%rbp), %rax
movq %rax, -0x490(%rbp)
cmpl $0x0, 0xf37e5(%rip)     # 0x18d070
je 0x9989b
movl 0xf37dd(%rip), %eax     # 0x18d070
movl %eax, -0x4b4(%rbp)
jmp 0x998ae
leaq 0xde936(%rip), %rax     # 0x1781d8
movl 0xa0(%rax), %eax
movl %eax, -0x4b4(%rbp)
movl -0x4b4(%rbp), %eax
movl %eax, -0x494(%rbp)
leaq -0x480(%rbp), %rdi
movq -0x490(%rbp), %rcx
movl -0x494(%rbp), %r8d
movq 0xf3762(%rip), %r14     # 0x18d038
movq -0x4a0(%rbp), %rax
movq 0x8(%rax), %rbx
movq -0x4a8(%rbp), %rax
movq (%rax), %r11
movq -0x4a8(%rbp), %rax
movl 0x8(%rax), %r10d
movq -0x4a0(%rbp), %rax
movq 0x18(%rax), %rax
movl $0x42e, %esi            # imm = 0x42E
leaq 0xad00b(%rip), %rdx     # 0x146918
leaq 0xf36f4(%rip), %r9      # 0x18d008
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movb $0x0, %al
callq 0x26120
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rdx
leaq -0x480(%rbp), %r9
leaq -0x5c1(%rip), %rsi      # 0x99390
leaq 0xacfdc(%rip), %rcx     # 0x146934
leaq 0xacd9e(%rip), %r8      # 0x1466fd
movb $0x0, %al
callq 0xa6e80
movl %eax, -0x484(%rbp)
cmpl $0x0, -0x484(%rbp)
je 0x9997e
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
jmp 0x99996
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
addq $0x4d0, %rsp            # imm = 0x4D0
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)