// File: /workspace/github_c_makefile_star2_O0/erikdubbelboer[P]discnt/src/networking.c
// Function: freeClient
void freeClient(client *c) {
    listNode *ln;

    /* Free the query buffer */
    sdsfree(c->querybuf);
    c->querybuf = NULL;

    /* Deallocate structures used to block on blocking ops. */
    if (c->flags & CLIENT_BLOCKED) unblockClient(c);

    if (c->sub_counters != NULL) {
      pubsubUnsubscribeAllCounters(c,0);
      dictRelease(c->sub_counters);
      c->sub_counters = NULL;
    }

    /* Free data structures. */
    listRelease(c->reply);
    freeClientArgv(c);

    /* Unlink the client: this will close the socket, remove the I/O
     * handlers, and remove references of the client from different
     * places where active clients may be referenced. */
    unlinkClient(c);

    if (c->flags & CLIENT_MONITOR) {
        ln = listSearchKey(server.monitors,c);
        serverAssert(ln != NULL);
        listDelNode(server.monitors,ln);
    }

    /* If this client was scheduled for async freeing we need to remove it
     * from the queue. */
    if (c->flags & CLIENT_CLOSE_ASAP) {
        ln = listSearchKey(server.clients_to_close,c);
        serverAssert(ln != NULL);
        listDelNode(server.clients_to_close,ln);
    }

    /* Release other dynamically allocated client structure fields,
     * and finally release the client structure itself. */
    if (c->name) decrRefCount(c->name);
    zfree(c->argv);
    sdsfree(c->peerid);
    zfree(c);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x1e3c0
movq -0x8(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
movl 0x88(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x25320
movq -0x8(%rbp), %rdi
callq 0x37e20
movq -0x8(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
je 0x25358
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x3da90
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rdi
callq 0x16fe0
movq -0x8(%rbp), %rax
movq $0x0, 0xa8(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x12b80
movq -0x8(%rbp), %rdi
callq 0x254a0
movq -0x8(%rbp), %rdi
callq 0x250e0
movq -0x8(%rbp), %rax
movl 0x88(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x253e6
leaq 0x99d58(%rip), %rax     # 0xbf0e8
movq 0x1f8(%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x131d0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x253ad
jmp 0x253cf
leaq 0x803ee(%rip), %rdi     # 0xa57a2
leaq 0x8033f(%rip), %rsi     # 0xa56fa
movl $0x2c8, %edx            # imm = 0x2C8
callq 0x300b0
movl $0x1, %edi
callq 0x12100
leaq 0x99d12(%rip), %rax     # 0xbf0e8
movq 0x1f8(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x12ec0
movq -0x8(%rbp), %rax
movl 0x88(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x25457
leaq 0x99ce7(%rip), %rax     # 0xbf0e8
movq 0x1e8(%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x131d0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x2541e
jmp 0x25440
leaq 0x8037d(%rip), %rdi     # 0xa57a2
leaq 0x802ce(%rip), %rsi     # 0xa56fa
movl $0x2d0, %edx            # imm = 0x2D0
callq 0x300b0
movl $0x1, %edi
callq 0x12100
leaq 0x99ca1(%rip), %rax     # 0xbf0e8
movq 0x1e8(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x12ec0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2546f
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x296f0
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x20ce0
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rdi
callq 0x1e3c0
movq -0x8(%rbp), %rdi
callq 0x20ce0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)