// File: /workspace/github_c_makefile_star2_O0/sszllzss[P]webSocket_Libevent_ThreadPool/ev_httpd.cpp
// Function: startHttpServe(event_base*, unsigned short*)
httpServer_t * startHttpServe(struct event_base* base, u_short *port)
{
    httpServer_t * httpServer = NULL;
    struct sockaddr_in addr;
#ifdef DYNAMIC_CONFING
    if(SERVER_STRING_VARIALE == NULL)
        return NULL;
#endif
    do
    {
        if(base == NULL)
        {
            De_fprintf(stderr, "event_base == NULL\r\n");
            break;
        }
        httpServer = (httpServer_t *) malloc(sizeof(httpServer_t));
        if(httpServer == NULL)
        {
            De_fprintf(stderr, "httpServer_t mallocl fail!");
            break;
        }
        memset(httpServer, 0, (sizeof(httpServer_t)));

        httpServer->http_listener_base = base;
        httpServer->shutdown = false;

        httpServer->evb_thpool =  evbase_threadpool_new(HTTPSERVER_BASE_MAX_MONITOR_NUM, HTTPSERVER_MIN_THREAD_NUM);
        if(httpServer->evb_thpool == NULL)
        {
            De_fprintf(stderr, "new evbase_threadpool fail!\r\n");
            break;
        }
        if(pthread_mutex_init(&httpServer->lock, NULL) != 0)
        {
            De_fprintf(stderr, "httpServer->lock init fail\r\n");
            break;
        }
        if(pthread_mutex_init(&httpServer->clientMap_lock, NULL) != 0)
        {
            De_fprintf(stderr, "httpServer->clientMap_lock init fail\r\n");
            break;
        }
        httpServer->clientMap = new BufferevMap();
        if(httpServer->clientMap == NULL)
        {
            De_fprintf(stderr, "httpServer->clientMap new fail\r\n");
            break;    
        }
        memset(&addr, 0, sizeof(addr));
        addr.sin_family = AF_INET;
        addr.sin_port = htons(*port);
        addr.sin_addr.s_addr = htonl(INADDR_ANY);
        if ((httpServer->http_listeber = evconnlistener_new_bind(base , listener_cd , httpServer, LEV_OPT_REUSEABLE | LEV_OPT_CLOSE_ON_FREE, -1,(struct sockaddr *)&addr, sizeof(addr))) == NULL)
        {
            De_fprintf(stderr, "evconnlistener_new_bind fail!\r\n");
            break;
        }
        httpServer->port = *port; 
        evconnlistener_set_error_cb(httpServer->http_listeber, accpt_error_cb);
        httpServer->pool = evbase_threadpool_get_threadpool(httpServer->evb_thpool);
        int ret = pthread_create(&httpServer->http_supervise_thread, NULL, http_supervise_thread, httpServer);
        if(ret != 0)
        {
            De_fprintf(stderr, "creatd thread fail:%s\r\n", strerror(ret));
            break;
        }
        return httpServer;
    }while(0);
    httpServer_free(httpServer);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
leaq 0x13491(%rip), %rax     # 0x1d4f0
cmpq $0x0, (%rax)
jne 0xa072
movq $0x0, -0x8(%rbp)
jmp 0xa559
jmp 0xa074
cmpq $0x0, -0x10(%rbp)
jne 0xa0de
jmp 0xa07d
movq 0x12f54(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xa10d(%rip), %rsi      # 0x1419b
leaq 0xba9d(%rip), %rdx      # 0x15b32
leaq 0xba13(%rip), %rcx      # 0x15aaf
movl $0x4ca, %r8d            # imm = 0x4CA
movb $0x0, %al
callq 0x46e0
movq 0x12f28(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xba87(%rip), %rsi      # 0x15b41
movb $0x0, %al
callq 0x46e0
movq 0x12f10(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xbc17(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xa548
movl $0xc0, %edi
callq 0x46a0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xa156
jmp 0xa0f5
movq 0x12edc(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xa095(%rip), %rsi      # 0x1419b
leaq 0xba25(%rip), %rdx      # 0x15b32
leaq 0xb99b(%rip), %rcx      # 0x15aaf
movl $0x4d0, %r8d            # imm = 0x4D0
movb $0x0, %al
callq 0x46e0
movq 0x12eb0(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xba24(%rip), %rsi      # 0x15b56
movb $0x0, %al
callq 0x46e0
movq 0x12e98(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xbb9f(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xa548
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0xc0, %edx
callq 0x4290
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x84(%rax)
leaq 0x13349(%rip), %rax     # 0x1d4d0
movl (%rax), %edi
leaq 0x1333c(%rip), %rax     # 0x1d4cc
movl (%rax), %esi
callq 0xd820
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x60(%rax)
jne 0xa210
jmp 0xa1af
movq 0x12e22(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x9fdb(%rip), %rsi      # 0x1419b
leaq 0xb96b(%rip), %rdx      # 0x15b32
leaq 0xb8e1(%rip), %rcx      # 0x15aaf
movl $0x4db, %r8d            # imm = 0x4DB
movb $0x0, %al
callq 0x46e0
movq 0x12df6(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb985(%rip), %rsi      # 0x15b71
movb $0x0, %al
callq 0x46e0
movq 0x12dde(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xbae5(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xa548
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4730
cmpl $0x0, %eax
je 0xa285
jmp 0xa224
movq 0x12dad(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x9f66(%rip), %rsi      # 0x1419b
leaq 0xb8f6(%rip), %rdx      # 0x15b32
leaq 0xb86c(%rip), %rcx      # 0x15aaf
movl $0x4e0, %r8d            # imm = 0x4E0
movb $0x0, %al
callq 0x46e0
movq 0x12d81(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb92e(%rip), %rsi      # 0x15b8f
movb $0x0, %al
callq 0x46e0
movq 0x12d69(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xba70(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xa548
movq -0x20(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4730
cmpl $0x0, %eax
je 0xa2fe
jmp 0xa29d
movq 0x12d34(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x9eed(%rip), %rsi      # 0x1419b
leaq 0xb87d(%rip), %rdx      # 0x15b32
leaq 0xb7f3(%rip), %rcx      # 0x15aaf
movl $0x4e5, %r8d            # imm = 0x4E5
movb $0x0, %al
callq 0x46e0
movq 0x12d08(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb8d2(%rip), %rsi      # 0x15bac
movb $0x0, %al
callq 0x46e0
movq 0x12cf0(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb9f7(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xa548
movl $0x30, %edi
callq 0x44f0
movq %rax, %rdi
movq %rdi, -0x40(%rbp)
xorl %esi, %esi
movl $0x30, %edx
callq 0x4290
movq -0x40(%rbp), %rdi
callq 0xb3c0
movq -0x40(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jne 0xa39e
jmp 0xa33d
movq 0x12c94(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x9e4d(%rip), %rsi      # 0x1419b
leaq 0xb7dd(%rip), %rdx      # 0x15b32
leaq 0xb753(%rip), %rcx      # 0x15aaf
movl $0x4eb, %r8d            # imm = 0x4EB
movb $0x0, %al
callq 0x46e0
movq 0x12c68(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb859(%rip), %rsi      # 0x15bd3
movb $0x0, %al
callq 0x46e0
movq 0x12c50(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb957(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xa548
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x4290
movw $0x2, -0x30(%rbp)
movq -0x18(%rbp), %rax
movzwl (%rax), %edi
callq 0x4090
movw %ax, -0x2e(%rbp)
xorl %edi, %edi
callq 0x43a0
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x193(%rip), %rsi       # 0xa570
movl $0xa, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
leaq -0x30(%rbp), %r9
movl $0x10, (%rsp)
callq 0x4470
movq -0x20(%rbp), %rcx
movq %rax, 0x68(%rcx)
cmpq $0x0, %rax
jne 0xa469
jmp 0xa408
movq 0x12bc9(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x9d82(%rip), %rsi      # 0x1419b
leaq 0xb712(%rip), %rdx      # 0x15b32
leaq 0xb688(%rip), %rcx      # 0x15aaf
movl $0x4f4, %r8d            # imm = 0x4F4
movb $0x0, %al
callq 0x46e0
movq 0x12b9d(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb7af(%rip), %rsi      # 0x15bf4
movb $0x0, %al
callq 0x46e0
movq 0x12b85(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb88c(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xa548
movq -0x18(%rbp), %rax
movzwl (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x80(%rax)
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rdi
leaq 0x6a7(%rip), %rsi       # 0xab30
callq 0x48c0
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0xd800
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x20(%rbp), %rdi
addq $0x78, %rdi
movq -0x20(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq -0x10cd(%rip), %rdx     # 0x93f0
callq 0x4880
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0xa53e
jmp 0xa4cd
movq 0x12b04(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0x9cbd(%rip), %rsi      # 0x1419b
leaq 0xb64d(%rip), %rdx      # 0x15b32
leaq 0xb5c3(%rip), %rcx      # 0x15aaf
movl $0x4fd, %r8d            # imm = 0x4FD
movb $0x0, %al
callq 0x46e0
movq 0x12ad8(%rip), %rax     # 0x1cfd8
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movl -0x34(%rbp), %edi
callq 0x4190
movq -0x48(%rbp), %rdi
movq %rax, %rdx
leaq 0xb6f7(%rip), %rsi      # 0x15c14
movb $0x0, %al
callq 0x46e0
movq 0x12aad(%rip), %rax     # 0x1cfd8
movq (%rax), %rdi
leaq 0xb7b4(%rip), %rsi      # 0x15ce9
movb $0x0, %al
callq 0x46e0
jmp 0xa548
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xa559
movq -0x20(%rbp), %rdi
callq 0x9e60
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)