// File: /workspace/github_cpp_makefile_star2_O3/tewalds[P]morat/hex/main.cpp
// Function: main
int main(int argc, char **argv){

	srand(Time().in_usec());
	GTP gtp;

	gtp.colorboard = isatty(fileno(stdout));

	for(int i = 1; i < argc; i++) {
		string arg = argv[i];
		if(arg == "-h" || arg == "--help"){
			die(255, "Usage:\n"
				"\t-h --help     Show this help\n"
				"\t-v --verbose  Give more output over gtp\n"
				"\t-n --nocolor  Don't output the board in color\n"
				"\t-c --cmd      Pass a gtp command from the command line\n"
				"\t-f --file     Run this gtp file before reading from stdin\n"
				);
		}else if(arg == "-v" || arg == "--verbose"){
			gtp.verbose = true;
		}else if(arg == "-n" || arg == "--nocolor"){
			gtp.colorboard = false;
		}else if(arg == "-c" || arg == "--cmd"){
			char * ptr = argv[++i];
			if(ptr == NULL) die(255, "Missing a command");
			gtp.cmd(ptr);
		}else if(arg == "-f" || arg == "--file"){
			char * ptr = argv[++i];
			if(ptr == NULL) die(255, "Missing a file to run");
			FILE * fd = fopen(ptr, "r");
			gtp.setinfile(fd);
			gtp.setoutfile(NULL);
			if(!gtp.run())
				return 0;
			fclose(fd);
		}else{
			die(255, "Unknown argument: " + arg + ", try --help");
		}
	}

	gtp.setinfile(stdin);
	gtp.setoutfile(stdout);
	gtp.run();
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
leaq 0xc8(%rsp), %r14
movq %rsi, %rbx
movl %edi, %ebp
xorl %esi, %esi
movq %r14, %rdi
callq 0x55b0
vcvtsi2sdq (%r14), %xmm0, %xmm0
vmovsd 0x2b0c5(%rip), %xmm2    # 0x31008
vcvtsi2sdq 0x8(%r14), %xmm1, %xmm1
vdivsd %xmm2, %xmm1, %xmm1
vaddsd %xmm0, %xmm1, %xmm0
vmulsd %xmm2, %xmm0, %xmm0
vcvttsd2usi %xmm0, %rdi
callq 0x5300
movq 0x43051(%rip), %rax     # 0x48fb8
movq 0x43022(%rip), %r15     # 0x48f90
leaq 0xc8(%rsp), %r14
movq %r14, %rdi
movq (%rax), %rsi
movq (%r15), %rdx
callq 0x6398
movq (%r15), %rdi
callq 0x5350
movl %eax, %edi
callq 0x5640
testl %eax, %eax
setne 0xcd(%r14)
cmpl $0x2, %ebp
jl 0x61cb
movl $0x1, %r12d
leaq 0x20(%rsp), %r14
movq %rsp, %r15
movslq %r12d, %r13
movq (%rbx,%r13,8), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x5120
leaq 0x2b0ab(%rip), %rsi     # 0x31078
movq %r14, %rdi
callq 0x50b0
testl %eax, %eax
je 0x624a
leaq 0x2b1f6(%rip), %rsi     # 0x311da
movq %r14, %rdi
callq 0x50b0
testl %eax, %eax
je 0x624a
leaq 0x2b171(%rip), %rsi     # 0x3116c
movq %r14, %rdi
callq 0x50b0
testl %eax, %eax
je 0x60fe
leaq 0x2b15d(%rip), %rsi     # 0x3116f
movq %r14, %rdi
callq 0x50b0
testl %eax, %eax
je 0x60fe
leaq 0x2b150(%rip), %rsi     # 0x31179
movq %r14, %rdi
callq 0x50b0
testl %eax, %eax
je 0x610e
leaq 0x2b13c(%rip), %rsi     # 0x3117c
movq %r14, %rdi
callq 0x50b0
testl %eax, %eax
je 0x610e
leaq 0x2b12f(%rip), %rsi     # 0x31186
movq %r14, %rdi
callq 0x50b0
testl %eax, %eax
je 0x611b
leaq 0x2b11b(%rip), %rsi     # 0x31189
movq %r14, %rdi
callq 0x50b0
testl %eax, %eax
je 0x611b
leaq 0x2b11c(%rip), %rsi     # 0x311a1
movq %r14, %rdi
callq 0x50b0
testl %eax, %eax
je 0x60a8
leaq 0x2b10c(%rip), %rsi     # 0x311a4
movq %r14, %rdi
callq 0x50b0
testl %eax, %eax
jne 0x62be
movq 0x8(%rbx,%r13,8), %rdi
testq %rdi, %rdi
je 0x629d
leaq 0x2f515(%rip), %rsi     # 0x355d2
callq 0x53e0
movq %rax, %r13
movq %rax, 0xc8(%rsp)
movq $0x0, 0xd0(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x9702
incl %r12d
testb %al, %al
je 0x61c6
movq %r13, %rdi
callq 0x5310
jmp 0x619c
movl $0x1, 0x190(%rsp)
jmp 0x619c
movb $0x0, 0x195(%rsp)
jmp 0x619c
movq 0x8(%rbx,%r13,8), %rsi
testq %rsi, %rsi
je 0x627c
leaq 0x40(%rsp), %r13
movq %r15, %rdx
movq %r13, %rdi
callq 0x5120
leaq 0x80(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
movq %r13, %rdx
callq 0x93a2
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x616b
callq 0x52e0
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x6185
callq 0x52e0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x6199
callq 0x52e0
incl %r12d
movb $0x1, %r13b
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x61b3
callq 0x52e0
testb %r13b, %r13b
je 0x61f3
incl %r12d
cmpl %ebp, %r12d
jl 0x5fb4
jmp 0x61cb
xorl %r13d, %r13d
jmp 0x619f
movq 0x42de6(%rip), %rax     # 0x48fb8
movq 0x42db7(%rip), %rcx     # 0x48f90
leaq 0xc8(%rsp), %rdi
movq (%rax), %rax
movq %rax, (%rdi)
movq (%rcx), %rax
movq %rax, 0x8(%rdi)
callq 0x9702
movq 0x188(%rsp), %rdi
testq %rdi, %rdi
je 0x6205
callq 0xb272
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x6217
callq 0x52e0
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x6229
callq 0x52e0
leaq 0xd8(%rsp), %rdi
callq 0xa886
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x2ae21(%rip), %rsi     # 0x3107b
leaq 0x2af0a(%rip), %rdx     # 0x3116b
movq %rsp, %rdi
callq 0xb1dc
movq (%rsp), %rdi
callq 0x5530
movl $0xff, %edi
callq 0x5420
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x2af03(%rip), %rsi     # 0x3118f
leaq 0x2af0d(%rip), %rdx     # 0x311a0
movq %rsp, %rdi
callq 0xb1dc
jmp 0x6269
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x2aefe(%rip), %rsi     # 0x311ab
leaq 0x2af0c(%rip), %rdx     # 0x311c0
movq %rsp, %rdi
callq 0xb1dc
jmp 0x6269
leaq 0x2aefc(%rip), %rsi     # 0x311c1
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x98b3
leaq 0x2aef9(%rip), %rsi     # 0x311d4
leaq 0x60(%rsp), %rdi
callq 0x56e0
leaq 0x10(%rsp), %rdi
movq %rax, %rcx
addq $0x10, %rcx
movq %rdi, -0x10(%rdi)
movq (%rax), %rdx
cmpq %rcx, %rdx
jne 0x6307
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%rdi)
jmp 0x6316
movq %rdx, (%rsp)
movq %rdx, %rdi
movq (%rcx), %rsi
movq %rsi, 0x10(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
jmp 0x626d
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x6358
jmp 0x636b
jmp 0x636b
jmp 0x636b
jmp 0x636b
jmp 0x6366
movq 0x40(%rsp), %rdi
movq %rax, %rbx
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x636e
callq 0x52e0
jmp 0x636e
jmp 0x636b
movq %rax, %rbx
jmp 0x6382
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x6382
callq 0x52e0
leaq 0xc8(%rsp), %rdi
callq 0x9934
movq %rbx, %rdi
callq 0x5670
nop