// File: /workspace/github_cpp_makefile_star2_O2/navrajsaini[P]PL_Compiler_design_project/Assembler.cpp
// Function: Assembler::secondPass()
void Assembler::secondPass()
{
   string nextop;
   (*insource) >> nextop;
   // Loop until ENDPROG.
   for (;;) {
      if (nextop == "ADD") {
	 (*outsource) << 0 << endl;;
	 currentAddress++;
      }
      else if (nextop == "AND") {
	 (*outsource) << 1 << endl;;
	 currentAddress++;
      }
      else if (nextop == "ARROW") {
	 (*outsource) << 2 << endl;;
	 int temp;
	 (*insource) >> temp;
	 // Output the absolute jump address.
	 (*outsource) << labelTable[temp] << endl;
	 currentAddress += 2;
      }
      else if (nextop == "ASSIGN") {
	 (*outsource) << 3 << endl;
	 int temp;
	 (*insource) >> temp;
	 (*outsource) << temp << endl;
	 currentAddress += 2;
      }
      else if (nextop == "BAR") {
	 (*outsource) << 4 << endl;
	 int temp;
	 (*insource) >> temp;
	 (*outsource) << labelTable[temp] << endl;
	 currentAddress += 2;
      }
      else if (nextop == "CALL") {
	 (*outsource) << 5 << endl;
	 int temp;
	 (*insource) >> temp;
	 (*outsource) << temp << endl;
	 (*insource) >> temp;
	 (*outsource) << labelTable[temp] << endl;
	 currentAddress += 3;
      }
      else if (nextop == "CONSTANT") {
	 (*outsource) << 6 << endl;
	 int temp;
	 (*insource) >> temp;
	 (*outsource) << temp << endl;
	 currentAddress += 2;
      }
      else if (nextop == "DIVIDE") {
	 (*outsource) << 7 << endl;
	 currentAddress++;
      }
      else if (nextop == "ENDPROC") {
	 (*outsource) << 8 << endl;
	 currentAddress++;
      }
      else if (nextop == "ENDPROG") {
	 (*outsource) << 9 << endl;
	 break;
      }
      else if (nextop == "EQUAL") {
	 (*outsource) << 10 << endl;
	 currentAddress++;
      }
      else if (nextop == "FI") {
	 (*outsource) << 11 << endl;
	 int temp;
	 (*insource) >> temp;
	 (*outsource) << temp << endl;
	 currentAddress += 2;
      }
      else if (nextop == "GREATER") {
	 (*outsource) << 12 << endl;
	 currentAddress++;
      }
      else if (nextop == "INDEX") {
	 (*outsource) << 13 << endl;
	 int temp;
	 (*insource) >> temp;
	 (*outsource) << temp << endl;
	 (*insource) >> temp;
	 (*outsource) << temp << endl;
	 currentAddress += 3;
      }
      else if (nextop == "LESS") {
	 (*outsource) << 14 << endl;
	 currentAddress++;
      }
      else if (nextop == "MINUS") {
	 (*outsource) << 15 << endl;
	 currentAddress++;
      }
      else if (nextop == "MODULO") {
	 (*outsource) << 16 << endl;
	 currentAddress++;
      }
      else if (nextop == "MULTIPLY") {
	 (*outsource) << 17 << endl;
	 currentAddress++;
      }
      else if (nextop == "NOT") {
	 (*outsource) << 18 << endl;
	 currentAddress++;
      }
      else if (nextop == "OR") {
	 (*outsource) << 19 << endl;
	 currentAddress++;
      }
      else if (nextop == "PROC") {
	 (*outsource) << 20 << endl;
	 int temp;
	 (*insource) >> temp;
	 (*outsource) << labelTable[temp] << endl;
	 (*insource) >> temp;
	 (*outsource) << labelTable[temp] << endl;
	 currentAddress += 3;
      }
      else if (nextop == "PROG") {
	 (*outsource) << 21 << endl;
	 int temp;
	 (*insource) >> temp;
	 (*outsource) << labelTable[temp] << endl;
	 (*insource) >> temp;
	 (*outsource) << labelTable[temp] << endl;
	 currentAddress += 3;
      }
      else if (nextop == "READ") {
	 (*outsource) << 22 << endl;
	 int temp;
	 (*insource) >> temp;
	 (*outsource) << temp << endl;
	 currentAddress += 2;
      }
      else if (nextop == "SUBTRACT") {
	 (*outsource) << 23 << endl;
	 currentAddress++;
      }
      else if (nextop == "VALUE") {
	 (*outsource) << 24 << endl;
	 currentAddress++;
      }
      else if (nextop == "VARIABLE") {
	 (*outsource) << 25 << endl;
	 int temp;
	 (*insource) >> temp;
	 (*outsource) << temp << endl;
	 (*insource) >> temp;
	 (*outsource) << temp << endl;
	 currentAddress += 3;
      }
      else if (nextop == "WRITE") {
	 (*outsource) << 26 << endl;
	 int temp;
	 (*insource) >> temp;
	 (*outsource) << temp << endl;
	 currentAddress += 2;
      }
      else if (nextop == "DEFADDR") {
	 int temp;
	 (*insource) >> temp;
      }
      else if (nextop == "DEFARG") {
	 int temp1, temp2;
	 (*insource) >> temp1 >> temp2;
      }
      else {
	 // We should never see this message.
	 cerr << "Assembler encountered an unknown operator.  Bailing..."
	      << endl;
	 exit(2);
      }
      (*insource) >> nextop;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, %rbx
movb $0x0, (%rax)
movq 0x7d8(%rdi), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2220
leaq 0x274a(%rip), %r14      # 0xf85d
leaq -0x50(%rbp), %r15
leaq 0x2711(%rip), %r12      # 0xf82f
leaq -0x2c(%rbp), %r13
movq %r15, %rdi
movq %r14, %rsi
callq 0x7926
testb %al, %al
je 0xd149
movq 0x7e0(%rbx), %rdi
xorl %esi, %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
movq %r12, %rsi
callq 0x7926
testb %al, %al
je 0xd17a
movq 0x7e0(%rbx), %rdi
pushq $0x1
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
incl 0x7d0(%rbx)
jmp 0xd280
movq %r15, %rdi
leaq 0x269e(%rip), %rsi      # 0xf822
callq 0x7926
testb %al, %al
je 0xd1d3
movq 0x7e0(%rbx), %rdi
pushq $0x2
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movslq -0x2c(%rbp), %rax
movl (%rbx,%rax,4), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd279
movq %r15, %rdi
leaq 0x25fc(%rip), %rsi      # 0xf7d9
callq 0x7926
testb %al, %al
je 0xd225
movq 0x7e0(%rbx), %rdi
pushq $0x3
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movl -0x2c(%rbp), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd279
movq %r15, %rdi
leaq 0x25f9(%rip), %rsi      # 0xf828
callq 0x7926
testb %al, %al
je 0xd294
movq 0x7e0(%rbx), %rdi
pushq $0x4
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movslq -0x2c(%rbp), %rax
movl (%rbx,%rax,4), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
addl $0x2, 0x7d0(%rbx)
movq 0x7d8(%rbx), %rdi
movq %r15, %rsi
callq 0x2220
jmp 0xd122
movq %r15, %rdi
leaq 0x2567(%rip), %rsi      # 0xf805
callq 0x7926
testb %al, %al
je 0xd31a
movq 0x7e0(%rbx), %rdi
pushq $0x5
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movl -0x2c(%rbp), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movslq -0x2c(%rbp), %rax
movl (%rbx,%rax,4), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
addl $0x3, 0x7d0(%rbx)
jmp 0xd280
movq %r15, %rdi
leaq 0x2562(%rip), %rsi      # 0xf886
callq 0x7926
testb %al, %al
je 0xd36f
movq 0x7e0(%rbx), %rdi
pushq $0x6
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movl -0x2c(%rbp), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd279
movq %r15, %rdi
leaq 0x2504(%rip), %rsi      # 0xf87d
callq 0x7926
testb %al, %al
je 0xd39e
movq 0x7e0(%rbx), %rdi
pushq $0x7
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x2402(%rip), %rsi      # 0xf7aa
callq 0x7926
testb %al, %al
je 0xd3cd
movq 0x7e0(%rbx), %rdi
pushq $0x8
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x22bd(%rip), %rsi      # 0xf694
callq 0x7926
testb %al, %al
jne 0xd90f
movq %r15, %rdi
leaq 0x2457(%rip), %rsi      # 0xf845
callq 0x7926
testb %al, %al
je 0xd413
movq 0x7e0(%rbx), %rdi
pushq $0xa
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x23f0(%rip), %rsi      # 0xf80d
callq 0x7926
testb %al, %al
je 0xd468
movq 0x7e0(%rbx), %rdi
pushq $0xb
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movl -0x2c(%rbp), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd279
movq %r15, %rdi
leaq 0x23d9(%rip), %rsi      # 0xf84b
callq 0x7926
testb %al, %al
je 0xd497
movq 0x7e0(%rbx), %rdi
pushq $0xc
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x2427(%rip), %rsi      # 0xf8c8
callq 0x7926
testb %al, %al
je 0xd512
movq 0x7e0(%rbx), %rdi
pushq $0xd
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movl -0x2c(%rbp), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movl -0x2c(%rbp), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd30e
movq %r15, %rdi
leaq 0x2324(%rip), %rsi      # 0xf840
callq 0x7926
testb %al, %al
je 0xd541
movq 0x7e0(%rbx), %rdi
pushq $0xe
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x23eb(%rip), %rsi      # 0xf936
callq 0x7926
testb %al, %al
je 0xd570
movq 0x7e0(%rbx), %rdi
pushq $0xf
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x22fc(%rip), %rsi      # 0xf876
callq 0x7926
testb %al, %al
je 0xd59f
movq 0x7e0(%rbx), %rdi
pushq $0x10
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x2393(%rip), %rsi      # 0xf93c
callq 0x7926
testb %al, %al
je 0xd5ce
movq 0x7e0(%rbx), %rdi
pushq $0x11
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x22bd(%rip), %rsi      # 0xf895
callq 0x7926
testb %al, %al
je 0xd5fd
movq 0x7e0(%rbx), %rdi
pushq $0x12
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x222c(%rip), %rsi      # 0xf833
callq 0x7926
testb %al, %al
je 0xd62c
movq 0x7e0(%rbx), %rdi
pushq $0x13
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x2177(%rip), %rsi      # 0xf7ad
callq 0x7926
testb %al, %al
je 0xd6af
movq 0x7e0(%rbx), %rdi
pushq $0x14
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movslq -0x2c(%rbp), %rax
movl (%rbx,%rax,4), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movslq -0x2c(%rbp), %rax
movl (%rbx,%rax,4), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd30e
movq %r15, %rdi
leaq 0x1fde(%rip), %rsi      # 0xf697
callq 0x7926
testb %al, %al
je 0xd732
movq 0x7e0(%rbx), %rdi
pushq $0x15
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movslq -0x2c(%rbp), %rax
movl (%rbx,%rax,4), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movslq -0x2c(%rbp), %rax
movl (%rbx,%rax,4), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd30e
movq %r15, %rdi
leaq 0x207c(%rip), %rsi      # 0xf7b8
callq 0x7926
testb %al, %al
je 0xd787
movq 0x7e0(%rbx), %rdi
pushq $0x16
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movl -0x2c(%rbp), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd279
movq %r15, %rdi
leaq 0x20d0(%rip), %rsi      # 0xf861
callq 0x7926
testb %al, %al
je 0xd7b6
movq 0x7e0(%rbx), %rdi
pushq $0x17
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x20cf(%rip), %rsi      # 0xf88f
callq 0x7926
testb %al, %al
je 0xd7e5
movq 0x7e0(%rbx), %rdi
pushq $0x18
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd16f
movq %r15, %rdi
leaq 0x20ad(%rip), %rsi      # 0xf89c
callq 0x7926
testb %al, %al
je 0xd860
movq 0x7e0(%rbx), %rdi
pushq $0x19
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movl -0x2c(%rbp), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movl -0x2c(%rbp), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd30e
movq %r15, %rdi
leaq 0x1f5f(%rip), %rsi      # 0xf7c9
callq 0x7926
testb %al, %al
je 0xd8b5
movq 0x7e0(%rbx), %rdi
pushq $0x1a
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq 0x7e0(%rbx), %rdi
movl -0x2c(%rbp), %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
jmp 0xd279
movq %r15, %rdi
leaq 0x1de4(%rip), %rsi      # 0xf6a3
callq 0x7926
testb %al, %al
je 0xd8dc
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
jmp 0xd280
movq %r15, %rdi
leaq 0x1db6(%rip), %rsi      # 0xf69c
callq 0x7926
testb %al, %al
je 0xd93e
movq 0x7d8(%rbx), %rdi
movq %r13, %rsi
callq 0x2130
movq %rax, %rdi
leaq -0x30(%rbp), %rsi
callq 0x2130
jmp 0xd280
movq 0x7e0(%rbx), %rdi
pushq $0x9
popq %rsi
callq 0x22c0
movq %rax, %rdi
callq 0x20f0
leaq -0x50(%rbp), %rdi
callq 0x20d0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x76ab(%rip), %rdi      # 0x14ff0
leaq 0x1ff9(%rip), %rsi      # 0xf945
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
pushq $0x2
popq %rdi
callq 0x2200
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
jmp 0xd97f
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x22e0
nop