// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/redis-cli.c
// Function: latencyMode
static void latencyMode(void) {
    redisReply *reply;
    long long start, latency, min = 0, max = 0, tot = 0, count = 0;
    long long history_interval =
        config.interval ? config.interval/1000 :
                          LATENCY_HISTORY_DEFAULT_INTERVAL;
    double avg;
    long long history_start = mstime();

    if (!context) exit(1);
    while(1) {
        start = mstime();
        reply = reconnectingRedisCommand(context,"PING");
        if (reply == NULL) {
            fprintf(stderr,"\nI/O error\n");
            exit(1);
        }
        latency = mstime()-start;
        freeReplyObject(reply);
        count++;
        if (count == 1) {
            min = max = tot = latency;
            avg = (double) latency;
        } else {
            if (latency < min) min = latency;
            if (latency > max) max = latency;
            tot += latency;
            avg = (double) tot/count;
        }
        printf("\x1b[0G\x1b[2Kmin: %lld, max: %lld, avg: %.2f (%lld samples)",
            min, max, avg, count);
        fflush(stdout);
        if (config.latency_history && mstime()-history_start > history_interval)
        {
            printf(" -- %.2f seconds range\n", (float)(mstime()-history_start)/1000);
            history_start = mstime();
            min = max = tot = count = 0;
        }
        usleep(LATENCY_SAMPLE_RATE * 1000);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x0, 0x8cdd8(%rip)     # 0xa14a8
je 0x146e9
movq 0x8cdcf(%rip), %rax     # 0xa14a8
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
movq %rax, -0x58(%rbp)
jmp 0x146f4
movl $0x3a98, %eax           # imm = 0x3A98
movq %rax, -0x58(%rbp)
jmp 0x146f4
movq -0x58(%rbp), %rax
movq %rax, -0x40(%rbp)
callq 0x16f20
movq %rax, -0x50(%rbp)
cmpq $0x0, 0x8cecb(%rip)     # 0xa15d8
jne 0x14719
movl $0x1, %edi
callq 0x10600
jmp 0x1471b
callq 0x16f20
movq %rax, -0x10(%rbp)
movq 0x8cead(%rip), %rdi     # 0xa15d8
leaq 0x74d84(%rip), %rsi     # 0x894b6
movb $0x0, %al
callq 0x16f40
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x14766
movq 0x8a8a5(%rip), %rax     # 0x9eff0
movq (%rax), %rdi
leaq 0x77603(%rip), %rsi     # 0x8bd58
movb $0x0, %al
callq 0x10360
movl $0x1, %edi
callq 0x10600
callq 0x16f20
subq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1b290
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
cmpq $0x1, -0x38(%rbp)
jne 0x147ac
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq %rax, -0x28(%rbp)
movq %rax, -0x20(%rbp)
cvtsi2sdq -0x18(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x147f1
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x147be
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
jle 0x147d0
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
cvtsi2sdq -0x30(%rbp), %xmm0
cvtsi2sdq -0x38(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movsd -0x48(%rbp), %xmm0
movq -0x38(%rbp), %rcx
leaq 0x7755b(%rip), %rdi     # 0x8bd64
movb $0x1, %al
callq 0x101d0
movq 0x8a7a9(%rip), %rax     # 0x9efc0
movq (%rax), %rdi
callq 0x10430
cmpl $0x0, 0x8cca6(%rip)     # 0xa14cc
je 0x1488c
callq 0x16f20
subq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
jle 0x1488c
callq 0x16f20
subq -0x50(%rbp), %rax
cvtsi2ss %rax, %xmm0
movss 0x7299b(%rip), %xmm1    # 0x871e8
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x7753f(%rip), %rdi     # 0x8bd9b
movb $0x1, %al
callq 0x101d0
callq 0x16f20
movq %rax, -0x50(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x2710, %edi           # imm = 0x2710
callq 0x106f0
jmp 0x1471b
nopl (%rax,%rax)