// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/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();

    /* 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->selectlen = sdslen(c->obuf);
    } else {
        c->selectlen = 0;
    }

    /* Append the request itself. */
    if (from) {
        c->obuf = sdscatlen(c->obuf,
            from->obuf+from->selectlen,
            sdslen(from->obuf)-from->selectlen);
    } else {
        for (j = 0; j < config.pipeline; j++)
            c->obuf = sdscatlen(c->obuf,cmd,len);
    }
    c->written = 0;
    c->pending = config.pipeline;
    c->randptr = NULL;
    c->randlen = 0;
    if (c->selectlen) c->pending++;

    /* 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 < c->randlen; j++) {
                c->randptr[j] = c->obuf + (from->randptr[j]-from->obuf);
                /* Adjust for the different select prefix length. */
                c->randptr[j] += c->selectlen - from->selectlen;
            }
        } 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__). */
            }
        }
    }
    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, %r15
movq %rdi, %r12
movl $0x48, %edi
callq 0xdff1
movq %rax, %rbx
movq 0x2a72a(%rip), %rdi     # 0x363e0
testq %rdi, %rdi
je 0xbcc2
callq 0xf666
jmp 0xbcd4
movq 0x2a707(%rip), %rdi     # 0x363d0
movl 0x2a709(%rip), %esi     # 0x363d8
callq 0xf5c7
movq %rax, (%rbx)
cmpl $0x0, (%rax)
jne 0xbf07
movq 0x98(%rax), %rax
movq $0x0, 0xa0(%rax)
callq 0xc676
movq %rax, %r13
movq %rax, 0x8(%rbx)
cmpl $0x0, 0x2a74b(%rip)     # 0x36450
je 0xbd2e
movq 0x2a74a(%rip), %rcx     # 0x36458
movl -0x8(%rcx), %edx
leaq 0x1d7cc(%rip), %rsi     # 0x294e4
movq %r13, %rdi
xorl %eax, %eax
callq 0xcc76
movq %rax, %r13
movq %rax, 0x8(%rbx)
movl -0x8(%rax), %eax
jmp 0xbd30
xorl %eax, %eax
movl %eax, 0x44(%rbx)
testq %r14, %r14
je 0xbd61
movq 0x8(%r14), %rsi
movslq 0x44(%r14), %rax
movslq -0x8(%rsi), %rdx
addq %rax, %rsi
subq %rax, %rdx
movq %r13, %rdi
callq 0xc8a1
movq %rax, %r13
movq %rax, 0x8(%rbx)
movl 0x2a6b1(%rip), %eax     # 0x36410
jmp 0xbd8e
movl 0x2a6a9(%rip), %eax     # 0x36410
testl %eax, %eax
jle 0xbd8e
xorl %ebp, %ebp
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xc8a1
movq %rax, %r13
movq %rax, 0x8(%rbx)
incl %ebp
movl 0x2a686(%rip), %eax     # 0x36410
cmpl %eax, %ebp
jl 0xbd6d
movl $0x0, 0x28(%rbx)
movl %eax, 0x40(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
cmpl $0x0, 0x44(%rbx)
je 0xbdaa
incl %eax
movl %eax, 0x40(%rbx)
cmpl $0x0, 0x2a653(%rip)     # 0x36404
je 0xbebc
testq %r14, %r14
je 0xbe20
movq 0x18(%r14), %rdi
movq %rdi, 0x18(%rbx)
movq $0x0, 0x20(%rbx)
shlq $0x3, %rdi
callq 0xdff1
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0xbebc
movslq 0x44(%rbx), %rcx
movslq 0x44(%r14), %rdx
subq %rdx, %rcx
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 0xbdf3
jmp 0xbebc
movq $0x0, 0x18(%rbx)
movq $0x8, 0x20(%rbx)
movl $0x40, %edi
callq 0xdff1
movq %rax, 0x10(%rbx)
leaq 0x1d4ac(%rip), %rsi     # 0x292f1
movq %r13, %rdi
callq 0x9590
testq %rax, %rax
je 0xbebc
movq %rax, %r14
movq %rbx, %r12
addq $0x10, %r12
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %r13
leaq 0x1d486(%rip), %r15     # 0x292f1
movq (%r12), %rax
testq %r13, %r13
jne 0xbe8f
shlq $0x4, %rsi
movq %rax, %rdi
callq 0xe09d
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 0x9590
movq %rax, %r14
movq %rbp, %rsi
testq %rax, %rax
jne 0xbe6b
movq 0x2a505(%rip), %rdi     # 0x363c8
movq (%rbx), %rax
movl 0x84(%rax), %esi
leaq 0x33c(%rip), %rcx       # 0xc20f
movl $0x2, %edx
movq %rbx, %r8
callq 0x9c2e
movq 0x2a551(%rip), %rdi     # 0x36438
movq %rbx, %rsi
callq 0xdc97
incl 0x2a4f7(%rip)           # 0x363ec
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x9620