// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x320bb
movq %rax, %r15
movq %rax, %rdi
callq 0x32116
testq %rax, %rax
je 0x7f225
movq %rsp, %r12
leaq 0x51223(%rip), %rbp     # 0xd036c
movq 0x8(%rax), %r13
callq 0x330c8
subq 0x40(%r13), %rax
cmpq $0x1389, %rax           # imm = 0x1389
jl 0x7f17a
andb $-0x21, (%r13)
movq 0xd8(%r13), %rdi
callq 0x392b6
movq $0x0, 0xd8(%r13)
testb $0x8, (%r14)
je 0x7f214
movq 0x28(%r13), %rax
cmpl $0x0, 0x4(%rax)
jne 0x7f214
testb $0x1, %bl
jne 0x7f1a8
callq 0x330c8
subq 0x40(%r13), %rax
cmpq $0x3e8, %rax            # imm = 0x3E8
jl 0x7f214
movq 0x20(%r14), %rax
movslq 0x8(%rax), %rdx
movl $0x20, %esi
movq %r12, %rdi
callq 0x433e5
movq 0x28(%r13), %rax
movq 0x10(%rax), %rdi
movq 0x20(%r14), %rax
cmpl $0x0, 0xf0(%r14)
movq (%rax), %r8
leaq 0x409ae(%rip), %r10     # 0xbfb89
leaq 0x9c496(%rip), %rax     # 0x11b678
cmovgq %rax, %r10
leaq -0x1fb(%rip), %rsi      # 0x7eff2
movq %r13, %rdx
movq %rbp, %rcx
movq %r12, %r9
xorl %eax, %eax
pushq %r10
pushq 0x9c4a8(%rip)           # 0x11b6a8
callq 0x867a1
addq $0x10, %rsp
testl %eax, %eax
jne 0x7f214
movq 0x28(%r13), %rax
incl 0x8(%rax)
movq %r15, %rdi
callq 0x32116
testq %rax, %rax
jne 0x7f149
movq %r15, %rdi
callq 0x321d3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq