// File: mbourand[P]webserv/srcs/VirtualHost.cpp
// Function: VirtualHost::VirtualHost(ConfigContext const&)
VirtualHost::VirtualHost(const ConfigContext& config)
	: _config(config)
{
	const std::list<std::string>& listen = _config.getParam("listen");
	for (std::list<std::string>::const_iterator it = listen.begin(); it != listen.end(); it++)
	{
		std::pair<std::string, int> full_ip = ft::complete_ip(*it);
		if (g_webserv.sockets.find(full_ip.second) == g_webserv.sockets.end())
			g_webserv.sockets.insert(std::make_pair(full_ip.second, new ServerSocket(full_ip.second)));
		_ports.push_back(full_ip.second);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
leaq 0x28783(%rip), %rax     # 0x8ed38
movq %rax, (%rdi)
addq $0x8, %rdi
movq %rdi, -0xf0(%rbp)
movq %rdi, %rax
movq %rax, -0xe8(%rbp)
movq -0x10(%rbp), %rsi
callq 0x47740
movq -0xe0(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
movq %rdi, -0xd8(%rbp)
callq 0x66b80
leaq -0x39(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x9b10
movq -0xd0(%rbp), %rdx
leaq 0x6b43(%rip), %rsi      # 0x6d151
leaq -0x38(%rbp), %rdi
callq 0xa780
jmp 0x66619
movq -0xf0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x4c710
movq %rax, -0xf8(%rbp)
jmp 0x66632
leaq -0x38(%rbp), %rdi
callq 0x9c98
leaq -0x39(%rbp), %rdi
callq 0x9700
movq -0xf8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x16b20
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
callq 0x4ffa0
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0xcc80
testb $0x1, %al
jne 0x6667f
jmp 0x6686b
leaq -0x58(%rbp), %rdi
callq 0xcce0
movq %rax, %rsi
leaq -0x88(%rbp), %rdi
callq 0x2fb80
jmp 0x66699
leaq -0x68(%rbp), %rsi
leaq 0x2907c(%rip), %rdi     # 0x8f720
addq $0x18, %rdi
callq 0x66bf0
movq %rax, -0x100(%rbp)
jmp 0x666b6
movq -0x100(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq 0x29055(%rip), %rdi     # 0x8f720
addq $0x18, %rdi
callq 0x5bf90
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x66bc0
testb $0x1, %al
jne 0x666f7
jmp 0x66821
leaq -0x68(%rbp), %rax
movq %rax, -0x110(%rbp)
movl $0x60, %edi
callq 0x9680
movq %rax, -0x108(%rbp)
jmp 0x66715
movq -0x108(%rbp), %rdi
movl -0x68(%rbp), %esi
callq 0x1b6c0
jmp 0x66726
movq -0x110(%rbp), %rdi
movq -0x108(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0xb0(%rbp), %rsi
callq 0x66c60
movq %rdx, -0x120(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x66756
movq -0x120(%rbp), %rax
movl -0x114(%rbp), %ecx
movl %ecx, -0xa8(%rbp)
movq %rax, -0xa0(%rbp)
leaq 0x28fa9(%rip), %rdi     # 0x8f720
addq $0x18, %rdi
leaq -0xa8(%rbp), %rsi
callq 0x66c20
movb %dl, -0x129(%rbp)
movq %rax, -0x128(%rbp)
jmp 0x66796
movb -0x129(%rbp), %al
movq -0x128(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
movb %al, -0xb8(%rbp)
jmp 0x66821
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x667d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x9c98
leaq -0x39(%rbp), %rdi
callq 0x9700
jmp 0x66874
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x66874
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x6685d
movq -0x108(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x60, %esi
callq 0x9690
jmp 0x6685d
movq -0xe0(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
leaq -0x68(%rbp), %rsi
callq 0x66c90
jmp 0x6683a
leaq -0x88(%rbp), %rdi
callq 0x32e50
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0xced0
movq %rax, -0xc8(%rbp)
jmp 0x6665c
leaq -0x88(%rbp), %rdi
callq 0x32e50
jmp 0x66874
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0xd8(%rbp), %rdi
callq 0x66ba0
movq -0xe8(%rbp), %rdi
callq 0x47670
movq -0x48(%rbp), %rdi
callq 0x9af0
nopw %cs:(%rax,%rax)