// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/latency.c
// Function: latencyCommand
void latencyCommand(client *c) {
    struct latencyTimeSeries *ts;

    if (!strcasecmp(c->argv[1]->ptr,"history") && c->argc == 3) {
        /* LATENCY HISTORY <event> */
        ts = dictFetchValue(server.latency_events,c->argv[2]->ptr);
        if (ts == NULL) {
            addReplyMultiBulkLen(c,0);
        } else {
            latencyCommandReplyWithSamples(c,ts);
        }
    } else if (!strcasecmp(c->argv[1]->ptr,"graph") && c->argc == 3) {
        /* LATENCY GRAPH <event> */
        sds graph;
        dictEntry *de;
        char *event;

        de = dictFind(server.latency_events,c->argv[2]->ptr);
        if (de == NULL) goto nodataerr;
        ts = dictGetVal(de);
        event = dictGetKey(de);

        graph = latencyCommandGenSparkeline(event,ts);
        addReplyBulkCString(c,graph);
        sdsfree(graph);
    } else if (!strcasecmp(c->argv[1]->ptr,"latest") && c->argc == 2) {
        /* LATENCY LATEST */
        latencyCommandReplyWithLatestEvents(c);
    } else if (!strcasecmp(c->argv[1]->ptr,"doctor") && c->argc == 2) {
        /* LATENCY DOCTOR */
        sds report = createLatencyReport();

        addReplyBulkCBuffer(c,report,sdslen(report));
        sdsfree(report);
    } else if (!strcasecmp(c->argv[1]->ptr,"reset") && c->argc >= 2) {
        /* LATENCY RESET */
        if (c->argc == 2) {
            addReplyLongLong(c,latencyResetEvent(NULL));
        } else {
            int j, resets = 0;

            for (j = 2; j < c->argc; j++)
                resets += latencyResetEvent(c->argv[j]->ptr);
            addReplyLongLong(c,resets);
        }
    } else {
        addReply(c,shared.syntaxerr);
    }
    return;

nodataerr:
    /* Common error when the user asks for an event we have no latency
     * information about. */
    addReplyErrorFormat(c,
        "No samples available for event '%s'", (char*) c->argv[2]->ptr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x40(%rdi), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %r14
leaq 0x4d3d1(%rip), %rsi     # 0xbfe63
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x72add
cmpl $0x3, 0x38(%rbx)
jne 0x72add
leaq 0x86dfd(%rip), %rax     # 0xf98a8
movq 0xa20(%rax), %rdi
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
callq 0x2a900
movq %rbx, %rdi
testq %rax, %rax
je 0x72bfb
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x72775
leaq 0x4d387(%rip), %rsi     # 0xbfe6b
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x72b39
cmpl $0x3, 0x38(%rbx)
jne 0x72b39
leaq 0x86dab(%rip), %rax     # 0xf98a8
movq 0xa20(%rax), %rdi
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
callq 0x2a5f9
testq %rax, %rax
je 0x72c0c
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x728bb
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x36f5d
jmp 0x72c97
leaq 0x4d331(%rip), %rsi     # 0xbfe71
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x72b64
cmpl $0x2, 0x38(%rbx)
jne 0x72b64
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x727ff
leaq 0x4d30d(%rip), %rsi     # 0xbfe78
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x72baf
cmpl $0x2, 0x38(%rbx)
jne 0x72baf
callq 0x72113
movq %rax, %r14
movzbl -0x1(%rax), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x72c8a
leaq 0x4bc5a(%rip), %rcx     # 0xbe7f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x72c8c
leaq 0x472ee(%rip), %rsi     # 0xb9ea4
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x72bdb
movl 0x38(%rbx), %eax
cmpl $0x2, %eax
jl 0x72bdb
jne 0x72c33
xorl %edi, %edi
callq 0x71f60
movslq %eax, %rsi
jmp 0x72c5e
leaq 0x8772e(%rip), %rax     # 0xfa310
movq 0x80(%rax), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x36987
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x370d9
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdx
leaq 0x4d260(%rip), %rsi     # 0xbfe7f
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x36b96
xorl %ebp, %ebp
pushq $0x2
popq %r14
cltq
cmpq %rax, %r14
jge 0x72c5b
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x8(%rax), %rdi
callq 0x71f60
addl %eax, %ebp
incq %r14
movl 0x38(%rbx), %eax
jmp 0x72c39
movslq %ebp, %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x370a6
movq -0x11(%r14), %rdx
jmp 0x72c8c
movzwl -0x5(%r14), %edx
jmp 0x72c8c
movl -0x9(%r14), %edx
jmp 0x72c8c
movzbl -0x3(%r14), %edx
jmp 0x72c8c
xorl %edx, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3716c
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x311c8
nopl (%rax)