// File: /workspace/github_c_makefile_star2_O1/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, %r15
movq %rdi, %r12
movl $0x50, %edi
callq 0x15d39
movq %rax, %rbx
movq 0x37643(%rip), %rdi     # 0x4c450
testq %rdi, %rdi
je 0x14e19
callq 0x176b9
jmp 0x14e2b
movq 0x37620(%rip), %rdi     # 0x4c440
movl 0x37622(%rip), %esi     # 0x4c448
callq 0x175c5
movq %rax, (%rbx)
cmpl $0x0, (%rax)
jne 0x1514c
movq 0x98(%rax), %rax
movq $0x0, 0xa0(%rax)
callq 0x1846f
movq %rax, 0x8(%rbx)
movl $0x0, 0x44(%rbx)
movq 0x37678(%rip), %rdx     # 0x4c4d8
testq %rdx, %rdx
je 0x14ea1
movq %rsp, %r13
movq $0x0, (%r13)
leaq 0x2476d(%rip), %rsi     # 0x395e4
movq %r13, %rdi
xorl %eax, %eax
callq 0x17203
movq 0x8(%rbx), %rdi
movq (%r13), %rsi
movslq %eax, %rdx
callq 0x18c9d
movq %rax, 0x8(%rbx)
movq (%r13), %rdi
callq 0xb050
incl 0x44(%rbx)
cmpl $0x0, 0x37618(%rip)     # 0x4c4c0
je 0x14f06
movq 0x8(%rbx), %rdi
movq 0x37613(%rip), %rcx     # 0x4c4c8
movzbl -0x1(%rcx), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x14eef
leaq 0x242f6(%rip), %rsi     # 0x391c0
movslq (%rsi,%rax,4), %rax
addq %rsi, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x14ef1
movq -0x11(%rcx), %rdx
jmp 0x14ef1
movzwl -0x5(%rcx), %edx
jmp 0x14ef1
movl -0x9(%rcx), %edx
jmp 0x14ef1
movzbl -0x3(%rcx), %edx
jmp 0x14ef1
xorl %edx, %edx
leaq 0x246f4(%rip), %rsi     # 0x395ec
xorl %eax, %eax
callq 0x190fe
movq %rax, 0x8(%rbx)
incl 0x44(%rbx)
movq 0x8(%rbx), %rdi
movzbl -0x1(%rdi), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x14f44
leaq 0x242b5(%rip), %rdx     # 0x391d4
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %eax
jmp 0x14f46
movq -0x11(%rdi), %rax
jmp 0x14f46
movzwl -0x5(%rdi), %eax
jmp 0x14f46
movl -0x9(%rdi), %eax
jmp 0x14f46
movzbl -0x3(%rdi), %eax
jmp 0x14f46
xorl %eax, %eax
movl %eax, 0x48(%rbx)
testq %r14, %r14
je 0x14f81
movq 0x8(%r14), %rcx
movslq 0x48(%r14), %rax
leaq (%rcx,%rax), %rsi
movzbl -0x1(%rcx), %edx
movl %edx, %r8d
andl $0x7, %r8d
cmpl $0x4, %r8d
ja 0x14fc2
leaq 0x24276(%rip), %r9      # 0x391e8
movslq (%r9,%r8,4), %r8
addq %r9, %r8
jmpq *%r8
shrl $0x3, %edx
jmp 0x14fc4
cmpl $0x0, 0x374f8(%rip)     # 0x4c480
jle 0x14fd0
xorl %ebp, %ebp
movq 0x8(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x18c9d
movq %rax, 0x8(%rbx)
incl %ebp
cmpl 0x374d9(%rip), %ebp     # 0x4c480
jl 0x14f8c
jmp 0x14fd0
movq -0x11(%rcx), %rdx
jmp 0x14fc4
movzwl -0x5(%rcx), %edx
jmp 0x14fc4
movl -0x9(%rcx), %edx
jmp 0x14fc4
movzbl -0x3(%rcx), %edx
jmp 0x14fc4
xorl %edx, %edx
subq %rax, %rdx
callq 0x18c9d
movq %rax, 0x8(%rbx)
movq $0x0, 0x28(%rbx)
movl 0x44(%rbx), %eax
addl 0x3749f(%rip), %eax     # 0x4c480
movl %eax, 0x40(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
cmpl $0x0, 0x37482(%rip)     # 0x4c474
je 0x150f8
testq %r14, %r14
je 0x15065
movq 0x18(%r14), %rdi
movq %rdi, 0x18(%rbx)
movq $0x0, 0x20(%rbx)
shlq $0x3, %rdi
callq 0x15d39
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rax
testl %eax, %eax
jle 0x150f8
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 0x15038
jmp 0x150f8
movq 0x8(%rbx), %r14
movq $0x0, 0x18(%rbx)
movq $0x8, 0x20(%rbx)
movl $0x40, %edi
callq 0x15d39
movq %rax, 0x10(%rbx)
leaq 0x24331(%rip), %rsi     # 0x393bf
movq %r14, %rdi
callq 0xb590
testq %rax, %rax
je 0x150f8
movq %rax, %r14
leaq 0x2431a(%rip), %r15     # 0x393bf
cmpq $0x0, 0x20(%rbx)
jne 0x150c9
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
shlq $0x4, %rsi
callq 0x15de5
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 0xb590
movq %rax, %r14
testq %rax, %rax
jne 0x150a5
cmpl $0x0, 0x373bd(%rip)     # 0x4c4bc
jne 0x15125
movq 0x37330(%rip), %rdi     # 0x4c438
movq (%rbx), %rax
movl 0x84(%rax), %esi
leaq 0x33a(%rip), %rcx       # 0x15452
movl $0x2, %edx
movq %rbx, %r8
callq 0x12963
movq 0x3737c(%rip), %rdi     # 0x4c4a8
movq %rbx, %rsi
callq 0x15a2b
incl 0x37322(%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