// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelInfoCommand
void sentinelInfoCommand(client *c) {
    if (c->argc > 2) {
        addReply(c,shared.syntaxerr);
        return;
    }

    int defsections = 0, allsections = 0;
    char *section = c->argc == 2 ? c->argv[1]->ptr : NULL;
    if (section) {
        allsections = !strcasecmp(section,"all");
        defsections = !strcasecmp(section,"default");
    } else {
        defsections = 1;
    }

    int sections = 0;
    sds info = sdsempty();

    info_section_from_redis("server");
    info_section_from_redis("clients");
    info_section_from_redis("cpu");
    info_section_from_redis("stats");

    if (defsections || allsections || !strcasecmp(section,"sentinel")) {
        dictIterator *di;
        dictEntry *de;
        int master_id = 0;

        if (sections++) info = sdscat(info,"\r\n");
        info = sdscatprintf(info,
            "# Sentinel\r\n"
            "sentinel_masters:%lu\r\n"
            "sentinel_tilt:%d\r\n"
            "sentinel_running_scripts:%d\r\n"
            "sentinel_scripts_queue_length:%ld\r\n"
            "sentinel_simulate_failure_flags:%lu\r\n",
            dictSize(sentinel.masters),
            sentinel.tilt,
            sentinel.running_scripts,
            listLength(sentinel.scripts_queue),
            sentinel.simfailure_flags);

        di = dictGetIterator(sentinel.masters);
        while((de = dictNext(di)) != NULL) {
            sentinelRedisInstance *ri = dictGetVal(de);
            char *status = "ok";

            if (ri->flags & SRI_O_DOWN) status = "odown";
            else if (ri->flags & SRI_S_DOWN) status = "sdown";
            info = sdscatprintf(info,
                "master%d:name=%s,status=%s,address=%s:%d,"
                "slaves=%lu,sentinels=%lu\r\n",
                master_id++, ri->name, status,
                ri->addr->ip, ri->addr->port,
                dictSize(ri->slaves),
                dictSize(ri->sentinels)+1);
        }
        dictReleaseIterator(di);
    }

    addReplyBulkSds(c, info);
}

// Assembly:
movl 0x38(%rdi), %eax
cmpl $0x3, %eax
jl 0x6a08f
leaq 0x9028d(%rip), %rax     # 0xfa310
movq 0x80(%rax), %rsi
jmp 0x36987
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movb $0x1, %bpl
cmpl $0x2, %eax
movq %rdi, (%rsp)
jne 0x6a0e5
movq 0x40(%rdi), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x6a0e5
leaq 0x58650(%rip), %rsi     # 0xc270e
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
sete %bl
leaq 0x457f1(%rip), %rsi     # 0xaf8c3
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
sete %bpl
orb %bl, %bpl
jmp 0x6a0e8
xorl %r15d, %r15d
callq 0x3114c
movq %rax, %r14
testb %bpl, %bpl
jne 0x6a10f
leaq 0x52f5c(%rip), %rsi     # 0xbd058
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
je 0x6a10f
movb $0x1, %bl
xorl %r13d, %r13d
jmp 0x6a150
leaq 0x52f42(%rip), %rdi     # 0xbd058
callq 0x2f3cf
movq %rax, %r12
movq %rax, %rdi
callq 0x6c6ff
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x31758
movq %rax, %r14
movq %r12, %rdi
callq 0x311c8
testb %bpl, %bpl
je 0x6a14a
pushq $0x2
popq %r13
jmp 0x6a16a
pushq $0x1
popq %r13
xorl %ebx, %ebx
leaq 0x4bd6a(%rip), %rsi     # 0xb5ec1
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x6a1b1
incl %r13d
testb %bl, %bl
jne 0x6a17c
leaq 0x4b01f(%rip), %rsi     # 0xb5190
movq %r14, %rdi
callq 0x317b7
movq %rax, %r14
leaq 0x4bd3e(%rip), %rdi     # 0xb5ec1
callq 0x2f3cf
movq %rax, %r12
movq %rax, %rdi
callq 0x6c6ff
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x31758
movq %rax, %r14
movq %r12, %rdi
callq 0x311c8
testb %bpl, %bpl
jne 0x6a1cd
leaq 0x46137(%rip), %rsi     # 0xb02ef
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x6a217
testl %r13d, %r13d
je 0x6a3c4
incl %r13d
leaq 0x4afb9(%rip), %rsi     # 0xb5190
movq %r14, %rdi
callq 0x317b7
movq %rax, %r14
leaq 0x46106(%rip), %rdi     # 0xb02ef
callq 0x2f3cf
movq %rax, %r12
movq %rax, %rdi
callq 0x6c6ff
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x31758
movq %rax, %r14
movq %r12, %rdi
callq 0x311c8
testb %bpl, %bpl
jne 0x6a22f
leaq 0x46144(%rip), %rsi     # 0xb0362
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x6a27a
testl %r13d, %r13d
je 0x6a241
leaq 0x4af5a(%rip), %rsi     # 0xb5190
movq %r14, %rdi
callq 0x317b7
movq %rax, %r14
leaq 0x4611a(%rip), %rdi     # 0xb0362
callq 0x2f3cf
movq %rax, %r12
movq %rax, %rdi
callq 0x6c6ff
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x31758
movq %rax, %r14
movq %r12, %rdi
callq 0x311c8
testb %bpl, %bpl
jne 0x6a296
pushq $0x1
popq %r13
leaq 0x53591(%rip), %rsi     # 0xbd812
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x6a3aa
testl %r13d, %r13d
je 0x6a2a8
leaq 0x4aef3(%rip), %rsi     # 0xb5190
movq %r14, %rdi
callq 0x317b7
movq %rax, %r14
movq 0xa4461(%rip), %rax     # 0x10e710
movq 0x48(%rax), %rdx
addq 0x28(%rax), %rdx
movl 0xa445b(%rip), %ecx     # 0x10e718
movl 0xa4458(%rip), %r8d     # 0x10e71c
movq 0xa4465(%rip), %rax     # 0x10e730
movq 0x28(%rax), %r9
subq $0x8, %rsp
leaq 0x53bab(%rip), %rsi     # 0xbde85
movq %r14, %rdi
xorl %eax, %eax
pushq 0xa4463(%rip)           # 0x10e748
callq 0x31a38
popq %rcx
popq %rdx
movq %rax, %r14
movq 0xa441a(%rip), %rdi     # 0x10e710
callq 0x2a99f
movq %rax, %r15
leaq 0x53c1a(%rip), %r12     # 0xbdf1f
xorl %r13d, %r13d
movq %r15, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x6a3a2
movq 0x8(%rax), %rax
movl (%rax), %ecx
testb $0x8, %cl
leaq 0x53d4e(%rip), %r8      # 0xbe077
leaq 0x57967(%rip), %rdx     # 0xc1c97
cmoveq %rdx, %r8
testb $0x10, %cl
leaq 0x53d47(%rip), %rcx     # 0xbe085
cmovneq %rcx, %r8
leal 0x1(%r13), %ebx
movq 0x8(%rax), %rcx
movq 0x20(%rax), %rdx
movq (%rdx), %r9
movl 0x8(%rdx), %r10d
movq 0x88(%rax), %rdx
movq 0x48(%rdx), %r11
addq 0x28(%rdx), %r11
movq 0x80(%rax), %rax
movq 0x28(%rax), %rdx
movq 0x48(%rax), %rax
leaq (%rdx,%rax), %rbp
incq %rbp
subq $0x8, %rsp
movq %r14, %rdi
movq %r12, %rsi
movl %r13d, %edx
xorl %eax, %eax
pushq %rbp
pushq %r11
pushq %r10
callq 0x31a38
addq $0x20, %rsp
movq %rax, %r14
movl %ebx, %r13d
jmp 0x6a308
movq %r15, %rdi
callq 0x2aa94
movq (%rsp), %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x371aa
pushq $0x1
popq %r13
jmp 0x6a1e2