// File: /workspace/github_c_makefile_star2_O2/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, %r12
movq %rdi, %r13
pushq $0x48
popq %rdi
callq 0xd539
movq %rax, %rbx
movq 0x28c59(%rip), %rdi     # 0x343e0
testq %rdi, %rdi
je 0xb793
callq 0xeada
jmp 0xb7a5
movq 0x28c36(%rip), %rdi     # 0x343d0
movl 0x28c38(%rip), %esi     # 0x343d8
callq 0xea3b
movq %rax, (%rbx)
cmpl $0x0, (%rax)
jne 0xb9a3
movq 0x98(%rax), %rax
andq $0x0, 0xa0(%rax)
callq 0xc0d7
movq %rax, %r15
movq %rax, 0x8(%rbx)
cmpl $0x0, 0x28c7d(%rip)     # 0x34450
je 0xb7fc
movq 0x28c7c(%rip), %rcx     # 0x34458
movl -0x8(%rcx), %edx
leaq 0x19cae(%rip), %rsi     # 0x25494
movq %r15, %rdi
xorl %eax, %eax
callq 0xc555
movq %rax, %r15
movq %rax, 0x8(%rbx)
movl -0x8(%rax), %eax
jmp 0xb7fe
xorl %eax, %eax
movl %eax, 0x44(%rbx)
testq %r14, %r14
je 0xb8b9
movq 0x8(%r14), %rsi
movslq 0x44(%r14), %rax
movslq -0x8(%rsi), %rdx
addq %rax, %rsi
subq %rax, %rdx
movq %r15, %rdi
callq 0xc285
movq %rax, %r15
movq %rax, 0x8(%rbx)
movl 0x28bdf(%rip), %eax     # 0x34410
andl $0x0, 0x28(%rbx)
movl %eax, 0x40(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
cmpl $0x0, 0x44(%rbx)
je 0xb84a
incl %eax
movl %eax, 0x40(%rbx)
cmpl $0x0, 0x28bb3(%rip)     # 0x34404
je 0xb95a
testq %r14, %r14
je 0xb8e2
movq 0x18(%r14), %rdi
movq %rdi, 0x18(%rbx)
andq $0x0, 0x20(%rbx)
shlq $0x3, %rdi
callq 0xd539
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0xb95a
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 0x44(%rbx), %rdx
movslq 0x44(%r14), %rsi
subq %rsi, %rdx
movq 0x10(%rbx), %rsi
addq %rdx, (%rsi,%rcx,8)
incq %rcx
jmp 0xb880
xorl %ebp, %ebp
movl 0x28b4f(%rip), %eax     # 0x34410
cmpl %eax, %ebp
jge 0xb831
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xc285
movq %rax, %r15
movq %rax, 0x8(%rbx)
incl %ebp
jmp 0xb8bb
andq $0x0, 0x18(%rbx)
movq $0x8, 0x20(%rbx)
pushq $0x40
popq %rdi
callq 0xd539
movq %rax, 0x10(%rbx)
leaq 0x1999f(%rip), %r14     # 0x252a1
movq %r15, %rdi
movq %r14, %rsi
callq 0x9590
testq %rax, %rax
je 0xb95a
movq %rax, %r15
movq 0x20(%rbx), %rcx
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rsi
testq %rcx, %rcx
jne 0xb941
shlq $0x4, %rsi
movq %rax, %rdi
callq 0xd5e3
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 0xb902
movq 0x28a67(%rip), %rdi     # 0x343c8
movq (%rbx), %rax
movl 0x84(%rax), %esi
leaq 0x304(%rip), %rcx       # 0xbc75
pushq $0x2
popq %rdx
movq %rbx, %r8
callq 0x98f8
movq 0x28ab5(%rip), %rdi     # 0x34438
movq %rbx, %rsi
callq 0xd260
incl 0x28a5b(%rip)           # 0x343ec
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2864e(%rip), %r14     # 0x33ff8
movq (%r14), %rcx
leaq 0x19aae(%rip), %rdi     # 0x25462
pushq $0x1e
popq %rsi
pushq $0x1
popq %rdx
callq 0x9520
movq 0x28a1a(%rip), %rdx     # 0x343e0
movq (%r14), %rdi
testq %rdx, %rdx
jne 0xb9f2
movq 0x289fb(%rip), %rdx     # 0x343d0
movl 0x289fd(%rip), %ecx     # 0x343d8
movq (%rbx), %r8
addq $0x4, %r8
leaq 0x19a98(%rip), %rsi     # 0x25481
xorl %eax, %eax
callq 0x9300
jmp 0xba07
movq (%rbx), %rcx
addq $0x4, %rcx
leaq 0x19a8c(%rip), %rsi     # 0x2548c
xorl %eax, %eax
callq 0x9300
pushq $0x1
popq %rdi
callq 0x9500