// File: /workspace/github_cpp_makefile_star2_O2/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)
pushq $0x1
popq %rax
movl %eax, 0x8(%rdx)
movl %eax, (%rdx)
movq 0x2a8(%rdi), %rsi
movq %rsp, %rcx
xorl %edi, %edi
callq 0x3380
movl %eax, 0x2b0(%rbx)
testl %eax, %eax
jne 0x3a25
movq (%rsp), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x30a0
movl %eax, 0x2b4(%rbx)
cmpl $-0x1, %eax
je 0x3a35
leaq 0xc(%rsp), %rcx
movl $0x1, (%rcx)
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x34c0
movl %eax, 0x2b0(%rbx)
cmpl $-0x1, %eax
je 0x3a4e
movl 0x2b4(%rbx), %edi
movq (%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
callq 0x3070
movl %eax, 0x2b0(%rbx)
cmpl $-0x1, %eax
je 0x3a72
movl 0x2b4(%rbx), %edi
pushq $0x64
popq %rsi
callq 0x3340
movl %eax, %ebp
movl %eax, 0x2b0(%rbx)
movq (%rsp), %rdi
callq 0x33a0
cmpl $-0x1, %ebp
je 0x3a96
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
movq 0xc5bc(%rip), %rdi      # 0xffe8
leaq 0x6624(%rip), %rsi      # 0xa057
jmp 0x3aaf
movq (%rsp), %rdi
callq 0x33a0
movq 0xc5a3(%rip), %rdi      # 0xffe8
leaq 0x662e(%rip), %rsi      # 0xa07a
jmp 0x3aaf
movq (%rsp), %rdi
callq 0x33a0
movl 0x2b4(%rbx), %edi
callq 0x3520
movq 0xc57f(%rip), %rdi      # 0xffe8
leaq 0x662f(%rip), %rsi      # 0xa09f
jmp 0x3aaf
movq (%rsp), %rdi
callq 0x33a0
movl 0x2b4(%rbx), %edi
callq 0x3520
movq 0xc55b(%rip), %rdi      # 0xffe8
leaq 0x6634(%rip), %rsi      # 0xa0c8
jmp 0x3aaf
movl 0x2b4(%rbx), %edi
callq 0x3520
movq 0xc540(%rip), %rdi      # 0xffe8
leaq 0x663d(%rip), %rsi      # 0xa0ec
callq 0x3300
movq %rax, %rdi
callq 0x3180
pushq $0x1
popq %rdi
callq 0x3360