// File: /workspace/github_cpp_makefile_star2_O3/dentiny[P]HTTP-Cache-Proxy/Proxy.cpp
// Function: Proxy::constructServer()
void constructServer()
    {
        // initialize host information
        struct addrinfo host_info;
    	struct addrinfo * host_info_list;
        memset(&host_info, 0, sizeof(host_info));
        host_info.ai_family = AF_UNSPEC;
        host_info.ai_socktype = SOCK_STREAM;
        host_info.ai_flags = AI_PASSIVE;

        // get address information
        status = getaddrinfo(NULL, listen_port, &host_info, &host_info_list);
        if(status != 0)
        {
            std::cerr << "Construct server getaddrinfo error" << std::endl;
            exit(EXIT_FAILURE);
        }

        // create a socket file descriptor
        socket_fd = socket(host_info_list->ai_family,
                        host_info_list->ai_socktype,
                        host_info_list->ai_protocol);
        if(socket_fd == -1) 
        {
        	freeaddrinfo(host_info_list);
            std::cerr << "Construct server create socket error" << std::endl;
            exit(EXIT_FAILURE);
        }

        // set socket option
        int yes = 1;
        status = setsockopt(socket_fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int));
        if(status == -1)
        {
        	freeaddrinfo(host_info_list);
        	close(socket_fd);
            std::cerr << "Construct server set socket option error" << std::endl;
            exit(EXIT_FAILURE);
        }

        // bind
        status = bind(socket_fd, host_info_list->ai_addr, host_info_list->ai_addrlen);
        if(status == -1) 
        {
        	freeaddrinfo(host_info_list);
        	close(socket_fd);
            std::cerr << "Construct server cannot bind socket" << std::endl;
            exit(EXIT_FAILURE);
        }

        // listen
        status = listen(socket_fd, BACKLOG);
        if(status == -1)
        {
        	freeaddrinfo(host_info_list);
        	close(socket_fd);
            std::cerr << "Construct server listen error" << std::endl;
            exit(EXIT_FAILURE);
        }

        // free allocated host_info_list
        freeaddrinfo(host_info_list);
    }

// Assembly:
pushq %rbp
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
movl $0x1, %eax
movl %eax, 0x8(%rdx)
movl %eax, (%rdx)
movq 0x2a8(%rdi), %rsi
movq %rsp, %rcx
xorl %edi, %edi
callq 0x33c0
movl %eax, 0x2b0(%rbx)
testl %eax, %eax
jne 0x3b8f
movq (%rsp), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x30b0
movl %eax, 0x2b4(%rbx)
cmpl $-0x1, %eax
je 0x3b9f
leaq 0xc(%rsp), %rcx
movl $0x1, (%rcx)
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x3520
movl %eax, 0x2b0(%rbx)
cmpl $-0x1, %eax
je 0x3bb8
movl 0x2b4(%rbx), %edi
movq (%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
callq 0x3080
movl %eax, 0x2b0(%rbx)
cmpl $-0x1, %eax
je 0x3bdc
movl 0x2b4(%rbx), %edi
movl $0x64, %esi
callq 0x3370
movl %eax, %ebp
movl %eax, 0x2b0(%rbx)
movq (%rsp), %rdi
callq 0x33d0
cmpl $-0x1, %ebp
je 0x3c00
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
movq 0xe452(%rip), %rdi      # 0x11fe8
leaq 0x94ba(%rip), %rsi      # 0xd057
jmp 0x3c19
movq (%rsp), %rdi
callq 0x33d0
movq 0xe439(%rip), %rdi      # 0x11fe8
leaq 0x94c4(%rip), %rsi      # 0xd07a
jmp 0x3c19
movq (%rsp), %rdi
callq 0x33d0
movl 0x2b4(%rbx), %edi
callq 0x3560
movq 0xe415(%rip), %rdi      # 0x11fe8
leaq 0x94c5(%rip), %rsi      # 0xd09f
jmp 0x3c19
movq (%rsp), %rdi
callq 0x33d0
movl 0x2b4(%rbx), %edi
callq 0x3560
movq 0xe3f1(%rip), %rdi      # 0x11fe8
leaq 0x94ca(%rip), %rsi      # 0xd0c8
jmp 0x3c19
movl 0x2b4(%rbx), %edi
callq 0x3560
movq 0xe3d6(%rip), %rdi      # 0x11fe8
leaq 0x94d3(%rip), %rsi      # 0xd0ec
callq 0x3320
movq %rax, %rdi
callq 0x3190
movl $0x1, %edi
callq 0x33a0