// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jle 0x93ef5
movq -0x8(%rbp), %rdi
leaq 0xe4d5c(%rip), %rax     # 0x178c40
movq 0x80(%rax), %rsi
callq 0x42cc0
jmp 0x943b7
movl $0x0, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x93f23
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x93f2b
xorl %eax, %eax
movq %rax, -0x78(%rbp)
jmp 0x93f2b
movq -0x78(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x93f7c
movq -0x18(%rbp), %rdi
leaq 0xb7c29(%rip), %rsi     # 0x14bb6e
callq 0x26300
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x10(%rbp)
movq -0x18(%rbp), %rdi
leaq 0xa49de(%rip), %rsi     # 0x138943
callq 0x26300
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xc(%rbp)
jmp 0x93f83
movl $0x1, -0xc(%rbp)
movl $0x0, -0x1c(%rbp)
callq 0x384f0
movq %rax, -0x28(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x93fb4
cmpl $0x0, -0x10(%rbp)
jne 0x93fb4
movq -0x18(%rbp), %rdi
leaq 0xb216e(%rip), %rsi     # 0x146118
callq 0x26300
cmpl $0x0, %eax
jne 0x94024
movl -0x1c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x93fd8
movq -0x28(%rbp), %rdi
leaq 0xaa2b9(%rip), %rsi     # 0x13e288
callq 0x390d0
movq %rax, -0x28(%rbp)
leaq 0xb2139(%rip), %rdi     # 0x146118
callq 0x35820
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rdi
callq 0x97af0
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq %rax, %rdx
callq 0x39040
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rdi
callq 0x38620
jmp 0x94026
jmp 0x94028
cmpl $0x0, -0xc(%rbp)
jne 0x94049
cmpl $0x0, -0x10(%rbp)
jne 0x94049
movq -0x18(%rbp), %rdi
leaq 0xaaf7a(%rip), %rsi     # 0x13efb9
callq 0x26300
cmpl $0x0, %eax
jne 0x940bf
movl -0x1c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x9406d
movq -0x28(%rbp), %rdi
leaq 0xaa224(%rip), %rsi     # 0x13e288
callq 0x390d0
movq %rax, -0x28(%rbp)
leaq 0xaaf45(%rip), %rdi     # 0x13efb9
callq 0x35820
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x38(%rbp), %rdi
callq 0x97af0
movq -0x98(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq %rax, %rdx
callq 0x39040
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rdi
callq 0x38620
jmp 0x940c1
jmp 0x940c3
cmpl $0x0, -0xc(%rbp)
jne 0x940e4
cmpl $0x0, -0x10(%rbp)
jne 0x940e4
movq -0x18(%rbp), %rdi
leaq 0xa5295(%rip), %rsi     # 0x13936f
callq 0x26300
cmpl $0x0, %eax
jne 0x9415a
movl -0x1c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x94108
movq -0x28(%rbp), %rdi
leaq 0xaa189(%rip), %rsi     # 0x13e288
callq 0x390d0
movq %rax, -0x28(%rbp)
leaq 0xa5260(%rip), %rdi     # 0x13936f
callq 0x35820
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x40(%rbp), %rdi
callq 0x97af0
movq -0xa8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movq %rax, %rdx
callq 0x39040
movq %rax, -0x28(%rbp)
movq -0x40(%rbp), %rdi
callq 0x38620
jmp 0x9415c
jmp 0x9415e
cmpl $0x0, -0xc(%rbp)
jne 0x9417f
cmpl $0x0, -0x10(%rbp)
jne 0x9417f
movq -0x18(%rbp), %rdi
leaq 0xa526d(%rip), %rsi     # 0x1393e2
callq 0x26300
cmpl $0x0, %eax
jne 0x941f5
movl -0x1c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x941a3
movq -0x28(%rbp), %rdi
leaq 0xaa0ee(%rip), %rsi     # 0x13e288
callq 0x390d0
movq %rax, -0x28(%rbp)
leaq 0xa5238(%rip), %rdi     # 0x1393e2
callq 0x35820
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x48(%rbp), %rdi
callq 0x97af0
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movq %rax, %rdx
callq 0x39040
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rdi
callq 0x38620
jmp 0x941f7
cmpl $0x0, -0xc(%rbp)
jne 0x9421c
cmpl $0x0, -0x10(%rbp)
jne 0x9421c
movq -0x18(%rbp), %rdi
leaq 0xb26c4(%rip), %rsi     # 0x1468d2
callq 0x26300
cmpl $0x0, %eax
jne 0x943aa
movl $0x0, -0x5c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x94247
movq -0x28(%rbp), %rdi
leaq 0xaa04a(%rip), %rsi     # 0x13e288
callq 0x390d0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq 0xf8dee(%rip), %rax     # 0x18d040
movq 0x28(%rax), %rdx
movq 0xf8de3(%rip), %rax     # 0x18d040
addq 0x48(%rax), %rdx
movl 0xf8de1(%rip), %ecx     # 0x18d048
movl 0xf8dde(%rip), %r8d     # 0x18d04c
movq 0xf8deb(%rip), %rax     # 0x18d060
movq 0x28(%rax), %r9
movq 0xf8df8(%rip), %rax     # 0x18d078
leaq 0xb2cbe(%rip), %rsi     # 0x146f45
movq %rax, (%rsp)
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq 0xf8da3(%rip), %rdi     # 0x18d040
callq 0x2e400
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0x943a1
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
leaq 0xb6ce7(%rip), %rax     # 0x14afb7
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x942ef
leaq 0xb2e5c(%rip), %rax     # 0x147145
movq %rax, -0x70(%rbp)
jmp 0x9430a
movq -0x68(%rbp), %rax
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x94308
leaq 0xb2e33(%rip), %rax     # 0x147137
movq %rax, -0x70(%rbp)
jmp 0x9430a
movq -0x28(%rbp), %rdi
movl -0x5c(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x70(%rbp), %r8
movq -0x68(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %r9
movq -0x68(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x8(%rax), %r11d
movq -0x68(%rbp), %rax
movq 0x88(%rax), %rax
movq 0x28(%rax), %r10
movq -0x68(%rbp), %rax
movq 0x88(%rax), %rax
addq 0x48(%rax), %r10
movq -0x68(%rbp), %rax
movq 0x80(%rax), %rax
movq 0x28(%rax), %rax
movq -0x68(%rbp), %rsi
movq 0x80(%rsi), %rsi
addq 0x48(%rsi), %rax
addq $0x1, %rax
leaq 0xb2c5c(%rip), %rsi     # 0x146fdf
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
jmp 0x942a6
movq -0x50(%rbp), %rdi
callq 0x2e600
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x43970
addq $0xd0, %rsp
popq %rbp
retq