// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: addReplySentinelRedisInstance
void addReplySentinelRedisInstance(client *c, sentinelRedisInstance *ri) {
    char *flags = sdsempty();
    void *mbl;
    int fields = 0;

    mbl = addDeferredMultiBulkLength(c);

    addReplyBulkCString(c,"name");
    addReplyBulkCString(c,ri->name);
    fields++;

    addReplyBulkCString(c,"ip");
    addReplyBulkCString(c,ri->addr->ip);
    fields++;

    addReplyBulkCString(c,"port");
    addReplyBulkLongLong(c,ri->addr->port);
    fields++;

    addReplyBulkCString(c,"runid");
    addReplyBulkCString(c,ri->runid ? ri->runid : "");
    fields++;

    addReplyBulkCString(c,"flags");
    if (ri->flags & SRI_S_DOWN) flags = sdscat(flags,"s_down,");
    if (ri->flags & SRI_O_DOWN) flags = sdscat(flags,"o_down,");
    if (ri->flags & SRI_MASTER) flags = sdscat(flags,"master,");
    if (ri->flags & SRI_SLAVE) flags = sdscat(flags,"slave,");
    if (ri->flags & SRI_SENTINEL) flags = sdscat(flags,"sentinel,");
    if (ri->link->disconnected) flags = sdscat(flags,"disconnected,");
    if (ri->flags & SRI_MASTER_DOWN) flags = sdscat(flags,"master_down,");
    if (ri->flags & SRI_FAILOVER_IN_PROGRESS)
        flags = sdscat(flags,"failover_in_progress,");
    if (ri->flags & SRI_PROMOTED) flags = sdscat(flags,"promoted,");
    if (ri->flags & SRI_RECONF_SENT) flags = sdscat(flags,"reconf_sent,");
    if (ri->flags & SRI_RECONF_INPROG) flags = sdscat(flags,"reconf_inprog,");
    if (ri->flags & SRI_RECONF_DONE) flags = sdscat(flags,"reconf_done,");

    if (sdslen(flags) != 0) sdsrange(flags,0,-2); /* remove last "," */
    addReplyBulkCString(c,flags);
    sdsfree(flags);
    fields++;

    addReplyBulkCString(c,"link-pending-commands");
    addReplyBulkLongLong(c,ri->link->pending_commands);
    fields++;

    addReplyBulkCString(c,"link-refcount");
    addReplyBulkLongLong(c,ri->link->refcount);
    fields++;

    if (ri->flags & SRI_FAILOVER_IN_PROGRESS) {
        addReplyBulkCString(c,"failover-state");
        addReplyBulkCString(c,(char*)sentinelFailoverStateStr(ri->failover_state));
        fields++;
    }

    addReplyBulkCString(c,"last-ping-sent");
    addReplyBulkLongLong(c,
        ri->link->act_ping_time ? (mstime() - ri->link->act_ping_time) : 0);
    fields++;

    addReplyBulkCString(c,"last-ok-ping-reply");
    addReplyBulkLongLong(c,mstime() - ri->link->last_avail_time);
    fields++;

    addReplyBulkCString(c,"last-ping-reply");
    addReplyBulkLongLong(c,mstime() - ri->link->last_pong_time);
    fields++;

    if (ri->flags & SRI_S_DOWN) {
        addReplyBulkCString(c,"s-down-time");
        addReplyBulkLongLong(c,mstime()-ri->s_down_since_time);
        fields++;
    }

    if (ri->flags & SRI_O_DOWN) {
        addReplyBulkCString(c,"o-down-time");
        addReplyBulkLongLong(c,mstime()-ri->o_down_since_time);
        fields++;
    }

    addReplyBulkCString(c,"down-after-milliseconds");
    addReplyBulkLongLong(c,ri->down_after_period);
    fields++;

    /* Masters and Slaves */
    if (ri->flags & (SRI_MASTER|SRI_SLAVE)) {
        addReplyBulkCString(c,"info-refresh");
        addReplyBulkLongLong(c,mstime() - ri->info_refresh);
        fields++;

        addReplyBulkCString(c,"role-reported");
        addReplyBulkCString(c, (ri->role_reported == SRI_MASTER) ? "master" :
                                                                   "slave");
        fields++;

        addReplyBulkCString(c,"role-reported-time");
        addReplyBulkLongLong(c,mstime() - ri->role_reported_time);
        fields++;
    }

    /* Only masters */
    if (ri->flags & SRI_MASTER) {
        addReplyBulkCString(c,"config-epoch");
        addReplyBulkLongLong(c,ri->config_epoch);
        fields++;

        addReplyBulkCString(c,"num-slaves");
        addReplyBulkLongLong(c,dictSize(ri->slaves));
        fields++;

        addReplyBulkCString(c,"num-other-sentinels");
        addReplyBulkLongLong(c,dictSize(ri->sentinels));
        fields++;

        addReplyBulkCString(c,"quorum");
        addReplyBulkLongLong(c,ri->quorum);
        fields++;

        addReplyBulkCString(c,"failover-timeout");
        addReplyBulkLongLong(c,ri->failover_timeout);
        fields++;

        addReplyBulkCString(c,"parallel-syncs");
        addReplyBulkLongLong(c,ri->parallel_syncs);
        fields++;

        if (ri->notification_script) {
            addReplyBulkCString(c,"notification-script");
            addReplyBulkCString(c,ri->notification_script);
            fields++;
        }

        if (ri->client_reconfig_script) {
            addReplyBulkCString(c,"client-reconfig-script");
            addReplyBulkCString(c,ri->client_reconfig_script);
            fields++;
        }
    }

    /* Only slaves */
    if (ri->flags & SRI_SLAVE) {
        addReplyBulkCString(c,"master-link-down-time");
        addReplyBulkLongLong(c,ri->master_link_down_time);
        fields++;

        addReplyBulkCString(c,"master-link-status");
        addReplyBulkCString(c,
            (ri->slave_master_link_status == SENTINEL_MASTER_LINK_STATUS_UP) ?
            "ok" : "err");
        fields++;

        addReplyBulkCString(c,"master-host");
        addReplyBulkCString(c,
            ri->slave_master_host ? ri->slave_master_host : "?");
        fields++;

        addReplyBulkCString(c,"master-port");
        addReplyBulkLongLong(c,ri->slave_master_port);
        fields++;

        addReplyBulkCString(c,"slave-priority");
        addReplyBulkLongLong(c,ri->slave_priority);
        fields++;

        addReplyBulkCString(c,"slave-repl-offset");
        addReplyBulkLongLong(c,ri->slave_repl_offset);
        fields++;
    }

    /* Only sentinels */
    if (ri->flags & SRI_SENTINEL) {
        addReplyBulkCString(c,"last-hello-message");
        addReplyBulkLongLong(c,mstime() - ri->last_hello_time);
        fields++;

        addReplyBulkCString(c,"voted-leader");
        addReplyBulkCString(c,ri->leader ? ri->leader : "?");
        fields++;

        addReplyBulkCString(c,"voted-leader-epoch");
        addReplyBulkLongLong(c,ri->leader_epoch);
        fields++;
    }

    setDeferredMultiBulkLength(c,mbl,fields*2);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
callq 0x3114c
movq %rax, %r12
movq %rbx, %rdi
callq 0x36dad
movq %rax, %r14
leaq 0x4fffc(%rip), %rsi     # 0xbdbcb
movq %rbx, %rdi
callq 0x36f5d
movq 0x8(%r15), %rsi
movq %rbx, %rdi
callq 0x36f5d
leaq 0x47fba(%rip), %rsi     # 0xb5ba4
movq %rbx, %rdi
callq 0x36f5d
movq 0x20(%r15), %rax
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x36f5d
leaq 0x47629(%rip), %rsi     # 0xb5231
movq %rbx, %rdi
callq 0x36f5d
movq 0x20(%r15), %rax
movslq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x37206
leaq 0x4f511(%rip), %rsi     # 0xbd138
movq %rbx, %rdi
callq 0x36f5d
movq 0x10(%r15), %rax
testq %rax, %rax
leaq 0x447c8(%rip), %rsi     # 0xb2405
cmovneq %rax, %rsi
movq %rbx, %rdi
callq 0x36f5d
leaq 0x4aacb(%rip), %rsi     # 0xb871b
movq %rbx, %rdi
callq 0x36f5d
movl (%r15), %eax
testb $0x8, %al
je 0x6dc74
leaq 0x4fc77(%rip), %rsi     # 0xbd8dd
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movl (%r15), %eax
testb $0x10, %al
je 0x6dc8d
leaq 0x4fc66(%rip), %rsi     # 0xbd8e5
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movl (%r15), %eax
testb $0x1, %al
je 0x6dca6
leaq 0x4c725(%rip), %rsi     # 0xba3bd
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movl (%r15), %eax
testb $0x2, %al
je 0x6dcbf
leaq 0x4c714(%rip), %rsi     # 0xba3c5
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movl (%r15), %eax
testb $0x4, %al
je 0x6dcd5
leaq 0x4fc23(%rip), %rsi     # 0xbd8ed
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movq 0x28(%r15), %rax
cmpl $0x0, 0x4(%rax)
je 0x6dcf1
leaq 0x4fc11(%rip), %rsi     # 0xbd8f7
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movl (%r15), %eax
testb $0x20, %al
je 0x6dd0d
leaq 0x4fc06(%rip), %rsi     # 0xbd905
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movl (%r15), %eax
testb $0x40, %al
je 0x6dd26
leaq 0x4fbfa(%rip), %rsi     # 0xbd912
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movl (%r15), %eax
testb %al, %al
jns 0x6dd3f
leaq 0x4fbf7(%rip), %rsi     # 0xbd928
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movl (%r15), %eax
btl $0x8, %eax
jae 0x6dd5a
leaq 0x4fbe6(%rip), %rsi     # 0xbd932
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movl (%r15), %eax
btl $0x9, %eax
jae 0x6dd75
leaq 0x4fbd8(%rip), %rsi     # 0xbd93f
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movl (%r15), %eax
btl $0xa, %eax
jae 0x6dd8d
leaq 0x4fbcc(%rip), %rsi     # 0xbd94e
movq %r12, %rdi
callq 0x317b7
movq %rax, %r12
movq %r12, %rdi
callq 0x6c6ff
testq %rax, %rax
je 0x6dda7
pushq $-0x2
popq %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x31e8e
movq %rbx, %rdi
movq %r12, %rsi
callq 0x36f5d
movq %r12, %rdi
callq 0x311c8
leaq 0x4fb9a(%rip), %rsi     # 0xbd95b
movq %rbx, %rdi
callq 0x36f5d
movq 0x28(%r15), %rax
movslq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x37206
leaq 0x4fb91(%rip), %rsi     # 0xbd971
movq %rbx, %rdi
callq 0x36f5d
movq 0x28(%r15), %rax
movslq (%rax), %rsi
movq %rbx, %rdi
callq 0x37206
testb $0x40, (%r15)
jne 0x6de01
pushq $0xa
jmp 0x6de29
leaq 0x4fb77(%rip), %rsi     # 0xbd97f
movq %rbx, %rdi
callq 0x36f5d
movl 0xf0(%r15), %edi
callq 0x6db89
movq %rbx, %rdi
movq %rax, %rsi
callq 0x36f5d
pushq $0xb
popq %r12
leaq 0x4fb5c(%rip), %rsi     # 0xbd98e
movq %rbx, %rdi
callq 0x36f5d
movq 0x28(%r15), %rax
cmpq $0x0, 0x40(%rax)
je 0x6de57
callq 0x2b8ae
movq %rax, %rsi
movq 0x28(%r15), %rax
subq 0x40(%rax), %rsi
jmp 0x6de59
xorl %esi, %esi
movq %rbx, %rdi
callq 0x37206
leaq 0x4fb35(%rip), %rsi     # 0xbd99d
movq %rbx, %rdi
callq 0x36f5d
callq 0x2b8ae
movq 0x28(%r15), %rcx
subq 0x38(%rcx), %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37206
leaq 0x4fb21(%rip), %rsi     # 0xbd9b0
movq %rbx, %rdi
callq 0x36f5d
callq 0x2b8ae
movq 0x28(%r15), %rcx
subq 0x50(%rcx), %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37206
movl (%r15), %eax
testb $0x8, %al
je 0x6dedf
leaq 0x4fb03(%rip), %rsi     # 0xbd9c0
movq %rbx, %rdi
callq 0x36f5d
callq 0x2b8ae
subq 0x48(%r15), %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37206
incl %r12d
movl (%r15), %eax
testb $0x10, %al
je 0x6df09
leaq 0x4fae2(%rip), %rsi     # 0xbd9cc
movq %rbx, %rdi
callq 0x36f5d
callq 0x2b8ae
subq 0x50(%r15), %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37206
incl %r12d
leaq 0x4f2b7(%rip), %rsi     # 0xbd1c7
movq %rbx, %rdi
callq 0x36f5d
movq 0x58(%r15), %rsi
movq %rbx, %rdi
callq 0x37206
movl (%r15), %eax
testb $0x3, %al
je 0x6dfa8
leaq 0x4faa6(%rip), %rsi     # 0xbd9d8
movq %rbx, %rdi
callq 0x36f5d
callq 0x2b8ae
subq 0x60(%r15), %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37206
leaq 0x4fa90(%rip), %rsi     # 0xbd9e5
movq %rbx, %rdi
callq 0x36f5d
cmpl $0x1, 0x68(%r15)
leaq 0x4bd22(%rip), %rax     # 0xb9c8b
leaq 0x4bd6d(%rip), %rsi     # 0xb9cdd
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0x36f5d
leaq 0x4fa70(%rip), %rsi     # 0xbd9f3
movq %rbx, %rdi
callq 0x36f5d
callq 0x2b8ae
subq 0x70(%r15), %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37206
addl $0x4, %r12d
movl (%r15), %eax
jmp 0x6dfab
incl %r12d
testb $0x1, %al
je 0x6e0d1
leaq 0x4be09(%rip), %rsi     # 0xb9dc3
movq %rbx, %rdi
callq 0x36f5d
movq 0x18(%r15), %rsi
movq %rbx, %rdi
callq 0x37206
leaq 0x4fa31(%rip), %rsi     # 0xbda06
movq %rbx, %rdi
callq 0x36f5d
movq 0x88(%r15), %rax
movq 0x48(%rax), %rsi
addq 0x28(%rax), %rsi
movq %rbx, %rdi
callq 0x37206
leaq 0x4fa16(%rip), %rsi     # 0xbda11
movq %rbx, %rdi
callq 0x36f5d
movq 0x80(%r15), %rax
movq 0x48(%rax), %rsi
addq 0x28(%rax), %rsi
movq %rbx, %rdi
callq 0x37206
leaq 0x4fb74(%rip), %rsi     # 0xbdb95
movq %rbx, %rdi
callq 0x36f5d
movl 0x90(%r15), %esi
movq %rbx, %rdi
callq 0x37206
leaq 0x4f1e5(%rip), %rsi     # 0xbd224
movq %rbx, %rdi
callq 0x36f5d
movq 0x108(%r15), %rsi
movq %rbx, %rdi
callq 0x37206
leaq 0x4f1d8(%rip), %rsi     # 0xbd235
movq %rbx, %rdi
callq 0x36f5d
movslq 0x94(%r15), %rsi
movq %rbx, %rdi
callq 0x37206
cmpq $0x0, 0x120(%r15)
je 0x6e0a2
leaq 0x4f1bf(%rip), %rsi     # 0xbd244
movq %rbx, %rdi
callq 0x36f5d
movq 0x120(%r15), %rsi
movq %rbx, %rdi
callq 0x36f5d
addl $0x7, %r12d
jmp 0x6e0a6
addl $0x6, %r12d
cmpq $0x0, 0x128(%r15)
je 0x6e0d1
leaq 0x4f1db(%rip), %rsi     # 0xbd292
movq %rbx, %rdi
callq 0x36f5d
movq 0x128(%r15), %rsi
movq %rbx, %rdi
callq 0x36f5d
incl %r12d
movl (%r15), %eax
testb $0x2, %al
je 0x6e1b8
leaq 0x4f942(%rip), %rsi     # 0xbda25
movq %rbx, %rdi
callq 0x36f5d
movq 0xa0(%r15), %rsi
movq %rbx, %rdi
callq 0x37206
leaq 0x4f93a(%rip), %rsi     # 0xbda3b
movq %rbx, %rdi
callq 0x36f5d
cmpl $0x0, 0xcc(%r15)
leaq 0x53b7f(%rip), %rax     # 0xc1c97
leaq 0x41c69(%rip), %rsi     # 0xafd88
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0x36f5d
leaq 0x4f91c(%rip), %rsi     # 0xbda4e
movq %rbx, %rdi
callq 0x36f5d
movq 0xc0(%r15), %rax
testq %rax, %rax
leaq 0x53c2b(%rip), %rsi     # 0xc1d76
cmovneq %rax, %rsi
movq %rbx, %rdi
callq 0x36f5d
leaq 0x4f8fc(%rip), %rsi     # 0xbda5a
movq %rbx, %rdi
callq 0x36f5d
movslq 0xc8(%r15), %rsi
movq %rbx, %rdi
callq 0x37206
leaq 0x47a0a(%rip), %rsi     # 0xb5b86
movq %rbx, %rdi
callq 0x36f5d
movslq 0xa8(%r15), %rsi
movq %rbx, %rdi
callq 0x37206
leaq 0x4f8cc(%rip), %rsi     # 0xbda66
movq %rbx, %rdi
callq 0x36f5d
movq 0xd0(%r15), %rsi
movq %rbx, %rdi
callq 0x37206
addl $0x6, %r12d
movl (%r15), %eax
testb $0x4, %al
je 0x6e22d
leaq 0x4f8b5(%rip), %rsi     # 0xbda78
movq %rbx, %rdi
callq 0x36f5d
callq 0x2b8ae
subq 0x38(%r15), %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37206
leaq 0x4f8a5(%rip), %rsi     # 0xbda8b
movq %rbx, %rdi
callq 0x36f5d
movq 0xd8(%r15), %rax
testq %rax, %rax
leaq 0x53b77(%rip), %rsi     # 0xc1d76
cmovneq %rax, %rsi
movq %rbx, %rdi
callq 0x36f5d
leaq 0x4f886(%rip), %rsi     # 0xbda98
movq %rbx, %rdi
callq 0x36f5d
movq 0xe0(%r15), %rsi
movq %rbx, %rdi
callq 0x37206
addl $0x3, %r12d
addl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x36de9