// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xa6d60(%rip), %rsi     # 0x149063
callq 0x26300
cmpl $0x0, %eax
jne 0xa2366
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
jne 0xa2366
leaq 0xd5eba(%rip), %rax     # 0x1781d8
movq 0xa20(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x2e280
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xa2354
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x437f0
jmp 0xa2361
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xa1e90
jmp 0xa2579
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xa6cee(%rip), %rsi     # 0x14906b
callq 0x26300
cmpl $0x0, %eax
jne 0xa240b
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
jne 0xa240b
leaq 0xd5e3c(%rip), %rax     # 0x1781d8
movq 0xa20(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x2dcb0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xa23c8
jmp 0xa257b
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xa2060
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43580
movq -0x18(%rbp), %rdi
callq 0x38620
jmp 0xa2577
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xa6c4f(%rip), %rsi     # 0x149071
callq 0x26300
cmpl $0x0, %eax
jne 0xa2444
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0xa2444
movq -0x8(%rbp), %rdi
callq 0xa1f50
jmp 0xa2575
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xa6c1d(%rip), %rsi     # 0x149078
callq 0x26300
cmpl $0x0, %eax
jne 0xa24af
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0xa24af
callq 0xa16c0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
callq 0xa25b0
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %rax, %rdx
callq 0x43920
movq -0x30(%rbp), %rdi
callq 0x38620
jmp 0xa2573
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xa0a77(%rip), %rsi     # 0x142f3d
callq 0x26300
cmpl $0x0, %eax
jne 0xa255a
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jl 0xa255a
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0xa2507
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0xa1380
movq -0x50(%rbp), %rdi
movslq %eax, %rsi
callq 0x43780
jmp 0xa2558
movl $0x0, -0x38(%rbp)
movl $0x2, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0xa254b
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
callq 0xa1380
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xa2515
movq -0x8(%rbp), %rdi
movslq -0x38(%rbp), %rsi
callq 0x43780
jmp 0xa2571
movq -0x8(%rbp), %rdi
leaq 0xd66db(%rip), %rax     # 0x178c40
movq 0x80(%rax), %rsi
callq 0x42cc0
jmp 0xa2573
jmp 0xa2575
jmp 0xa2577
jmp 0xa2579
jmp 0xa259d
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdx
leaq 0xa6ae9(%rip), %rsi     # 0x14907f
movb $0x0, %al
callq 0x42fd0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)