// File: /workspace/github_cpp_makefile_star2_O2/zerolfx[P]P-Machine/main.cpp
// Function: main
int main(int argc, char *argv[])
{
	try
	{
		if(argc < 2)
		{
			usage(); 
			exit(0);
		}
				
		for(int i = 0; i < argc; ++i)
		{
			if(argv[i][0] == '-')
			{
				switch(argv[i][1])
				{
					case 's':
					{
						if(argv[i+1] == 0)
						{
							cerr << "switch -s expects a numeric value" << endl;
							usage();
							exit(0);
						}
						
						Pmachine.setStepSize(atoi(argv[i+1]));
						break;
					}
					case 't': 
					{
						if(argv[i+1] == 0)
						{
							cerr << "switch -t expects a numeric value" << endl;
							usage();
							exit(0);
						}
						
						Pmachine.setStackSize(atoi(argv[i+1]));
						break;
					}
					case 'h':
					{
						Pmachine.setShowHeap();
						break;
					}
					default:
					{
						cerr << "unrecognized switch" << endl;
						usage();
						exit(0);
					}
				}
			}
		}

		
		
		FILE *file = fopen(argv[1], "r");
		if(file != NULL)
		{
			yyin = file;
		}
		else
		{
			cerr << "File " << argv[1] << " niet beschikbaar" << endl;
			usage();
			exit(0);
		}
		
		yyparse();
		
		fclose(file);
		
		Pmachine.run();
	}
	catch(ExecutionError e)
	{
		cerr << e.getMsg() << endl;
	}
	catch(CompileTimeError e)
	{
		cerr << e.getMsg() << endl;
	}
	catch(...)
	{
		cerr << "unknown error" << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
cmpl $0x2, %edi
jl 0x19e37
movq %rsi, %rbx
movl %edi, %r15d
xorl %r12d, %r12d
leaq 0x15605(%rip), %r14     # 0x2f318
cmpq %r12, %r15
je 0x19d83
movq (%rbx,%r12,8), %rax
cmpb $0x2d, (%rax)
jne 0x19d7e
movzbl 0x1(%rax), %eax
cmpl $0x68, %eax
je 0x19d76
cmpl $0x74, %eax
je 0x19d57
cmpl $0x73, %eax
jne 0x19dd1
movq 0x8(%rbx,%r12,8), %rdi
testq %rdi, %rdi
je 0x19df3
callq 0x6360
movq %r14, %rdi
movl %eax, %esi
callq 0x19946
jmp 0x19d7e
movq 0x8(%rbx,%r12,8), %rdi
testq %rdi, %rdi
je 0x19e15
callq 0x6360
movq %r14, %rdi
movl %eax, %esi
callq 0x19932
jmp 0x19d7e
movq %r14, %rdi
callq 0x19922
incq %r12
jmp 0x19d13
movq 0x8(%rbx), %rdi
leaq 0x7ccb(%rip), %rsi      # 0x21a59
callq 0x6250
testq %rax, %rax
je 0x19e43
movq %rax, %r14
leaq 0x15502(%rip), %rax     # 0x2f2a8
movq %r14, (%rax)
callq 0x1b34c
movq %r14, %rdi
callq 0x61c0
leaq 0x1555b(%rip), %rdi     # 0x2f318
callq 0x19466
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x15218(%rip), %rdi     # 0x2eff0
leaq 0x7c50(%rip), %rsi      # 0x21a2f
callq 0x61b0
movq %rax, %rdi
callq 0x60e0
callq 0x19c6c
jmp 0x19e3c
movq 0x151f6(%rip), %rdi     # 0x2eff0
leaq 0x7bea(%rip), %rsi      # 0x219eb
callq 0x61b0
movq %rax, %rdi
callq 0x60e0
callq 0x19c6c
jmp 0x19e3c
movq 0x151d4(%rip), %rdi     # 0x2eff0
leaq 0x7bea(%rip), %rsi      # 0x21a0d
callq 0x61b0
movq %rax, %rdi
callq 0x60e0
callq 0x19c6c
jmp 0x19e3c
callq 0x19c6c
xorl %edi, %edi
callq 0x6270
movq 0x151a6(%rip), %rdi     # 0x2eff0
leaq 0x7bf2(%rip), %rsi      # 0x21a43
callq 0x61b0
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x61b0
leaq 0x7be0(%rip), %rsi      # 0x21a49
movq %rax, %rdi
callq 0x61b0
movq %rax, %rdi
callq 0x60e0
callq 0x19c6c
jmp 0x19e3c
jmp 0x19e86
jmp 0x19e86
jmp 0x19e86
movq %rax, %rbx
cmpl $0x3, %edx
jne 0x19ee3
movq %rbx, %rdi
callq 0x62a0
leaq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x62f0
movq %rbx, %rdi
callq 0x60b0
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x17d24
movq 0x15132(%rip), %rdi     # 0x2eff0
leaq -0x40(%rbp), %rsi
callq 0x61a0
movq %rax, %rdi
callq 0x60e0
leaq -0x40(%rbp), %rdi
callq 0x60d0
leaq -0x60(%rbp), %rdi
callq 0x17d1a
jmp 0x19f60
cmpl $0x2, %edx
jne 0x19f3d
movq %rbx, %rdi
callq 0x62a0
leaq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x62f0
movq %rbx, %rdi
callq 0x60b0
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x17d50
movq 0x150d8(%rip), %rdi     # 0x2eff0
leaq -0x40(%rbp), %rsi
callq 0x61a0
movq %rax, %rdi
callq 0x60e0
leaq -0x40(%rbp), %rdi
callq 0x60d0
leaq -0x60(%rbp), %rdi
callq 0x17d46
jmp 0x19f60
movq %rbx, %rdi
callq 0x60b0
movq 0x150a4(%rip), %rdi     # 0x2eff0
leaq 0x7b08(%rip), %rsi      # 0x21a5b
callq 0x61b0
movq %rax, %rdi
callq 0x60e0
callq 0x63a0
jmp 0x19dc2
movq %rax, %rbx
jmp 0x19f85
movq %rax, %rbx
callq 0x63a0
jmp 0x19fb4
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x60d0
leaq -0x60(%rbp), %rdi
callq 0x17d46
callq 0x63a0
jmp 0x19fb4
movq %rax, %rbx
jmp 0x19fa6
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x60d0
leaq -0x60(%rbp), %rdi
callq 0x17d1a
callq 0x63a0
movq %rbx, %rdi
callq 0x63f0
movq %rax, %rdi
callq 0x180e5