// File: Silica[P]PSL/PSL.cpp
// Function: main
int main(int argc, char **argv)
{
	if (argc < 2)
		return 0;

	using namespace PSL;
	PSLVM p;
	if (PSLVM::error e = p.loadScript(argv[1]))
	{
		if (e == PSLVM::FOPEN_ERROR)
		{
			string input = argv[1];
			for (int i = 2; i < argc; ++i)
			{
				input += ' ';
				input += argv[i];
			}
			input += ';';
			p.loadString(input);
			variable v = p.run();
			printf("%s", v.toString().c_str());
			return 0;
		}
		else
		{
			printf(" - compile error\n");
		}
	}
	else
	{
		printf(" - compiled\n");

		if (argc > 2)
			p.writeCompiledCode(argv[2]);

#ifdef PSL_DEBUG
		variable r;
		while (!(r = p.stepExec())) if (getch() == 'q')break;
#endif
		variable v = p.run(argv[1]);
	}

	#ifdef _WIN32
	printf("end - press any key\n");
	getch();
	#endif
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0xc3fb
movl $0x0, -0x4(%rbp)
jmp 0xc7a8
leaq -0x38(%rbp), %rdi
callq 0xc7c0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x48(%rbp), %rdi
callq 0xc8b0
jmp 0xc417
leaq -0x38(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xc800
movl %eax, -0xbc(%rbp)
jmp 0xc42c
leaq -0x48(%rbp), %rdi
callq 0xc950
movl -0xbc(%rbp), %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0xc67a
cmpl $0x1, -0x3c(%rbp)
jne 0xc663
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x60(%rbp), %rdi
callq 0xc8b0
jmp 0xc465
movl $0x2, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0xc4e4
leaq -0x60(%rbp), %rdi
movl $0x20, %esi
callq 0xc980
jmp 0xc484
movq -0x10(%rbp), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x60(%rbp), %rdi
callq 0xca80
jmp 0xc49b
jmp 0xc49d
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0xc46c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xc79d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xc950
jmp 0xc79d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xc655
leaq -0x60(%rbp), %rdi
movl $0x3b, %esi
callq 0xc980
jmp 0xc4f4
leaq 0x321b5(%rip), %rsi     # 0x3e6b0
leaq -0x70(%rbp), %rdi
callq 0xc8b0
jmp 0xc506
leaq -0x38(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0xcb70
jmp 0xc519
leaq -0x70(%rbp), %rdi
callq 0xc950
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
callq 0xcce0
jmp 0xc532
leaq -0x80(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0xcc30
jmp 0xc548
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xcd50
jmp 0xc557
leaq -0x80(%rbp), %rdi
callq 0xcd90
leaq -0x88(%rbp), %rdi
callq 0xcdc0
leaq -0x90(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xcdf0
jmp 0xc57e
leaq -0x90(%rbp), %rdi
callq 0xce20
movq %rax, -0xc8(%rbp)
jmp 0xc593
movq -0xc8(%rbp), %rsi
leaq 0x3211a(%rip), %rdi     # 0x3e6bb
xorl %eax, %eax
callq 0xc050
jmp 0xc5aa
leaq -0x90(%rbp), %rdi
callq 0xc950
movl $0x0, -0x4(%rbp)
movl $0x1, -0x94(%rbp)
leaq -0x78(%rbp), %rdi
callq 0xcdc0
leaq -0x60(%rbp), %rdi
callq 0xc950
jmp 0xc792
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xc950
jmp 0xc655
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xc618
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xcd90
leaq -0x88(%rbp), %rdi
callq 0xcdc0
jmp 0xc655
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xc64c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xc950
leaq -0x78(%rbp), %rdi
callq 0xcdc0
leaq -0x60(%rbp), %rdi
callq 0xc950
jmp 0xc79d
leaq 0x32054(%rip), %rdi     # 0x3e6be
xorl %eax, %eax
callq 0xc050
jmp 0xc673
jmp 0xc675
jmp 0xc781
leaq 0x3204f(%rip), %rdi     # 0x3e6d0
xorl %eax, %eax
callq 0xc050
jmp 0xc68a
cmpl $0x2, -0x8(%rbp)
jle 0xc6e3
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0xa0(%rbp), %rdi
callq 0xc8b0
jmp 0xc6a6
leaq -0x38(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xce70
jmp 0xc6b8
leaq -0xa0(%rbp), %rdi
callq 0xc950
jmp 0xc6e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xc950
jmp 0xc79d
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0xb8(%rbp), %rdi
callq 0xcee0
jmp 0xc6f9
leaq -0xb0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0xcc30
jmp 0xc712
leaq -0xa8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0xcd50
jmp 0xc727
leaq -0xb0(%rbp), %rdi
callq 0xcd90
leaq -0xb8(%rbp), %rdi
callq 0xcdc0
leaq -0xa8(%rbp), %rdi
callq 0xcdc0
jmp 0xc781
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xc773
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0xcd90
leaq -0xb8(%rbp), %rdi
callq 0xcdc0
jmp 0xc79d
movl $0x0, -0x4(%rbp)
movl $0x1, -0x94(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xcf90
jmp 0xc7a8
leaq -0x38(%rbp), %rdi
callq 0xcf90
jmp 0xc7b4
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0xc280
nopl (%rax)