// File: /workspace/github_c_makefile_star2_O3/erikdubbelboer[P]discnt/src/discnt-benchmark.c
// Function: readHandler
static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
    client c = privdata;
    void *reply = NULL;
    UNUSED(el);
    UNUSED(fd);
    UNUSED(mask);

    /* Calculate latency only for the first read event. This means that the
     * server already sent the reply and we need to parse it. Parsing overhead
     * is not part of the latency, so calculate it only once, here. */
    if (c->latency < 0) c->latency = ustime()-(c->start);

    if (redisBufferRead(c->context) != REDIS_OK) {
        fprintf(stderr,"Error: %s\n",c->context->errstr);
        exit(1);
    } else {
        while(c->pending) {
            if (redisGetReply(c->context,&reply) != REDIS_OK) {
                fprintf(stderr,"Error: %s\n",c->context->errstr);
                exit(1);
            }
            if (reply != NULL) {
                if (reply == (void*)REDIS_REPLY_ERROR) {
                    fprintf(stderr,"Unexpected error reply, exiting...\n");
                    exit(1);
                }

                freeReplyObject(reply);
                /* This is an OK for prefix commands such as auth and select.*/
                if (c->prefix_pending > 0) {
                    c->prefix_pending--;
                    c->pending--;
                    /* Discard prefix commands on first response.*/
                    if (c->prefixlen > 0) {
                        size_t j;
                        sdsrange(c->obuf, c->prefixlen, -1);
                        /* We also need to fix the pointers to the strings
                        * we need to randomize. */
                        for (j = 0; j < c->randlen; j++)
                            c->randptr[j] -= c->prefixlen;
                        c->prefixlen = 0;
                    }
                    continue;                
                }

                if (config.requests_finished < config.requests)
                    config.latency[config.requests_finished++] = c->latency;
                c->pending--;
                if (c->pending == 0) {
                    clientDone(c);
                    break;
                }
            } else {
                break;
            }
        }
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq $0x0, (%rsp)
cmpq $0x0, 0x38(%rdx)
jns 0x10e7b
leaq 0x8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0xa1f0
imulq $0xf4240, (%r14), %rax  # imm = 0xF4240
addq 0x8(%r14), %rax
subq 0x30(%rbx), %rax
movq %rax, 0x38(%rbx)
movq (%rbx), %rdi
callq 0x12e14
testl %eax, %eax
jne 0x11021
cmpl $0x0, 0x40(%rbx)
je 0x10f5a
movq %rsp, %r14
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x1312b
testl %eax, %eax
jne 0x11014
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x10f5a
cmpq $0x6, %rdi
je 0x1101c
callq 0x1189c
movl 0x44(%rbx), %eax
testl %eax, %eax
jle 0x10f1e
decl %eax
movl %eax, 0x44(%rbx)
movl 0x40(%rbx), %edx
movl 0x48(%rbx), %esi
decl %edx
movl %edx, 0x40(%rbx)
testl %esi, %esi
jle 0x10f52
movq 0x8(%rbx), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1503b
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x10f12
movslq 0x48(%rbx), %rcx
negq %rcx
xorl %edx, %edx
movq 0x10(%rbx), %rsi
addq %rcx, (%rsi,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x10f02
movl $0x0, 0x48(%rbx)
movl 0x40(%rbx), %edx
jmp 0x10f52
movl 0x344f4(%rip), %eax     # 0x45418
movl 0x344e6(%rip), %ecx     # 0x45410
cmpl %ecx, %eax
jge 0x10f48
movslq %eax, %rdx
movq 0x38(%rbx), %rsi
movq 0x3450c(%rip), %rdi     # 0x45448
incl %eax
movl %eax, 0x344d4(%rip)     # 0x45418
movq %rsi, (%rdi,%rdx,8)
movl 0x40(%rbx), %edx
decl %edx
movl %edx, 0x40(%rbx)
je 0x10f62
testl %edx, %edx
jne 0x10e98
addq $0x18, %rsp
popq %rbx
popq %r14
retq
cmpl %ecx, %eax
jne 0x10f7c
movq %rbx, %rdi
callq 0x10d9d
movq 0x34473(%rip), %rdi     # 0x453e8
callq 0xe4f6
jmp 0x10f5a
cmpl $0x0, 0x344a9(%rip)     # 0x4542c
je 0x10ff3
movq 0x3445c(%rip), %rdi     # 0x453e8
movq (%rbx), %rax
movl 0x84(%rax), %esi
movl $0x2, %edx
callq 0xe5c4
movq 0x34442(%rip), %rdi     # 0x453e8
movq (%rbx), %rax
movl 0x84(%rax), %esi
movl $0x1, %edx
callq 0xe5c4
movq 0x34428(%rip), %rdi     # 0x453e8
movq (%rbx), %rax
movl 0x84(%rax), %esi
leaq -0x458(%rip), %rcx      # 0x10b78
movl $0x2, %edx
movq %rbx, %r8
callq 0xe4fe
movq $0x0, 0x28(%rbx)
movl 0x34445(%rip), %eax     # 0x45430
movl %eax, 0x40(%rbx)
jmp 0x10f5a
decl 0x34413(%rip)           # 0x4540c
movq %rbx, %rdi
callq 0x10878
incl 0x34405(%rip)           # 0x4540c
movq %rbx, %rdi
callq 0x10d9d
jmp 0x10f5a
movq %rbx, %rdi
callq 0xa6f8
callq 0xa723
movq %rbx, %rdi
callq 0xa6cd