// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/sentinel.c
// Function: sentinelInfoCommand
void sentinelInfoCommand(redisClient *c) {
    char *section = c->argc == 2 ? c->argv[1]->ptr : "default";
    sds info = sdsempty();
    int defsections = !strcasecmp(section,"default");
    int sections = 0;

    if (c->argc > 2) {
        addReply(c,shared.syntaxerr);
        return;
    }

    if (!strcasecmp(section,"server") || defsections) {
        if (sections++) info = sdscat(info,"\r\n");
        sds serversection = genRedisInfoString("server");
        info = sdscatlen(info,serversection,sdslen(serversection));
        sdsfree(serversection);
    }

    if (!strcasecmp(section,"sentinel") || defsections) {
        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",
            dictSize(sentinel.masters),
            sentinel.tilt,
            sentinel.running_scripts,
            listLength(sentinel.scripts_queue));

        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);
    }

    addReplySds(c,sdscatprintf(sdsempty(),"$%lu\r\n",
        (unsigned long)sdslen(info)));
    addReplySds(c,info);
    addReply(c,shared.crlf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x2, 0x30(%rax)
jne 0x7941f
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x7942c
leaq 0x6615d(%rip), %rax     # 0xdf583
movq %rax, -0x58(%rbp)
jmp 0x7942c
movq -0x58(%rbp), %rax
movq %rax, -0x10(%rbp)
callq 0x2c0c0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x6613b(%rip), %rsi     # 0xdf583
callq 0x1f2f0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x2, 0x30(%rax)
jle 0x7948a
movq -0x8(%rbp), %rdi
leaq 0x9acd7(%rip), %rax     # 0x114150
movq 0x80(%rax), %rsi
callq 0x35a70
jmp 0x7970c
movq -0x10(%rbp), %rdi
leaq 0x6fb12(%rip), %rsi     # 0xe8fa7
callq 0x1f2f0
cmpl $0x0, %eax
je 0x794a5
cmpl $0x0, -0x1c(%rbp)
je 0x7950f
movl -0x20(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x20(%rbp)
cmpl $0x0, %eax
je 0x794c9
movq -0x18(%rbp), %rdi
leaq 0x6a31e(%rip), %rsi     # 0xe37de
callq 0x2c5b0
movq %rax, -0x18(%rbp)
leaq 0x6fad7(%rip), %rdi     # 0xe8fa7
callq 0x29db0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
callq 0x788c0
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq %rax, %rdx
callq 0x2c500
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rdi
callq 0x2c160
movq -0x10(%rbp), %rdi
leaq 0x70184(%rip), %rsi     # 0xe969e
callq 0x1f2f0
cmpl $0x0, %eax
je 0x7952e
cmpl $0x0, -0x1c(%rbp)
je 0x796b1
movl $0x0, -0x3c(%rbp)
movl -0x20(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x20(%rbp)
cmpl $0x0, %eax
je 0x79559
movq -0x18(%rbp), %rdi
leaq 0x6a28e(%rip), %rsi     # 0xe37de
callq 0x2c5b0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq 0xaecdc(%rip), %rax     # 0x128240
movq 0x28(%rax), %rdx
movq 0xaecd1(%rip), %rax     # 0x128240
addq 0x48(%rax), %rdx
movl 0xaeccf(%rip), %ecx     # 0x128248
movl 0xaeccc(%rip), %r8d     # 0x12824c
movq 0xaecd9(%rip), %rax     # 0x128260
movq 0x28(%rax), %r9
leaq 0x70538(%rip), %rsi     # 0xe9aca
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x18(%rbp)
movq 0xaec9c(%rip), %rdi     # 0x128240
callq 0x241d0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x24270
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x796a8
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
leaq 0x727f4(%rip), %rax     # 0xebdcb
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movl (%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x795f6
leaq 0x706b5(%rip), %rax     # 0xe9ca5
movq %rax, -0x50(%rbp)
jmp 0x79611
movq -0x48(%rbp), %rax
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x7960f
leaq 0x7068c(%rip), %rax     # 0xe9c97
movq %rax, -0x50(%rbp)
jmp 0x79611
movq -0x18(%rbp), %rdi
movl -0x3c(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x50(%rbp), %r8
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %r9
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x8(%rax), %r11d
movq -0x48(%rbp), %rax
movq 0xc8(%rax), %rax
movq 0x28(%rax), %r10
movq -0x48(%rbp), %rax
movq 0xc8(%rax), %rax
addq 0x48(%rax), %r10
movq -0x48(%rbp), %rax
movq 0xc0(%rax), %rax
movq 0x28(%rax), %rax
movq -0x48(%rbp), %rsi
movq 0xc0(%rsi), %rsi
addq 0x48(%rsi), %rax
addq $0x1, %rax
leaq 0x704b5(%rip), %rsi     # 0xe9b3f
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x18(%rbp)
jmp 0x795ad
movq -0x30(%rbp), %rdi
callq 0x243d0
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
callq 0x2c0c0
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
callq 0x788c0
movq -0x78(%rbp), %rdi
movq %rax, %rdx
leaq 0x668ce(%rip), %rsi     # 0xdffa7
movb $0x0, %al
callq 0x2cad0
movq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0x35c00
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x35c00
movq -0x8(%rbp), %rdi
leaq 0x9aa4c(%rip), %rax     # 0x114150
movq (%rax), %rsi
callq 0x35a70
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)