// File: /workspace/github_cpp_makefile_star2_O1/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 0x1dd4f
movq %rsi, %rbx
movl %edi, %r15d
xorl %r12d, %r12d
leaq 0x1670e(%rip), %r14     # 0x34320
movq (%rbx,%r12,8), %rax
cmpb $0x2d, (%rax)
jne 0x1dc78
movzbl 0x1(%rax), %eax
cmpl $0x68, %eax
je 0x1dc70
cmpl $0x74, %eax
je 0x1dc51
cmpl $0x73, %eax
jne 0x1dcce
movq 0x8(%rbx,%r12,8), %rdi
testq %rdi, %rdi
je 0x1dcf9
callq 0x6370
movq %r14, %rdi
movl %eax, %esi
callq 0x1d7e8
jmp 0x1dc78
movq 0x8(%rbx,%r12,8), %rdi
testq %rdi, %rdi
je 0x1dd24
callq 0x6370
movq %r14, %rdi
movl %eax, %esi
callq 0x1d7d4
jmp 0x1dc78
movq %r14, %rdi
callq 0x1d7c4
incq %r12
cmpq %r12, %r15
jne 0x1dc12
movq 0x8(%rbx), %rdi
leaq 0x8dce(%rip), %rsi      # 0x26a59
callq 0x6280
testq %rax, %rax
je 0x1dd5b
movq %rax, %r14
leaq 0x1660d(%rip), %rax     # 0x342b0
movq %r14, (%rax)
callq 0x1f5f8
movq %r14, %rdi
callq 0x61f0
leaq 0x16666(%rip), %rdi     # 0x34320
callq 0x1d09a
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x1631b(%rip), %rdi     # 0x33ff0
leaq 0x8d53(%rip), %rsi      # 0x26a2f
movl $0x13, %edx
callq 0x6270
movq 0x16303(%rip), %rdi     # 0x33ff0
callq 0x60f0
callq 0x1da98
jmp 0x1dd54
movq 0x162f0(%rip), %rdi     # 0x33ff0
leaq 0x8ce4(%rip), %rsi      # 0x269eb
movl $0x21, %edx
callq 0x6270
movq 0x162d8(%rip), %rdi     # 0x33ff0
callq 0x60f0
callq 0x1da98
jmp 0x1dd54
movq 0x162c5(%rip), %rdi     # 0x33ff0
leaq 0x8cdb(%rip), %rsi      # 0x26a0d
movl $0x21, %edx
callq 0x6270
movq 0x162ad(%rip), %rdi     # 0x33ff0
callq 0x60f0
callq 0x1da98
jmp 0x1dd54
callq 0x1da98
xorl %edi, %edi
callq 0x62a0
movq 0x1628e(%rip), %rdi     # 0x33ff0
leaq 0x8cda(%rip), %rsi      # 0x26a43
movl $0x5, %edx
callq 0x6270
movq 0x8(%rbx), %rsi
movq 0x16272(%rip), %rdi     # 0x33ff0
callq 0x61e0
movq %rax, %rbx
leaq 0x8cbc(%rip), %rsi      # 0x26a49
movl $0x11, %edx
movq %rax, %rdi
callq 0x6270
movq %rbx, %rdi
callq 0x60f0
callq 0x1da98
jmp 0x1dd54
jmp 0x1ddaf
jmp 0x1ddaf
jmp 0x1ddaf
movq %rax, %rbx
cmpl $0x3, %edx
jne 0x1de32
movq %rbx, %rdi
callq 0x62d0
leaq -0x50(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x60(%rbp), %rdi
callq 0x8a9a
movq %rbx, %rdi
callq 0x60d0
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x1b458
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq 0x161f2(%rip), %rdi     # 0x33ff0
callq 0x6270
movq %rax, %rdi
callq 0x60f0
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1de24
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
leaq -0x60(%rbp), %rdi
callq 0x1b436
jmp 0x1dedb
cmpl $0x2, %edx
jne 0x1deaf
movq %rbx, %rdi
callq 0x62d0
leaq -0x50(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x60(%rbp), %rdi
callq 0x8a9a
movq %rbx, %rdi
callq 0x60d0
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x1b4c4
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq 0x16172(%rip), %rdi     # 0x33ff0
callq 0x6270
movq %rax, %rdi
callq 0x60f0
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1dea4
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
leaq -0x60(%rbp), %rdi
callq 0x1b4a2
jmp 0x1dedb
movq %rbx, %rdi
callq 0x60d0
movq 0x16132(%rip), %rdi     # 0x33ff0
leaq 0x8b96(%rip), %rsi      # 0x26a5b
movl $0xd, %edx
callq 0x6270
movq 0x1611a(%rip), %rdi     # 0x33ff0
callq 0x60f0
callq 0x63b0
jmp 0x1dcbf
movq %rax, %rbx
jmp 0x1df10
movq %rax, %rbx
callq 0x63b0
jmp 0x1df4f
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1df10
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
leaq -0x60(%rbp), %rdi
callq 0x1b4a2
callq 0x63b0
jmp 0x1df4f
movq %rax, %rbx
jmp 0x1df41
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1df41
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
leaq -0x60(%rbp), %rdi
callq 0x1b436
callq 0x63b0
movq %rbx, %rdi
callq 0x6410
movq %rax, %rdi
callq 0x1b99f
nop