// File: /workspace/github_c_makefile_star2_O0/erikdubbelboer[P]discnt/src/discnt-cli.c
// Function: statMode
static void statMode(void) {
    redisReply *reply;
    long aux, requests = 0;
    int i = 0;

    while(1) {
        char buf[64];
        int j;

        reply = reconnectingInfo();
        if (reply->type == REDIS_REPLY_ERROR) {
            printf("ERROR: %s\n", reply->str);
            exit(1);
        }

        if ((i++ % 20) == 0) {
            printf(
"------- data ------ --------------------- load -------------------- - child -\n"
"keys       mem      clients blocked requests            connections          \n");
        }

        /* Keys */
        aux = 0;
        for (j = 0; j < 20; j++) {
            long k;

            sprintf(buf,"db%d:keys",j);
            k = getLongInfoField(reply->str,buf);
            if (k == LONG_MIN) continue;
            aux += k;
        }
        sprintf(buf,"%ld",aux);
        printf("%-11s",buf);

        /* Used memory */
        aux = getLongInfoField(reply->str,"used_memory");
        bytesToHuman(buf,aux);
        printf("%-8s",buf);

        /* Clients */
        aux = getLongInfoField(reply->str,"connected_clients");
        sprintf(buf,"%ld",aux);
        printf(" %-8s",buf);

        /* Blocked (BLPOPPING) Clients */
        aux = getLongInfoField(reply->str,"blocked_clients");
        sprintf(buf,"%ld",aux);
        printf("%-8s",buf);

        /* Requets */
        aux = getLongInfoField(reply->str,"total_commands_processed");
        sprintf(buf,"%ld (+%ld)",aux,requests == 0 ? 0 : aux-requests);
        printf("%-19s",buf);
        requests = aux;

        /* Connections */
        aux = getLongInfoField(reply->str,"total_connections_received");
        sprintf(buf,"%ld",aux);
        printf(" %-12s",buf);

        /* Children */
        aux = getLongInfoField(reply->str,"bgsave_in_progress");
        if (aux) {
            printf("SAVE");
        }

        printf("\n");
        freeReplyObject(reply);
        usleep(config.interval);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
callq 0x13640
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x6, (%rax)
jne 0x12a6c
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0x710aa(%rip), %rdi     # 0x83b05
movb $0x0, %al
callq 0xc1c0
movl $0x1, %edi
callq 0xc590
movl -0x1c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
movl $0x14, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x12a92
leaq 0x71085(%rip), %rdi     # 0x83b10
movb $0x0, %al
callq 0xc1c0
movq $0x0, -0x10(%rbp)
movl $0x0, -0x64(%rbp)
cmpl $0x14, -0x64(%rbp)
jge 0x12afa
leaq -0x60(%rbp), %rdi
movl -0x64(%rbp), %edx
leaq 0x710f8(%rip), %rsi     # 0x83bad
movb $0x0, %al
callq 0xc580
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x60(%rbp), %rsi
callq 0x13790
movq %rax, -0x70(%rbp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, -0x70(%rbp)
jne 0x12ae3
jmp 0x12aef
movq -0x70(%rbp), %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x12aa1
leaq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x710ae(%rip), %rsi     # 0x83bb7
movb $0x0, %al
callq 0xc580
leaq -0x60(%rbp), %rsi
leaq 0x710a0(%rip), %rdi     # 0x83bbb
movb $0x0, %al
callq 0xc1c0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x71090(%rip), %rsi     # 0x83bc1
callq 0x13790
movq %rax, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11420
leaq -0x60(%rbp), %rsi
leaq 0x7108e(%rip), %rdi     # 0x83be0
movb $0x0, %al
callq 0xc1c0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x71065(%rip), %rsi     # 0x83bcd
callq 0x13790
movq %rax, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x71037(%rip), %rsi     # 0x83bb7
movb $0x0, %al
callq 0xc580
leaq -0x60(%rbp), %rsi
leaq 0x7104d(%rip), %rdi     # 0x83bdf
movb $0x0, %al
callq 0xc1c0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x7103d(%rip), %rsi     # 0x83be5
callq 0x13790
movq %rax, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x70ff7(%rip), %rsi     # 0x83bb7
movb $0x0, %al
callq 0xc580
leaq -0x60(%rbp), %rsi
leaq 0x7100e(%rip), %rdi     # 0x83be0
movb $0x0, %al
callq 0xc1c0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x7100d(%rip), %rsi     # 0x83bf5
callq 0x13790
movq %rax, -0x10(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x12c13
xorl %eax, %eax
movq %rax, -0x88(%rbp)
jmp 0x12c22
movq -0x10(%rbp), %rax
subq -0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rcx
leaq 0x70fd6(%rip), %rsi     # 0x83c0e
movb $0x0, %al
callq 0xc580
leaq -0x60(%rbp), %rsi
leaq 0x70fcf(%rip), %rdi     # 0x83c19
movb $0x0, %al
callq 0xc1c0
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x70fb7(%rip), %rsi     # 0x83c1f
callq 0x13790
movq %rax, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x70f37(%rip), %rsi     # 0x83bb7
movb $0x0, %al
callq 0xc580
leaq -0x60(%rbp), %rsi
leaq 0x70fa8(%rip), %rdi     # 0x83c3a
movb $0x0, %al
callq 0xc1c0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x70f99(%rip), %rsi     # 0x83c41
callq 0x13790
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x12cc6
leaq 0x6f92a(%rip), %rdi     # 0x825e9
movb $0x0, %al
callq 0xc1c0
leaq 0x70c43(%rip), %rdi     # 0x83910
movb $0x0, %al
callq 0xc1c0
movq -0x8(%rbp), %rdi
callq 0x165c0
movq 0x83ef4(%rip), %rax     # 0x96bd8
movl %eax, %edi
callq 0xc670
jmp 0x12a3a