// File: /workspace/github_c_makefile_star2_O3/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 0xf095(%rip), %rax      # 0x12290
cmpl $0x0, 0x1b8(%rax)
je 0x3210
callq 0x2a24
movq 0xf080(%rip), %rax      # 0x12290
movq 0x1c8(%rax), %rdi
testq %rdi, %rdi
je 0x3228
callq 0x29ec
movq 0xf068(%rip), %rax      # 0x12290
movq 0x1d0(%rax), %rdi
testq %rdi, %rdi
je 0x3239
callq 0x4b94
callq 0x2a86
movq 0xf04b(%rip), %rax      # 0x12290
movl 0x48(%rax), %edi
incl %edi
callq 0x39ec
movq 0xf03a(%rip), %rcx      # 0x12290
movq %rax, (%rcx)
movq 0xf030(%rip), %rcx      # 0x12290
movl 0x20(%rcx), %edx
testl %edx, %edx
je 0x32a6
movq 0x18(%rcx), %rsi
addq $0x60, %rcx
movq %rcx, %rdi
callq 0x4448
movq 0xf012(%rip), %rcx      # 0x12290
movl %eax, 0x8(%rcx)
cmpl $-0x1, %eax
jne 0x32a6
movq 0x18(%rcx), %rsi
addq $0x60, %rcx
leaq 0x8f43(%rip), %rdi      # 0xc1d8
movq %rcx, %rdx
xorl %eax, %eax
callq 0x4dc6
movq 0xefea(%rip), %rcx      # 0x12290
movq 0x28(%rcx), %rdi
testq %rdi, %rdi
je 0x32f6
callq 0x2060
movq 0xefd5(%rip), %rax      # 0x12290
leaq 0x60(%rax), %rdi
movq 0x28(%rax), %rsi
movl 0x30(%rax), %edx
callq 0x460b
movq 0xefbe(%rip), %rcx      # 0x12290
movl %eax, 0xc(%rcx)
cmpl $-0x1, %eax
jne 0x32f6
addq $0x60, %rcx
leaq 0x8f0e(%rip), %rdi      # 0xc1f3
movq %rcx, %rsi
xorl %eax, %eax
callq 0x4dc6
movq 0xef9a(%rip), %rcx      # 0x12290
movl 0x8(%rcx), %esi
testl %esi, %esi
js 0x332d
testl %esi, %esi
jle 0x3333
movq (%rcx), %rdi
leaq 0x5579(%rip), %rcx      # 0x8884
movl $0x1, %edx
xorl %r8d, %r8d
callq 0x3c0f
cmpl $-0x1, %eax
jne 0x3333
leaq 0x8efa(%rip), %rdi      # 0xc21e
xorl %eax, %eax
callq 0x4dc6
jmp 0x3333
cmpl $0x0, 0xc(%rcx)
js 0x3398
movq 0xef56(%rip), %rax      # 0x12290
movl 0xc(%rax), %esi
testl %esi, %esi
jle 0x336b
movq (%rax), %rdi
leaq 0x55c4(%rip), %rcx      # 0x890f
movl $0x1, %edx
xorl %r8d, %r8d
callq 0x3c0f
cmpl $-0x1, %eax
jne 0x336b
leaq 0x8eba(%rip), %rdi      # 0xc21e
xorl %eax, %eax
callq 0x4dc6
movq 0xef1e(%rip), %rax      # 0x12290
movq (%rax), %rdi
leaq -0x2da(%rip), %rdx      # 0x30a2
movl $0x1, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3dae
movq 0xeefe(%rip), %rcx      # 0x12290
movq %rax, 0x10(%rcx)
popq %rax
retq
leaq 0x8e68(%rip), %rdi      # 0xc207
xorl %eax, %eax
callq 0x4dc6
movq 0xeee3(%rip), %rcx      # 0x12290
movl 0x8(%rcx), %esi
jmp 0x32fd