// File: /workspace/github_cpp_makefile_star2_O3/JayWalker512[P]JayParser/VM.cpp
// Function: VM::parseCodeSection()
void VM::parseCodeSection()
{	
	jumpToSection(CODESEC);
	
	// Parse
	while (!m_program->eof()) {
		readNextInstruction();
		
		switch (m_instruction)
		{
			case NOP:
				break;
			case DSP:
				execDSP();
				break;
			case MOV:
				execMOV();
				break;
			case SET:
				execSET();
				break;
			case JMP:
				execJMP();
				break;
			case JMF:
				execJMF();
				break;
			case JMPMK:
				execJMF();
				break;
			case RSTLG:
				execRSTLG();
				break;		
			case ADD:
				execADD();
				break;
			case SUB:
				execSUB();
				break;
			case MUL:
				execMUL();
				break;
			case DIV:
				execDIV();
				break;
			case DEC:
				execDEC();
				break;
			case INC:
				execINC();
				break;
			case NEG:
				execNEG();
				break;
			case EQQ:
				execEQQ();
				break;
			case NEQ:
				execNEQ();
				break;
			case AND:
				execAND();
				break;
			case ORR:
				execORR();
				break;
			case NOT:
				execNOT();
				break;
			default:
				m_log->add(new Error(FATAL + PARSERR + 1, "Unknown instruction."));
		}
						   
		if (m_log->getErrorCount())
			return;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl $0xccffccff, %esi       # imm = 0xCCFFCCFF
callq 0x33ec
leaq -0x38(%rbp), %r15
leaq 0x110d(%rip), %r12      # 0x40b0
movq 0x40040(%rbx), %rax
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x2, 0x20(%rax,%rcx)
jne 0x326c
movq %rbx, %rdi
callq 0x32ee
movl 0x40028(%rbx), %eax
cmpq $0x29, %rax
ja 0x3094
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movq 0x40038(%rbx), %rax
cmpl $0x0, (%rax)
je 0x31de
movq %rbx, %rdi
callq 0x3588
jmp 0x322b
movl 0x4002c(%rbx), %ecx
movl $0x1, %eax
cmpl $0x0, (%rbx,%rcx,4)
jne 0x31f8
jmp 0x31ab
movl 0x4002c(%rbx), %eax
incl (%rbx,%rax,4)
jmp 0x322b
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movl (%rbx,%rax,4), %edx
imull (%rbx,%rcx,4), %edx
movl %edx, (%rbx,%rax,4)
jmp 0x322b
movl 0x4002c(%rbx), %eax
decl (%rbx,%rax,4)
jmp 0x322b
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movslq (%rbx,%rcx,4), %rcx
movl (%rbx,%rcx,4), %ecx
jmp 0x3142
movq 0x40038(%rbx), %rax
xorl %ecx, %ecx
cmpl $0x0, (%rax)
sete %cl
movl %ecx, (%rax)
jmp 0x322b
movl 0x4002c(%rbx), %ecx
movl 0x40030(%rbx), %esi
movl (%rbx,%rcx,4), %eax
cltd
idivl (%rbx,%rsi,4)
movl %eax, (%rbx,%rcx,4)
jmp 0x322b
movq 0x40048(%rbx), %r14
movl $0x28, %edi
callq 0x2120
movq %rax, %r13
movq %r15, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
leaq 0x10d7(%rip), %rsi      # 0x418e
leaq 0x10e4(%rip), %rdx      # 0x41a2
callq 0x2c54
movl $0x80ffee01, (%r13)     # imm = 0x80FFEE01
leaq 0x8(%r13), %rdi
movq %r13, %rax
addq $0x18, %rax
movq %rax, 0x8(%r13)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
movb $0x1, %r15b
callq 0x2bb6
movq %r13, -0x50(%rbp)
movq 0x30(%r14), %rax
movq 0x40(%r14), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x3203
movq %r13, (%rax)
addq $0x8, 0x30(%r14)
jmp 0x3212
movq 0x40018(%rbx), %rax
movl (%rax), %edi
callq 0x2180
jmp 0x322b
movq $0x0, 0x40038(%rbx)
jmp 0x322b
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movl %ecx, (%rbx,%rax,4)
jmp 0x322b
movl 0x4002c(%rbx), %eax
negl (%rbx,%rax,4)
jmp 0x322b
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movl (%rbx,%rax,4), %eax
xorl %edx, %edx
cmpl (%rbx,%rcx,4), %eax
sete %dl
jmp 0x31d3
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movl (%rbx,%rcx,4), %ecx
subl %ecx, (%rbx,%rax,4)
jmp 0x322b
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movl (%rbx,%rcx,4), %ecx
addl %ecx, (%rbx,%rax,4)
jmp 0x322b
movl 0x4002c(%rbx), %eax
cmpl $0x0, (%rbx,%rax,4)
je 0x31f6
movl 0x40030(%rbx), %ecx
xorl %eax, %eax
cmpl $0x0, (%rbx,%rcx,4)
setne %al
jmp 0x31f8
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movl (%rbx,%rax,4), %eax
xorl %edx, %edx
cmpl (%rbx,%rcx,4), %eax
setne %dl
movq 0x40038(%rbx), %rax
movl %edx, (%rax)
jmp 0x322b
movq 0x40040(%rbx), %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x2160
jmp 0x322b
xorl %eax, %eax
movq 0x40038(%rbx), %rcx
movl %eax, (%rcx)
jmp 0x322b
xorl %r15d, %r15d
movq %r14, %rdi
leaq -0x50(%rbp), %rsi
callq 0x29a4
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %r15
cmpq %r15, %rdi
je 0x322b
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2130
movq 0x40048(%rbx), %rax
movq 0x48(%rax), %rcx
movl 0x28(%rax), %edx
movl %ecx, %esi
subl %edx, %esi
shrl $0x3, %esi
cmpq $0x1, %rcx
adcl $-0x1, %esi
shll $0x6, %esi
movq 0x20(%rax), %rcx
movq 0x30(%rax), %rdx
subq 0x38(%rax), %rdx
shrq $0x3, %rdx
addl %esi, %edx
subq 0x10(%rax), %rcx
shrq $0x3, %rcx
addl %edx, %ecx
je 0x2fa3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x32a1
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x329c
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2130
testb %r15b, %r15b
je 0x32ae
movl $0x28, %esi
movq %r13, %rdi
callq 0x2130
movq %rbx, %rdi
callq 0x21d0