// File: BlinfoldKing[P]lisval/src/main.cpp
// Function: main
int main(int argc, char **argv) {
	if (argc > 1)	{
		string input = "";
		string line;
		ifstream myfile(argv[1]);
		if (myfile.is_open())
		{
			while (getline(myfile, line))
			{
				input += line + '\n';
			}
			myfile.close();
		}

		else
			cout << "Unable to open file\n";

		Parser p(input);
		Token* t = p.parse();
		if (t) {
			Evaluator e;
			e.eval(t);
		} else {
			cout << "invalid pattern: " << input << '\n';
		}

		return 0;
	}

	Repl r;
	r.run();
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3a0, %rsp            # imm = 0x3A0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
jle 0x39ef
leaq -0x31(%rbp), %rdi
movq %rdi, -0x360(%rbp)
callq 0x34a0
movq -0x360(%rbp), %rdx
leaq 0x1ff06(%rip), %rsi     # 0x23657
leaq -0x30(%rbp), %rdi
callq 0x33b0
jmp 0x375c
leaq -0x31(%rbp), %rdi
callq 0x3300
leaq -0x68(%rbp), %rdi
callq 0x33c0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x270(%rbp), %rdi
movl $0x8, %edx
callq 0x34c0
jmp 0x3789
leaq -0x270(%rbp), %rdi
callq 0x3420
movb %al, -0x361(%rbp)
jmp 0x379d
movb -0x361(%rbp), %al
testb $0x1, %al
jne 0x37ac
jmp 0x3894
jmp 0x37ae
leaq -0x270(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3080
movq %rax, -0x370(%rbp)
jmp 0x37c7
movq -0x370(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3370
movb %al, -0x371(%rbp)
jmp 0x37e5
movb -0x371(%rbp), %al
testb $0x1, %al
jne 0x37f4
jmp 0x3884
leaq -0x290(%rbp), %rdi
leaq -0x68(%rbp), %rsi
movl $0xa, %edx
callq 0x3a60
jmp 0x380b
leaq -0x30(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x3380
jmp 0x381d
leaq -0x290(%rbp), %rdi
callq 0x31c0
jmp 0x37ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x3300
jmp 0x3a4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x39db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x39cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x31c0
jmp 0x39cf
leaq -0x270(%rbp), %rdi
callq 0x3090
jmp 0x3892
jmp 0x38ab
movq 0x3072d(%rip), %rdi     # 0x33fc8
leaq 0x1f762(%rip), %rsi     # 0x23004
callq 0x32a0
jmp 0x38a9
jmp 0x38ab
leaq -0x2c8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3ae0
jmp 0x38bd
leaq -0x2c8(%rbp), %rdi
callq 0x171c0
movq %rax, -0x380(%rbp)
jmp 0x38d2
movq -0x380(%rbp), %rax
movq %rax, -0x2d0(%rbp)
cmpq $0x0, -0x2d0(%rbp)
je 0x3946
leaq -0x308(%rbp), %rdi
callq 0x8ab0
jmp 0x38f8
movq -0x2d0(%rbp), %rsi
leaq -0x308(%rbp), %rdi
callq 0x5980
jmp 0x390d
leaq -0x308(%rbp), %rdi
callq 0x3b40
jmp 0x3990
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x39c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x3b40
jmp 0x39c3
movq 0x3067b(%rip), %rdi     # 0x33fc8
leaq 0x1f6c5(%rip), %rsi     # 0x23019
callq 0x32a0
movq %rax, -0x388(%rbp)
jmp 0x3962
movq -0x388(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3280
movq %rax, -0x390(%rbp)
jmp 0x397b
movq -0x390(%rbp), %rdi
movl $0xa, %esi
callq 0x3320
jmp 0x398e
jmp 0x3990
movl $0x0, -0x4(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x3b70
leaq -0x270(%rbp), %rdi
callq 0x30b0
leaq -0x68(%rbp), %rdi
callq 0x31c0
leaq -0x30(%rbp), %rdi
callq 0x31c0
jmp 0x3a3f
leaq -0x2c8(%rbp), %rdi
callq 0x3b70
leaq -0x270(%rbp), %rdi
callq 0x30b0
leaq -0x68(%rbp), %rdi
callq 0x31c0
leaq -0x30(%rbp), %rdi
callq 0x31c0
jmp 0x3a4b
leaq -0x358(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x3ba0
movq -0x398(%rbp), %rdi
callq 0x21d10
jmp 0x3a10
movl $0x0, -0x4(%rbp)
leaq -0x358(%rbp), %rdi
callq 0x3bd0
jmp 0x3a3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x358(%rbp), %rdi
callq 0x3bd0
jmp 0x3a4b
movl -0x4(%rbp), %eax
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x3490
nopw %cs:(%rax,%rax)
nop