// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x50
popq %rdi
callq 0xe87d
movq %rax, %rbx
movq 0x3a92f(%rip), %rdi     # 0x48450
testq %rdi, %rdi
je 0xdb2d
callq 0xffae
jmp 0xdb3f
movq 0x3a90c(%rip), %rdi     # 0x48440
movl 0x3a90e(%rip), %esi     # 0x48448
callq 0xfec5
movq %rax, (%rbx)
cmpl $0x0, (%rax)
jne 0xdda0
movq 0x98(%rax), %rax
andq $0x0, 0xa0(%rax)
callq 0x10a70
movq %rax, 0x8(%rbx)
andl $0x0, 0x44(%rbx)
movq 0x3a96a(%rip), %rdx     # 0x484d8
testq %rdx, %rdx
je 0xdbaf
movq %rsp, %r15
andq $0x0, (%r15)
leaq 0x269e2(%rip), %rsi     # 0x34563
movq %r15, %rdi
xorl %eax, %eax
callq 0xfb51
movq 0x8(%rbx), %rdi
movq (%r15), %rsi
movslq %eax, %rdx
callq 0x1107c
movq %rax, 0x8(%rbx)
movq (%r15), %rdi
callq 0xb050
incl 0x44(%rbx)
movq 0x8(%rbx), %r15
jmp 0xdbb2
movq %rax, %r15
cmpl $0x0, 0x3a907(%rip)     # 0x484c0
je 0xdbea
movq 0x3a906(%rip), %rbp     # 0x484c8
movq %rbp, %rdi
callq 0xe072
leaq 0x2699a(%rip), %rsi     # 0x3456b
movq %r15, %rdi
movl %eax, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x1135c
movq %rax, %r15
movq %rax, 0x8(%rbx)
incl 0x44(%rbx)
movq %r15, %rdi
callq 0xe072
movl %eax, 0x48(%rbx)
testq %r14, %r14
je 0xdcb2
movq 0x8(%r14), %rdi
movslq 0x48(%r14), %r13
leaq (%rdi,%r13), %r12
callq 0xe072
subq %r13, %rax
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x1107c
movq %rax, %r15
movq %rax, 0x8(%rbx)
movl 0x3a853(%rip), %eax     # 0x48480
andq $0x0, 0x28(%rbx)
addl 0x44(%rbx), %eax
movl %eax, 0x40(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
cmpl $0x0, 0x3a82e(%rip)     # 0x48474
je 0xdd4e
testq %r14, %r14
je 0xdcdb
movq 0x18(%r14), %rdi
movq %rdi, 0x18(%rbx)
andq $0x0, 0x20(%rbx)
shlq $0x3, %rdi
callq 0xe87d
movq %rax, 0x10(%rbx)
movl 0x18(%rbx), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0xdd4e
movq 0x10(%r14), %rdx
movq (%rdx,%rcx,8), %rdx
subq 0x8(%r14), %rdx
addq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rsi
movq %rdx, (%rsi,%rcx,8)
movslq 0x48(%rbx), %rdx
movslq 0x48(%r14), %rsi
subq %rsi, %rdx
movq 0x10(%rbx), %rsi
addq %rdx, (%rsi,%rcx,8)
incq %rcx
jmp 0xdc79
xorl %ebp, %ebp
movl 0x3a7c6(%rip), %eax     # 0x48480
cmpl %eax, %ebp
jge 0xdc2d
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x1107c
movq %rax, %r15
movq %rax, 0x8(%rbx)
incl %ebp
jmp 0xdcb4
movq $0x8, 0x20(%rbx)
pushq $0x40
popq %rdi
callq 0xe87d
movq %rax, 0x10(%rbx)
leaq 0x26648(%rip), %r14     # 0x3433e
movq %r15, %rdi
movq %r14, %rsi
callq 0xb590
testq %rax, %rax
je 0xdd4e
movq %rax, %r15
movq 0x20(%rbx), %rcx
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rsi
testq %rcx, %rcx
jne 0xdd35
shlq $0x4, %rsi
movq %rax, %rdi
callq 0xe927
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rcx
addq %rsi, %rcx
leaq 0x1(%rsi), %rdx
movq %rdx, 0x18(%rbx)
movq %r15, (%rax,%rsi,8)
decq %rcx
movq %rcx, 0x20(%rbx)
addq $0xc, %r15
jmp 0xdcf6
cmpl $0x0, 0x3a767(%rip)     # 0x484bc
jne 0xdd79
movq 0x3a6da(%rip), %rdi     # 0x48438
movq (%rbx), %rax
movl 0x84(%rax), %esi
leaq 0x33c(%rip), %rcx       # 0xe0aa
pushq $0x2
popq %rdx
movq %rbx, %r8
callq 0xb8f8
movq 0x3a728(%rip), %rdi     # 0x484a8
movq %rbx, %rsi
callq 0xe5cc
incl 0x3a6ce(%rip)           # 0x4845c
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3a251(%rip), %r14     # 0x47ff8
movq (%r14), %rcx
leaq 0x26780(%rip), %rdi     # 0x34531
pushq $0x1e
popq %rsi
pushq $0x1
popq %rdx
callq 0xb520
movq 0x3a68d(%rip), %rdx     # 0x48450
movq (%r14), %rdi
testq %rdx, %rdx
jne 0xddef
movq 0x3a66e(%rip), %rdx     # 0x48440
movl 0x3a670(%rip), %ecx     # 0x48448
movq (%rbx), %r8
addq $0x4, %r8
leaq 0x2676a(%rip), %rsi     # 0x34550
xorl %eax, %eax
callq 0xb310
jmp 0xde04
movq (%rbx), %rcx
addq $0x4, %rcx
leaq 0x2675e(%rip), %rsi     # 0x3455b
xorl %eax, %eax
callq 0xb310
pushq $0x1
popq %rdi
callq 0xb500