// File: /workspace/github_cpp_makefile_star2_O1/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 0x3d00
movq %rax, %rbx
leaq -0x40(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x3d54
leaq 0x1ce0(%rip), %rsi      # 0x80b0
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
jne 0x6543
movq %rbx, %rdi
callq 0x3e36
movl $0x20, %edi
callq 0x2190
movq %rax, %r15
movq %rax, %rdi
callq 0x7170
movq %r15, (%r14)
movq %r15, %rdi
callq 0x735c
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x3d54
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %r15
movq %r15, %rsi
callq 0x2200
movq (%r15), %rdi
leaq -0x50(%rbp), %r12
cmpq %r12, %rdi
je 0x643c
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x21a0
leaq 0x2321(%rip), %rsi      # 0x8764
leaq -0x40(%rbp), %rdi
callq 0x2090
testl %eax, %eax
jne 0x657f
movq %rbx, %rdi
callq 0x3e36
movl $0x18, %edi
callq 0x2190
movq %rax, %r15
movq 0x10(%r14), %rsi
movq %rax, %rdi
callq 0x4c40
movq %r15, 0x8(%r14)
movq %r15, %rdi
callq 0x4c96
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x3d54
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %r14
movq %r14, %rsi
callq 0x2200
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x64b1
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x21a0
leaq 0x1bf0(%rip), %rsi      # 0x80a8
leaq -0x40(%rbp), %rdi
callq 0x2090
testl %eax, %eax
jne 0x65cc
movq %rbx, %rdi
callq 0x3e36
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x3d54
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x2200
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x64fd
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x21a0
leaq 0x2268(%rip), %rsi      # 0x876c
leaq -0x40(%rbp), %rdi
callq 0x2090
testl %eax, %eax
jne 0x6616
movq %rbx, %rdi
callq 0x3e36
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6536
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x21a0
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x5a8e(%rip), %rdi      # 0xbfd8
leaq 0x229a(%rip), %rsi      # 0x87eb
movl $0x1e, %edx
callq 0x21d0
movq 0x5a76(%rip), %rdi      # 0xbfd8
callq 0x20c0
movq 0x5a6a(%rip), %rdi      # 0xbfd8
leaq 0x1ba5(%rip), %rsi      # 0x811a
callq 0x2180
jmp 0x665e
movq 0x5a52(%rip), %rdi      # 0xbfd8
leaq 0x2233(%rip), %rsi      # 0x87c0
movl $0x2a, %edx
callq 0x21d0
movq 0x5a3a(%rip), %rdi      # 0xbfd8
callq 0x20c0
movq 0x5a2e(%rip), %rdi      # 0xbfd8
leaq 0x1b69(%rip), %rsi      # 0x811a
movl $0x10, %edx
callq 0x21d0
movq 0x5a16(%rip), %rdi      # 0xbfd8
callq 0x20c0
jmp 0x665e
movq 0x5a05(%rip), %rdi      # 0xbfd8
leaq 0x21bc(%rip), %rsi      # 0x8796
movl $0x29, %edx
callq 0x21d0
movq 0x59ed(%rip), %rdi      # 0xbfd8
callq 0x20c0
movq 0x59e1(%rip), %rdi      # 0xbfd8
leaq 0x1b1c(%rip), %rsi      # 0x811a
movl $0x10, %edx
callq 0x21d0
movq 0x59c9(%rip), %rdi      # 0xbfd8
callq 0x20c0
jmp 0x665e
movq 0x59bb(%rip), %rdi      # 0xbfd8
leaq 0x214a(%rip), %rsi      # 0x876e
movl $0x27, %edx
callq 0x21d0
movq 0x59a3(%rip), %rdi      # 0xbfd8
callq 0x20c0
movq 0x5997(%rip), %rdi      # 0xbfd8
leaq 0x1ad2(%rip), %rsi      # 0x811a
movl $0x10, %edx
callq 0x21d0
movq 0x597f(%rip), %rdi      # 0xbfd8
callq 0x20c0
xorl %edi, %edi
callq 0x21f0
jmp 0x6687
jmp 0x6687
movq %rax, %rbx
movl $0x18, %esi
jmp 0x667d
jmp 0x6687
movq %rax, %rbx
movl $0x20, %esi
movq %r15, %rdi
callq 0x21a0
jmp 0x668a
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x66a3
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x22b0
nop