// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
movq 0x14305(%rip), %rax     # 0x172b0
cmpl $0x0, 0x1b8(%rax)
je 0x2fb9
callq 0x2670
movq 0x142f0(%rip), %rax     # 0x172b0
cmpq $0x0, 0x1c8(%rax)
je 0x2fdd
movq 0x142df(%rip), %rax     # 0x172b0
movq 0x1c8(%rax), %rdi
callq 0x2610
movq 0x142cc(%rip), %rax     # 0x172b0
cmpq $0x0, 0x1d0(%rax)
je 0x3001
movq 0x142bb(%rip), %rax     # 0x172b0
movq 0x1d0(%rax), %rdi
callq 0x57f0
callq 0x26f0
movq 0x142a3(%rip), %rax     # 0x172b0
movq 0x48(%rax), %rax
addq $0x1, %rax
movl %eax, %edi
callq 0x3a20
movq %rax, %rcx
movq 0x1428a(%rip), %rax     # 0x172b0
movq %rcx, (%rax)
movq 0x14280(%rip), %rax     # 0x172b0
cmpl $0x0, 0x20(%rax)
je 0x309a
movq 0x14273(%rip), %rdi     # 0x172b0
addq $0x60, %rdi
movq 0x14268(%rip), %rax     # 0x172b0
movq 0x18(%rax), %rsi
movq 0x1425d(%rip), %rax     # 0x172b0
movl 0x20(%rax), %edx
callq 0x4bc0
movl %eax, %ecx
movq 0x1424c(%rip), %rax     # 0x172b0
movl %ecx, 0x8(%rax)
movq 0x14242(%rip), %rax     # 0x172b0
cmpl $-0x1, 0x8(%rax)
jne 0x3098
movq 0x14235(%rip), %rax     # 0x172b0
movq 0x18(%rax), %rsi
movq 0x1422a(%rip), %rdx     # 0x172b0
addq $0x60, %rdx
leaq 0xf12b(%rip), %rdi      # 0x121bc
movb $0x0, %al
callq 0x5ab0
jmp 0x309a
movq 0x1420f(%rip), %rax     # 0x172b0
cmpq $0x0, 0x28(%rax)
je 0x3111
movq 0x14201(%rip), %rax     # 0x172b0
movq 0x28(%rax), %rdi
callq 0x2060
movq 0x141f1(%rip), %rdi     # 0x172b0
addq $0x60, %rdi
movq 0x141e6(%rip), %rax     # 0x172b0
movq 0x28(%rax), %rsi
movq 0x141db(%rip), %rax     # 0x172b0
movl 0x30(%rax), %edx
callq 0x4e50
movl %eax, %ecx
movq 0x141ca(%rip), %rax     # 0x172b0
movl %ecx, 0xc(%rax)
movq 0x141c0(%rip), %rax     # 0x172b0
cmpl $-0x1, 0xc(%rax)
jne 0x310f
movq 0x141b3(%rip), %rsi     # 0x172b0
addq $0x60, %rsi
leaq 0xf0cf(%rip), %rdi      # 0x121d7
movb $0x0, %al
callq 0x5ab0
jmp 0x3111
movq 0x14198(%rip), %rax     # 0x172b0
cmpl $0x0, 0x8(%rax)
jge 0x3139
movq 0x1418b(%rip), %rax     # 0x172b0
cmpl $0x0, 0xc(%rax)
jge 0x3139
leaq 0xf0b9(%rip), %rdi      # 0x121eb
movb $0x0, %al
callq 0x5ab0
movq 0x14170(%rip), %rax     # 0x172b0
cmpl $0x0, 0x8(%rax)
jle 0x3183
movq 0x14163(%rip), %rax     # 0x172b0
movq (%rax), %rdi
movq 0x14159(%rip), %rax     # 0x172b0
movl 0x8(%rax), %esi
movl $0x1, %edx
leaq 0x87aa(%rip), %rcx      # 0xb910
xorl %eax, %eax
movl %eax, %r8d
callq 0x3c60
cmpl $-0x1, %eax
jne 0x3183
leaq 0xf086(%rip), %rdi      # 0x12202
movb $0x0, %al
callq 0x5ab0
movq 0x14126(%rip), %rax     # 0x172b0
cmpl $0x0, 0xc(%rax)
jle 0x31cd
movq 0x14119(%rip), %rax     # 0x172b0
movq (%rax), %rdi
movq 0x1410f(%rip), %rax     # 0x172b0
movl 0xc(%rax), %esi
movl $0x1, %edx
leaq 0x8840(%rip), %rcx      # 0xb9f0
xorl %eax, %eax
movl %eax, %r8d
callq 0x3c60
cmpl $-0x1, %eax
jne 0x31cd
leaq 0xf03c(%rip), %rdi      # 0x12202
movb $0x0, %al
callq 0x5ab0
movq 0x140dc(%rip), %rax     # 0x172b0
movq (%rax), %rdi
movl $0x1, %esi
leaq -0x3c3(%rip), %rdx      # 0x2e20
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x3ff0
movq %rax, %rcx
movq 0x140b6(%rip), %rax     # 0x172b0
movq %rcx, 0x10(%rax)
popq %rbp
retq