// File: ATOMIC-LICHESS[P]ATOMKRAFT/main.cpp
// Function: main
int main(int argc, char* argv[]) {
	srand(time(0));
	
	
	setvbuf(stderr, NULL, _IONBF, 0);
	setvbuf(stdin, NULL, _IONBF, 0);
	setvbuf(stdout, NULL, _IONBF, 0);
	cout.rdbuf()->pubsetbuf(NULL, 0);
	cin.rdbuf()->pubsetbuf(NULL, 0);
	
	// Startup initializations
	init_bitboards();
	Position::init_zobrist();
	Position::init_piece_square_tables();
	init_kpk_bitbase();
	init_search();
	Threads.init();
	generate_explosionSquares();
	generate_squaresTouch();
	
	
#ifndef NDEBUG
	cout << "Debug version of atomkraft, define NDEBUG to get the release version." << endl;
#endif
	
	// Print copyright notice
	cout << engine_name() << endl;
	cout << "by " << engine_authors() << endl;
	cout << "built " << __DATE__ << " " << __TIME__ << endl << endl;
	
	if (CpuHasPOPCNT)
		cout << "Good! CPU has hardware POPCNT." << endl;
	
	
#ifdef SWEN_VERSION
	Options["Threads"] = UCIOption(2, 1, MAX_THREADS);
	Options["Hash"] = UCIOption(512, 4, 8192);
	Options["Book File"] = UCIOption("eao.bin");
#endif
	
	
	
	
#if defined ANALYZE_VERSION
    
    main_analyze();

#elif defined BOOK_VERSION
	
	main_book_from_file();
	//main_book_from_thinking();
	
#elif defined FICS_VERSION
	
	main_fics();


#elif defined UCI_VERSION

	main_uci(argc);
	
#else
	
	cout << "no version specified" << endl;
	
#endif
	
	
	
	
	return 0;
}

// Assembly:
subq $0xa8, %rsp
movl $0x0, 0xa4(%rsp)
movl %edi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
xorl %eax, %eax
movl %eax, %edi
movq %rdi, 0x28(%rsp)
callq 0x6450
movl %eax, %edi
callq 0x6490
movq 0x28(%rsp), %rcx
movq 0x41b4e(%rip), %rax     # 0x6bfc0
movq (%rax), %rdi
movl $0x2, %edx
movl %edx, 0x24(%rsp)
movq %rcx, %rsi
callq 0x6050
movl 0x24(%rsp), %edx
movq 0x28(%rsp), %rcx
movq 0x41b1a(%rip), %rax     # 0x6bfb0
movq (%rax), %rdi
movq %rcx, %rsi
callq 0x6050
movl 0x24(%rsp), %edx
movq 0x28(%rsp), %rcx
movq 0x41ac7(%rip), %rax     # 0x6bf78
movq (%rax), %rdi
movq %rcx, %rsi
callq 0x6050
movq 0x41af5(%rip), %rdi     # 0x6bfb8
movq %rdi, 0x30(%rsp)
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x6200
movq 0x28(%rsp), %rdx
movq %rax, %rdi
movq %rdx, %rsi
callq 0x6090
movq 0x41aea(%rip), %rdi     # 0x6bfd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x6200
movq 0x28(%rsp), %rdx
movq %rax, %rdi
movq %rdx, %rsi
callq 0x6090
callq 0xda00
callq 0x3d560
callq 0x3d6a0
callq 0xcf20
callq 0x40780
leaq 0x3c6713(%rip), %rdi    # 0x3f0c40
callq 0x4f920
callq 0xca10
callq 0xc940
leaq 0x78(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x2b7d0
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x6420
movq %rax, 0x40(%rsp)
jmp 0x2a561
movq 0x40(%rsp), %rdi
movq 0x41a23(%rip), %rsi     # 0x6bf90
callq 0x6520
jmp 0x2a574
leaq 0x78(%rsp), %rdi
callq 0x6a78
movq 0x41a33(%rip), %rdi     # 0x6bfb8
leaq 0x2fea8(%rip), %rsi     # 0x5a434
callq 0x64b0
movq %rax, 0x8(%rsp)
leaq 0x48(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x2be80
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x6420
movq %rax, 0x18(%rsp)
jmp 0x2a5bb
movq 0x18(%rsp), %rdi
movq 0x419c9(%rip), %rsi     # 0x6bf90
callq 0x6520
jmp 0x2a5ce
leaq 0x48(%rsp), %rdi
callq 0x6a78
movq 0x419d9(%rip), %rdi     # 0x6bfb8
leaq 0x2fe52(%rip), %rsi     # 0x5a438
callq 0x64b0
movq %rax, %rdi
leaq 0x2fe4a(%rip), %rsi     # 0x5a43f
callq 0x64b0
movq %rax, %rdi
leaq 0x2ef5c(%rip), %rsi     # 0x59560
callq 0x64b0
movq %rax, %rdi
leaq 0x2fe38(%rip), %rsi     # 0x5a44b
callq 0x64b0
movq %rax, %rdi
movq 0x4196e(%rip), %rsi     # 0x6bf90
callq 0x6520
movq %rax, %rdi
movq 0x4195f(%rip), %rsi     # 0x6bf90
callq 0x6520
movl 0xa0(%rsp), %edi
callq 0x2a690
xorl %eax, %eax
addq $0xa8, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x70(%rsp)
movl %eax, 0x6c(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x6a78
jmp 0x2a67e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x70(%rsp)
movl %eax, 0x6c(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x6a78
movq 0x70(%rsp), %rdi
callq 0x6970
nopl (%rax,%rax)