// File: /workspace/github_cpp_makefile_star2_O3/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 0x1da97
movq %rsi, %rbx
movl %edi, %r15d
xorl %r12d, %r12d
leaq 0x169c6(%rip), %r14     # 0x34320
movq (%rbx,%r12,8), %rax
cmpb $0x2d, (%rax)
jne 0x1d9c0
movzbl 0x1(%rax), %eax
cmpl $0x68, %eax
je 0x1d9b8
cmpl $0x74, %eax
je 0x1d999
cmpl $0x73, %eax
jne 0x1da16
movq 0x8(%rbx,%r12,8), %rdi
testq %rdi, %rdi
je 0x1da41
callq 0x6370
movq %r14, %rdi
movl %eax, %esi
callq 0x1d53c
jmp 0x1d9c0
movq 0x8(%rbx,%r12,8), %rdi
testq %rdi, %rdi
je 0x1da6c
callq 0x6370
movq %r14, %rdi
movl %eax, %esi
callq 0x1d528
jmp 0x1d9c0
movq %r14, %rdi
callq 0x1d518
incq %r12
cmpq %r12, %r15
jne 0x1d95a
movq 0x8(%rbx), %rdi
leaq 0x9086(%rip), %rsi      # 0x26a59
callq 0x6280
testq %rax, %rax
je 0x1daa3
movq %rax, %r14
leaq 0x168c5(%rip), %rax     # 0x342b0
movq %r14, (%rax)
callq 0x1f288
movq %r14, %rdi
callq 0x61f0
leaq 0x1691e(%rip), %rdi     # 0x34320
callq 0x1cdea
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x165d3(%rip), %rdi     # 0x33ff0
leaq 0x900b(%rip), %rsi      # 0x26a2f
movl $0x13, %edx
callq 0x6270
movq 0x165bb(%rip), %rdi     # 0x33ff0
callq 0x60f0
callq 0x1d7e0
jmp 0x1da9c
movq 0x165a8(%rip), %rdi     # 0x33ff0
leaq 0x8f9c(%rip), %rsi      # 0x269eb
movl $0x21, %edx
callq 0x6270
movq 0x16590(%rip), %rdi     # 0x33ff0
callq 0x60f0
callq 0x1d7e0
jmp 0x1da9c
movq 0x1657d(%rip), %rdi     # 0x33ff0
leaq 0x8f93(%rip), %rsi      # 0x26a0d
movl $0x21, %edx
callq 0x6270
movq 0x16565(%rip), %rdi     # 0x33ff0
callq 0x60f0
callq 0x1d7e0
jmp 0x1da9c
callq 0x1d7e0
xorl %edi, %edi
callq 0x62a0
movq 0x16546(%rip), %rdi     # 0x33ff0
leaq 0x8f92(%rip), %rsi      # 0x26a43
movl $0x5, %edx
callq 0x6270
movq 0x8(%rbx), %rsi
movq 0x1652a(%rip), %rdi     # 0x33ff0
callq 0x61e0
movq %rax, %rbx
leaq 0x8f74(%rip), %rsi      # 0x26a49
movl $0x11, %edx
movq %rax, %rdi
callq 0x6270
movq %rbx, %rdi
callq 0x60f0
callq 0x1d7e0
jmp 0x1da9c
jmp 0x1daf7
jmp 0x1daf7
jmp 0x1daf7
movq %rax, %rbx
cmpl $0x3, %edx
jne 0x1db7a
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 0x8a76
movq %rbx, %rdi
callq 0x60d0
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x1b18c
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq 0x164aa(%rip), %rdi     # 0x33ff0
callq 0x6270
movq %rax, %rdi
callq 0x60f0
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1db6c
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
leaq -0x60(%rbp), %rdi
callq 0x1b16a
jmp 0x1dc23
cmpl $0x2, %edx
jne 0x1dbf7
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 0x8a76
movq %rbx, %rdi
callq 0x60d0
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x1b1f8
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq 0x1642a(%rip), %rdi     # 0x33ff0
callq 0x6270
movq %rax, %rdi
callq 0x60f0
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1dbec
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
leaq -0x60(%rbp), %rdi
callq 0x1b1d6
jmp 0x1dc23
movq %rbx, %rdi
callq 0x60d0
movq 0x163ea(%rip), %rdi     # 0x33ff0
leaq 0x8e4e(%rip), %rsi      # 0x26a5b
movl $0xd, %edx
callq 0x6270
movq 0x163d2(%rip), %rdi     # 0x33ff0
callq 0x60f0
callq 0x63b0
jmp 0x1da07
movq %rax, %rbx
jmp 0x1dc58
movq %rax, %rbx
callq 0x63b0
jmp 0x1dc97
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1dc58
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
leaq -0x60(%rbp), %rdi
callq 0x1b1d6
callq 0x63b0
jmp 0x1dc97
movq %rax, %rbx
jmp 0x1dc89
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1dc89
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
leaq -0x60(%rbp), %rdi
callq 0x1b16a
callq 0x63b0
movq %rbx, %rdi
callq 0x6410
movq %rax, %rdi
callq 0x1b6f9
nop