// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/src/networking.c
// Function: clientCommand
void clientCommand(client *c) {
    listNode *ln;
    listIter li;
    client *client;

    if (!strcasecmp(c->argv[1]->ptr,"list") && c->argc == 2) {
        /* CLIENT LIST */
        sds o = getAllClientsInfoString();
        addReplyBulkCBuffer(c,o,sdslen(o));
        sdsfree(o);
    } else if (!strcasecmp(c->argv[1]->ptr,"reply") && c->argc == 3) {
        /* CLIENT REPLY ON|OFF|SKIP */
        if (!strcasecmp(c->argv[2]->ptr,"on")) {
            c->flags &= ~(CLIENT_REPLY_SKIP|CLIENT_REPLY_OFF);
            addReply(c,shared.ok);
        } else if (!strcasecmp(c->argv[2]->ptr,"off")) {
            c->flags |= CLIENT_REPLY_OFF;
        } else if (!strcasecmp(c->argv[2]->ptr,"skip")) {
            if (!(c->flags & CLIENT_REPLY_OFF))
                c->flags |= CLIENT_REPLY_SKIP_NEXT;
        } else {
            addReply(c,shared.syntaxerr);
            return;
        }
    } else if (!strcasecmp(c->argv[1]->ptr,"kill")) {
        /* CLIENT KILL <ip:port>
         * CLIENT KILL <option> [value] ... <option> [value] */
        char *addr = NULL;
        int type = -1;
        uint64_t id = 0;
        int skipme = 1;
        int killed = 0, close_this_client = 0;

        if (c->argc == 3) {
            /* Old style syntax: CLIENT KILL <addr> */
            addr = c->argv[2]->ptr;
            skipme = 0; /* With the old form, you can kill yourself. */
        } else if (c->argc > 3) {
            int i = 2; /* Next option index. */

            /* New style syntax: parse options. */
            while(i < c->argc) {
                int moreargs = c->argc > i+1;

                if (!strcasecmp(c->argv[i]->ptr,"id") && moreargs) {
                    long long tmp;

                    if (getLongLongFromObjectOrReply(c,c->argv[i+1],&tmp,NULL)
                        != C_OK) return;
                    id = tmp;
                } else if (!strcasecmp(c->argv[i]->ptr,"type") && moreargs) {
                    type = getClientTypeByName(c->argv[i+1]->ptr);
                    if (type == -1) {
                        addReplyErrorFormat(c,"Unknown client type '%s'",
                            (char*) c->argv[i+1]->ptr);
                        return;
                    }
                } else if (!strcasecmp(c->argv[i]->ptr,"addr") && moreargs) {
                    addr = c->argv[i+1]->ptr;
                } else if (!strcasecmp(c->argv[i]->ptr,"skipme") && moreargs) {
                    if (!strcasecmp(c->argv[i+1]->ptr,"yes")) {
                        skipme = 1;
                    } else if (!strcasecmp(c->argv[i+1]->ptr,"no")) {
                        skipme = 0;
                    } else {
                        addReply(c,shared.syntaxerr);
                        return;
                    }
                } else {
                    addReply(c,shared.syntaxerr);
                    return;
                }
                i += 2;
            }
        } else {
            addReply(c,shared.syntaxerr);
            return;
        }

        /* Iterate clients killing all the matching clients. */
        listRewind(server.clients,&li);
        while ((ln = listNext(&li)) != NULL) {
            client = listNodeValue(ln);
            if (addr && strcmp(getClientPeerId(client),addr) != 0) continue;
            if (type != -1 &&
                getClientType(client) != type) continue;
            if (id != 0 && client->id != id) continue;
            if (c == client && skipme) continue;

            /* Kill it. */
            if (c == client) {
                close_this_client = 1;
            } else {
                freeClient(client);
            }
            killed++;
        }

        /* Reply according to old/new format. */
        if (c->argc == 3) {
            if (killed == 0)
                addReplyError(c,"No such client");
            else
                addReply(c,shared.ok);
        } else {
            addReplyLongLong(c,killed);
        }

        /* If this client has to be closed, flag it as CLOSE_AFTER_REPLY
         * only after we queued the reply to its output buffers. */
        if (close_this_client) c->flags |= CLIENT_CLOSE_AFTER_REPLY;
    } else if (!strcasecmp(c->argv[1]->ptr,"setname") && c->argc == 3) {
        int j, len = sdslen(c->argv[2]->ptr);
        char *p = c->argv[2]->ptr;

        /* Setting the client name to an empty string actually removes
         * the current name. */
        if (len == 0) {
            if (c->name) decrRefCount(c->name);
            c->name = NULL;
            addReply(c,shared.ok);
            return;
        }

        /* Otherwise check if the charset is ok. We need to do this otherwise
         * CLIENT LIST format will break. You should always be able to
         * split by space to get the different fields. */
        for (j = 0; j < len; j++) {
            if (p[j] < '!' || p[j] > '~') { /* ASCII is assumed. */
                addReplyError(c,
                    "Client names cannot contain spaces, "
                    "newlines or special characters.");
                return;
            }
        }
        if (c->name) decrRefCount(c->name);
        c->name = c->argv[2];
        incrRefCount(c->name);
        addReply(c,shared.ok);
    } else if (!strcasecmp(c->argv[1]->ptr,"getname") && c->argc == 2) {
        if (c->name)
            addReplyBulk(c,c->name);
        else
            addReply(c,shared.nullbulk);
    } else if (!strcasecmp(c->argv[1]->ptr,"pause") && c->argc == 3) {
        long long duration;

        if (getTimeoutFromObjectOrReply(c,c->argv[2],&duration,UNIT_MILLISECONDS)
                                        != C_OK) return;
        pauseClients(duration);
        addReply(c,shared.ok);
    } else {
        addReplyError(c, "Syntax error, try CLIENT (LIST | KILL ip:port | GETNAME | SETNAME connection-name)");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbp
movq 0x30(%rdi), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %r14
leaq 0x30c0a(%rip), %rsi     # 0x54f4a
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
jne 0x24384
cmpl $0x2, 0x28(%rbp)
jne 0x24384
callq 0x2428b
movq %rax, %r14
movzbl -0x1(%rax), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x24932
leaq 0x30875(%rip), %rcx     # 0x54be8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x24934
leaq 0x30bc4(%rip), %rsi     # 0x54f4f
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
jne 0x2440a
cmpl $0x3, 0x28(%rbp)
jne 0x2440a
movq 0x10(%r15), %rax
movq 0x8(%rax), %r14
leaq 0x31480(%rip), %rsi     # 0x5582c
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
je 0x24903
leaq 0x30b92(%rip), %rsi     # 0x54f55
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
je 0x2490f
leaq 0x30b7f(%rip), %rsi     # 0x54f59
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
jne 0x248a9
movl 0x88(%rbp), %eax
btl $0x15, %eax
jb 0x24974
orl $0x400000, %eax         # imm = 0x400000
movl %eax, 0x88(%rbp)
jmp 0x24974
leaq 0x30b4d(%rip), %rsi     # 0x54f5e
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
je 0x2452e
leaq 0x30b76(%rip), %rsi     # 0x54f9e
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
jne 0x2446c
cmpl $0x3, 0x28(%rbp)
jne 0x2446c
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movzbl -0x1(%rax), %ecx
movl %ecx, %edx
andl $0x7, %edx
cmpl $0x4, %edx
ja 0x249a7
leaq 0x30779(%rip), %rsi     # 0x54bd4
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
shrl $0x3, %ecx
jmp 0x249a9
leaq 0x30b77(%rip), %rsi     # 0x54fea
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
jne 0x244a8
cmpl $0x2, 0x28(%rbp)
jne 0x244a8
movq 0x10(%rbp), %rsi
testq %rsi, %rsi
je 0x24983
movq %rbp, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22a4a
leaq 0x30b43(%rip), %rsi     # 0x54ff2
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
jne 0x24645
cmpl $0x3, 0x28(%rbp)
jne 0x24645
movq 0x10(%r15), %rsi
leaq 0x38(%rsp), %rdx
movq %rbp, %rdi
movl $0x1, %ecx
callq 0x30144
testl %eax, %eax
jne 0x24974
movq 0x38(%rsp), %rcx
leaq 0x4ab95(%rip), %rax     # 0x6f088
cmpl $0x0, 0x208(%rax)
je 0x24505
cmpq %rcx, 0x210(%rax)
jge 0x2450c
movq %rcx, 0x210(%rax)
movl $0x1, 0x208(%rax)
leaq 0x4b27b(%rip), %rax     # 0x6f798
movq 0x8(%rax), %rsi
movq %rbp, %rdi
callq 0x21f58
jmp 0x24974
movl 0x28(%rbp), %eax
cmpl $0x3, %eax
jne 0x24667
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movl $0x0, 0x10(%rsp)
leaq 0x4ab2a(%rip), %rax     # 0x6f088
movq 0x1e0(%rax), %rdi
leaq 0x38(%rsp), %r15
movq %r15, %rsi
callq 0x16c72
movq %r15, %rdi
callq 0x16c8f
testq %rax, %rax
je 0x248d1
movl %ebx, 0x14(%rsp)
xorl %ecx, %ecx
leaq 0x38(%rsp), %r15
xorl %r13d, %r13d
movl %ecx, 0x8(%rsp)
movl 0x14(%rsp), %ebx
movq 0x10(%rax), %r12
cmpq $0x0, 0x28(%rsp)
je 0x245be
movq %r12, %rdi
callq 0x2422b
movq %rax, %rdi
movq 0x28(%rsp), %rsi
callq 0x124a0
testl %eax, %eax
jne 0x24603
cmpl $-0x1, %ebx
je 0x245d5
movl 0x88(%r12), %eax
shrl $0x12, %eax
andl $0x1, %eax
cmpl %ebx, %eax
jne 0x24603
testq %r14, %r14
je 0x245f4
cmpl $0x0, 0x10(%rsp)
setne %cl
cmpq %rbp, %r12
sete %al
cmpq %r14, (%r12)
jne 0x24603
andb %al, %cl
jne 0x24603
jmp 0x24615
cmpq %rbp, %r12
sete %al
jne 0x24615
cmpl $0x0, 0x10(%rsp)
je 0x24615
movq %r15, %rdi
callq 0x16c8f
testq %rax, %rax
jne 0x24599
jmp 0x248bc
movl $0x1, %ebx
testb %al, %al
jne 0x2462a
movq %r12, %rdi
callq 0x22f00
movl 0x8(%rsp), %ebx
incl %r13d
movq %r15, %rdi
callq 0x16c8f
movl %ebx, %ecx
testq %rax, %rax
jne 0x24591
jmp 0x248d6
leaq 0x309ac(%rip), %rsi     # 0x54ff8
movl $0x52, %edx
movq %rbp, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x222c4
jle 0x248a9
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0x2, %eax
movl $0x1, 0x10(%rsp)
xorl %r14d, %r14d
movq $0x0, 0x28(%rsp)
movq %rbp, 0x20(%rsp)
movl %eax, %ecx
movl 0x28(%rbp), %r15d
cmpl %r15d, %eax
movl %r15d, 0x34(%rsp)
jge 0x248c2
movl %ebx, 0x14(%rsp)
movq %r14, 0x18(%rsp)
leal 0x1(%rcx), %ebx
cmpl %ebx, %r15d
setg %r14b
movq 0x30(%rbp), %r13
movq %rcx, 0x8(%rsp)
movslq %ecx, %rax
movq (%r13,%rax,8), %rax
movq 0x8(%rax), %r12
movq %r12, %rdi
leaq 0x3137b(%rip), %rsi     # 0x55a51
callq 0x12090
testl %eax, %eax
sete %al
andb %r14b, %al
cmpb $0x1, %al
jne 0x24720
movslq %ebx, %rax
movq (%r13,%rax,8), %rsi
xorl %ebx, %ebx
movq %rbp, %rdi
leaq 0x38(%rsp), %rdx
xorl %ecx, %ecx
callq 0x266f6
testl %eax, %eax
movq 0x18(%rsp), %r14
jne 0x2470e
movq 0x38(%rsp), %r14
movq 0x8(%rsp), %rcx
movl %ecx, %eax
jne 0x2487c
jmp 0x247a2
cmpl %ebx, %r15d
setg %r14b
movq %r12, %rdi
leaq 0x30832(%rip), %rsi     # 0x54f63
callq 0x12090
testl %eax, %eax
sete %al
andb %r14b, %al
cmpb $0x1, %al
jne 0x24765
movslq %ebx, %rax
movq (%r13,%rax,8), %rax
movq 0x8(%rax), %r12
movq %r12, %rdi
callq 0x24a36
cmpl $-0x1, %eax
je 0x24834
movl %eax, 0x14(%rsp)
jmp 0x24798
cmpl %ebx, %r15d
setg %r14b
movq %r12, %rdi
leaq 0x32350(%rip), %rsi     # 0x56ac6
callq 0x12090
testl %eax, %eax
sete %al
andb %r14b, %al
cmpb $0x1, %al
jne 0x247ac
movslq %ebx, %rax
movq (%r13,%rax,8), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x18(%rsp), %r14
movq 0x8(%rsp), %rcx
leal 0x2(%rcx), %eax
movb $0x1, %bl
jmp 0x2487c
cmpl %ebx, %r15d
setg %r14b
movq %r12, %rdi
leaq 0x307c4(%rip), %rsi     # 0x54f81
callq 0x12090
testl %eax, %eax
sete %al
andb %r14b, %al
cmpb $0x1, %al
jne 0x24856
movslq %ebx, %rax
movq (%r13,%rax,8), %rax
movq 0x8(%rax), %r12
movq %r12, %rdi
leaq 0x307a0(%rip), %rsi     # 0x54f88
callq 0x12090
testl %eax, %eax
movq 0x18(%rsp), %r14
je 0x2488f
movq %r12, %rdi
leaq 0x30788(%rip), %rsi     # 0x54f8c
callq 0x12090
testl %eax, %eax
je 0x2489c
leaq 0x4af80(%rip), %rax     # 0x6f798
movq 0x80(%rax), %rsi
movq 0x20(%rsp), %rdi
callq 0x21f58
xorl %ebx, %ebx
movq 0x8(%rsp), %rcx
movl %ecx, %eax
jmp 0x2487c
xorl %ebx, %ebx
movq 0x20(%rsp), %rdi
leaq 0x30726(%rip), %rsi     # 0x54f68
movq %r12, %rdx
xorl %eax, %eax
callq 0x22331
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x24870
leaq 0x4af3b(%rip), %rax     # 0x6f798
movq 0x80(%rax), %rsi
movq 0x20(%rsp), %rdi
callq 0x21f58
xorl %ebx, %ebx
movq 0x8(%rsp), %rcx
movl %ecx, %eax
movq 0x18(%rsp), %r14
testb %bl, %bl
movq 0x20(%rsp), %rbp
movl 0x14(%rsp), %ebx
jne 0x24690
jmp 0x248c2
movl $0x1, 0x10(%rsp)
jmp 0x2479d
movl $0x0, 0x10(%rsp)
jmp 0x2479d
leaq 0x4aee8(%rip), %rax     # 0x6f798
movq 0x80(%rax), %rsi
jmp 0x24a0f
movl 0x8(%rsp), %ebx
jmp 0x248d6
cmpl 0x34(%rsp), %ecx
jge 0x24557
jmp 0x24974
xorl %r13d, %r13d
xorl %ebx, %ebx
cmpl $0x3, 0x28(%rbp)
jne 0x248f6
testl %r13d, %r13d
je 0x24955
leaq 0x4aeb0(%rip), %rax     # 0x6f798
movq 0x8(%rax), %rsi
movq %rbp, %rdi
callq 0x21f58
jmp 0x24969
movslq %r13d, %rsi
movq %rbp, %rdi
callq 0x22941
jmp 0x24969
andb $0x5f, 0x8a(%rbp)
jmp 0x24a04
orb $0x20, 0x8a(%rbp)
jmp 0x24974
movq -0x11(%r14), %rdx
jmp 0x24934
movzwl -0x5(%r14), %edx
jmp 0x24934
movl -0x9(%r14), %edx
jmp 0x24934
movzbl -0x3(%r14), %edx
jmp 0x24934
xorl %edx, %edx
movq %rbp, %rdi
movq %r14, %rsi
callq 0x22a7d
movq %r14, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1ded3
leaq 0x30633(%rip), %rsi     # 0x54f8f
movl $0xe, %edx
movq %rbp, %rdi
callq 0x222c4
testl %ebx, %ebx
je 0x24974
orb $0x40, 0x88(%rbp)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4ae0e(%rip), %rax     # 0x6f798
movq 0x50(%rax), %rsi
jmp 0x24a0f
movq -0x11(%rax), %rcx
jmp 0x249a9
movzwl -0x5(%rax), %ecx
jmp 0x249a9
movl -0x9(%rax), %ecx
jmp 0x249a9
movzbl -0x3(%rax), %ecx
jmp 0x249a9
xorl %ecx, %ecx
testl %ecx, %ecx
je 0x249ee
jle 0x249cd
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %edx, %edx
movb (%rax,%rdx), %sil
addb $-0x7f, %sil
cmpb $-0x5f, %sil
jbe 0x24a25
incq %rdx
cmpq %rdx, %rcx
jne 0x249b7
movq 0x10(%rbp), %rdi
testq %rdi, %rdi
je 0x249db
callq 0x25d25
movq 0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq %rdi, 0x10(%rbp)
callq 0x25b5e
jmp 0x24a04
movq 0x10(%rbp), %rdi
testq %rdi, %rdi
je 0x249fc
callq 0x25d25
movq $0x0, 0x10(%rbp)
leaq 0x4ad8d(%rip), %rax     # 0x6f798
movq 0x8(%rax), %rsi
movq %rbp, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21f58
leaq 0x3057a(%rip), %rsi     # 0x54fa6
movl $0x43, %edx
jmp 0x24651