// File: /workspace/github_c_makefile_star2_O3/yancanchen[P]mc-bloom-filter/mc_bloom_filter.c
// Function: conn_new
conn *conn_new(int sfd, int init_state, int event_flags) {
    conn *c;

    /* do we have a free conn structure from a previous close? */
    if (freecurr > 0) {
        c = freeconns[--freecurr];
    } else { /* allocate a new one */
        if (!(c = (conn *)malloc(sizeof(conn)))) {
            perror("malloc()");
            return 0;
        }
        c->rbuf = c->wbuf = 0;
        c->rbuf = (char *) malloc(DATA_BUFFER_SIZE);
        c->wbuf = (char *) malloc(DATA_BUFFER_SIZE);

        if (c->rbuf == 0 || c->wbuf == 0) {
            if (c->rbuf != 0) free(c->rbuf);
            if (c->wbuf != 0) free(c->wbuf);
            free(c);
            perror("malloc()");
            return 0;
        }
        c->rsize = c->wsize = DATA_BUFFER_SIZE;
        c->rcurr = c->rbuf;
        stats.conn_structs++;
    }

    if (my_srv.verbose > 1) {
        if (init_state == conn_listening)
            fprintf(stderr, "<%d server listening\n", sfd);
        else
            fprintf(stderr, "<%d new client connection\n", sfd);
    }

    c->sfd = sfd;
    c->state = init_state;
    c->rbytes = c->wbytes = 0;
    c->rlbytes = 0;
    c->wcurr = c->wbuf;
    c->write_and_go = conn_read;
    c->is_corked = 0;
    
    event_set(&c->event, sfd, event_flags, event_handler, (void *)c);
    c->ev_flags = event_flags;

    if (event_add(&c->event, 0) == -1) {
        if (freecurr < freetotal) {
            freeconns[freecurr++] = c;
        } else {
            free (c->rbuf);
            free (c->wbuf);
            free (c);
        }
        return 0;
    }

    stats.curr_conns++;
    stats.total_conns++;

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %r15d
movl %edi, %ebp
movl 0x60cd(%rip), %eax      # 0x92cc
testl %eax, %eax
jle 0x3218
movq 0x60c6(%rip), %rcx      # 0x92d0
decl %eax
movl %eax, 0x60ba(%rip)      # 0x92cc
movq (%rcx,%rax,8), %rbx
jmp 0x3286
movl $0xf8, %edi
callq 0x2280
testq %rax, %rax
je 0x33c2
movq %rax, %rbx
movl $0x800, %edi            # imm = 0x800
callq 0x2280
movq %rax, %r12
movq %rax, 0x90(%rbx)
movl $0x800, %edi            # imm = 0x800
callq 0x2280
movq %rax, %r13
movq %rax, 0xb0(%rbx)
testq %r12, %r12
je 0x33a0
testq %r13, %r13
je 0x33a0
movl $0x800, %eax            # imm = 0x800
movl %eax, 0xc0(%rbx)
movl %eax, 0xa0(%rbx)
movq %r12, 0x98(%rbx)
incl 0x5fca(%rip)            # 0x9250
cmpl $0x2, 0x600f(%rip)      # 0x929c
jge 0x3373
movl %ebp, (%rbx)
movl %r15d, 0x4(%rbx)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0xc4(%rbx)
movq $0x0, 0xa4(%rbx)
movq 0xb0(%rbx), %rax
movq %rax, 0xb8(%rbx)
movb $0x0, 0xcc(%rbx)
leaq 0x8(%rbx), %r15
movswl %r14w, %r14d
leaq 0xf7(%rip), %rcx        # 0x33d0
movq %r15, %rdi
movl %ebp, %esi
movl %r14d, %edx
movq %rbx, %r8
callq 0x2310
movw %r14w, 0x88(%rbx)
movq %r15, %rdi
xorl %esi, %esi
callq 0x2210
cmpl $-0x1, %eax
je 0x331a
movq 0x5f40(%rip), %xmm0     # 0x9248
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x5f30(%rip)     # 0x9248
jmp 0x3361
movslq 0x5fab(%rip), %rax      # 0x92cc
cmpl 0x5fa1(%rip), %eax      # 0x92c8
jge 0x333f
movq 0x5fa0(%rip), %rcx      # 0x92d0
leal 0x1(%rax), %edx
movl %edx, 0x5f93(%rip)      # 0x92cc
movq %rbx, (%rcx,%rax,8)
jmp 0x335f
movq 0x90(%rbx), %rdi
callq 0x2030
movq 0xb0(%rbx), %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
testl %r15d, %r15d
movq 0x5c7b(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x2f46(%rip), %rax      # 0x62cd
leaq 0x2f55(%rip), %rsi      # 0x62e3
cmoveq %rax, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2230
jmp 0x3293
testq %r12, %r12
je 0x33ad
movq %r12, %rdi
callq 0x2030
testq %r13, %r13
je 0x33ba
movq %r13, %rdi
callq 0x2030
movq %rbx, %rdi
callq 0x2030
leaq 0x2efb(%rip), %rdi      # 0x62c4
callq 0x2360
jmp 0x335f