// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl $0x48, %edi
callq 0xde29
movq %rax, %rbx
movq 0x298d6(%rip), %rdi     # 0x353e0
testq %rdi, %rdi
je 0xbb16
callq 0xf537
jmp 0xbb28
movq 0x298b3(%rip), %rdi     # 0x353d0
movl 0x298b5(%rip), %esi     # 0x353d8
callq 0xf498
movq %rax, (%rbx)
cmpl $0x0, (%rax)
jne 0xbd3f
movq 0x98(%rax), %rax
movq $0x0, 0xa0(%rax)
callq 0xc49e
movq %rax, 0x8(%rbx)
cmpl $0x0, 0x298fa(%rip)     # 0x35450
je 0xbb7c
movq 0x298f9(%rip), %rcx     # 0x35458
movl -0x8(%rcx), %edx
leaq 0x1c942(%rip), %rsi     # 0x284ab
movq %rax, %rdi
xorl %eax, %eax
callq 0xca4c
movq %rax, 0x8(%rbx)
movl -0x8(%rax), %eax
jmp 0xbb7e
xorl %eax, %eax
movl %eax, 0x44(%rbx)
testq %r14, %r14
je 0xbba7
movq 0x8(%rbx), %rdi
movq 0x8(%r14), %rsi
movslq 0x44(%r14), %rax
movslq -0x8(%rsi), %rdx
addq %rax, %rsi
subq %rax, %rdx
callq 0xc66c
movq %rax, 0x8(%rbx)
jmp 0xbbcf
cmpl $0x0, 0x29862(%rip)     # 0x35410
jle 0xbbcf
xorl %ebp, %ebp
movq 0x8(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xc66c
movq %rax, 0x8(%rbx)
incl %ebp
cmpl 0x29843(%rip), %ebp     # 0x35410
jl 0xbbb2
movl $0x0, 0x28(%rbx)
movl 0x29834(%rip), %eax     # 0x35410
movl %eax, 0x40(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
cmpl $0x0, 0x44(%rbx)
je 0xbbf1
incl %eax
movl %eax, 0x40(%rbx)
cmpl $0x0, 0x2980c(%rip)     # 0x35404
je 0xbcfa
testq %r14, %r14
je 0xbc67
movq 0x18(%r14), %rdi
movq %rdi, 0x18(%rbx)
movq $0x0, 0x20(%rbx)
shlq $0x3, %rdi
callq 0xde29
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0xbcfa
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 0xbc3a
jmp 0xbcfa
movq 0x8(%rbx), %r14
movq $0x0, 0x18(%rbx)
movq $0x8, 0x20(%rbx)
movl $0x40, %edi
callq 0xde29
movq %rax, 0x10(%rbx)
leaq 0x1c628(%rip), %rsi     # 0x282b8
movq %r14, %rdi
callq 0x9590
testq %rax, %rax
je 0xbcfa
movq %rax, %r14
leaq 0x1c611(%rip), %r15     # 0x282b8
cmpq $0x0, 0x20(%rbx)
jne 0xbccb
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
shlq $0x4, %rsi
callq 0xded5
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rax
addq %rax, 0x20(%rbx)
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x18(%rbx)
movq %r14, (%rax,%rcx,8)
decq 0x20(%rbx)
addq $0xc, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x9590
movq %rax, %r14
testq %rax, %rax
jne 0xbca7
movq 0x296c7(%rip), %rdi     # 0x353c8
movq (%rbx), %rax
movl 0x84(%rax), %esi
leaq 0x334(%rip), %rcx       # 0xc045
movl $0x2, %edx
movq %rbx, %r8
callq 0x9a43
movq 0x29713(%rip), %rdi     # 0x35438
movq %rbx, %rsi
callq 0xdac3
incl 0x296b9(%rip)           # 0x353ec
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x9620