// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rsi, %rbx
movl %edi, %ebp
leaq 0xc8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x55b0
vcvtsi2sdq (%r14), %xmm0, %xmm0
vcvtsi2sdq 0x8(%r14), %xmm1, %xmm1
vmovsd 0x2b0bf(%rip), %xmm2    # 0x31008
vdivsd %xmm2, %xmm1, %xmm1
vaddsd %xmm0, %xmm1, %xmm0
vmulsd %xmm2, %xmm0, %xmm0
vcvttsd2usi %xmm0, %rdi
callq 0x5300
movq 0x44051(%rip), %rax     # 0x49fb8
movq (%rax), %rsi
movq 0x4401f(%rip), %r15     # 0x49f90
movq (%r15), %rdx
leaq 0xc8(%rsp), %r14
movq %r14, %rdi
callq 0x6394
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
movq %r14, %rdi
leaq 0x2b0a8(%rip), %rsi     # 0x31078
callq 0x50b0
testl %eax, %eax
je 0x624a
movq %r14, %rdi
leaq 0x2b1f3(%rip), %rsi     # 0x311da
callq 0x50b0
testl %eax, %eax
je 0x624a
movq %r14, %rdi
leaq 0x2b16e(%rip), %rsi     # 0x3116c
callq 0x50b0
testl %eax, %eax
je 0x60fe
movq %r14, %rdi
leaq 0x2b15a(%rip), %rsi     # 0x3116f
callq 0x50b0
testl %eax, %eax
je 0x60fe
movq %r14, %rdi
leaq 0x2b14d(%rip), %rsi     # 0x31179
callq 0x50b0
testl %eax, %eax
je 0x610e
movq %r14, %rdi
leaq 0x2b139(%rip), %rsi     # 0x3117c
callq 0x50b0
testl %eax, %eax
je 0x610e
movq %r14, %rdi
leaq 0x2b12c(%rip), %rsi     # 0x31186
callq 0x50b0
testl %eax, %eax
je 0x611b
movq %r14, %rdi
leaq 0x2b118(%rip), %rsi     # 0x31189
callq 0x50b0
testl %eax, %eax
je 0x611b
movq %r14, %rdi
leaq 0x2b119(%rip), %rsi     # 0x311a1
callq 0x50b0
testl %eax, %eax
je 0x60a8
movq %r14, %rdi
leaq 0x2b109(%rip), %rsi     # 0x311a4
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 0x965c
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 %r13, %rdi
movq %r15, %rdx
callq 0x5120
leaq 0x80(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
movq %r13, %rdx
callq 0x92fc
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 0x43de6(%rip), %rax     # 0x49fb8
movq (%rax), %rax
leaq 0xc8(%rsp), %rdi
movq %rax, (%rdi)
movq 0x43da9(%rip), %rax     # 0x49f90
movq (%rax), %rax
movq %rax, 0x8(%rdi)
callq 0x965c
movq 0x188(%rsp), %rdi
testq %rdi, %rdi
je 0x6205
callq 0xb170
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 0xa7bc
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 0xb0e0
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 0xb0e0
jmp 0x6269
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x2aefe(%rip), %rsi     # 0x311ab
leaq 0x2af0c(%rip), %rdx     # 0x311c0
movq %rsp, %rdi
callq 0xb0e0
jmp 0x6269
leaq 0x2aefc(%rip), %rsi     # 0x311c1
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x9805
leaq 0x2aef9(%rip), %rsi     # 0x311d4
leaq 0x60(%rsp), %rdi
callq 0x56e0
leaq 0x10(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
jne 0x6307
vmovupd (%rcx), %xmm0
vmovupd %xmm0, (%rdx)
jmp 0x6313
movq %rsi, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
jmp 0x6269
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x6355
jmp 0x6368
jmp 0x6368
jmp 0x6368
jmp 0x6368
jmp 0x6363
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x636b
callq 0x52e0
jmp 0x636b
jmp 0x6368
movq %rax, %rbx
jmp 0x637f
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x637f
callq 0x52e0
leaq 0xc8(%rsp), %rdi
callq 0x9886
movq %rbx, %rdi
callq 0x5670