// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelFailoverReconfNextSlave
void sentinelFailoverReconfNextSlave(sentinelRedisInstance *master) {
    dictIterator *di;
    dictEntry *de;
    int in_progress = 0;

    di = dictGetIterator(master->slaves);
    while((de = dictNext(di)) != NULL) {
        sentinelRedisInstance *slave = dictGetVal(de);

        if (slave->flags & (SRI_RECONF_SENT|SRI_RECONF_INPROG))
            in_progress++;
    }
    dictReleaseIterator(di);

    di = dictGetIterator(master->slaves);
    while(in_progress < master->parallel_syncs &&
          (de = dictNext(di)) != NULL)
    {
        sentinelRedisInstance *slave = dictGetVal(de);
        int retval;

        /* Skip the promoted slave, and already configured slaves. */
        if (slave->flags & (SRI_PROMOTED|SRI_RECONF_DONE)) continue;

        /* If too much time elapsed without the slave moving forward to
         * the next state, consider it reconfigured even if it is not.
         * Sentinels will detect the slave as misconfigured and fix its
         * configuration later. */
        if ((slave->flags & SRI_RECONF_SENT) &&
            (mstime() - slave->slave_reconf_sent_time) >
            SENTINEL_SLAVE_RECONF_TIMEOUT)
        {
            sentinelEvent(LL_NOTICE,"-slave-reconf-sent-timeout",slave,"%@");
            slave->flags &= ~SRI_RECONF_SENT;
            slave->flags |= SRI_RECONF_DONE;
        }

        /* Nothing to do for instances that are disconnected or already
         * in RECONF_SENT state. */
        if (slave->flags & (SRI_RECONF_SENT|SRI_RECONF_INPROG)) continue;
        if (slave->link->disconnected) continue;

        /* Send SLAVEOF <new master>. */
        retval = sentinelSendSlaveOf(slave,
                master->promoted_slave->addr->ip,
                master->promoted_slave->addr->port);
        if (retval == C_OK) {
            slave->flags |= SRI_RECONF_SENT;
            slave->slave_reconf_sent_time = mstime();
            sentinelEvent(LL_NOTICE,"+slave-reconf-sent",slave,"%@");
            in_progress++;
        }
    }
    dictReleaseIterator(di);

    /* Check if all the slaves are reconfigured and handle timeout. */
    sentinelFailoverDetectEnd(master);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rdi
callq 0x2e400
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x9c401
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0x300, %eax            # imm = 0x300
cmpl $0x0, %eax
je 0x9c3ff
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9c3c7
movq -0x10(%rbp), %rdi
callq 0x2e600
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rdi
callq 0x2e400
movq %rax, -0x10(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x8(%rbp), %rdx
xorl %eax, %eax
cmpl 0x94(%rdx), %ecx
movb %al, -0x35(%rbp)
jge 0x9c449
movq -0x10(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
setne %al
movb %al, -0x35(%rbp)
movb -0x35(%rbp), %al
testb $0x1, %al
jne 0x9c455
jmp 0x9c580
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0x480, %eax            # imm = 0x480
cmpl $0x0, %eax
je 0x9c473
jmp 0x9c41e
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x9c4d5
callq 0x2ff70
movq -0x30(%rbp), %rcx
subq 0xb0(%rcx), %rax
cmpq $0x2710, %rax           # imm = 0x2710
jle 0x9c4d5
movq -0x30(%rbp), %rdx
movl $0x2, %edi
leaq 0xaaf18(%rip), %rsi     # 0x1473c3
leaq 0xa9d5a(%rip), %rcx     # 0x14620c
movb $0x0, %al
callq 0x94990
movq -0x30(%rbp), %rax
movl (%rax), %ecx
andl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movl (%rax), %ecx
orl $0x400, %ecx            # imm = 0x400
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0x300, %eax            # imm = 0x300
cmpl $0x0, %eax
je 0x9c4ea
jmp 0x9c41e
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
cmpl $0x0, 0x4(%rax)
je 0x9c4fd
jmp 0x9c41e
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x118(%rax), %rax
movq 0x20(%rax), %rax
movq (%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x118(%rax), %rax
movq 0x20(%rax), %rax
movl 0x8(%rax), %edx
callq 0x98fc0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x9c57b
movq -0x30(%rbp), %rax
movl (%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, (%rax)
callq 0x2ff70
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0xb0(%rax)
movq -0x30(%rbp), %rdx
movl $0x2, %edi
leaq 0xaae7a(%rip), %rsi     # 0x1473de
leaq 0xa9ca1(%rip), %rcx     # 0x14620c
movb $0x0, %al
callq 0x94990
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9c41e
movq -0x10(%rbp), %rdi
callq 0x2e600
movq -0x8(%rbp), %rdi
callq 0x9c180
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)