// File: /workspace/github_c_makefile_star2_O0/sszllzss[P]webSocket_Libevent_ThreadPool/ev_httpd.cpp
// Function: listener_cd(evconnlistener*, int, sockaddr*, int, void*)
static void listener_cd(struct evconnlistener *listener, evutil_socket_t fd, struct sockaddr *sa, int socklen, void *arg)
{
    httpServer_t *httpServer=(httpServer_t *)arg;
    listener = (struct evconnlistener *)listener;
    struct httpChilent_t *client;
    char ip[INET_ADDRSTRLEN];
    struct sockaddr_in * addr = (struct sockaddr_in *)sa;
    inet_ntop(AF_INET, &addr->sin_addr, ip, INET_ADDRSTRLEN);

    event_base *base = evbase_threadpool_add_event(httpServer->evb_thpool);
    if(base == NULL)
    {
        De_fprintf(stderr, "%s:%d[ base get fall!\r\n",ip, ntohs(addr->sin_port));
        return;
    }

    struct bufferevent *bev = bufferevent_socket_new(base, fd, BEV_OPT_CLOSE_ON_FREE);
    if(bev == NULL)
    {
        De_fprintf(stderr, "%s:%d[ bufferevent new error:%s\r\n",ip, ntohs(addr->sin_port), evutil_socket_error_to_string(EVUTIL_SOCKET_ERROR()));
        return;
    }


    client = (struct httpChilent_t *) malloc(sizeof(struct httpChilent_t));
    if(client == NULL)
    {
        De_fprintf(stderr, "%s:%d[ httpChilent malloc fail!\r\n",ip, ntohs(addr->sin_port));
        return;
    }
    memset(client, 0, sizeof(struct httpChilent_t));

    memcpy(&client->addr, sa, sizeof(sizeof(struct sockaddr_in)));
    client->ws_weite_cb_flage = 1;
    client->bev = bev;
    client->httpServer = httpServer;

    if(gettimeofday(&client->final_optime, NULL) != 0)
    {
        De_fprintf(stderr, "%s:%d[ gettimeofday fail!\r\n",ip, ntohs(addr->sin_port));
        return;
    }
    client->stat = HTTP_CONNECTED;
    if(pthread_mutex_init(&client->lock, NULL)!=0)
    {
        De_fprintf(stderr, "client->lock init fail!\r\n");
        httpChilent_free(client);
        return;
    }

    client->receive_evbuff = evbuffer_new();
    if(client->receive_evbuff == NULL)
    {
        De_fprintf(stderr, "%s:%d[ evbuffer_new fail!\r\n",ip, ntohs(addr->sin_port));
        return;
    }
    evbuffer_enable_locking(client->receive_evbuff, NULL);

    bufferevent_setcb(bev, bufferev_read_cb, bufferev_write_cb, bufferev_event_cb, client);
    pthread_mutex_lock(&httpServer->clientMap_lock);
    httpServer->clientMap->insert(std::pair<struct bufferevent *, httpChilent_t *>(bev ,client));
    pthread_mutex_unlock(&httpServer->clientMap_lock);

    bufferevent_enable(bev, EV_READ| EV_WRITE);
    De_printf("client connection:%s:%d\r\n",ip, ntohs(addr->sin_port));
    socklen = (int)socklen;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rsi
addq $0x4, %rsi
leaq -0x50(%rbp), %rdx
movl $0x2, %edi
movl $0x10, %ecx
callq 0x4540
movq -0x30(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0xdde0
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0xa66f
jmp 0xa5de
movq 0x129f3(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x9bac(%rip), %rsi      # 0x1419b
leaq 0xb68e(%rip), %rdx      # 0x15c84
leaq 0xb4b2(%rip), %rcx      # 0x15aaf
movl $0x41d, %r8d            # imm = 0x41D
movb $0x0, %al
callq 0x46e0
movq 0x129c7(%rip), %rax     # 0x1cfd8
movq (%rax), %rax
movq %rax, -0x98(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x4890
movq -0x98(%rbp), %rdi
movq -0x90(%rbp), %rdx
movzwl %ax, %ecx
leaq 0xb645(%rip), %rsi      # 0x15c90
movb $0x0, %al
callq 0x46e0
movq 0x1297f(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb686(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xab1c
movq -0x60(%rbp), %rdi
movl -0xc(%rbp), %esi
movl $0x1, %edx
callq 0x47f0
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0xa73d
jmp 0xa691
movq 0x12940(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x9af9(%rip), %rsi      # 0x1419b
leaq 0xb5db(%rip), %rdx      # 0x15c84
leaq 0xb3ff(%rip), %rcx      # 0x15aaf
movl $0x424, %r8d            # imm = 0x424
movb $0x0, %al
callq 0x46e0
movq 0x12914(%rip), %rax     # 0x1cfd8
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x4890
movzwl %ax, %eax
movl %eax, -0x9c(%rbp)
callq 0x4070
movl (%rax), %edi
callq 0x4190
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rdx
movl -0x9c(%rbp), %ecx
movq %rax, %r8
leaq 0xb58f(%rip), %rsi      # 0x15ca8
movb $0x0, %al
callq 0x46e0
movq 0x128b1(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb5b8(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xab1c
movl $0xd0, %edi
callq 0x46a0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xa7e9
jmp 0xa758
movq 0x12879(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x9a32(%rip), %rsi      # 0x1419b
leaq 0xb514(%rip), %rdx      # 0x15c84
leaq 0xb338(%rip), %rcx      # 0x15aaf
movl $0x42c, %r8d            # imm = 0x42C
movb $0x0, %al
callq 0x46e0
movq 0x1284d(%rip), %rax     # 0x1cfd8
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x4890
movq -0xc0(%rbp), %rdi
movq -0xb8(%rbp), %rdx
movzwl %ax, %ecx
leaq 0xb505(%rip), %rsi      # 0x15cca
movb $0x0, %al
callq 0x46e0
movq 0x12805(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb50c(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xab1c
movq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0xd0, %edx
callq 0x4290
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, 0xa4(%rax)
movq -0x38(%rbp), %rax
movb $0x1, 0xc8(%rax)
movq -0x68(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x38(%rbp), %rdi
addq $0xb8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4780
cmpl $0x0, %eax
je 0xa8de
jmp 0xa84d
movq 0x12784(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x993d(%rip), %rsi      # 0x1419b
leaq 0xb41f(%rip), %rdx      # 0x15c84
leaq 0xb243(%rip), %rcx      # 0x15aaf
movl $0x438, %r8d            # imm = 0x438
movb $0x0, %al
callq 0x46e0
movq 0x12758(%rip), %rax     # 0x1cfd8
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x4890
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rdx
movzwl %ax, %ecx
leaq 0xb432(%rip), %rsi      # 0x15cec
movb $0x0, %al
callq 0x46e0
movq 0x12710(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb417(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xab1c
movq -0x38(%rbp), %rax
movl $0x1, 0x38(%rax)
movq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4730
cmpl $0x0, %eax
je 0xa967
jmp 0xa8fd
movq 0x126d4(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x988d(%rip), %rsi      # 0x1419b
leaq 0xb36f(%rip), %rdx      # 0x15c84
leaq 0xb193(%rip), %rcx      # 0x15aaf
movl $0x43e, %r8d            # imm = 0x43E
movb $0x0, %al
callq 0x46e0
movq 0x126a8(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb3ce(%rip), %rsi      # 0x15d08
movb $0x0, %al
callq 0x46e0
movq 0x12690(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb397(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
movq -0x38(%rbp), %rdi
callq 0x9800
jmp 0xab1c
callq 0x4060
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x98(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x98(%rax)
jne 0xaa1f
jmp 0xa98e
movq 0x12643(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x97fc(%rip), %rsi      # 0x1419b
leaq 0xb2de(%rip), %rdx      # 0x15c84
leaq 0xb102(%rip), %rcx      # 0x15aaf
movl $0x446, %r8d            # imm = 0x446
movb $0x0, %al
callq 0x46e0
movq 0x12617(%rip), %rax     # 0x1cfd8
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x4890
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rdx
movzwl %ax, %ecx
leaq 0xb327(%rip), %rsi      # 0x15d22
movb $0x0, %al
callq 0x46e0
movq 0x125cf(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb2d6(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xab1c
movq -0x38(%rbp), %rax
movq 0x98(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4660
movq -0x68(%rbp), %rdi
movq -0x38(%rbp), %r8
leaq 0x16e(%rip), %rsi       # 0xabb0
leaq 0x227(%rip), %rdx       # 0xac70
leaq -0x11c0(%rip), %rcx     # 0x9890
callq 0x4500
movq -0x30(%rbp), %rdi
addq $0x28, %rdi
callq 0x4720
movq -0x30(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0xe8(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0xbc90
movq -0xe8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xbc50
movq %rax, -0x88(%rbp)
movb %dl, -0x80(%rbp)
movq -0x30(%rbp), %rdi
addq $0x28, %rdi
callq 0x4390
movq -0x68(%rbp), %rdi
movl $0x6, %esi
callq 0x48b0
leaq 0x96dd(%rip), %rdi      # 0x1419b
leaq 0xb1bf(%rip), %rsi      # 0x15c84
leaq 0xafe3(%rip), %rdx      # 0x15aaf
movl $0x451, %ecx            # imm = 0x451
movb $0x0, %al
callq 0x4080
leaq -0x50(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x4890
movq -0xf0(%rbp), %rsi
movzwl %ax, %edx
leaq 0xb23d(%rip), %rdi      # 0x15d3e
movb $0x0, %al
callq 0x4080
leaq 0xb1da(%rip), %rdi      # 0x15ce9
movb $0x0, %al
callq 0x4080
movl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)