// File: /workspace/github_cpp_makefile_star2_O3/mbourand[P]webserv/srcs/tcp-server.cpp
// Function: handle_new_connection(ServerSocket&, std::__cxx11::list<Client, std::allocator<Client>>&)
int		handle_new_connection(ServerSocket &server, std::list<Client> &clients)
{
	if (clients.size() <= g_webserv.max_connections)
	{
		Client	new_client;
		new_client.sckt = new ServerSocket;
		new_client.req = new Request(server.getServerPort());
		new_client.sckt->setServerPort(server.getServerPort());
		server.Accept(*new_client.sckt);
		clients.push_back(new_client);
		return (Logger::print("New Client Connected ("+new_client.sckt->getIPAddress()+")", new_client.sckt->GetSocket(), SUCCESS, NORMAL));
	}
	else
	{
		return (Logger::print("Connections limit reached, client pending connection.", 0, ERROR, NORMAL));
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl 0x20458(%rip), %eax     # 0x4e62c
cmpq %rax, 0x10(%rsi)
jbe 0x2e22c
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xef5e(%rip), %rsi      # 0x3d148
leaq 0xef8c(%rip), %rdx      # 0x3d17d
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x80f4
movq %rbx, %rdi
xorl %esi, %esi
movl $0x3, %edx
movl $0x1, %ecx
callq 0x12c02
movl %eax, %ebx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e3f9
movq 0x58(%rsp), %rsi
jmp 0x2e3f1
movq %rsi, %r14
movq %rdi, %r15
movl $0x60, %edi
callq 0x74a0
movq %rax, %rbx
movq %rax, %rdi
callq 0x124dc
leaq 0x1f89a(%rip), %rax     # 0x4dae8
addq $0x10, %rax
movq %rax, (%rbx)
movq %rbx, %rax
addq $0x50, %rax
movq %rax, 0x40(%rbx)
movq $0x0, 0x48(%rbx)
movb $0x0, 0x50(%rbx)
movl $0x1a0, %edi            # imm = 0x1A0
callq 0x74a0
movq %rax, %r12
movq %r15, %rdi
callq 0x12388
movq %r12, %rdi
movl %eax, %esi
callq 0x333ee
movq %r15, %rdi
callq 0x12388
movq %rbx, %rdi
movl %eax, %esi
callq 0x122d2
movq %r15, %rdi
movq %rbx, %rsi
callq 0x121dc
movl $0x20, %edi
callq 0x74a0
movq %rbx, 0x10(%rax)
movq %r12, 0x18(%rax)
movq %rax, %rdi
movq %r14, %rsi
callq 0x7090
incq 0x10(%r14)
leaq 0x68(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x123b0
leaq 0xee51(%rip), %rcx      # 0x3d131
movl $0x16, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x7500
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2e319
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x2e320
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xcb19(%rip), %rsi      # 0x3ae5c
callq 0x78d0
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2e370
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x2e378
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
callq 0x12bfe
leaq 0x8(%rsp), %rdi
movl %eax, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x12c02
movl %eax, %ebx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e3c7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e3de
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e3f9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x74b0
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
jmp 0x2e44f
movq %rax, %r14
jmp 0x2e466
movq %rax, %r14
movl $0x60, %esi
movq %rbx, %rdi
jmp 0x2e489
movq %rax, %r14
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e48e
movq 0x58(%rsp), %rsi
jmp 0x2e479
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e44f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e466
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e48e
movq 0x78(%rsp), %rsi
incq %rsi
jmp 0x2e489
movq %rax, %r14
movl $0x1a0, %esi            # imm = 0x1A0
movq %r12, %rdi
callq 0x74b0
movq %r14, %rdi
callq 0x7810