// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/redis-cli.c
// Function: statMode
static void statMode() {
    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");
        aux |= getLongInfoField(reply->str,"aof_rewrite_in_progress") << 1;
        switch(aux) {
        case 0: break;
        case 1:
            printf("SAVE");
            break;
        case 2:
            printf("AOF");
            break;
        case 3:
            printf("SAVE+AOF");
            break;
        }

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
callq 0x15900
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x6, (%rax)
jne 0x155ec
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0x39aef(%rip), %rdi     # 0x4f0ca
movb $0x0, %al
callq 0xd1c0
movl $0x1, %edi
callq 0xd5c0
movl -0x1c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
movl $0x14, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x15612
leaq 0x39aca(%rip), %rdi     # 0x4f0d5
movb $0x0, %al
callq 0xd1c0
movq $0x0, -0x10(%rbp)
movl $0x0, -0x64(%rbp)
cmpl $0x14, -0x64(%rbp)
jge 0x1567a
leaq -0x60(%rbp), %rdi
movl -0x64(%rbp), %edx
leaq 0x39b3d(%rip), %rsi     # 0x4f172
movb $0x0, %al
callq 0xd5b0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x60(%rbp), %rsi
callq 0x15a50
movq %rax, -0x70(%rbp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, -0x70(%rbp)
jne 0x15663
jmp 0x1566f
movq -0x70(%rbp), %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x15621
leaq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x39af3(%rip), %rsi     # 0x4f17c
movb $0x0, %al
callq 0xd5b0
leaq -0x60(%rbp), %rsi
leaq 0x39ae5(%rip), %rdi     # 0x4f180
movb $0x0, %al
callq 0xd1c0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x39ad5(%rip), %rsi     # 0x4f186
callq 0x15a50
movq %rax, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11a60
leaq -0x60(%rbp), %rsi
leaq 0x39ad3(%rip), %rdi     # 0x4f1a5
movb $0x0, %al
callq 0xd1c0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x39aaa(%rip), %rsi     # 0x4f192
callq 0x15a50
movq %rax, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x39a7c(%rip), %rsi     # 0x4f17c
movb $0x0, %al
callq 0xd5b0
leaq -0x60(%rbp), %rsi
leaq 0x39a92(%rip), %rdi     # 0x4f1a4
movb $0x0, %al
callq 0xd1c0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x39a82(%rip), %rsi     # 0x4f1aa
callq 0x15a50
movq %rax, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x39a3c(%rip), %rsi     # 0x4f17c
movb $0x0, %al
callq 0xd5b0
leaq -0x60(%rbp), %rsi
leaq 0x39a53(%rip), %rdi     # 0x4f1a5
movb $0x0, %al
callq 0xd1c0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x39a52(%rip), %rsi     # 0x4f1ba
callq 0x15a50
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 0x15793
xorl %eax, %eax
movq %rax, -0x88(%rbp)
jmp 0x157a2
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 0x39a1b(%rip), %rsi     # 0x4f1d3
xorl %eax, %eax
movb %al, -0x91(%rbp)
callq 0xd5b0
movb -0x91(%rbp), %al
leaq 0x39a0c(%rip), %rdi     # 0x4f1de
leaq -0x60(%rbp), %rsi
movq %rsi, -0xa0(%rbp)
callq 0xd1c0
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x399eb(%rip), %rsi     # 0x4f1e4
callq 0x15a50
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movb -0x91(%rbp), %al
movq %rcx, -0x10(%rbp)
movq -0x10(%rbp), %rdx
leaq 0x3995f(%rip), %rsi     # 0x4f17c
callq 0xd5b0
movq -0xa0(%rbp), %rsi
movb -0x91(%rbp), %al
leaq 0x399c9(%rip), %rdi     # 0x4f1ff
callq 0xd1c0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x399bc(%rip), %rsi     # 0x4f206
callq 0x15a50
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x399b7(%rip), %rsi     # 0x4f219
callq 0x15a50
movq %rax, %rcx
addq %rcx, %rcx
movq -0x10(%rbp), %rax
orq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
subq $0x3, %rax
ja 0x158d0
movq -0x90(%rbp), %rax
leaq 0x35af1(%rip), %rcx     # 0x4b388
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x158d0
leaq 0x35b8a(%rip), %rdi     # 0x4b433
movb $0x0, %al
callq 0xd1c0
jmp 0x158d0
leaq 0x3997d(%rip), %rdi     # 0x4f236
movb $0x0, %al
callq 0xd1c0
jmp 0x158d0
leaq 0x39968(%rip), %rdi     # 0x4f231
movb $0x0, %al
callq 0xd1c0
leaq 0x395a0(%rip), %rdi     # 0x4ee77
movb $0x0, %al
callq 0xd1c0
movq -0x8(%rbp), %rdi
callq 0x182e0
movq 0x4b4ea(%rip), %rax     # 0x60dd8
movl %eax, %edi
callq 0xd6a0
jmp 0x155ba
nopw (%rax,%rax)