// File: /workspace/github_cpp_makefile_star2_O2/navrajsaini[P]PL_Compiler_design_project/test.cpp
// Function: main
int main ()
{

   //TESING SCANNER && ADMIN
   ifstream infile;
   ofstream outfile;
   cout << endl << endl << endl;
   cout << "--------testing scanner-----------";
   string codefile, tokenfile;
   string codef[8] =
      {
	 "./testfiles/test1.txt", "./testfiles/test2.txt",
	 "./testfiles/test3.txt", "./testfiles/test4.txt",
	 "./testfiles/test5.txt", "./testfiles/test6.txt",
	 "./testfiles/test7.txt", "./testfiles/testLang.txt"};

   string tokenf[8] =
      {"./testfiles/test1.Out", "./testfiles/test2.Out",
       "./testfiles/test3.Out", "./testfiles/test4.Out",
       "./testfiles/test5.Out", "./testfiles/test6.Out",
       "./testfiles/test7.Out", "./testfiles/testLang.Out"};
   for (int i = 0; i < 8; i++)
   {
      cout << "testing file: " << i+1 << endl;

      if (i == 7)
      {
	 cout << "testing the proper testLang file." << endl
	      << "There should not be any errorrs..."
	      << endl;
      }
      codefile = codef[i];
      tokenfile = tokenf[i];
      cout << endl;

      Scanner scanTest (codefile, tokenfile);
      Admin compiler(codefile, tokenfile, scanTest);
      compiler.tst = true;
      cout << "finished making the compiler..." << endl;
      int fin = compiler.scan();
      cout << "compile finished, output is: " << fin << endl;
      cout << endl << endl << "about to print... " << endl;
      compiler.print();

      //   cout << "the location of begin is: " << scanTest.getToken("begin") << endl;

      cout << "------------------testing parser-----------" << endl;
      compiler.parse();
      // if ctd is false there is a error in the parser
      // so the assembler will not run.
      if (compiler.ctd == true)
      {
	 cout << "-------------------testing assembler----------" << endl;
	 outfile.open(tokenfile);
	 infile.open("psudogen");
	 Assembler a(infile, outfile);
	 
	 cout << "first run" << endl;
	 a.firstPass();
	 
	 cout << "second run" << endl;
	 outfile.close();
	 infile.close();
	 
	 outfile.open(tokenfile);
	 infile.open("psudogen");
	 a.secondPass();
	 infile.close();
	 outfile.close();
	 cout << "------------------testing interpreter----------" << endl;
	 Interpreter b(tokenfile, true);
      }
      else
	 cout << "compiling error, exiting..." << endl;
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4df8, %rsp           # imm = 0x4DF8
leaq -0x718(%rbp), %rdi
callq 0x21d0
leaq -0x510(%rbp), %rdi
callq 0x22a0
movq 0x11c79(%rip), %rdi     # 0x14fc8
callq 0x20f0
movq %rax, %rdi
callq 0x20f0
movq %rax, %rdi
callq 0x20f0
movq 0x11c5d(%rip), %rdi     # 0x14fc8
leaq 0xbd20(%rip), %rsi      # 0xf092
callq 0x21a0
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0xbd17(%rip), %rsi      # 0xf0b5
leaq -0x310(%rbp), %r14
leaq -0x3e60(%rbp), %rdx
movq %r14, %rdi
callq 0x20a0
leaq -0x2f0(%rbp), %r15
leaq 0xbd09(%rip), %rsi      # 0xf0cb
leaq -0x4e18(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x2d0(%rbp), %r15
leaq 0xbd02(%rip), %rsi      # 0xf0e1
leaq -0x1d70(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x2b0(%rbp), %r15
leaq 0xbcfb(%rip), %rsi      # 0xf0f7
leaq -0xf00(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x290(%rbp), %r15
leaq 0xbcf4(%rip), %rsi      # 0xf10d
leaq -0x210(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x270(%rbp), %r15
leaq 0xbced(%rip), %rsi      # 0xf123
leaq -0x2b(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x250(%rbp), %r15
leaq 0xbce9(%rip), %rsi      # 0xf139
leaq -0x2a(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x230(%rbp), %r15
leaq 0xbce5(%rip), %rsi      # 0xf14f
leaq -0x29(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq 0xbceb(%rip), %rsi      # 0xf168
leaq -0x210(%rbp), %r14
leaq -0x3e60(%rbp), %rdx
movq %r14, %rdi
callq 0x20a0
leaq -0x1f0(%rbp), %r15
leaq 0xbcdd(%rip), %rsi      # 0xf17e
leaq -0x4e18(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x1d0(%rbp), %r15
leaq 0xbcd6(%rip), %rsi      # 0xf194
leaq -0x1d70(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x1b0(%rbp), %r15
leaq 0xbccf(%rip), %rsi      # 0xf1aa
leaq -0xf00(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x190(%rbp), %r15
leaq 0xbcc8(%rip), %rsi      # 0xf1c0
leaq -0x2b(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x170(%rbp), %r15
leaq 0xbcc4(%rip), %rsi      # 0xf1d6
leaq -0x2a(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x150(%rbp), %r15
leaq 0xbcc0(%rip), %rsi      # 0xf1ec
leaq -0x29(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
leaq -0x130(%rbp), %r15
leaq 0xbcbc(%rip), %rsi      # 0xf202
leaq -0x2c(%rbp), %rdx
movq %r15, %rdi
callq 0x20a0
xorl %r15d, %r15d
leaq -0x110(%rbp), %r13
xorl %r14d, %r14d
cmpq $0x100, %r15            # imm = 0x100
je 0x38f5
movq 0x11a55(%rip), %rdi     # 0x14fc8
leaq 0xbca1(%rip), %rsi      # 0xf21b
callq 0x21a0
leaq 0x1(%r14), %r12
movq %rax, %rdi
movl %r12d, %esi
callq 0x22b0
movq %rax, %rdi
callq 0x20f0
cmpq $0x7, %r14
jne 0x35ce
movq 0x11a25(%rip), %rdi     # 0x14fc8
leaq 0xbc80(%rip), %rsi      # 0xf22a
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
movq %rax, %rdi
leaq 0xbc8b(%rip), %rsi      # 0xf24c
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq (%r15,%rbp), %rsi
addq $-0x310, %rsi           # imm = 0xFCF0
leaq -0x70(%rbp), %rdi
callq 0x2110
leaq (%r15,%rbp), %rsi
addq $-0x210, %rsi           # imm = 0xFDF0
leaq -0x50(%rbp), %rdi
callq 0x2110
movq 0x119cb(%rip), %rdi     # 0x14fc8
callq 0x20f0
movq %r13, %rdi
leaq -0x70(%rbp), %rsi
callq 0x2230
leaq -0xf0(%rbp), %rbx
movq %rbx, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2230
leaq -0x1d70(%rbp), %rdi
movq %r13, %r14
movq %r13, %rsi
movq %rbx, %rdx
callq 0x8c74
movq %rbx, %rdi
callq 0x20d0
movq %r14, %rdi
callq 0x20d0
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2230
leaq -0xd0(%rbp), %r14
movq %r14, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2230
leaq -0x3e60(%rbp), %rdi
leaq -0x90(%rbp), %rbx
movq %rbx, %rsi
movq %r14, %rdx
leaq -0x1d70(%rbp), %rcx
callq 0x82c2
movq %r14, %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x20d0
movb $0x1, -0x3e5e(%rbp)
movq 0x11921(%rip), %rdi     # 0x14fc8
leaq 0xbbc1(%rip), %rsi      # 0xf26f
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq -0x3e60(%rbp), %rdi
callq 0x84dc
movl %eax, %r14d
movq 0x118f7(%rip), %rdi     # 0x14fc8
leaq 0xbbb7(%rip), %rsi      # 0xf28f
callq 0x21a0
movq %rax, %rdi
movl %r14d, %esi
callq 0x22b0
movq %rax, %rdi
callq 0x20f0
movq 0x118d1(%rip), %rdi     # 0x14fc8
callq 0x20f0
movq %rax, %rdi
callq 0x20f0
movq %rax, %rdi
leaq 0xbb9f(%rip), %rsi      # 0xf2ad
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq -0x3e60(%rbp), %rdi
callq 0x84ca
movq 0x1189a(%rip), %rdi     # 0x14fc8
leaq 0xbb8b(%rip), %rsi      # 0xf2c0
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq -0x3e60(%rbp), %rdi
callq 0x85c0
cmpb $0x1, -0x3e5f(%rbp)
jne 0x38b6
movq 0x11866(%rip), %rdi     # 0x14fc8
leaq 0xbb83(%rip), %rsi      # 0xf2ec
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq -0x510(%rbp), %rdi
leaq -0x50(%rbp), %rsi
pushq $0x10
popq %rdx
callq 0x20e0
leaq -0x718(%rbp), %rdi
leaq 0xbb84(%rip), %rsi      # 0xf31b
pushq $0x8
popq %rdx
callq 0x2140
leaq -0xf00(%rbp), %rdi
leaq -0x718(%rbp), %rsi
leaq -0x510(%rbp), %rdx
callq 0xd184
movq 0x11808(%rip), %rdi     # 0x14fc8
leaq 0xbb5d(%rip), %rsi      # 0xf324
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq -0xf00(%rbp), %rdi
callq 0xd1b8
movq 0x117e1(%rip), %rdi     # 0x14fc8
leaq 0xbb40(%rip), %rsi      # 0xf32e
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq -0x510(%rbp), %rdi
callq 0x2240
leaq -0x718(%rbp), %rdi
callq 0x2040
leaq -0x510(%rbp), %rdi
leaq -0x50(%rbp), %rsi
pushq $0x10
popq %rdx
callq 0x20e0
leaq -0x718(%rbp), %rdi
leaq 0xbae7(%rip), %rsi      # 0xf31b
pushq $0x8
popq %rdx
callq 0x2140
leaq -0xf00(%rbp), %rdi
callq 0xd438
leaq -0x718(%rbp), %rdi
callq 0x2040
leaq -0x510(%rbp), %rdi
callq 0x2240
movq 0x11761(%rip), %rdi     # 0x14fc8
leaq 0xbacb(%rip), %rsi      # 0xf339
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq -0xb0(%rbp), %rbx
movq %rbx, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2230
leaq -0x4e18(%rbp), %rdi
movq %rbx, %rsi
pushq $0x1
popq %rdx
callq 0xdcf4
movq %rbx, %rdi
callq 0x20d0
leaq -0xf00(%rbp), %rdi
callq 0xd1b2
jmp 0x38d1
movq 0x1170b(%rip), %rdi     # 0x14fc8
leaq 0xbaa5(%rip), %rsi      # 0xf369
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq -0x3e60(%rbp), %rdi
callq 0x3ae0
leaq -0x1d70(%rbp), %rdi
callq 0x3b44
addq $0x20, %r15
movq %r12, %r14
jmp 0x355f
movl $0xe0, %ebx
leaq (%rbx,%rbp), %rdi
addq $-0x210, %rdi           # imm = 0xFDF0
callq 0x20d0
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x38fa
movl $0xe0, %ebx
leaq (%rbx,%rbp), %rdi
addq $-0x310, %rdi           # imm = 0xFCF0
callq 0x20d0
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x3919
leaq -0x50(%rbp), %rdi
callq 0x20d0
leaq -0x70(%rbp), %rdi
callq 0x20d0
leaq -0x510(%rbp), %rdi
callq 0x2260
leaq -0x718(%rbp), %rdi
callq 0x2050
xorl %eax, %eax
addq $0x4df8, %rsp           # imm = 0x4DF8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x397d
jmp 0x397d
jmp 0x397d
jmp 0x397d
jmp 0x397d
jmp 0x397d
movq %rax, %rbx
addq $-0x20, %r15
movq %r15, %rdi
callq 0x20d0
cmpq %r14, %r15
jne 0x3980
jmp 0x3a8e
movq %rax, %rbx
jmp 0x3a8e
jmp 0x39aa
jmp 0x39aa
jmp 0x39aa
jmp 0x39aa
jmp 0x39aa
jmp 0x39aa
movq %rax, %rbx
addq $-0x20, %r15
movq %r15, %rdi
callq 0x20d0
cmpq %r14, %r15
jne 0x39ad
jmp 0x3aae
movq %rax, %rbx
jmp 0x3aae
movq %rax, %rbx
jmp 0x3acc
movq %rax, %rbx
jmp 0x3ac0
jmp 0x3a3d
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x20d0
jmp 0x3a40
jmp 0x3a53
movq %rax, %rbx
jmp 0x3a04
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x20d0
leaq -0x90(%rbp), %rdi
callq 0x20d0
jmp 0x3a62
jmp 0x3a4e
movq %rax, %rbx
jmp 0x3a28
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x20d0
leaq -0x110(%rbp), %rdi
callq 0x20d0
jmp 0x3a6e
movq %rax, %rbx
jmp 0x3a62
jmp 0x3a53
movq %rax, %rbx
leaq -0xf00(%rbp), %rdi
callq 0xd1b2
jmp 0x3a56
movq %rax, %rbx
jmp 0x3a6e
movq %rax, %rbx
leaq -0x3e60(%rbp), %rdi
callq 0x3ae0
leaq -0x1d70(%rbp), %rdi
callq 0x3b44
movl $0xe0, %r14d
leaq (%r14,%rbp), %rdi
addq $-0x210, %rdi           # imm = 0xFDF0
callq 0x20d0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x3a74
movl $0xe0, %r14d
leaq (%r14,%rbp), %rdi
addq $-0x310, %rdi           # imm = 0xFCF0
callq 0x20d0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x3a94
leaq -0x50(%rbp), %rdi
callq 0x20d0
leaq -0x70(%rbp), %rdi
callq 0x20d0
leaq -0x510(%rbp), %rdi
callq 0x2260
leaq -0x718(%rbp), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x22d0