// File: /workspace/github_cpp_makefile_star2_O2/smallsimple[P]CoreInterpreter-CSE5341/Loop.cpp
// Function: Loop::ParseLoop()
void Loop::ParseLoop(){
  Tokenizer *tokensLoop;
  tokensLoop = Tokenizer::getInstance();
  string tokenTemp = tokensLoop->getToken();
  if (tokenTemp.compare("while") == 0){
    tokensLoop->skipToken();
    cond = new Cond();
    cond->ParseCond();
    tokenTemp = tokensLoop->getToken();
    if (tokenTemp.compare("loop") == 0){
      tokensLoop->skipToken();
      stmtSeq = new StmtSeq(infile);
      stmtSeq->ParseStmtSeq();
      tokenTemp = tokensLoop->getToken();
      if (tokenTemp.compare("end") == 0){
	tokensLoop->skipToken();
	tokenTemp = tokensLoop->getToken();
	if (tokenTemp.compare(";") == 0){
	  tokensLoop->skipToken();
	  return;
	}
	else{
	  cout << "Syntax Error: ParseLoop: \";\" not found!" << endl;
	  cout << "program stopped." << endl;
	  exit(0);
	}
      }
      else {
	cout << "Syntax Error: ParseLoop: \"end\" not found!" << endl;
	cout << "program stopped." << endl;
	exit(0);
      }
    }
    else {
      cout << "Syntax Error: ParseLoop: \"loop\" not found!" << endl;
      cout << "program stopped." << endl;
      exit(0);
    }
    
  }
  
  else {
    cout << "Syntax Error: while not found!" << endl;
    cout << "program stopped.";
    exit(0);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %r14
callq 0x3692
movq %rax, %rbx
leaq -0x60(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x36e6
leaq 0x17bc(%rip), %rsi      # 0x70b8
movq %r15, %rdi
callq 0x2080
testl %eax, %eax
jne 0x5a35
movq %rbx, %rdi
callq 0x3746
pushq $0x20
popq %rdi
callq 0x2180
movq %rax, %r15
movq %rax, %rdi
callq 0x63cc
movq %r15, (%r14)
movq %r15, %rdi
callq 0x65ac
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x36e6
leaq -0x60(%rbp), %r15
leaq -0x40(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x21e0
movq %r12, %rdi
callq 0x20c0
leaq 0x1ddc(%rip), %rsi      # 0x773c
movq %r15, %rdi
callq 0x2080
testl %eax, %eax
jne 0x5a68
movq %rbx, %rdi
callq 0x3746
pushq $0x18
popq %rdi
callq 0x2180
movq %rax, %r15
movq 0x10(%r14), %rsi
movq %rax, %rdi
callq 0x449c
movq %r15, 0x8(%r14)
movq %r15, %rdi
callq 0x44f2
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x36e6
leaq -0x60(%rbp), %r14
leaq -0x40(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x21e0
movq %r15, %rdi
callq 0x20c0
leaq 0x16df(%rip), %rsi      # 0x70a8
movq %r14, %rdi
callq 0x2080
testl %eax, %eax
jne 0x5aa0
movq %rbx, %rdi
callq 0x3746
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x36e6
movq %r14, %rdi
movq %r15, %rsi
callq 0x21e0
movq %r15, %rdi
callq 0x20c0
leaq 0x1d3d(%rip), %rsi      # 0x7744
movq %r14, %rdi
callq 0x2080
testl %eax, %eax
jne 0x5ad8
movq %rbx, %rdi
callq 0x3746
leaq -0x60(%rbp), %rdi
callq 0x20c0
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x559c(%rip), %rdi      # 0xafd8
leaq 0x1d80(%rip), %rsi      # 0x77c3
callq 0x2170
movq %rax, %rdi
callq 0x20d0
movq 0x5581(%rip), %rdi      # 0xafd8
leaq 0x16e8(%rip), %rsi      # 0x7146
callq 0x2170
jmp 0x5b0e
movq 0x5569(%rip), %rdi      # 0xafd8
leaq 0x1d22(%rip), %rsi      # 0x7798
callq 0x2170
movq %rax, %rdi
callq 0x20d0
movq 0x554e(%rip), %rdi      # 0xafd8
leaq 0x16b5(%rip), %rsi      # 0x7146
callq 0x2170
movq %rax, %rdi
callq 0x20d0
jmp 0x5b0e
movq 0x5531(%rip), %rdi      # 0xafd8
leaq 0x1cc0(%rip), %rsi      # 0x776e
callq 0x2170
movq %rax, %rdi
callq 0x20d0
movq 0x5516(%rip), %rdi      # 0xafd8
leaq 0x167d(%rip), %rsi      # 0x7146
callq 0x2170
movq %rax, %rdi
callq 0x20d0
jmp 0x5b0e
movq 0x54f9(%rip), %rdi      # 0xafd8
leaq 0x1c60(%rip), %rsi      # 0x7746
callq 0x2170
movq %rax, %rdi
callq 0x20d0
movq 0x54de(%rip), %rdi      # 0xafd8
leaq 0x1645(%rip), %rsi      # 0x7146
callq 0x2170
movq %rax, %rdi
callq 0x20d0
xorl %edi, %edi
callq 0x21d0
jmp 0x5b32
jmp 0x5b32
movq %rax, %rbx
pushq $0x18
jmp 0x5b27
jmp 0x5b32
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x2190
jmp 0x5b35
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x2290
nop