// File: /workspace/github_cpp_makefile_star2_O2/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 $0x38, %rsp
movq %rdi, %rbx
movl $0xccffccff, %esi       # imm = 0xCCFFCCFF
callq 0x315e
pushq $0x28
popq %r14
leaq 0x1371(%rip), %r12      # 0x418e
leaq -0x58(%rbp), %r15
leaq 0x1288(%rip), %r13      # 0x40b0
movq 0x40040(%rbx), %rax
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x2, 0x20(%rax,%rcx)
jne 0x2ffd
movq %rbx, %rdi
callq 0x3070
movl 0x40028(%rbx), %eax
cmpq $0x29, %rax
ja 0x2efd
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq %rbx, %rdi
callq 0x33fc
jmp 0x2fe9
movq %rbx, %rdi
callq 0x3492
jmp 0x2fe9
movl 0x4002c(%rbx), %eax
incl (%rbx,%rax,4)
jmp 0x2fe9
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movl (%rbx,%rax,4), %edx
imull (%rbx,%rcx,4), %edx
movl %edx, (%rbx,%rax,4)
jmp 0x2fe9
movl 0x4002c(%rbx), %eax
decl (%rbx,%rax,4)
jmp 0x2fe9
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movslq (%rbx,%rcx,4), %rcx
movl (%rbx,%rcx,4), %ecx
jmp 0x2f8b
movq 0x40038(%rbx), %rax
xorl %ecx, %ecx
cmpl $0x0, (%rax)
sete %cl
movl %ecx, (%rax)
jmp 0x2fe9
movl 0x4002c(%rbx), %ecx
movl 0x40030(%rbx), %esi
movl (%rbx,%rcx,4), %eax
cltd
idivl (%rbx,%rsi,4)
movl %eax, (%rbx,%rcx,4)
jmp 0x2fe9
movq 0x40048(%rbx), %rax
movq %rax, -0x38(%rbp)
movq %r14, %rdi
callq 0x2130
movq %rax, %r14
movq %r15, %rdi
movq %r12, %rsi
leaq -0x29(%rbp), %rdx
callq 0x25d0
movl $0x80ffee01, (%r14)     # imm = 0x80FFEE01
movq %r14, %rdi
addq $0x8, %rdi
movb $0x1, %r12b
movq %r14, %rax
movq %r15, %r14
movq %r15, %rsi
movq %rax, %r15
callq 0x2170
xorl %r12d, %r12d
movq -0x38(%rbp), %rdi
movq %r15, %rsi
callq 0x25b2
movq %r14, %r15
movq %r14, %rdi
callq 0x2090
pushq $0x28
popq %r14
leaq 0x1225(%rip), %r12      # 0x418e
jmp 0x2fe9
movq %rbx, %rdi
callq 0x33e8
jmp 0x2fe9
andq $0x0, 0x40038(%rbx)
jmp 0x2fe9
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movl %ecx, (%rbx,%rax,4)
jmp 0x2fe9
movl 0x4002c(%rbx), %eax
negl (%rbx,%rax,4)
jmp 0x2fe9
movq %rbx, %rdi
callq 0x3418
jmp 0x2fe9
movq %rbx, %rdi
callq 0x325a
jmp 0x2fe9
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movl (%rbx,%rcx,4), %ecx
subl %ecx, (%rbx,%rax,4)
jmp 0x2fe9
movl 0x4002c(%rbx), %eax
movl 0x40030(%rbx), %ecx
movl (%rbx,%rcx,4), %ecx
addl %ecx, (%rbx,%rax,4)
jmp 0x2fe9
movq %rbx, %rdi
callq 0x3464
jmp 0x2fe9
movq %rbx, %rdi
callq 0x343e
movq 0x40048(%rbx), %rdi
callq 0x29ce
testl %eax, %eax
je 0x2e28
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %r15
movq %rax, %rbx
jmp 0x3025
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x2090
testb %r12b, %r12b
je 0x3030
pushq $0x28
popq %rsi
movq %r15, %rdi
callq 0x2140
movq %rbx, %rdi
callq 0x21e0