LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelSendPing
int sentinelSendPing(sentinelRedisInstance *ri) {
    int retval = redisAsyncCommand(ri->link->cc,
        sentinelPingReplyCallback, ri, "PING");
    if (retval == C_OK) {
        ri->link->pending_commands++;
        ri->link->last_ping_time = mstime();
        /* We update the active ping time only if we received the pong for
         * the previous ping, otherwise we are technically waiting since the
         * first ping that did not received a reply. */
        if (ri->link->act_ping_time == 0)
            ri->link->act_ping_time = ri->link->last_ping_time;
        return 1;
    } else {
        return 0;
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x28(%rdi), %rax
movq 0x10(%rax), %rdi
leaq 0xa71(%rip), %rsi       # 0x6d538
leaq 0x46cf3(%rip), %rcx     # 0xb37c1
xorl %ebp, %ebp
movq %rbx, %rdx
xorl %eax, %eax
callq 0x7597e
testl %eax, %eax
jne 0x6cb00
movq 0x28(%rbx), %rax
incl 0x8(%rax)
callq 0x2b8ae
movq 0x28(%rbx), %rcx
movq %rax, 0x48(%rcx)
pushq $0x1
popq %rbp
cmpq $0x0, 0x40(%rcx)
jne 0x6cb00
movq %rax, 0x40(%rcx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelReceiveHelloMessages
void sentinelReceiveHelloMessages(redisAsyncContext *c, void *reply, void *privdata) {
    sentinelRedisInstance *ri = privdata;
    redisReply *r;
    UNUSED(c);

    if (!reply || !ri) return;
    r = reply;

    /* Update the last activity in the pubsub channel. Note that since we
     * receive our messages as well this timestamp can be used to detect
     * if the link is probably disconnected even if it seems otherwise. */
    ri->link->pc_last_activity = mstime();

    /* Sanity check in the reply we expect, so that the code that follows
     * can avoid to check for details. */
    if (r->type != REDIS_REPLY_ARRAY ||
        r->elements != 3 ||
        r->element[0]->type != REDIS_REPLY_STRING ||
        r->element[1]->type != REDIS_REPLY_STRING ||
        r->element[2]->type != REDIS_REPLY_STRING ||
        strcmp(r->element[0]->str,"message") != 0) return;

    /* We are not interested in meeting ourselves */
    if (strstr(r->element[2]->str,sentinel.myid) != NULL) return;

    sentinelProcessHelloMessage(r->element[2]->str, r->element[2]->len);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
jne 0x6cb87
movq %rdx, %r14
movq %rsi, %rbx
callq 0x2b8ae
movq 0x28(%r14), %rcx
movq %rax, 0x30(%rcx)
cmpl $0x2, (%rbx)
jne 0x6cb87
cmpq $0x3, 0x20(%rbx)
jne 0x6cb87
movq 0x28(%rbx), %rcx
movq (%rcx), %rax
cmpl $0x1, (%rax)
jne 0x6cb87
movq 0x8(%rcx), %rdx
cmpl $0x1, (%rdx)
jne 0x6cb87
movq 0x10(%rcx), %r14
cmpl $0x1, (%r14)
jne 0x6cb87
movq 0x18(%rax), %rdi
leaq 0x50f1d(%rip), %rsi     # 0xbda83
callq 0x268f0
testl %eax, %eax
jne 0x6cb87
movq 0x18(%r14), %rbx
leaq 0xa1b5e(%rip), %rsi     # 0x10e6d8
movq %rbx, %rdi
callq 0x266b0
testq %rax, %rax
je 0x6cb8f
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl 0x10(%r14), %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6d657
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelMasterLooksSane
int sentinelMasterLooksSane(sentinelRedisInstance *master) {
    return
        master->flags & SRI_MASTER &&
        master->role_reported == SRI_MASTER &&
        (master->flags & (SRI_S_DOWN|SRI_O_DOWN)) == 0 &&
        (mstime() - master->info_refresh) < SENTINEL_INFO_PERIOD*2;
}

// Assembly:
movl (%rdi), %ecx
xorl %eax, %eax
testb $0x1, %cl
je 0x6cbd3
testb $0x18, %cl
jne 0x6cbd3
pushq %rbx
movq %rdi, %rbx
cmpl $0x1, 0x68(%rdi)
jne 0x6cbd2
callq 0x2b8ae
movq %rax, %rcx
subq 0x60(%rbx), %rcx
xorl %eax, %eax
cmpq $0x4e20, %rcx           # imm = 0x4E20
setl %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelForceHelloUpdateForMaster
int sentinelForceHelloUpdateForMaster(sentinelRedisInstance *master) {
    if (!(master->flags & SRI_MASTER)) return C_ERR;
    if (master->last_pub_time >= (SENTINEL_PUBLISH_PERIOD+1))
        master->last_pub_time -= (SENTINEL_PUBLISH_PERIOD+1);
    sentinelForceHelloUpdateDictOfRedisInstances(master->sentinels);
    sentinelForceHelloUpdateDictOfRedisInstances(master->slaves);
    return C_OK;
}

// Assembly:
testb $0x1, (%rdi)
jne 0x6d3b7
pushq $-0x1
popq %rax
retq
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rax
cmpq $0x7d1, %rax            # imm = 0x7D1
jl 0x6d3d1
addq $-0x7d1, %rax           # imm = 0xF82F
movq %rax, 0x30(%rbx)
movq 0x80(%rbx), %rdi
callq 0x6da5b
movq 0x88(%rbx), %rdi
callq 0x6da5b
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelInfoReplyCallback
void sentinelInfoReplyCallback(redisAsyncContext *c, void *reply, void *privdata) {
    sentinelRedisInstance *ri = privdata;
    instanceLink *link = c->data;
    redisReply *r;

    if (!reply || !link) return;
    link->pending_commands--;
    r = reply;

    if (r->type == REDIS_REPLY_STRING)
        sentinelRefreshInstanceInfo(ri,r->str);
}

// Assembly:
movq 0xb0(%rdi), %rax
testq %rsi, %rsi
setne %cl
testq %rax, %rax
setne %dil
andb %cl, %dil
cmpb $0x1, %dil
jne 0x6d537
decl 0x8(%rax)
cmpl $0x1, (%rsi)
jne 0x6d537
movq 0x18(%rsi), %rsi
movq %rdx, %rdi
jmp 0x6cbd4
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelPingReplyCallback
void sentinelPingReplyCallback(redisAsyncContext *c, void *reply, void *privdata) {
    sentinelRedisInstance *ri = privdata;
    instanceLink *link = c->data;
    redisReply *r;

    if (!reply || !link) return;
    link->pending_commands--;
    r = reply;

    if (r->type == REDIS_REPLY_STATUS ||
        r->type == REDIS_REPLY_ERROR) {
        /* Update the "instance available" field only if this is an
         * acceptable reply. */
        if (strncmp(r->str,"PONG",4) == 0 ||
            strncmp(r->str,"LOADING",7) == 0 ||
            strncmp(r->str,"MASTERDOWN",10) == 0)
        {
            link->last_avail_time = mstime();
            link->act_ping_time = 0; /* Flag the pong as received. */
        } else {
            /* Send a SCRIPT KILL command if the instance appears to be
             * down because of a busy script. */
            if (strncmp(r->str,"BUSY",4) == 0 &&
                (ri->flags & SRI_S_DOWN) &&
                !(ri->flags & SRI_SCRIPT_KILL_SENT))
            {
                if (redisAsyncCommand(ri->link->cc,
                        sentinelDiscardReplyCallback, ri,
                        "SCRIPT KILL") == C_OK)
                    ri->link->pending_commands++;
                ri->flags |= SRI_SCRIPT_KILL_SENT;
            }
        }
    }
    link->last_pong_time = mstime();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0xb0(%rdi), %r15
testq %rsi, %rsi
setne %al
testq %r15, %r15
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x6d620
decl 0x8(%r15)
movl (%rsi), %eax
addl $-0x5, %eax
cmpl $0x1, %eax
ja 0x6d617
movq %rdx, %rbx
movq 0x18(%rsi), %r14
leaq 0x50225(%rip), %rsi     # 0xbd7a0
pushq $0x4
popq %rdx
movq %r14, %rdi
callq 0x26350
testl %eax, %eax
je 0x6d609
leaq 0x50214(%rip), %rsi     # 0xbd7a5
pushq $0x7
popq %rdx
movq %r14, %rdi
callq 0x26350
testl %eax, %eax
je 0x6d609
leaq 0x50206(%rip), %rsi     # 0xbd7ad
pushq $0xa
popq %rdx
movq %r14, %rdi
callq 0x26350
testl %eax, %eax
je 0x6d609
leaq 0x501fb(%rip), %rsi     # 0xbd7b8
pushq $0x4
popq %rdx
movq %r14, %rdi
callq 0x26350
testl %eax, %eax
jne 0x6d617
movl $0x1008, %eax           # imm = 0x1008
andl (%rbx), %eax
cmpl $0x8, %eax
jne 0x6d617
movq 0x28(%rbx), %rax
movq 0x10(%rax), %rdi
leaq -0x233c(%rip), %rsi     # 0x6b2ab
leaq 0x501cf(%rip), %rcx     # 0xbd7bd
movq %rbx, %rdx
xorl %eax, %eax
callq 0x7597e
testl %eax, %eax
jne 0x6d603
movq 0x28(%rbx), %rax
incl 0x8(%rax)
orb $0x10, 0x1(%rbx)
jmp 0x6d617
callq 0x2b8ae
movq %rax, 0x38(%r15)
andq $0x0, 0x40(%r15)
callq 0x2b8ae
movq %rax, 0x50(%r15)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelPublishReplyCallback
void sentinelPublishReplyCallback(redisAsyncContext *c, void *reply, void *privdata) {
    sentinelRedisInstance *ri = privdata;
    instanceLink *link = c->data;
    redisReply *r;

    if (!reply || !link) return;
    link->pending_commands--;
    r = reply;

    /* Only update pub_time if we actually published our message. Otherwise
     * we'll retry again in 100 milliseconds. */
    if (r->type != REDIS_REPLY_ERROR)
        ri->last_pub_time = mstime();
}

// Assembly:
pushq %rbx
movq %rdx, %rbx
movq 0xb0(%rdi), %rax
testq %rsi, %rsi
setne %cl
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x6d655
decl 0x8(%rax)
cmpl $0x6, (%rsi)
je 0x6d655
callq 0x2b8ae
movq %rax, 0x30(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelSendHello
int sentinelSendHello(sentinelRedisInstance *ri) {
    char ip[NET_IP_STR_LEN];
    char payload[NET_IP_STR_LEN+1024];
    int retval;
    char *announce_ip;
    int announce_port;
    sentinelRedisInstance *master = (ri->flags & SRI_MASTER) ? ri : ri->master;
    sentinelAddr *master_addr = sentinelGetCurrentMasterAddress(master);

    if (ri->link->disconnected) return C_ERR;

    /* Use the specified announce address if specified, otherwise try to
     * obtain our own IP address. */
    if (sentinel.announce_ip) {
        announce_ip = sentinel.announce_ip;
    } else {
        if (anetSockName(ri->link->cc->c.fd,ip,sizeof(ip),NULL) == -1)
            return C_ERR;
        announce_ip = ip;
    }
    announce_port = sentinel.announce_port ?
                    sentinel.announce_port : server.port;

    /* Format and send the Hello message. */
    snprintf(payload,sizeof(payload),
        "%s,%d,%s,%llu," /* Info about this sentinel. */
        "%s,%s,%d,%llu", /* Info about current master. */
        announce_ip, announce_port, sentinel.myid,
        (unsigned long long) sentinel.current_epoch,
        /* --- */
        master->name,master_addr->ip,master_addr->port,
        (unsigned long long) master->config_epoch);
    retval = redisAsyncCommand(ri->link->cc,
        sentinelPublishReplyCallback, ri, "PUBLISH %s %s",
            SENTINEL_HELLO_CHANNEL,payload);
    if (retval != C_OK) return C_ERR;
    ri->link->pending_commands++;
    return C_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x468, %rsp            # imm = 0x468
movq %rdi, %rbx
testb $0x1, (%rdi)
movq %rdi, %r14
jne 0x6d967
movq 0xb8(%rbx), %r14
movq %r14, %rdi
callq 0x6bcc0
movq %rax, %r15
movq 0x28(%rbx), %rax
pushq $-0x1
popq %rbp
cmpl $0x0, 0x4(%rax)
jne 0x6da47
movq 0xa0dae(%rip), %r12     # 0x10e738
testq %r12, %r12
jne 0x6d9b2
movq 0x10(%rax), %rax
movl 0x84(%rax), %edi
movq %rsp, %r12
pushq $0x2e
popq %rdx
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x29f34
cmpl $-0x1, %eax
je 0x6da47
leaq 0xa0d1f(%rip), %r9      # 0x10e6d8
movl 0xa0d80(%rip), %r8d     # 0x10e740
testl %r8d, %r8d
jne 0x6d9d3
leaq 0x8bedc(%rip), %rax     # 0xf98a8
movl 0xa0(%rax), %r8d
movl 0x8(%r15), %r10d
subq $0x8, %rsp
leaq 0x4fe76(%rip), %rdx     # 0xbd858
leaq 0x38(%rsp), %r13
movl $0x42e, %esi            # imm = 0x42E
movq %r13, %rdi
movq %r12, %rcx
xorl %eax, %eax
pushq 0x18(%r14)
pushq %r10
pushq (%r15)
pushq 0x8(%r14)
pushq 0xa0d01(%rip)           # 0x10e708
callq 0x26120
addq $0x30, %rsp
movq 0x28(%rbx), %rax
movq 0x10(%rax), %rdi
leaq -0x3f9(%rip), %rsi      # 0x6d626
leaq 0x4fe4e(%rip), %rcx     # 0xbd874
leaq 0x4fc10(%rip), %r8      # 0xbd63d
movq %rbx, %rdx
movq %r13, %r9
xorl %eax, %eax
callq 0x7597e
testl %eax, %eax
jne 0x6da47
movq 0x28(%rbx), %rax
incl 0x8(%rax)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelForceHelloUpdateDictOfRedisInstances
void sentinelForceHelloUpdateDictOfRedisInstances(dict *instances) {
    dictIterator *di;
    dictEntry *de;

    di = dictGetSafeIterator(instances);
    while((de = dictNext(di)) != NULL) {
        sentinelRedisInstance *ri = dictGetVal(de);
        if (ri->last_pub_time >= (SENTINEL_PUBLISH_PERIOD+1))
            ri->last_pub_time -= (SENTINEL_PUBLISH_PERIOD+1);
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %rbx
callq 0x2a9c4
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x6da8f
movq 0x8(%rax), %rax
movq 0x30(%rax), %rcx
cmpq $0x7d1, %rcx            # imm = 0x7D1
jl 0x6da64
addq $-0x7d1, %rcx           # imm = 0xF82F
movq %rcx, 0x30(%rax)
jmp 0x6da64
movq %rbx, %rdi
popq %rbx
jmp 0x2aa94
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: addReplyDictOfRedisInstances
void addReplyDictOfRedisInstances(client *c, dict *instances) {
    dictIterator *di;
    dictEntry *de;

    di = dictGetIterator(instances);
    addReplyMultiBulkLen(c,dictSize(instances));
    while((de = dictNext(di)) != NULL) {
        sentinelRedisInstance *ri = dictGetVal(de);

        addReplySentinelRedisInstance(c,ri);
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2a99f
movq %rax, %r14
movq 0x48(%r15), %rsi
addq 0x28(%r15), %rsi
movq %rbx, %rdi
callq 0x370d9
movq %r14, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x6e28a
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x6dba7
jmp 0x6e26f
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2aa94
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelIsQuorumReachable
int sentinelIsQuorumReachable(sentinelRedisInstance *master, int *usableptr) {
    dictIterator *di;
    dictEntry *de;
    int usable = 1; /* Number of usable Sentinels. Init to 1 to count myself. */
    int result = SENTINEL_ISQR_OK;
    int voters = dictSize(master->sentinels)+1; /* Known Sentinels + myself. */

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

        if (ri->flags & (SRI_S_DOWN|SRI_O_DOWN)) continue;
        usable++;
    }
    dictReleaseIterator(di);

    if (usable < (int)master->quorum) result |= SENTINEL_ISQR_NOQUORUM;
    if (usable < voters/2+1) result |= SENTINEL_ISQR_NOAUTH;
    if (usableptr) *usableptr = usable;
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x80(%rdi), %rdi
movq 0x28(%rdi), %r12
movq 0x48(%rdi), %r13
callq 0x2a99f
movq %rax, %r15
pushq $0x1
popq %rbp
movq %r15, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x6e317
movq 0x8(%rax), %rax
movb (%rax), %al
andb $0x18, %al
cmpb $0x1, %al
adcl $0x0, %ebp
jmp 0x6e2fb
movq %r15, %rdi
callq 0x2aa94
movl 0x90(%r14), %ecx
testq %rbx, %rbx
je 0x6e32d
movl %ebp, (%rbx)
leal (%r12,%r13), %eax
incl %eax
pushq $0x2
popq %rsi
cltd
idivl %esi
xorl %edx, %edx
cmpl %ecx, %ebp
setl %dl
leal 0x2(%rdx), %ecx
cmpl %eax, %ebp
cmovgl %edx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelVoteLeader
char *sentinelVoteLeader(sentinelRedisInstance *master, uint64_t req_epoch, char *req_runid, uint64_t *leader_epoch) {
    if (req_epoch > sentinel.current_epoch) {
        sentinel.current_epoch = req_epoch;
        sentinelFlushConfig();
        sentinelEvent(LL_WARNING,"+new-epoch",master,"%llu",
            (unsigned long long) sentinel.current_epoch);
    }

    if (master->leader_epoch < req_epoch && sentinel.current_epoch <= req_epoch)
    {
        sdsfree(master->leader);
        master->leader = sdsnew(req_runid);
        master->leader_epoch = sentinel.current_epoch;
        sentinelFlushConfig();
        sentinelEvent(LL_WARNING,"+vote-for-leader",master,"%s %llu",
            master->leader, (unsigned long long) master->leader_epoch);
        /* If we did not voted for ourselves, set the master failover start
         * time to now, in order to force a delay before we can start a
         * failover for the same master. */
        if (strcasecmp(master->leader,sentinel.myid))
            master->failover_start_time = mstime()+rand()%SENTINEL_MAX_DESYNC;
    }

    *leader_epoch = master->leader_epoch;
    return master->leader ? sdsnew(master->leader) : NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movq 0xa0394(%rip), %rax     # 0x10e708
cmpq %rsi, %rax
jae 0x6e3ae
movq %r12, 0xa0388(%rip)     # 0x10e708
callq 0x6a604
movq 0xa037c(%rip), %r8      # 0x10e708
leaq 0x4f488(%rip), %rsi     # 0xbd81b
leaq 0x4ad37(%rip), %rcx     # 0xb90d1
pushq $0x3
popq %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x6a7bb
movq 0xa035a(%rip), %rax     # 0x10e708
cmpq %r12, 0xe0(%r14)
jae 0x6e457
cmpq %r12, %rax
ja 0x6e457
movq 0xd8(%r14), %rdi
callq 0x311c8
movq %r15, %rdi
callq 0x3115a
movq %rax, 0xd8(%r14)
leaq 0xa02f2(%rip), %r15     # 0x10e6d8
movq 0xa031b(%rip), %rax     # 0x10e708
movq %rax, 0xe0(%r14)
callq 0x6a604
movq 0xd8(%r14), %r8
movq 0xe0(%r14), %r9
leaq 0x4fd0c(%rip), %rsi     # 0xbe11a
leaq 0x4f0b4(%rip), %rcx     # 0xbd4c9
pushq $0x3
popq %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x6a7bb
movq 0xd8(%r14), %rdi
movq %r15, %rsi
callq 0x262f0
testl %eax, %eax
je 0x6e457
callq 0x2b8ae
movq %rax, %r15
callq 0x26b70
movl $0x3e8, %ecx            # imm = 0x3E8
cltd
idivl %ecx
movslq %edx, %rax
addq %r15, %rax
movq %rax, 0x100(%r14)
movq 0xe0(%r14), %rax
movq %rax, (%rbx)
movq 0xd8(%r14), %rdi
testq %rdi, %rdi
je 0x6e47d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3115a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelStartFailover
void sentinelStartFailover(sentinelRedisInstance *master) {
    serverAssert(master->flags & SRI_MASTER);

    master->failover_state = SENTINEL_FAILOVER_STATE_WAIT_START;
    master->flags |= SRI_FAILOVER_IN_PROGRESS;
    master->failover_epoch = ++sentinel.current_epoch;
    sentinelEvent(LL_WARNING,"+new-epoch",master,"%llu",
        (unsigned long long) sentinel.current_epoch);
    sentinelEvent(LL_WARNING,"+try-failover",master,"%@");
    master->failover_start_time = mstime()+rand()%SENTINEL_MAX_DESYNC;
    master->failover_state_change_time = mstime();
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl (%rdi), %eax
testb $0x1, %al
je 0x6e65b
movq %rdi, %rbx
movl $0x1, 0xf0(%rdi)
orl $0x40, %eax
movl %eax, (%rdi)
movq 0xa0128(%rip), %r8      # 0x10e708
incq %r8
movq %r8, 0xa011e(%rip)      # 0x10e708
movq %r8, 0xe8(%rdi)
leaq 0x4f223(%rip), %rsi     # 0xbd81b
leaq 0x4aad2(%rip), %rcx     # 0xb90d1
pushq $0x3
popq %rbp
movl %ebp, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6a7bb
leaq 0x4fb90(%rip), %rsi     # 0xbe1a5
leaq 0x4eb30(%rip), %rcx     # 0xbd14c
movl %ebp, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6a7bb
callq 0x2b8ae
movq %rax, %r14
callq 0x26b70
movl $0x3e8, %ecx            # imm = 0x3E8
cltd
idivl %ecx
movslq %edx, %rax
addq %r14, %rax
movq %rax, 0x100(%rbx)
callq 0x2b8ae
movq %rax, 0xf8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x4fb28(%rip), %rdi     # 0xbe18a
leaq 0x4e833(%rip), %rsi     # 0xbce9c
movl $0xed5, %edx            # imm = 0xED5
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelCheckObjectivelyDown
void sentinelCheckObjectivelyDown(sentinelRedisInstance *master) {
    dictIterator *di;
    dictEntry *de;
    unsigned int quorum = 0, odown = 0;

    if (master->flags & SRI_S_DOWN) {
        /* Is down for enough sentinels? */
        quorum = 1; /* the current sentinel. */
        /* Count all the other sentinels. */
        di = dictGetIterator(master->sentinels);
        while((de = dictNext(di)) != NULL) {
            sentinelRedisInstance *ri = dictGetVal(de);

            if (ri->flags & SRI_MASTER_DOWN) quorum++;
        }
        dictReleaseIterator(di);
        if (quorum >= master->quorum) odown = 1;
    }

    /* Set the flag accordingly to the outcome. */
    if (odown) {
        if ((master->flags & SRI_O_DOWN) == 0) {
            sentinelEvent(LL_WARNING,"+odown",master,"%@ #quorum %d/%d",
                quorum, master->quorum);
            master->flags |= SRI_O_DOWN;
            master->o_down_since_time = mstime();
        }
    } else {
        if (master->flags & SRI_O_DOWN) {
            sentinelEvent(LL_WARNING,"-odown",master,"%@");
            master->flags &= ~SRI_O_DOWN;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %eax
testb $0x8, %al
je 0x6eb3f
movq 0x80(%rbx), %rdi
callq 0x2a99f
movq %rax, %r14
pushq $0x1
popq %rbp
movq %r14, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x6eb29
movq 0x8(%rax), %rax
btl $0x5, (%rax)
adcl $0x0, %ebp
jmp 0x6eb0f
movq %r14, %rdi
callq 0x2aa94
movl (%rbx), %eax
movl 0x90(%rbx), %r9d
cmpl %r9d, %ebp
jae 0x6eb63
testb $0x10, %al
je 0x6eb91
leaq 0x4f552(%rip), %rsi     # 0xbe09c
leaq 0x4e5fb(%rip), %rcx     # 0xbd14c
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6a7bb
andb $-0x11, (%rbx)
jmp 0x6eb91
testb $0x10, %al
jne 0x6eb91
leaq 0x4f516(%rip), %rsi     # 0xbe084
leaq 0x4f516(%rip), %rcx     # 0xbe08b
pushq $0x3
popq %rdi
movq %rbx, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x6a7bb
orb $0x10, (%rbx)
callq 0x2b8ae
movq %rax, 0x50(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelReceiveIsMasterDownReply
void sentinelReceiveIsMasterDownReply(redisAsyncContext *c, void *reply, void *privdata) {
    sentinelRedisInstance *ri = privdata;
    instanceLink *link = c->data;
    redisReply *r;

    if (!reply || !link) return;
    link->pending_commands--;
    r = reply;

    /* Ignore every error or unexpected reply.
     * Note that if the command returns an error for any reason we'll
     * end clearing the SRI_MASTER_DOWN flag for timeout anyway. */
    if (r->type == REDIS_REPLY_ARRAY && r->elements == 3 &&
        r->element[0]->type == REDIS_REPLY_INTEGER &&
        r->element[1]->type == REDIS_REPLY_STRING &&
        r->element[2]->type == REDIS_REPLY_INTEGER)
    {
        ri->last_master_down_reply_time = mstime();
        if (r->element[0]->integer == 1) {
            ri->flags |= SRI_MASTER_DOWN;
        } else {
            ri->flags &= ~SRI_MASTER_DOWN;
        }
        if (strcmp(r->element[1]->str,"*")) {
            /* If the runid in the reply is not "*" the Sentinel actually
             * replied with a vote. */
            sdsfree(ri->leader);
            if ((long long)ri->leader_epoch != r->element[2]->integer)
                serverLog(LL_WARNING,
                    "%s voted for %s %llu", ri->name,
                    r->element[1]->str,
                    (unsigned long long) r->element[2]->integer);
            ri->leader = sdsnew(r->element[1]->str);
            ri->leader_epoch = r->element[2]->integer;
        }
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq 0xb0(%rdi), %rax
testq %rsi, %rsi
setne %cl
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x6eca1
movq %rsi, %r14
decl 0x8(%rax)
cmpl $0x2, (%rsi)
jne 0x6eca1
cmpq $0x3, 0x20(%r14)
jne 0x6eca1
movq 0x28(%r14), %rax
movq (%rax), %rcx
cmpl $0x3, (%rcx)
jne 0x6eca1
movq 0x8(%rax), %rcx
cmpl $0x1, (%rcx)
jne 0x6eca1
movq 0x10(%rax), %rax
cmpl $0x3, (%rax)
jne 0x6eca1
callq 0x2b8ae
movq %rax, 0x40(%rbx)
movq 0x28(%r14), %rax
movq (%rax), %rcx
xorl %edx, %edx
cmpq $0x1, 0x8(%rcx)
sete %dl
movl (%rbx), %ecx
andl $-0x21, %ecx
shll $0x5, %edx
orl %ecx, %edx
movl %edx, (%rbx)
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpb $0x2a, (%rax)
jne 0x6ec38
cmpb $0x0, 0x1(%rax)
je 0x6eca1
movq 0xd8(%rbx), %rdi
callq 0x311c8
movq 0x28(%r14), %rax
movq 0x10(%rax), %rcx
movq 0x8(%rcx), %r8
cmpq %r8, 0xe0(%rbx)
je 0x6ec7a
movq 0x8(%rbx), %rdx
movq 0x8(%rax), %rax
movq 0x18(%rax), %rcx
leaq 0x4f437(%rip), %rsi     # 0xbe0a3
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x2b699
movq 0x28(%r14), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x3115a
movq %rax, 0xd8(%rbx)
movq 0x28(%r14), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0xe0(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x2a99f
movq %rax, %r15
movq %rsp, %r12
leaq 0x4f3e3(%rip), %r13     # 0xbe0b8
movq %r15, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x6edac
movq 0x8(%rax), %rbp
callq 0x2b8ae
subq 0x40(%rbp), %rax
cmpq $0x1389, %rax           # imm = 0x1389
jl 0x6ed13
andb $-0x21, (%rbp)
movq 0xd8(%rbp), %rdi
callq 0x311c8
andq $0x0, 0xd8(%rbp)
testb $0x8, (%r14)
je 0x6ecd5
movq 0x28(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x6ecd5
testb $0x1, %bl
jne 0x6ed39
callq 0x2b8ae
subq 0x40(%rbp), %rax
cmpq $0x3e8, %rax            # imm = 0x3E8
jl 0x6ecd5
movq 0x20(%r14), %rax
movslq 0x8(%rax), %rdx
movq %r12, %rdi
pushq $0x20
popq %rsi
callq 0x39796
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x20(%r14), %rax
cmpl $0x0, 0xf0(%r14)
movq (%rax), %r8
leaq 0x3fd81(%rip), %r10     # 0xaeaeb
leaq 0x9f967(%rip), %rax     # 0x10e6d8
cmovgq %rax, %r10
leaq -0x1e6(%rip), %rsi      # 0x6eb96
movq %rbp, %rdx
movq %r13, %rcx
movq %r12, %r9
xorl %eax, %eax
pushq %r10
pushq 0x9f979(%rip)           # 0x10e708
callq 0x7597e
addq $0x10, %rsp
testl %eax, %eax
jne 0x6ecd5
movq 0x28(%rbp), %rax
incl 0x8(%rax)
jmp 0x6ecd5
movq %r15, %rdi
callq 0x2aa94
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelLeaderIncr
int sentinelLeaderIncr(dict *counters, char *runid) {
    dictEntry *de = dictFind(counters,runid);
    uint64_t oldval;

    if (de) {
        oldval = dictGetUnsignedIntegerVal(de);
        dictSetUnsignedIntegerVal(de,oldval+1);
        return oldval+1;
    } else {
        de = dictAddRaw(counters,runid);
        serverAssert(de != NULL);
        dictSetUnsignedIntegerVal(de,1);
        return 1;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x2a5f9
testq %rax, %rax
je 0x6ede7
movq %rax, %rcx
movq 0x8(%rax), %rax
incq %rax
movq %rax, 0x8(%rcx)
jmp 0x6ee02
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2a42e
testq %rax, %rax
je 0x6ee0a
movq $0x1, 0x8(%rax)
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x43ac0(%rip), %rdi     # 0xb28d1
leaq 0x4e084(%rip), %rsi     # 0xbce9c
movl $0xe44, %edx            # imm = 0xE44
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelStartFailoverIfNeeded
int sentinelStartFailoverIfNeeded(sentinelRedisInstance *master) {
    /* We can't failover if the master is not in O_DOWN state. */
    if (!(master->flags & SRI_O_DOWN)) return 0;

    /* Failover already in progress? */
    if (master->flags & SRI_FAILOVER_IN_PROGRESS) return 0;

    /* Last failover attempt started too little time ago? */
    if (mstime() - master->failover_start_time <
        master->failover_timeout*2)
    {
        if (master->failover_delay_logged != master->failover_start_time) {
            time_t clock = (master->failover_start_time +
                            master->failover_timeout*2) / 1000;
            char ctimebuf[26];

            ctime_r(&clock,ctimebuf);
            ctimebuf[24] = '\0'; /* Remove newline. */
            master->failover_delay_logged = master->failover_start_time;
            serverLog(LL_WARNING,
                "Next failover delay: I will not start a failover before %s",
                ctimebuf);
        }
        return 0;
    }

    sentinelStartFailover(master);
    return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movl (%rdi), %eax
andl $0x50, %eax
xorl %ebp, %ebp
cmpl $0x10, %eax
jne 0x6f051
movq %rdi, %rbx
callq 0x2b8ae
movq %rax, %rcx
movq 0x100(%rbx), %rdx
movq 0x108(%rbx), %rax
subq %rdx, %rcx
addq %rax, %rax
cmpq %rax, %rcx
jge 0x6f046
cmpq %rdx, 0x110(%rbx)
je 0x6f051
addq %rdx, %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x26bc0
movb $0x0, 0x18(%r14)
movq 0x100(%rbx), %rax
movq %rax, 0x110(%rbx)
leaq 0x4f17e(%rip), %rsi     # 0xbe1b3
xorl %ebp, %ebp
pushq $0x3
popq %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2b699
jmp 0x6f051
movq %rbx, %rdi
callq 0x6e5b9
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: compareSlavesForPromotion
int compareSlavesForPromotion(const void *a, const void *b) {
    sentinelRedisInstance **sa = (sentinelRedisInstance **)a,
                          **sb = (sentinelRedisInstance **)b;
    char *sa_runid, *sb_runid;

    if ((*sa)->slave_priority != (*sb)->slave_priority)
        return (*sa)->slave_priority - (*sb)->slave_priority;

    /* If priority is the same, select the slave with greater replication
     * offset (processed more data from the master). */
    if ((*sa)->slave_repl_offset > (*sb)->slave_repl_offset) {
        return -1; /* a < b */
    } else if ((*sa)->slave_repl_offset < (*sb)->slave_repl_offset) {
        return 1; /* a > b */
    }

    /* If the replication offset is the same select the slave with that has
     * the lexicographically smaller runid. Note that we try to handle runid
     * == NULL as there are old Redis versions that don't publish runid in
     * INFO. A NULL runid is considered bigger than any other runid. */
    sa_runid = (*sa)->runid;
    sb_runid = (*sb)->runid;
    if (sa_runid == NULL && sb_runid == NULL) return 0;
    else if (sa_runid == NULL) return 1;  /* a > b */
    else if (sb_runid == NULL) return -1; /* a < b */
    return strcasecmp(sa_runid, sb_runid);
}

// Assembly:
movq (%rdi), %rcx
movl 0xa8(%rcx), %eax
movq (%rsi), %rdx
subl 0xa8(%rdx), %eax
jne 0x6f0c4
movq 0xd0(%rdx), %rax
cmpq %rax, 0xd0(%rcx)
jbe 0x6f084
pushq $-0x1
jmp 0x6f088
jae 0x6f08a
pushq $0x1
popq %rax
retq
movq 0x10(%rcx), %rdi
movq 0x10(%rdx), %rsi
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %r8b
xorl %ecx, %ecx
movq %rdi, %rdx
orq %rsi, %rdx
setne %dl
orb %al, %r8b
xorl %eax, %eax
movq %rdi, %r9
negq %r9
sbbl %eax, %eax
testb %r8b, %r8b
je 0x262f0
movb %dl, %cl
orl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0xe8(%rdi), %rsi
callq 0x6ee2a
testq %rax, %rax
je 0x6f0ff
movq %rax, %r14
leaq 0x9f5f1(%rip), %rsi     # 0x10e6d8
movq %rax, %rdi
callq 0x262f0
movl %eax, %ebp
movq %r14, %rdi
callq 0x311c8
testl %ebp, %ebp
jne 0x6f106
jmp 0x6f15e
xorl %edi, %edi
callq 0x311c8
testb $0x8, 0x1(%rbx)
jne 0x6f15e
movq 0x108(%rbx), %rax
movl $0x2710, %ecx           # imm = 0x2710
cmpq %rcx, %rax
movslq %eax, %r14
cmovgeq %rcx, %r14
callq 0x2b8ae
subq 0x100(%rbx), %rax
cmpq %r14, %rax
jle 0x6f1b7
leaq 0x4f0b0(%rip), %rsi     # 0xbe1ee
leaq 0x4e007(%rip), %rcx     # 0xbd14c
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6a7bb
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x6f1c1
leaq 0x4f0a5(%rip), %rsi     # 0xbe20a
leaq 0x4dfe0(%rip), %rcx     # 0xbd14c
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6a7bb
testb $0x1, 0x9f5c8(%rip)     # 0x10e748
jne 0x6f1bc
movl $0x2, 0xf0(%rbx)
callq 0x2b8ae
movq %rax, 0xf8(%rbx)
leaq 0x4f07b(%rip), %rsi     # 0xbe21a
leaq 0x4dfa6(%rip), %rcx     # 0xbd14c
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x6a7bb
popq %rbx
popq %r14
popq %rbp
retq
callq 0x6d394
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelAbortFailover
void sentinelAbortFailover(sentinelRedisInstance *ri) {
    serverAssert(ri->flags & SRI_FAILOVER_IN_PROGRESS);
    serverAssert(ri->failover_state <= SENTINEL_FAILOVER_STATE_WAIT_PROMOTION);

    ri->flags &= ~(SRI_FAILOVER_IN_PROGRESS|SRI_FORCE_FAILOVER);
    ri->failover_state = SENTINEL_FAILOVER_STATE_NONE;
    ri->failover_state_change_time = mstime();
    if (ri->promoted_slave) {
        ri->promoted_slave->flags &= ~SRI_PROMOTED;
        ri->promoted_slave = NULL;
    }
}

// Assembly:
pushq %rbx
movl (%rdi), %eax
testb $0x40, %al
je 0x6f207
movq %rdi, %rbx
cmpl $0x5, 0xf0(%rdi)
jge 0x6f21c
andl $0xfffff7bf, %eax       # imm = 0xFFFFF7BF
movl %eax, (%rbx)
andl $0x0, 0xf0(%rbx)
callq 0x2b8ae
movq %rax, 0xf8(%rbx)
movq 0x118(%rbx), %rax
testq %rax, %rax
je 0x6f205
andb $0x7f, (%rax)
andq $0x0, 0x118(%rbx)
popq %rbx
retq
leaq 0x4f123(%rip), %rdi     # 0xbe331
leaq 0x4dc87(%rip), %rsi     # 0xbce9c
movl $0x1074, %edx           # imm = 0x1074
jmp 0x6f22f
leaq 0x4f133(%rip), %rdi     # 0xbe356
leaq 0x4dc72(%rip), %rsi     # 0xbce9c
movl $0x1075, %edx           # imm = 0x1075
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelFailoverSelectSlave
void sentinelFailoverSelectSlave(sentinelRedisInstance *ri) {
    sentinelRedisInstance *slave = sentinelSelectSlave(ri);

    /* We don't handle the timeout in this state as the function aborts
     * the failover or go forward in the next state. */
    if (slave == NULL) {
        sentinelEvent(LL_WARNING,"-failover-abort-no-good-slave",ri,"%@");
        sentinelAbortFailover(ri);
    } else {
        sentinelEvent(LL_WARNING,"+selected-slave",slave,"%@");
        slave->flags |= SRI_PROMOTED;
        ri->promoted_slave = slave;
        ri->failover_state = SENTINEL_FAILOVER_STATE_SEND_SLAVEOF_NOONE;
        ri->failover_state_change_time = mstime();
        sentinelEvent(LL_NOTICE,"+failover-state-send-slaveof-noone",
            slave, "%@");
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x6e48b
testq %rax, %rax
je 0x6f2ac
movq %rax, %r14
leaq 0x4effd(%rip), %rsi     # 0xbe255
leaq 0x4deed(%rip), %r15     # 0xbd14c
pushq $0x3
popq %rdi
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x6a7bb
orb $-0x80, (%r14)
movq %r14, 0x118(%rbx)
movl $0x3, 0xf0(%rbx)
callq 0x2b8ae
movq %rax, 0xf8(%rbx)
leaq 0x4efce(%rip), %rsi     # 0xbe265
pushq $0x2
popq %rdi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x6a7bb
leaq 0x4ef84(%rip), %rsi     # 0xbe237
leaq 0x4de92(%rip), %rcx     # 0xbd14c
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6a7bb
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x6f1c1
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelFailoverSendSlaveOfNoOne
void sentinelFailoverSendSlaveOfNoOne(sentinelRedisInstance *ri) {
    int retval;

    /* We can't send the command to the promoted slave if it is now
     * disconnected. Retry again and again with this state until the timeout
     * is reached, then abort the failover. */
    if (ri->promoted_slave->link->disconnected) {
        if (mstime() - ri->failover_state_change_time > ri->failover_timeout) {
            sentinelEvent(LL_WARNING,"-failover-abort-slave-timeout",ri,"%@");
            sentinelAbortFailover(ri);
        }
        return;
    }

    /* Send SLAVEOF NO ONE command to turn the slave into a master.
     * We actually register a generic callback for this command as we don't
     * really care about the reply. We check if it worked indirectly observing
     * if INFO returns a different role (master instead of slave). */
    retval = sentinelSendSlaveOf(ri->promoted_slave,NULL,0);
    if (retval != C_OK) return;
    sentinelEvent(LL_NOTICE, "+failover-state-wait-promotion",
        ri->promoted_slave,"%@");
    ri->failover_state = SENTINEL_FAILOVER_STATE_WAIT_PROMOTION;
    ri->failover_state_change_time = mstime();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x118(%rdi), %rdi
movq 0x28(%rdi), %rax
cmpl $0x0, 0x4(%rax)
je 0x6f322
callq 0x2b8ae
subq 0xf8(%rbx), %rax
cmpq 0x108(%rbx), %rax
jle 0x6f364
leaq 0x4ef83(%rip), %rsi     # 0xbe288
leaq 0x4de40(%rip), %rcx     # 0xbd14c
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6a7bb
movq %rbx, %rdi
popq %rbx
jmp 0x6f1c1
xorl %esi, %esi
xorl %edx, %edx
callq 0x6d3ed
testl %eax, %eax
jne 0x6f364
movq 0x118(%rbx), %rdx
leaq 0x4ef69(%rip), %rsi     # 0xbe2a6
leaq 0x4de08(%rip), %rcx     # 0xbd14c
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x6a7bb
movl $0x4, 0xf0(%rbx)
callq 0x2b8ae
movq %rax, 0xf8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelFailoverWaitPromotion
void sentinelFailoverWaitPromotion(sentinelRedisInstance *ri) {
    /* Just handle the timeout. Switching to the next state is handled
     * by the function parsing the INFO command of the promoted slave. */
    if (mstime() - ri->failover_state_change_time > ri->failover_timeout) {
        sentinelEvent(LL_WARNING,"-failover-abort-slave-timeout",ri,"%@");
        sentinelAbortFailover(ri);
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x2b8ae
subq 0xf8(%rbx), %rax
cmpq 0x108(%rbx), %rax
jle 0x6f3a3
leaq 0x4ef02(%rip), %rsi     # 0xbe288
leaq 0x4ddbf(%rip), %rcx     # 0xbd14c
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6a7bb
movq %rbx, %rdi
popq %rbx
jmp 0x6f1c1
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelFailoverSwitchToPromotedSlave
void sentinelFailoverSwitchToPromotedSlave(sentinelRedisInstance *master) {
    sentinelRedisInstance *ref = master->promoted_slave ?
                                 master->promoted_slave : master;

    sentinelEvent(LL_WARNING,"+switch-master",master,"%s %s %d %s %d",
        master->name, master->addr->ip, master->addr->port,
        ref->addr->ip, ref->addr->port);

    sentinelResetMasterAndChangeAddress(master,ref->addr->ip,ref->addr->port);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x118(%rdi), %r14
testq %r14, %r14
cmoveq %rdi, %r14
movq 0x8(%rdi), %r8
movq 0x20(%rdi), %rax
movq (%rax), %r9
movl 0x8(%rax), %r10d
movq 0x20(%r14), %r11
movl 0x8(%r11), %r15d
subq $0x8, %rsp
leaq 0x4e191(%rip), %rsi     # 0xbd83a
leaq 0x4e199(%rip), %rcx     # 0xbd849
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
pushq %r15
pushq (%r11)
pushq %r10
callq 0x6a7bb
addq $0x20, %rsp
movq 0x20(%r14), %rax
movq (%rax), %rsi
movl 0x8(%rax), %edx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x6bb07
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelFailoverStateMachine
void sentinelFailoverStateMachine(sentinelRedisInstance *ri) {
    serverAssert(ri->flags & SRI_MASTER);

    if (!(ri->flags & SRI_FAILOVER_IN_PROGRESS)) return;

    switch(ri->failover_state) {
        case SENTINEL_FAILOVER_STATE_WAIT_START:
            sentinelFailoverWaitStart(ri);
            break;
        case SENTINEL_FAILOVER_STATE_SELECT_SLAVE:
            sentinelFailoverSelectSlave(ri);
            break;
        case SENTINEL_FAILOVER_STATE_SEND_SLAVEOF_NOONE:
            sentinelFailoverSendSlaveOfNoOne(ri);
            break;
        case SENTINEL_FAILOVER_STATE_WAIT_PROMOTION:
            sentinelFailoverWaitPromotion(ri);
            break;
        case SENTINEL_FAILOVER_STATE_RECONF_SLAVES:
            sentinelFailoverReconfNextSlave(ri);
            break;
    }
}

// Assembly:
movl (%rdi), %eax
testb $0x1, %al
je 0x6f720
testb $0x40, %al
jne 0x6f6ea
retq
movl 0xf0(%rdi), %eax
decl %eax
cmpl $0x4, %eax
ja 0x6f6e9
leaq 0x4d76e(%rip), %rcx     # 0xbce6c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x6f0c5
jmp 0x6f51a
jmp 0x6f2d4
jmp 0x6f366
jmp 0x6f23c
pushq %rax
leaq 0x4d9f3(%rip), %rdi     # 0xbd11b
leaq 0x4d76d(%rip), %rsi     # 0xbce9c
movl $0x1057, %edx           # imm = 0x1057
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelHandleRedisInstance
void sentinelHandleRedisInstance(sentinelRedisInstance *ri) {
    /* ========== MONITORING HALF ============ */
    /* Every kind of instance */
    sentinelReconnectInstance(ri);
    sentinelSendPeriodicCommands(ri);

    /* ============== ACTING HALF ============= */
    /* We don't proceed with the acting half if we are in TILT mode.
     * TILT happens when we find something odd with the time, like a
     * sudden change in the clock. */
    if (sentinel.tilt) {
        if (mstime()-sentinel.tilt_start_time < SENTINEL_TILT_PERIOD) return;
        sentinel.tilt = 0;
        sentinelEvent(LL_WARNING,"-tilt",NULL,"#tilt mode exited");
    }

    /* Every kind of instance */
    sentinelCheckSubjectivelyDown(ri);

    /* Masters and slaves */
    if (ri->flags & (SRI_MASTER|SRI_SLAVE)) {
        /* Nothing so far. */
    }

    /* Only masters */
    if (ri->flags & SRI_MASTER) {
        sentinelCheckObjectivelyDown(ri);
        if (sentinelStartFailoverIfNeeded(ri))
            sentinelAskMasterStateToOtherSentinels(ri,SENTINEL_ASK_FORCED);
        sentinelFailoverStateMachine(ri);
        sentinelAskMasterStateToOtherSentinels(ri,SENTINEL_NO_FLAGS);
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x6c7e4
movq %rbx, %rdi
callq 0x6da98
cmpl $0x0, 0x9efbf(%rip)     # 0x10e718
je 0x6f790
callq 0x2b8ae
subq 0x9efb9(%rip), %rax     # 0x10e720
cmpq $0x7530, %rax           # imm = 0x7530
jl 0x6f79d
andl $0x0, 0x9efa2(%rip)     # 0x10e718
leaq 0x4ec16(%rip), %rsi     # 0xbe393
leaq 0x4ec15(%rip), %rcx     # 0xbe399
pushq $0x3
popq %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x6a7bb
movq %rbx, %rdi
callq 0x6e980
testb $0x1, (%rbx)
jne 0x6f79f
popq %rbx
retq
movq %rbx, %rdi
callq 0x6eaf0
movq %rbx, %rdi
callq 0x6efb4
testl %eax, %eax
je 0x6f7be
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x6eca9
movq %rbx, %rdi
callq 0x6f6df
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
jmp 0x6eca9
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelHandleDictOfRedisInstances
void sentinelHandleDictOfRedisInstances(dict *instances) {
    dictIterator *di;
    dictEntry *de;
    sentinelRedisInstance *switch_to_promoted = NULL;

    /* There are a number of things we need to perform against every master. */
    di = dictGetIterator(instances);
    while((de = dictNext(di)) != NULL) {
        sentinelRedisInstance *ri = dictGetVal(de);

        sentinelHandleRedisInstance(ri);
        if (ri->flags & SRI_MASTER) {
            sentinelHandleDictOfRedisInstances(ri->slaves);
            sentinelHandleDictOfRedisInstances(ri->sentinels);
            if (ri->failover_state == SENTINEL_FAILOVER_STATE_UPDATE_CONFIG) {
                switch_to_promoted = ri;
            }
        }
    }
    if (switch_to_promoted)
        sentinelFailoverSwitchToPromotedSlave(switch_to_promoted);
    dictReleaseIterator(di);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
callq 0x2a99f
movq %rax, %rbx
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x6f826
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x6f741
testb $0x1, (%r15)
je 0x6f7e1
movq 0x88(%r15), %rdi
callq 0x6f7d1
movq 0x80(%r15), %rdi
callq 0x6f7d1
cmpl $0x6, 0xf0(%r15)
cmoveq %r15, %r14
jmp 0x6f7e1
testq %r14, %r14
je 0x6f833
movq %r14, %rdi
callq 0x6f671
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2aa94
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelCheckTiltCondition
void sentinelCheckTiltCondition(void) {
    mstime_t now = mstime();
    mstime_t delta = now - sentinel.previous_time;

    if (delta < 0 || delta > SENTINEL_TILT_TRIGGER) {
        sentinel.tilt = 1;
        sentinel.tilt_start_time = mstime();
        sentinelEvent(LL_WARNING,"+tilt",NULL,"#tilt mode entered");
    }
    sentinel.previous_time = mstime();
}

// Assembly:
pushq %rax
callq 0x2b8ae
subq 0x9eedb(%rip), %rax     # 0x10e728
cmpq $0x7d1, %rax            # imm = 0x7D1
jb 0x6f885
movl $0x1, 0x9eeb9(%rip)     # 0x10e718
callq 0x2b8ae
movq %rax, 0x9eeb5(%rip)     # 0x10e720
leaq 0x4eb39(%rip), %rsi     # 0xbe3ab
leaq 0x4eb38(%rip), %rcx     # 0xbe3b1
pushq $0x3
popq %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x6a7bb
callq 0x2b8ae
movq %rax, 0x9ee97(%rip)     # 0x10e728
popq %rax
retq