// File: /workspace/github_c_makefile_star2_O0/sszllzss[P]webSocket_Libevent_ThreadPool/ev_httpd.cpp
// Function: bufferev_event_cb(bufferevent*, short, void*)
static void bufferev_event_cb(struct bufferevent *bev, short events,void *ctx)
{
    httpChilent_t *client = (httpChilent_t *)ctx;
    struct sockaddr_in *address = NULL; 
    char ip[INET_ADDRSTRLEN];
    BufferevMap::iterator i;
    do
    {
        if(client == NULL)
        {
            De_printf("httpChilent NULL\r\n");
            break;
        }
        pthread_mutex_lock(&client->lock);
        address = (struct sockaddr_in *)&(client->addr);
        if(address != NULL)
        {
            inet_ntop(AF_INET, &address->sin_addr,ip, INET_ADDRSTRLEN);
        }
        if(events & BEV_EVENT_ERROR)
        {
            if(address != NULL)
                De_printf("%s:%d[ Error from bufferevnt:%s\r\n", inet_ntop(AF_INET,&address->sin_addr, ip,(socklen_t) sizeof(ip)), ntohs(address->sin_port), strerror(errno));  
            else
                De_printf("Unknown[ Error from bufferevnt:%s\r\n",strerror(errno));
        }
        else if(events & (BEV_EVENT_EOF))
        {
            if(address != NULL)
                De_printf("Connection close:%s:%d\r\n", inet_ntop(AF_INET,&address->sin_addr, ip,(socklen_t) sizeof(ip)), ntohs(address->sin_port));  
            else
                De_printf("Connection close: Unknown\r\n");
        }
        pthread_mutex_unlock(&client->lock);
    }
    while(0);
    bufferevent_lock(bev);
    bufferevent_disable(bev, EV_WRITE | EV_READ);
    if(client != NULL)
    {
        if(client->stat == HTTP_WS_DATA && client->ws_weite_cb_flage)
        {
            WebddSocket_Thread_Cb_arg_t * cb_arg = (WebddSocket_Thread_Cb_arg_t *)malloc(sizeof(WebddSocket_Thread_Cb_arg_t));
            cb_arg->client = client;
            cb_arg->type = Ws_Cb_Type_disconnect;
            threadpool_add(evbase_threadpool_get_threadpool(client->httpServer->evb_thpool), webSocke_thread_cb, cb_arg);
        }
        pthread_mutex_lock(&client->lock);
        evbase_threadpool_close_event(client->httpServer->evb_thpool, bufferevent_get_base(bev));
        pthread_mutex_lock(&client->httpServer->clientMap_lock);
        client->httpServer->clientMap->erase(bev);
        pthread_mutex_unlock(&client->httpServer->clientMap_lock);

        pthread_mutex_unlock(&client->lock);
        httpChilent_free(client);
    }
    //close(bufferevent_getfd(bev));
    bufferevent_lock(bev);
    bufferevent_free(bev);
    /* bufferevent_unlock(bev); */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movw %si, %ax
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xb350
cmpq $0x0, -0x20(%rbp)
jne 0x990b
jmp 0x98c9
leaq 0xa8cb(%rip), %rdi      # 0x1419b
leaq 0xc355(%rip), %rsi      # 0x15c2c
leaq 0xc1d1(%rip), %rdx      # 0x15aaf
movl $0x3ab, %ecx            # imm = 0x3AB
movb $0x0, %al
callq 0x4080
leaq 0xc1f9(%rip), %rdi      # 0x15aea
movb $0x0, %al
callq 0x4080
leaq 0xc3ea(%rip), %rdi      # 0x15ce9
movb $0x0, %al
callq 0x4080
jmp 0x9b16
movq -0x20(%rbp), %rdi
callq 0x4720
movq -0x20(%rbp), %rax
addq $0xa4, %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x9944
movq -0x28(%rbp), %rsi
addq $0x4, %rsi
leaq -0x40(%rbp), %rdx
movl $0x2, %edi
movl $0x10, %ecx
callq 0x4540
movswl -0xa(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x9a3d
cmpq $0x0, -0x28(%rbp)
je 0x99e8
jmp 0x9961
leaq 0xa833(%rip), %rdi      # 0x1419b
leaq 0xc2bd(%rip), %rsi      # 0x15c2c
leaq 0xc139(%rip), %rdx      # 0x15aaf
movl $0x3b7, %ecx            # imm = 0x3B7
movb $0x0, %al
callq 0x4080
movq -0x28(%rbp), %rsi
addq $0x4, %rsi
leaq -0x40(%rbp), %rdx
movl $0x2, %edi
movl $0x10, %ecx
callq 0x4540
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x4890
movzwl %ax, %eax
movl %eax, -0x54(%rbp)
callq 0x4070
movl (%rax), %edi
callq 0x4190
movq -0x60(%rbp), %rsi
movl -0x54(%rbp), %edx
movq %rax, %rcx
leaq 0xc26d(%rip), %rdi      # 0x15c3e
movb $0x0, %al
callq 0x4080
leaq 0xc30a(%rip), %rdi      # 0x15ce9
movb $0x0, %al
callq 0x4080
jmp 0x9a38
jmp 0x99ea
leaq 0xa7aa(%rip), %rdi      # 0x1419b
leaq 0xc234(%rip), %rsi      # 0x15c2c
leaq 0xc0b0(%rip), %rdx      # 0x15aaf
movl $0x3b9, %ecx            # imm = 0x3B9
movb $0x0, %al
callq 0x4080
callq 0x4070
movl (%rax), %edi
callq 0x4190
movq %rax, %rsi
leaq 0xc23f(%rip), %rdi      # 0x15c60
movb $0x0, %al
callq 0x4080
leaq 0xc2ba(%rip), %rdi      # 0x15ce9
movb $0x0, %al
callq 0x4080
jmp 0x9a38
jmp 0x9b0d
movswl -0xa(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x9b0b
cmpq $0x0, -0x28(%rbp)
je 0x9ac8
jmp 0x9a56
leaq 0xa73e(%rip), %rdi      # 0x1419b
leaq 0xc1c8(%rip), %rsi      # 0x15c2c
leaq 0xc044(%rip), %rdx      # 0x15aaf
movl $0x3be, %ecx            # imm = 0x3BE
movb $0x0, %al
callq 0x4080
movq -0x28(%rbp), %rsi
addq $0x4, %rsi
leaq -0x40(%rbp), %rdx
movl $0x2, %edi
movl $0x10, %ecx
callq 0x4540
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x4890
movq -0x68(%rbp), %rsi
movzwl %ax, %edx
leaq 0xc04c(%rip), %rdi      # 0x15afd
movb $0x0, %al
callq 0x4080
leaq 0xc22a(%rip), %rdi      # 0x15ce9
movb $0x0, %al
callq 0x4080
jmp 0x9b09
jmp 0x9aca
leaq 0xa6ca(%rip), %rdi      # 0x1419b
leaq 0xc154(%rip), %rsi      # 0x15c2c
leaq 0xbfd0(%rip), %rdx      # 0x15aaf
movl $0x3c0, %ecx            # imm = 0x3C0
movb $0x0, %al
callq 0x4080
leaq 0xc024(%rip), %rdi      # 0x15b16
movb $0x0, %al
callq 0x4080
leaq 0xc1e9(%rip), %rdi      # 0x15ce9
movb $0x0, %al
callq 0x4080
jmp 0x9b09
jmp 0x9b0b
jmp 0x9b0d
movq -0x20(%rbp), %rdi
callq 0x4390
movq -0x8(%rbp), %rdi
callq 0x4710
movq -0x8(%rbp), %rdi
movl $0x6, %esi
callq 0x4750
cmpq $0x0, -0x20(%rbp)
je 0x9c0e
movq -0x20(%rbp), %rax
cmpl $0x5, 0x38(%rax)
jne 0x9b97
movq -0x20(%rbp), %rax
cmpb $0x0, 0xc8(%rax)
je 0x9b97
movl $0x10, %edi
callq 0x46a0
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rax
movl $0x3, 0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x60(%rax), %rdi
callq 0xd800
movq %rax, %rdi
movq -0x50(%rbp), %rdx
leaq -0x1f32(%rip), %rsi     # 0x7c60
callq 0xfc20
movq -0x20(%rbp), %rdi
callq 0x4720
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x60(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4820
movq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0xe060
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
addq $0x28, %rdi
callq 0x4720
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x50(%rax), %rdi
leaq -0x8(%rbp), %rsi
callq 0xb370
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
addq $0x28, %rdi
callq 0x4390
movq -0x20(%rbp), %rdi
callq 0x4390
movq -0x20(%rbp), %rdi
callq 0x9800
movq -0x8(%rbp), %rdi
callq 0x4710
movq -0x8(%rbp), %rdi
callq 0x4160
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)