// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelAskMasterStateToOtherSentinels
void sentinelAskMasterStateToOtherSentinels(sentinelRedisInstance *master, int flags) {
    dictIterator *di;
    dictEntry *de;

    di = dictGetIterator(master->sentinels);
    while((de = dictNext(di)) != NULL) {
        sentinelRedisInstance *ri = dictGetVal(de);
        mstime_t elapsed = mstime() - ri->last_master_down_reply_time;
        char port[32];
        int retval;

        /* If the master state from other sentinel is too old, we clear it. */
        if (elapsed > SENTINEL_ASK_PERIOD*5) {
            ri->flags &= ~SRI_MASTER_DOWN;
            sdsfree(ri->leader);
            ri->leader = NULL;
        }

        /* Only ask if master is down to other sentinels if:
         *
         * 1) We believe it is down, or there is a failover in progress.
         * 2) Sentinel is connected.
         * 3) We did not received the info within SENTINEL_ASK_PERIOD ms. */
        if ((master->flags & SRI_S_DOWN) == 0) continue;
        if (ri->link->disconnected) continue;
        if (!(flags & SENTINEL_ASK_FORCED) &&
            mstime() - ri->last_master_down_reply_time < SENTINEL_ASK_PERIOD)
            continue;

        /* Ask */
        ll2string(port,sizeof(port),master->addr->port);
        retval = redisAsyncCommand(ri->link->cc,
                    sentinelReceiveIsMasterDownReply, ri,
                    "SENTINEL is-master-down-by-addr %s %s %llu %s",
                    master->addr->ip, port,
                    sentinel.current_epoch,
                    (master->failover_state > SENTINEL_FAILOVER_STATE_NONE) ?
                    sentinel.myid : "*");
        if (retval == C_OK) ri->link->pending_commands++;
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebx
movq %rdi, %r14
movq 0x80(%rdi), %rdi
callq 0x2efbb
movq %rax, %r15
movq %rax, %rdi
callq 0x2f015
testq %rax, %rax
je 0x7b745
movq %rsp, %r12
leaq 0x51e03(%rip), %rbp     # 0xcd46c
movq 0x8(%rax), %r13
callq 0x2ffce
subq 0x40(%r13), %rax
cmpq $0x1389, %rax           # imm = 0x1389
jl 0x7b69a
andb $-0x21, (%r13)
movq 0xd8(%r13), %rdi
callq 0x36330
movq $0x0, 0xd8(%r13)
testb $0x8, (%r14)
je 0x7b734
movq 0x28(%r13), %rax
cmpl $0x0, 0x4(%rax)
jne 0x7b734
testb $0x1, %bl
jne 0x7b6c8
callq 0x2ffce
subq 0x40(%r13), %rax
cmpq $0x3e8, %rax            # imm = 0x3E8
jl 0x7b734
movq 0x20(%r14), %rax
movslq 0x8(%rax), %rdx
movl $0x20, %esi
movq %r12, %rdi
callq 0x3ff83
movq 0x28(%r13), %rax
movq 0x10(%rax), %rdi
movq 0x20(%r14), %rax
cmpl $0x0, 0xf0(%r14)
movq (%rax), %r8
leaq 0x41500(%rip), %r10     # 0xbcbfb
leaq 0x9afd6(%rip), %rax     # 0x1166d8
cmovgq %rax, %r10
leaq -0x1f6(%rip), %rsi      # 0x7b517
movq %r13, %rdx
movq %rbp, %rcx
movq %r12, %r9
xorl %eax, %eax
pushq %r10
pushq 0x9afe8(%rip)           # 0x116708
callq 0x82c47
addq $0x10, %rsp
testl %eax, %eax
jne 0x7b734
movq 0x28(%r13), %rax
incl 0x8(%rax)
movq %r15, %rdi
callq 0x2f015
testq %rax, %rax
jne 0x7b669
movq %r15, %rdi
callq 0x2f0dd
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq