// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelFailoverWaitStart
void sentinelFailoverWaitStart(sentinelRedisInstance *ri) {
    char *leader;
    int isleader;

    /* Check if we are the leader for the failover epoch. */
    leader = sentinelGetLeader(ri, ri->failover_epoch);
    isleader = leader && strcasecmp(leader,sentinel.myid) == 0;
    sdsfree(leader);

    /* If I'm not the leader, and it is not a forced failover via
     * SENTINEL FAILOVER, then I can't continue with the failover. */
    if (!isleader && !(ri->flags & SRI_FORCE_FAILOVER)) {
        int election_timeout = SENTINEL_ELECTION_TIMEOUT;

        /* The election timeout is the MIN between SENTINEL_ELECTION_TIMEOUT
         * and the configured failover timeout. */
        if (election_timeout > ri->failover_timeout)
            election_timeout = ri->failover_timeout;
        /* Abort the failover if I'm not the leader after some time. */
        if (mstime() - ri->failover_start_time > election_timeout) {
            sentinelEvent(LL_WARNING,"-failover-abort-not-elected",ri,"%@");
            sentinelAbortFailover(ri);
        }
        return;
    }
    sentinelEvent(LL_WARNING,"+elected-leader",ri,"%@");
    if (sentinel.simfailure_flags & SENTINEL_SIMFAILURE_CRASH_AFTER_ELECTION)
        sentinelSimFailureCrash();
    ri->failover_state = SENTINEL_FAILOVER_STATE_SELECT_SLAVE;
    ri->failover_state_change_time = mstime();
    sentinelEvent(LL_WARNING,"+failover-state-select-slave",ri,"%@");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0xe8(%rax), %rsi
callq 0x9b890
movq %rax, -0x10(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x10(%rbp)
movb %al, -0x19(%rbp)
je 0x9bd79
movq -0x10(%rbp), %rdi
leaq 0xf129d(%rip), %rsi     # 0x18d008
callq 0x26300
cmpl $0x0, %eax
sete %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x38620
cmpl $0x0, -0x14(%rbp)
jne 0x9be0b
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x9be0b
movl $0x2710, -0x18(%rbp)    # imm = 0x2710
movslq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x108(%rcx), %rax
jle 0x9bdc9
movq -0x8(%rbp), %rax
movq 0x108(%rax), %rax
movl %eax, -0x18(%rbp)
callq 0x2ff70
movq -0x8(%rbp), %rcx
subq 0x100(%rcx), %rax
movslq -0x18(%rbp), %rcx
cmpq %rcx, %rax
jle 0x9be09
movq -0x8(%rbp), %rdx
movl $0x3, %edi
leaq 0xab4bc(%rip), %rsi     # 0x1472ae
leaq 0xaa413(%rip), %rcx     # 0x14620c
movb $0x0, %al
callq 0x94990
movq -0x8(%rbp), %rdi
callq 0x9be90
jmp 0x9be7e
movq -0x8(%rbp), %rdx
movl $0x3, %edi
leaq 0xab4af(%rip), %rsi     # 0x1472ca
leaq 0xaa3ea(%rip), %rcx     # 0x14620c
movb $0x0, %al
callq 0x94990
movq 0xf1248(%rip), %rax     # 0x18d078
andq $0x1, %rax
cmpq $0x0, %rax
je 0x9be3f
callq 0x98f10
movq -0x8(%rbp), %rax
movl $0x2, 0xf0(%rax)
callq 0x2ff70
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xf8(%rax)
movq -0x8(%rbp), %rdx
movl $0x3, %edi
leaq 0xab46a(%rip), %rsi     # 0x1472da
leaq 0xaa395(%rip), %rcx     # 0x14620c
movb $0x0, %al
callq 0x94990
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)