// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/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 | GETNAME | SETNAME | PAUSE | REPLY)");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xf59b2(%rip), %rsi     # 0x13b808
callq 0x26300
cmpl $0x0, %eax
jne 0x45eb6
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x45eb6
callq 0x45d90
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %rdi
callq 0x42810
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq %rax, %rdx
callq 0x43920
movq -0x30(%rbp), %rdi
callq 0x38620
jmp 0x46640
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x100b9d(%rip), %rsi    # 0x146a6a
callq 0x26300
cmpl $0x0, %eax
jne 0x45fe4
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
jne 0x45fe4
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x104233(%rip), %rsi    # 0x14a133
callq 0x26300
cmpl $0x0, %eax
jne 0x45f39
movq -0x8(%rbp), %rax
movl 0x98(%rax), %ecx
andl $0xfebfffff, %ecx       # imm = 0xFEBFFFFF
movl %ecx, 0x98(%rax)
movq -0x8(%rbp), %rdi
leaq 0x132d15(%rip), %rax    # 0x178c40
movq 0x8(%rax), %rsi
callq 0x42cc0
jmp 0x45fdf
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xf4e77(%rip), %rsi     # 0x13adc7
callq 0x26300
cmpl $0x0, %eax
jne 0x45f72
movq -0x8(%rbp), %rax
movl 0x98(%rax), %ecx
orl $0x400000, %ecx         # imm = 0x400000
movl %ecx, 0x98(%rax)
jmp 0x45fdd
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xf4e42(%rip), %rsi     # 0x13adcb
callq 0x26300
cmpl $0x0, %eax
jne 0x45fbf
movq -0x8(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x400000, %eax         # imm = 0x400000
cmpl $0x0, %eax
jne 0x45fbd
movq -0x8(%rbp), %rax
movl 0x98(%rax), %ecx
orl $0x800000, %ecx         # imm = 0x800000
movl %ecx, 0x98(%rax)
jmp 0x45fdb
movq -0x8(%rbp), %rdi
leaq 0x132c76(%rip), %rax    # 0x178c40
movq 0x80(%rax), %rsi
callq 0x42cc0
jmp 0x46640
jmp 0x45fdd
jmp 0x45fdf
jmp 0x4663e
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xf4dd5(%rip), %rsi     # 0x13add0
callq 0x26300
cmpl $0x0, %eax
jne 0x4640e
movq $0x0, -0x38(%rbp)
movl $0xffffffff, -0x3c(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x48(%rbp)
movl $0x1, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
jne 0x4605f
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x4c(%rbp)
jmp 0x462e3
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
jle 0x462c5
movl $0x2, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0x462c3
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
movl -0x58(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x5c(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xf98a6(%rip), %rsi     # 0x13f95f
callq 0x26300
cmpl $0x0, %eax
jne 0x46106
cmpl $0x0, -0x5c(%rbp)
je 0x46106
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x58(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x68(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49ea0
cmpl $0x0, %eax
je 0x460f9
jmp 0x46640
movq -0x68(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x462b5
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0x103455(%rip), %rsi    # 0x149576
callq 0x26300
cmpl $0x0, %eax
jne 0x4618d
cmpl $0x0, -0x5c(%rbp)
je 0x4618d
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x58(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
callq 0x46650
movl %eax, -0x3c(%rbp)
cmpl $-0x1, -0x3c(%rbp)
jne 0x46188
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x58(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdx
leaq 0xf4c59(%rip), %rsi     # 0x13add5
movb $0x0, %al
callq 0x42fd0
jmp 0x46640
jmp 0x462b3
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0x100724(%rip), %rsi    # 0x1468cc
callq 0x26300
cmpl $0x0, %eax
jne 0x461da
cmpl $0x0, -0x5c(%rbp)
je 0x461da
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x58(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x462b1
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xf4bf9(%rip), %rsi     # 0x13adee
callq 0x26300
cmpl $0x0, %eax
jne 0x46293
cmpl $0x0, -0x5c(%rbp)
je 0x46293
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x58(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xf4bc8(%rip), %rsi     # 0x13adf5
callq 0x26300
cmpl $0x0, %eax
jne 0x46240
movl $0x1, -0x4c(%rbp)
jmp 0x46291
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x58(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xfe26e(%rip), %rsi     # 0x1444ce
callq 0x26300
cmpl $0x0, %eax
jne 0x46273
movl $0x0, -0x4c(%rbp)
jmp 0x4628f
movq -0x8(%rbp), %rdi
leaq 0x1329c2(%rip), %rax    # 0x178c40
movq 0x80(%rax), %rsi
callq 0x42cc0
jmp 0x46640
jmp 0x46291
jmp 0x462af
movq -0x8(%rbp), %rdi
leaq 0x1329a2(%rip), %rax    # 0x178c40
movq 0x80(%rax), %rsi
callq 0x42cc0
jmp 0x46640
jmp 0x462b1
jmp 0x462b3
jmp 0x462b5
movl -0x58(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x58(%rbp)
jmp 0x46074
jmp 0x462e1
movq -0x8(%rbp), %rdi
leaq 0x132970(%rip), %rax    # 0x178c40
movq 0x80(%rax), %rsi
callq 0x42cc0
jmp 0x46640
jmp 0x462e3
leaq 0x131eee(%rip), %rax    # 0x1781d8
movq 0x1c8(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x27320
leaq -0x20(%rbp), %rdi
callq 0x27380
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x463ab
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x46340
movq -0x28(%rbp), %rdi
callq 0x45c10
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x268f0
cmpl $0x0, %eax
je 0x46340
jmp 0x462fa
cmpl $-0x1, -0x3c(%rbp)
je 0x46356
movq -0x28(%rbp), %rdi
callq 0x466f0
cmpl -0x3c(%rbp), %eax
je 0x46356
jmp 0x462fa
cmpq $0x0, -0x48(%rbp)
je 0x4636c
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpq -0x48(%rbp), %rax
je 0x4636c
jmp 0x462fa
movq -0x8(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0x46381
cmpl $0x0, -0x4c(%rbp)
je 0x46381
jmp 0x462fa
movq -0x8(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0x46394
movl $0x1, -0x54(%rbp)
jmp 0x4639d
movq -0x28(%rbp), %rdi
callq 0x43ea0
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x462fa
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
jne 0x463e3
cmpl $0x0, -0x50(%rbp)
jne 0x463cd
movq -0x8(%rbp), %rdi
leaq 0xf4a33(%rip), %rsi     # 0x13adf9
callq 0x42f90
jmp 0x463e1
movq -0x8(%rbp), %rdi
leaq 0x132868(%rip), %rax    # 0x178c40
movq 0x8(%rax), %rsi
callq 0x42cc0
jmp 0x463f0
movq -0x8(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x43780
cmpl $0x0, -0x54(%rbp)
je 0x46409
movq -0x8(%rbp), %rax
movl 0x98(%rax), %ecx
orl $0x40, %ecx
movl %ecx, 0x98(%rax)
jmp 0x4663c
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xf49e3(%rip), %rsi     # 0x13ae08
callq 0x26300
cmpl $0x0, %eax
jne 0x46555
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
jne 0x46555
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x42810
movl %eax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
cmpl $0x0, -0x70(%rbp)
jne 0x464b0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x4648b
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x48f70
movq -0x8(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x8(%rbp), %rdi
leaq 0x13279e(%rip), %rax    # 0x178c40
movq 0x8(%rax), %rsi
callq 0x42cc0
jmp 0x46640
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x70(%rbp), %eax
jge 0x46503
movq -0x78(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x21, %eax
jl 0x464e1
movq -0x78(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x7e, %eax
jle 0x464f6
movq -0x8(%rbp), %rdi
leaq 0xf4924(%rip), %rsi     # 0x13ae10
callq 0x42f90
jmp 0x46640
jmp 0x464f8
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x464b7
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x4651b
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x48f70
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x487b0
movq -0x8(%rbp), %rdi
leaq 0x1326f9(%rip), %rax    # 0x178c40
movq 0x8(%rax), %rsi
callq 0x42cc0
jmp 0x4663a
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xf48e8(%rip), %rsi     # 0x13ae54
callq 0x26300
cmpl $0x0, %eax
jne 0x465b7
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x465b7
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x4659e
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x43630
jmp 0x465b2
movq -0x8(%rbp), %rdi
leaq 0x132697(%rip), %rax    # 0x178c40
movq 0x50(%rax), %rsi
callq 0x42cc0
jmp 0x46638
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x104709(%rip), %rsi    # 0x14acd7
callq 0x26300
cmpl $0x0, %eax
jne 0x46626
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
jne 0x46626
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
leaq -0x80(%rbp), %rdx
movl $0x1, %ecx
callq 0x9d6d0
cmpl $0x0, %eax
je 0x46607
jmp 0x46640
movq -0x80(%rbp), %rdi
callq 0x46770
movq -0x8(%rbp), %rdi
leaq 0x132625(%rip), %rax    # 0x178c40
movq 0x8(%rax), %rsi
callq 0x42cc0
jmp 0x46636
movq -0x8(%rbp), %rdi
leaq 0xf482b(%rip), %rsi     # 0x13ae5c
callq 0x42f90
jmp 0x46638
jmp 0x4663a
jmp 0x4663c
jmp 0x4663e
jmp 0x46640
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)