// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movl %edi, 0x1c(%rsp)
movl %esi, 0x18(%rsp)
movl %edx, 0x14(%rsp)
cmpl $0x0, 0x6c4d(%rip)      # 0xa2d4
jle 0x36b0
movq 0x6c48(%rip), %rax      # 0xa2d8
movl 0x6c3e(%rip), %ecx      # 0xa2d4
addl $-0x1, %ecx
movl %ecx, 0x6c35(%rip)      # 0xa2d4
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x8(%rsp)
jmp 0x37f8
movl $0xf8, %edi
callq 0x22a0
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
jne 0x36df
leaq 0x3c34(%rip), %rdi      # 0x7300
callq 0x2380
movq $0x0, 0x20(%rsp)
jmp 0x399d
movq 0x8(%rsp), %rax
movq $0x0, 0xb0(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x90(%rax)
movl $0x800, %edi            # imm = 0x800
callq 0x22a0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x90(%rax)
movl $0x800, %edi            # imm = 0x800
callq 0x22a0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0xb0(%rax)
movq 0x8(%rsp), %rax
cmpq $0x0, 0x90(%rax)
je 0x374f
movq 0x8(%rsp), %rax
cmpq $0x0, 0xb0(%rax)
jne 0x37b3
movq 0x8(%rsp), %rax
cmpq $0x0, 0x90(%rax)
je 0x376f
movq 0x8(%rsp), %rax
movq 0x90(%rax), %rdi
callq 0x2030
movq 0x8(%rsp), %rax
cmpq $0x0, 0xb0(%rax)
je 0x378f
movq 0x8(%rsp), %rax
movq 0xb0(%rax), %rdi
callq 0x2030
movq 0x8(%rsp), %rdi
callq 0x2030
leaq 0x3b60(%rip), %rdi      # 0x7300
callq 0x2380
movq $0x0, 0x20(%rsp)
jmp 0x399d
movq 0x8(%rsp), %rax
movl $0x800, 0xc0(%rax)      # imm = 0x800
movq 0x8(%rsp), %rax
movl $0x800, 0xa0(%rax)      # imm = 0x800
movq 0x8(%rsp), %rax
movq 0x90(%rax), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x98(%rax)
movl 0x6a71(%rip), %eax      # 0xa260
addl $0x1, %eax
movl %eax, 0x6a68(%rip)      # 0xa260
cmpl $0x1, 0x6aa5(%rip)      # 0xa2a4
jle 0x3844
cmpl $0x0, 0x18(%rsp)
jne 0x3826
movq 0x67e9(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movl 0x1c(%rsp), %edx
leaq 0x3aec(%rip), %rsi      # 0x7309
movb $0x0, %al
callq 0x2250
jmp 0x3842
movq 0x67cb(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movl 0x1c(%rsp), %edx
leaq 0x3ae4(%rip), %rsi      # 0x731f
movb $0x0, %al
callq 0x2250
jmp 0x3844
movl 0x1c(%rsp), %ecx
movq 0x8(%rsp), %rax
movl %ecx, (%rax)
movl 0x18(%rsp), %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x4(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0xc4(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0xa4(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0xa8(%rax)
movq 0x8(%rsp), %rax
movq 0xb0(%rax), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0xb8(%rax)
movq 0x8(%rsp), %rax
movl $0x1, 0xc8(%rax)
movq 0x8(%rsp), %rax
movb $0x0, 0xcc(%rax)
movq 0x8(%rsp), %rdi
addq $0x8, %rdi
movl 0x1c(%rsp), %esi
movl 0x14(%rsp), %eax
movq 0x8(%rsp), %r8
leaq 0xd8(%rip), %rcx        # 0x39b0
movswl %ax, %edx
callq 0x2330
movl 0x14(%rsp), %eax
movw %ax, %cx
movq 0x8(%rsp), %rax
movw %cx, 0x88(%rax)
movq 0x8(%rsp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2230
cmpl $-0x1, %eax
jne 0x3975
movl 0x69c4(%rip), %eax      # 0xa2d4
cmpl 0x69ba(%rip), %eax      # 0xa2d0
jge 0x393e
movq 0x8(%rsp), %rdx
movq 0x69b4(%rip), %rax      # 0xa2d8
movl 0x69aa(%rip), %ecx      # 0xa2d4
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x699f(%rip)      # 0xa2d4
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x396a
movq 0x8(%rsp), %rax
movq 0x90(%rax), %rdi
callq 0x2030
movq 0x8(%rsp), %rax
movq 0xb0(%rax), %rdi
callq 0x2030
movq 0x8(%rsp), %rdi
callq 0x2030
movq $0x0, 0x20(%rsp)
jmp 0x399d
movl 0x68dd(%rip), %eax      # 0xa258
addl $0x1, %eax
movl %eax, 0x68d4(%rip)      # 0xa258
movl 0x68d2(%rip), %eax      # 0xa25c
addl $0x1, %eax
movl %eax, 0x68c9(%rip)      # 0xa25c
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0x28, %rsp
retq
nopw (%rax,%rax)