// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelReconnectInstance
void sentinelReconnectInstance(sentinelRedisInstance *ri) {
    if (ri->link->disconnected == 0) return;
    if (ri->addr->port == 0) return; /* port == 0 means invalid address. */
    instanceLink *link = ri->link;
    mstime_t now = mstime();

    if (now - ri->link->last_reconn_time < SENTINEL_PING_PERIOD) return;
    ri->link->last_reconn_time = now;

    /* Commands connection. */
    if (link->cc == NULL) {
        link->cc = redisAsyncConnectBind(ri->addr->ip,ri->addr->port,NET_FIRST_BIND_ADDR);
        if (link->cc->err) {
            sentinelEvent(LL_DEBUG,"-cmd-link-reconnection",ri,"%@ #%s",
                link->cc->errstr);
            instanceLinkCloseConnection(link,link->cc);
        } else {
            link->pending_commands = 0;
            link->cc_conn_time = mstime();
            link->cc->data = link;
            redisAeAttach(server.el,link->cc);
            redisAsyncSetConnectCallback(link->cc,
                    sentinelLinkEstablishedCallback);
            redisAsyncSetDisconnectCallback(link->cc,
                    sentinelDisconnectCallback);
            sentinelSendAuthIfNeeded(ri,link->cc);
            sentinelSetClientName(ri,link->cc,"cmd");

            /* Send a PING ASAP when reconnecting. */
            sentinelSendPing(ri);
        }
    }
    /* Pub / Sub */
    if ((ri->flags & (SRI_MASTER|SRI_SLAVE)) && link->pc == NULL) {
        link->pc = redisAsyncConnectBind(ri->addr->ip,ri->addr->port,NET_FIRST_BIND_ADDR);
        if (link->pc->err) {
            sentinelEvent(LL_DEBUG,"-pubsub-link-reconnection",ri,"%@ #%s",
                link->pc->errstr);
            instanceLinkCloseConnection(link,link->pc);
        } else {
            int retval;

            link->pc_conn_time = mstime();
            link->pc->data = link;
            redisAeAttach(server.el,link->pc);
            redisAsyncSetConnectCallback(link->pc,
                    sentinelLinkEstablishedCallback);
            redisAsyncSetDisconnectCallback(link->pc,
                    sentinelDisconnectCallback);
            sentinelSendAuthIfNeeded(ri,link->pc);
            sentinelSetClientName(ri,link->pc,"pubsub");
            /* Now we subscribe to the Sentinels "Hello" channel. */
            retval = redisAsyncCommand(link->pc,
                sentinelReceiveHelloMessages, ri, "SUBSCRIBE %s",
                    SENTINEL_HELLO_CHANNEL);
            if (retval != C_OK) {
                /* If we can't subscribe, the Pub/Sub connection is useless
                 * and we can simply disconnect it and try again. */
                instanceLinkCloseConnection(link,link->pc);
                return;
            }
        }
    }
    /* Clear the disconnected status only if we have both the connections
     * (or just the commands connection if this is a sentinel instance). */
    if (link->cc && (ri->flags & SRI_SENTINEL || link->pc))
        link->disconnected = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
cmpl $0x0, 0x4(%rax)
jne 0x97cbf
jmp 0x98053
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
cmpl $0x0, 0x8(%rax)
jne 0x97cd2
jmp 0x98053
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x10(%rbp)
callq 0x2ff70
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
subq 0x58(%rcx), %rax
cmpq $0x3e8, %rax            # imm = 0x3E8
jge 0x97d04
jmp 0x98053
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x97e7a
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x20(%rbp)
leaq 0xe0491(%rip), %rax     # 0x1781d8
cmpl $0x0, 0x128(%rax)
je 0x97d64
leaq 0xe0481(%rip), %rax     # 0x1781d8
movq 0xa8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x97d6c
xorl %eax, %eax
movq %rax, -0x30(%rbp)
jmp 0x97d6c
movl -0x20(%rbp), %esi
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rdx
callq 0xa5df0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x0, 0xa0(%rax)
je 0x97dd8
movq -0x8(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0xa8(%rax), %r8
xorl %edi, %edi
leaq 0xae900(%rip), %rsi     # 0x1466b4
leaq 0xae910(%rip), %rcx     # 0x1466cb
movb $0x0, %al
callq 0x94990
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x95940
jmp 0x97e78
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
callq 0x2ff70
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0xb0(%rax)
leaq 0xe03cb(%rip), %rax     # 0x1781d8
movq 0x40(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x98060
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x1eed(%rip), %rsi     # 0x95f40
callq 0xa5eb0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x1ed1(%rip), %rsi     # 0x95f70
callq 0xa5f20
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x97b80
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq 0xae868(%rip), %rdx     # 0x1466d2
callq 0x97c20
movq -0x8(%rbp), %rdi
callq 0x98160
jmp 0x97e7a
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x98024
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x98024
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x34(%rbp)
leaq 0xe0319(%rip), %rax     # 0x1781d8
cmpl $0x0, 0x128(%rax)
je 0x97edc
leaq 0xe0309(%rip), %rax     # 0x1781d8
movq 0xa8(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x97ee4
xorl %eax, %eax
movq %rax, -0x48(%rbp)
jmp 0x97ee4
movl -0x34(%rbp), %esi
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rdx
callq 0xa5df0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
cmpl $0x0, 0xa0(%rax)
je 0x97f50
movq -0x8(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0xa8(%rax), %r8
xorl %edi, %edi
leaq 0xae7aa(%rip), %rsi     # 0x1466d6
leaq 0xae798(%rip), %rcx     # 0x1466cb
movb $0x0, %al
callq 0x94990
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x95940
jmp 0x98022
callq 0x2ff70
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0xb0(%rax)
leaq 0xe025e(%rip), %rax     # 0x1781d8
movq 0x40(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x98060
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x205a(%rip), %rsi     # 0x95f40
callq 0xa5eb0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x203e(%rip), %rsi     # 0x95f70
callq 0xa5f20
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x97b80
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0x9f879(%rip), %rdx     # 0x137850
callq 0x97c20
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x8(%rbp), %rdx
leaq 0x211(%rip), %rsi       # 0x98200
leaq 0xae6fa(%rip), %rcx     # 0x1466f0
leaq 0xae700(%rip), %r8      # 0x1466fd
movb $0x0, %al
callq 0xa6e80
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x98020
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x95940
jmp 0x98053
jmp 0x98022
jmp 0x98024
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x98053
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x98048
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x98053
movq -0x10(%rbp), %rax
movl $0x0, 0x4(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)