// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/slowlog.c
// Function: slowlogCommand
void slowlogCommand(client *c) {
    if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"reset")) {
        slowlogReset();
        addReply(c,shared.ok);
    } else if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"len")) {
        addReplyLongLong(c,listLength(server.slowlog));
    } else if ((c->argc == 2 || c->argc == 3) &&
               !strcasecmp(c->argv[1]->ptr,"get"))
    {
        long count = 10, sent = 0;
        listIter li;
        void *totentries;
        listNode *ln;
        slowlogEntry *se;

        if (c->argc == 3 &&
            getLongFromObjectOrReply(c,c->argv[2],&count,NULL) != C_OK)
            return;

        listRewind(server.slowlog,&li);
        totentries = addDeferredMultiBulkLength(c);
        while(count-- && (ln = listNext(&li))) {
            int j;

            se = ln->value;
            addReplyMultiBulkLen(c,4);
            addReplyLongLong(c,se->id);
            addReplyLongLong(c,se->time);
            addReplyLongLong(c,se->duration);
            addReplyMultiBulkLen(c,se->argc);
            for (j = 0; j < se->argc; j++)
                addReplyBulk(c,se->argv[j]);
            sent++;
        }
        setDeferredMultiBulkLength(c,totentries,sent);
    } else {
        addReplyError(c,
            "Unknown SLOWLOG subcommand or wrong # of args. Try GET, RESET, LEN.");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x38(%rdi), %ebp
cmpl $0x2, %ebp
jne 0x6d4ae
movq 0x40(%rbx), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %r14
leaq 0x5ba59(%rip), %rsi     # 0xc8ebc
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x6d4f4
leaq 0x61ec2(%rip), %rsi     # 0xcf33c
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
jne 0x6d4c4
leaq 0x9441b(%rip), %rax     # 0x1018a8
movq 0x3f8(%rax), %rax
movq 0x28(%rax), %rsi
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3d23f
movl %ebp, %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x6d4d7
movq 0x40(%rbx), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %r14
leaq 0x4f2aa(%rip), %rsi     # 0xbc775
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x6d51a
leaq 0x5c183(%rip), %rsi     # 0xc9661
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3cc06
callq 0x6d414
leaq 0x94e10(%rip), %rax     # 0x102310
movq 0x8(%rax), %rsi
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3c854
movq $0xa, (%rsp)
cmpl $0x3, %ebp
jne 0x6d540
movq 0x10(%r15), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x41718
testl %eax, %eax
jne 0x6d605
leaq 0x94361(%rip), %rax     # 0x1018a8
movq 0x3f8(%rax), %rdi
leaq 0x8(%rsp), %rsi
callq 0x2b3b7
movq %rbx, %rdi
callq 0x3cee9
movq %rax, %r14
subq $0x1, (%rsp)
jae 0x6d572
xorl %r15d, %r15d
jmp 0x6d5f7
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x2b3d4
testq %rax, %rax
je 0x6d5f7
movq 0x10(%rax), %r13
movl $0x4, %esi
movq %rbx, %rdi
callq 0x3d274
movq 0x10(%r13), %rsi
movq %rbx, %rdi
callq 0x3d23f
movq 0x20(%r13), %rsi
movq %rbx, %rdi
callq 0x3d23f
movq 0x18(%r13), %rsi
movq %rbx, %rdi
callq 0x3d23f
movslq 0x8(%r13), %rsi
movq %rbx, %rdi
callq 0x3d274
cmpl $0x0, 0x8(%r13)
jle 0x6d5ed
xorl %ebp, %ebp
movq (%r13), %rax
movq (%rax,%rbp,8), %rsi
movq %rbx, %rdi
callq 0x3d170
incq %rbp
movslq 0x8(%r13), %rax
cmpq %rax, %rbp
jl 0x6d5d1
incq %r15
subq $0x1, (%rsp)
jae 0x6d57a
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3cf25
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq