// File: /workspace/github_c_makefile_star2_O1/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: init_server
void init_server(void)
{
	if (server->daemonize) {
		daemonize();
	}

	if (server->pidfile) {
		create_pid_file(server->pidfile);
	}

	if (server->logfile) {
		enable_log(server->logfile);
	}

	unblock_open_files_limit();

	server->loop = create_event_loop(server->max_clients + 1);

	if (server->port != 0)
	{
		server->fd = net_tcp_server(server->error, server->addr, server->port);
		if (server->fd == EG_NET_ERR) {
			fatal("Error create server: %s\n%s", server->addr, server->error);
		}
	}

	if (server->unix_socket != NULL)
	{
		unlink(server->unix_socket);

		server->sfd = net_unix_server(server->error, server->unix_socket, server->unix_perm);
		if (server->sfd == EG_NET_ERR) {
			fatal("Opening socket: %s\n", server->error);
		}
	}

	if (server->fd < 0 && server->sfd < 0) {
		fatal("Error configure server");
	}

	if (server->fd > 0 && create_file_event(server->loop, server->fd, EG_EVENT_READABLE, accept_tcp_handler, NULL) == EG_EVENT_ERR) {
		fatal("Error create file event");
	}

	if (server->sfd > 0 && create_file_event(server->loop, server->sfd, EG_EVENT_READABLE, accept_unix_handler, NULL) == EG_EVENT_ERR) {
		fatal("Error create file event");
	}

	server->ufd = create_time_event(server->loop, 1, server_updater, NULL, NULL);
}

// Assembly:
pushq %rax
movq 0xf4ad(%rip), %rax      # 0x12290
cmpl $0x0, 0x1b8(%rax)
je 0x2df1
callq 0x2604
movq 0xf498(%rip), %rax      # 0x12290
movq 0x1c8(%rax), %rdi
testq %rdi, %rdi
je 0x2e09
callq 0x25cc
movq 0xf480(%rip), %rax      # 0x12290
movq 0x1d0(%rax), %rdi
testq %rdi, %rdi
je 0x2e21
callq 0x4700
callq 0x2666
movq 0xf463(%rip), %rax      # 0x12290
movl 0x48(%rax), %edi
incl %edi
callq 0x35cc
movq 0xf452(%rip), %rcx      # 0x12290
movq %rax, (%rcx)
movq 0xf448(%rip), %rdi      # 0x12290
movl 0x20(%rdi), %edx
testl %edx, %edx
je 0x2e81
movq 0x18(%rdi), %rsi
addq $0x60, %rdi
callq 0x3fa8
movq 0xf42d(%rip), %rdx      # 0x12290
movl %eax, 0x8(%rdx)
cmpl $-0x1, %eax
jne 0x2e81
movq 0x18(%rdx), %rsi
addq $0x60, %rdx
leaq 0x935e(%rip), %rdi      # 0xc1d8
xorl %eax, %eax
callq 0x4932
movq 0xf408(%rip), %rax      # 0x12290
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x2ece
callq 0x2060
movq 0xf3f3(%rip), %rax      # 0x12290
leaq 0x60(%rax), %rdi
movq 0x28(%rax), %rsi
movl 0x30(%rax), %edx
callq 0x4167
movq 0xf3dc(%rip), %rsi      # 0x12290
movl %eax, 0xc(%rsi)
cmpl $-0x1, %eax
jne 0x2ece
addq $0x60, %rsi
leaq 0x932c(%rip), %rdi      # 0xc1f3
xorl %eax, %eax
callq 0x4932
movq 0xf3bb(%rip), %rax      # 0x12290
cmpl $0x0, 0x8(%rax)
jns 0x2eef
cmpl $0x0, 0xc(%rax)
jns 0x2eef
leaq 0x931f(%rip), %rdi      # 0xc207
xorl %eax, %eax
callq 0x4932
movq 0xf39a(%rip), %rax      # 0x12290
movl 0x8(%rax), %esi
testl %esi, %esi
jle 0x2f27
movq (%rax), %rdi
leaq 0x54e4(%rip), %rcx      # 0x83eb
movl $0x1, %edx
xorl %r8d, %r8d
callq 0x3712
cmpl $-0x1, %eax
jne 0x2f27
leaq 0x92fe(%rip), %rdi      # 0xc21e
xorl %eax, %eax
callq 0x4932
movq 0xf362(%rip), %rax      # 0x12290
movl 0xc(%rax), %esi
testl %esi, %esi
jle 0x2f5f
movq (%rax), %rdi
leaq 0x5537(%rip), %rcx      # 0x8476
movl $0x1, %edx
xorl %r8d, %r8d
callq 0x3712
cmpl $-0x1, %eax
jne 0x2f5f
leaq 0x92c6(%rip), %rdi      # 0xc21e
xorl %eax, %eax
callq 0x4932
movq 0xf32a(%rip), %rax      # 0x12290
movq (%rax), %rdi
leaq -0x2e6(%rip), %rdx      # 0x2c8a
movl $0x1, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x389d
movq 0xf30a(%rip), %rcx      # 0x12290
movq %rax, 0x10(%rcx)
popq %rax
retq