// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %r14
leaq 0x24c9e(%rip), %rsi     # 0x55844
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
jne 0x30bec
cmpl $0x3, 0x28(%rbx)
jne 0x30bec
leaq 0x3e4c9(%rip), %rax     # 0x6f088
movq 0x678(%rax), %rdi
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
callq 0x191a0
movq %rbx, %rdi
testq %rax, %rax
je 0x30d01
movq %rax, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x30829
leaq 0x27c60(%rip), %rsi     # 0x58853
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
jne 0x30c48
cmpl $0x3, 0x28(%rbx)
jne 0x30c48
leaq 0x3e47c(%rip), %rax     # 0x6f088
movq 0x678(%rax), %rdi
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
callq 0x190de
testq %rax, %rax
je 0x30d0d
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x309a2
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x22791
jmp 0x30d98
leaq 0x27c0a(%rip), %rsi     # 0x58859
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
jne 0x30c6e
cmpl $0x2, 0x28(%rbx)
jne 0x30c6e
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x308c7
leaq 0x27beb(%rip), %rsi     # 0x58860
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
jne 0x30cb9
cmpl $0x2, 0x28(%rbx)
jne 0x30cb9
callq 0x305c8
movq %rax, %r14
movzbl -0x1(%rax), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x30d8b
leaq 0x27414(%rip), %rcx     # 0x580bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x30d8d
leaq 0x253c8(%rip), %rsi     # 0x56088
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
jne 0x30ce6
cmpl $0x2, 0x28(%rbx)
jl 0x30ce6
jne 0x30d2f
xorl %edi, %edi
callq 0x30436
movslq %eax, %rsi
movq %rbx, %rdi
jmp 0x30d67
leaq 0x3eaab(%rip), %rax     # 0x6f798
movq 0x80(%rax), %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x21f58
xorl %esi, %esi
popq %rbx
popq %r14
popq %r15
jmp 0x22976
movq 0x30(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdx
leaq 0x27b47(%rip), %rsi     # 0x58867
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x22331
xorl %r14d, %r14d
cmpl $0x3, 0x28(%rbx)
jl 0x30d61
movl $0x2, %r15d
movq 0x30(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x8(%rax), %rdi
callq 0x30436
addl %eax, %r14d
incq %r15
movslq 0x28(%rbx), %rax
cmpq %rax, %r15
jl 0x30d3e
movslq %r14d, %r14
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x22941
movq -0x11(%r14), %rdx
jmp 0x30d8d
movzwl -0x5(%r14), %edx
jmp 0x30d8d
movl -0x9(%r14), %edx
jmp 0x30d8d
movzbl -0x3(%r14), %edx
jmp 0x30d8d
xorl %edx, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22a7d
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1ded3
nopl (%rax)