// File: /workspace/github_c_makefile_star2_O3/zuocheng-liu[P]ae-memcached/src/ae.c
// Function: aeCreateEventLoop
aeEventLoop *aeCreateEventLoop(int setsize) {
    aeEventLoop *eventLoop;
    int i;

    if ((eventLoop = malloc(sizeof(*eventLoop))) == NULL) goto err;
    eventLoop->events = malloc(sizeof(aeFileEvent)*setsize);
    eventLoop->fired = malloc(sizeof(aeFiredEvent)*setsize);
    if (eventLoop->events == NULL || eventLoop->fired == NULL) goto err;
    eventLoop->setsize = setsize;
    eventLoop->lastTime = time(NULL);
    eventLoop->timeEventHead = NULL;
    eventLoop->timeEventNextId = 0;
    eventLoop->stop = 0;
    eventLoop->maxfd = -1;
    eventLoop->beforesleep = NULL;
    if (aeApiCreate(eventLoop) == -1) goto err;
    /* Events with mask == AE_NONE are not set. So let's initialize the
     * vector with it. */
    for (i = 0; i < setsize; i++)
        eventLoop->events[i].mask = AE_NONE;
    return eventLoop;

err:
    if (eventLoop) {
        free(eventLoop->events);
        free(eventLoop->fired);
        free(eventLoop);
    }
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %r14d
movl $0x48, %edi
callq 0x22c0
testq %rax, %rax
je 0x2cc2
movq %rax, %rbx
movslq %r14d, %rbp
movq %rbp, %rdi
shlq $0x5, %rdi
callq 0x22c0
movq %rax, %r15
movq %rax, 0x18(%rbx)
leaq (,%rbp,8), %rdi
callq 0x22c0
movq %rax, %r12
movq %rax, 0x20(%rbx)
testq %r15, %r15
sete %al
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x2caa
movl %r14d, 0x4(%rbx)
xorl %r13d, %r13d
xorl %edi, %edi
callq 0x22b0
movq %rax, 0x10(%rbx)
movq %r13, 0x28(%rbx)
movq %r13, 0x8(%rbx)
movl $0x0, 0x30(%rbx)
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movq %r13, 0x40(%rbx)
movl $0x10, %edi
callq 0x22c0
testq %rax, %rax
je 0x2caa
movq %rax, %r13
shlq $0x2, %rbp
leaq (,%rbp,2), %rdi
addq %rbp, %rdi
callq 0x22c0
movq %rax, 0x8(%r13)
testq %rax, %rax
je 0x2ca2
movq %rax, %rbp
movl $0x400, %edi            # imm = 0x400
callq 0x23f0
movl %eax, (%r13)
cmpl $-0x1, %eax
je 0x2c9a
movq %r13, 0x38(%rbx)
testl %r14d, %r14d
jle 0x2cc4
movl %r14d, %eax
addl $0x3, %r14d
decq %rax
movq %rax, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %r14d
shlq $0x7, %r14
movdqa 0x5455(%rip), %xmm1     # 0x8010
movdqa 0x545d(%rip), %xmm2     # 0x8020
xorl %eax, %eax
movdqa 0x5463(%rip), %xmm3     # 0x8030
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x5463(%rip), %xmm5     # 0x8040
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %ecx
notl %ecx
testb $0x1, %cl
je 0x2c19
movl $0x0, (%r15,%rax)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %ecx
testb $0x1, %cl
je 0x2c30
movl $0x0, 0x20(%r15,%rax)
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %ecx
testb $0x1, %cl
je 0x2c70
movl $0x0, 0x40(%r15,%rax)
pextrw $0x4, %xmm6, %ecx
testb $0x1, %cl
je 0x2c83
movl $0x0, 0x60(%r15,%rax)
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
subq $-0x80, %rax
cmpq %rax, %r14
jne 0x2bdd
jmp 0x2cc4
movq %rbp, %rdi
callq 0x2030
movq %r13, %rdi
callq 0x2030
movq %r15, %rdi
callq 0x2030
movq %r12, %rdi
callq 0x2030
movq %rbx, %rdi
callq 0x2030
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq