// File: /workspace/github_c_makefile_star2_O3/zhou-yuxin[P]redis-aof-no-cow/src/redis-benchmark.c
// Function: createClient
static client createClient(char *cmd, size_t len, client from) {
    int j;
    client c = zmalloc(sizeof(struct _client));

    if (config.hostsocket == NULL) {
        c->context = redisConnectNonBlock(config.hostip,config.hostport);
    } else {
        c->context = redisConnectUnixNonBlock(config.hostsocket);
    }
    if (c->context->err) {
        fprintf(stderr,"Could not connect to Redis at ");
        if (config.hostsocket == NULL)
            fprintf(stderr,"%s:%d: %s\n",config.hostip,config.hostport,c->context->errstr);
        else
            fprintf(stderr,"%s: %s\n",config.hostsocket,c->context->errstr);
        exit(1);
    }
    /* Suppress hiredis cleanup of unused buffers for max speed. */
    c->context->reader->maxbuf = 0;

    /* Build the request buffer:
     * Queue N requests accordingly to the pipeline size, or simply clone
     * the example client buffer. */
    c->obuf = sdsempty();
    /* Prefix the request buffer with AUTH and/or SELECT commands, if applicable.
     * These commands are discarded after the first response, so if the client is
     * reused the commands will not be used again. */
    c->prefix_pending = 0;
    if (config.auth) {
        char *buf = NULL;
        int len = redisFormatCommand(&buf, "AUTH %s", config.auth);
        c->obuf = sdscatlen(c->obuf, buf, len);
        free(buf);
        c->prefix_pending++;
    }

    /* If a DB number different than zero is selected, prefix our request
     * buffer with the SELECT command, that will be discarded the first
     * time the replies are received, so if the client is reused the
     * SELECT command will not be used again. */
    if (config.dbnum != 0) {
        c->obuf = sdscatprintf(c->obuf,"*2\r\n$6\r\nSELECT\r\n$%d\r\n%s\r\n",
            (int)sdslen(config.dbnumstr),config.dbnumstr);
        c->prefix_pending++;
    }
    c->prefixlen = sdslen(c->obuf);
    /* Append the request itself. */
    if (from) {
        c->obuf = sdscatlen(c->obuf,
            from->obuf+from->prefixlen,
            sdslen(from->obuf)-from->prefixlen);
    } else {
        for (j = 0; j < config.pipeline; j++)
            c->obuf = sdscatlen(c->obuf,cmd,len);
    }

    c->written = 0;
    c->pending = config.pipeline+c->prefix_pending;
    c->randptr = NULL;
    c->randlen = 0;

    /* Find substrings in the output buffer that need to be randomized. */
    if (config.randomkeys) {
        if (from) {
            c->randlen = from->randlen;
            c->randfree = 0;
            c->randptr = zmalloc(sizeof(char*)*c->randlen);
            /* copy the offsets. */
            for (j = 0; j < (int)c->randlen; j++) {
                c->randptr[j] = c->obuf + (from->randptr[j]-from->obuf);
                /* Adjust for the different select prefix length. */
                c->randptr[j] += c->prefixlen - from->prefixlen;
            }
        } else {
            char *p = c->obuf;

            c->randlen = 0;
            c->randfree = RANDPTR_INITIAL_SIZE;
            c->randptr = zmalloc(sizeof(char*)*c->randfree);
            while ((p = strstr(p,"__rand_int__")) != NULL) {
                if (c->randfree == 0) {
                    c->randptr = zrealloc(c->randptr,sizeof(char*)*c->randlen*2);
                    c->randfree += c->randlen;
                }
                c->randptr[c->randlen++] = p;
                c->randfree--;
                p += 12; /* 12 is strlen("__rand_int__). */
            }
        }
    }
    if (config.idlemode == 0)
        aeCreateFileEvent(config.el,c->context->fd,AE_WRITABLE,writeHandler,c);
    listAddNodeTail(config.clients,c);
    config.liveclients++;
    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r13
movl $0x50, %edi
callq 0x15ae5
movq %rax, %rbx
movq 0x3787e(%rip), %rdi     # 0x4c450
testq %rdi, %rdi
je 0x14bde
callq 0x17411
jmp 0x14bf0
movq 0x3785b(%rip), %rdi     # 0x4c440
movl 0x3785d(%rip), %esi     # 0x4c448
callq 0x17328
movq %rax, (%rbx)
cmpl $0x0, (%rax)
jne 0x14f21
movq 0x98(%rax), %rax
movq $0x0, 0xa0(%rax)
callq 0x18186
movq %rax, 0x8(%rbx)
movl $0x0, 0x44(%rbx)
movq 0x378b3(%rip), %rdx     # 0x4c4d8
testq %rdx, %rdx
je 0x14c69
movq %rsp, %r15
movq $0x0, (%r15)
leaq 0x249dc(%rip), %rsi     # 0x39617
movq %r15, %rdi
xorl %eax, %eax
callq 0x16f79
movq 0x8(%rbx), %rdi
movq (%r15), %rsi
movslq %eax, %rdx
callq 0x189ce
movq %rax, 0x8(%rbx)
movq (%r15), %rdi
callq 0xb050
incl 0x44(%rbx)
movq 0x8(%rbx), %r15
jmp 0x14c6c
movq %rax, %r15
cmpl $0x0, 0x3784d(%rip)     # 0x4c4c0
je 0x14cd3
movq 0x3784c(%rip), %rcx     # 0x4c4c8
movzbl -0x1(%rcx), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x14cb6
leaq 0x2458f(%rip), %rsi     # 0x39220
movslq (%rsi,%rax,4), %rax
addq %rsi, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x14cb8
movq -0x11(%rcx), %rdx
jmp 0x14cb8
movzwl -0x5(%rcx), %edx
jmp 0x14cb8
movl -0x9(%rcx), %edx
jmp 0x14cb8
movzbl -0x3(%rcx), %edx
jmp 0x14cb8
xorl %edx, %edx
leaq 0x24960(%rip), %rsi     # 0x3961f
movq %r15, %rdi
xorl %eax, %eax
callq 0x18e2a
movq %rax, %r15
movq %rax, 0x8(%rbx)
incl 0x44(%rbx)
movzbl -0x1(%r15), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x14d11
leaq 0x2454b(%rip), %rdx     # 0x39234
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %eax
jmp 0x14d13
movq -0x11(%r15), %rax
jmp 0x14d13
movzwl -0x5(%r15), %eax
jmp 0x14d13
movl -0x9(%r15), %eax
jmp 0x14d13
movzbl -0x3(%r15), %eax
jmp 0x14d13
xorl %eax, %eax
movl %eax, 0x48(%rbx)
testq %r14, %r14
je 0x14d4a
movq 0x8(%r14), %rcx
movslq 0x48(%r14), %rax
leaq (%rcx,%rax), %rsi
movzbl -0x1(%rcx), %edx
movl %edx, %edi
andl $0x7, %edi
cmpl $0x4, %edi
ja 0x14d90
leaq 0x2450c(%rip), %r8      # 0x39248
movslq (%r8,%rdi,4), %rdi
addq %r8, %rdi
jmpq *%rdi
shrl $0x3, %edx
jmp 0x14d92
movl 0x37730(%rip), %eax     # 0x4c480
testl %eax, %eax
jle 0x14daa
xorl %ebp, %ebp
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x189ce
movq %rax, %r15
movq %rax, 0x8(%rbx)
incl %ebp
movl 0x3770d(%rip), %eax     # 0x4c480
cmpl %eax, %ebp
jl 0x14d56
jmp 0x14daa
movq -0x11(%rcx), %rdx
jmp 0x14d92
movzwl -0x5(%rcx), %edx
jmp 0x14d92
movl -0x9(%rcx), %edx
jmp 0x14d92
movzbl -0x3(%rcx), %edx
jmp 0x14d92
xorl %edx, %edx
subq %rax, %rdx
movq %r15, %rdi
callq 0x189ce
movq %rax, %r15
movq %rax, 0x8(%rbx)
movl 0x376d6(%rip), %eax     # 0x4c480
movq $0x0, 0x28(%rbx)
addl 0x44(%rbx), %eax
movl %eax, 0x40(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
cmpl $0x0, 0x376ae(%rip)     # 0x4c474
je 0x14ecd
testq %r14, %r14
je 0x14e39
movq 0x18(%r14), %rdi
movq %rdi, 0x18(%rbx)
movq $0x0, 0x20(%rbx)
shlq $0x3, %rdi
callq 0x15ae5
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rax
testl %eax, %eax
jle 0x14ecd
movslq 0x48(%rbx), %rcx
movslq 0x48(%r14), %rdx
subq %rdx, %rcx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
movq 0x10(%r14), %rsi
movq (%rsi,%rdx,8), %rsi
subq 0x8(%r14), %rsi
addq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdi
movq %rsi, (%rdi,%rdx,8)
movq 0x10(%rbx), %rsi
addq %rcx, (%rsi,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x14e0c
jmp 0x14ecd
movq $0x8, 0x20(%rbx)
movl $0x40, %edi
callq 0x15ae5
movq %rax, 0x10(%rbx)
leaq 0x2459c(%rip), %rsi     # 0x393f2
movq %r15, %rdi
callq 0xb590
testq %rax, %rax
je 0x14ecd
movq %rax, %r14
movq %rbx, %r12
addq $0x10, %r12
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %r13
leaq 0x24576(%rip), %r15     # 0x393f2
movq (%r12), %rax
testq %r13, %r13
jne 0x14ea0
shlq $0x4, %rsi
movq %rax, %rdi
callq 0x15b91
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %r13
addq %rsi, %r13
leaq 0x1(%rsi), %rbp
movq %rbp, 0x18(%rbx)
movq %r14, (%rax,%rsi,8)
decq %r13
movq %r13, 0x20(%rbx)
addq $0xc, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0xb590
movq %rax, %r14
movq %rbp, %rsi
testq %rax, %rax
jne 0x14e7c
cmpl $0x0, 0x375e8(%rip)     # 0x4c4bc
jne 0x14efa
movq 0x3755b(%rip), %rdi     # 0x4c438
movq (%rbx), %rax
movl 0x84(%rax), %esi
leaq 0x33c(%rip), %rcx       # 0x15229
movl $0x2, %edx
movq %rbx, %r8
callq 0x1275e
movq 0x375a7(%rip), %rdi     # 0x4c4a8
movq %rbx, %rsi
callq 0x157fb
incl 0x3754d(%rip)           # 0x4c45c
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0xb645