// File: /workspace/github_cpp_makefile_star2_O3/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 0x3c70
movq %rax, %rbx
leaq -0x40(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x3cc4
leaq 0x1d80(%rip), %rsi      # 0x80b0
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
jne 0x64a3
movq %rbx, %rdi
callq 0x3da6
movl $0x20, %edi
callq 0x2190
movq %rax, %r15
movq %rax, %rdi
callq 0x70d0
movq %r15, (%r14)
movq %r15, %rdi
callq 0x72bc
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x3cc4
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %r15
movq %r15, %rsi
callq 0x2200
movq (%r15), %rdi
leaq -0x50(%rbp), %r12
cmpq %r12, %rdi
je 0x639c
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x21a0
leaq 0x23bf(%rip), %rsi      # 0x8762
leaq -0x40(%rbp), %rdi
callq 0x2090
testl %eax, %eax
jne 0x64df
movq %rbx, %rdi
callq 0x3da6
movl $0x18, %edi
callq 0x2190
movq %rax, %r15
movq 0x10(%r14), %rsi
movq %rax, %rdi
callq 0x4b80
movq %r15, 0x8(%r14)
movq %r15, %rdi
callq 0x4bd6
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x3cc4
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %r14
movq %r14, %rsi
callq 0x2200
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x6411
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x21a0
leaq 0x1c90(%rip), %rsi      # 0x80a8
leaq -0x40(%rbp), %rdi
callq 0x2090
testl %eax, %eax
jne 0x652c
movq %rbx, %rdi
callq 0x3da6
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x3cc4
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x2200
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x645d
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x21a0
leaq 0x2306(%rip), %rsi      # 0x876a
leaq -0x40(%rbp), %rdi
callq 0x2090
testl %eax, %eax
jne 0x6576
movq %rbx, %rdi
callq 0x3da6
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6496
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x21a0
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x5b2e(%rip), %rdi      # 0xbfd8
leaq 0x2338(%rip), %rsi      # 0x87e9
movl $0x1e, %edx
callq 0x21d0
movq 0x5b16(%rip), %rdi      # 0xbfd8
callq 0x20c0
movq 0x5b0a(%rip), %rdi      # 0xbfd8
leaq 0x1c45(%rip), %rsi      # 0x811a
callq 0x2180
jmp 0x65be
movq 0x5af2(%rip), %rdi      # 0xbfd8
leaq 0x22d1(%rip), %rsi      # 0x87be
movl $0x2a, %edx
callq 0x21d0
movq 0x5ada(%rip), %rdi      # 0xbfd8
callq 0x20c0
movq 0x5ace(%rip), %rdi      # 0xbfd8
leaq 0x1c09(%rip), %rsi      # 0x811a
movl $0x10, %edx
callq 0x21d0
movq 0x5ab6(%rip), %rdi      # 0xbfd8
callq 0x20c0
jmp 0x65be
movq 0x5aa5(%rip), %rdi      # 0xbfd8
leaq 0x225a(%rip), %rsi      # 0x8794
movl $0x29, %edx
callq 0x21d0
movq 0x5a8d(%rip), %rdi      # 0xbfd8
callq 0x20c0
movq 0x5a81(%rip), %rdi      # 0xbfd8
leaq 0x1bbc(%rip), %rsi      # 0x811a
movl $0x10, %edx
callq 0x21d0
movq 0x5a69(%rip), %rdi      # 0xbfd8
callq 0x20c0
jmp 0x65be
movq 0x5a5b(%rip), %rdi      # 0xbfd8
leaq 0x21e8(%rip), %rsi      # 0x876c
movl $0x27, %edx
callq 0x21d0
movq 0x5a43(%rip), %rdi      # 0xbfd8
callq 0x20c0
movq 0x5a37(%rip), %rdi      # 0xbfd8
leaq 0x1b72(%rip), %rsi      # 0x811a
movl $0x10, %edx
callq 0x21d0
movq 0x5a1f(%rip), %rdi      # 0xbfd8
callq 0x20c0
xorl %edi, %edi
callq 0x21f0
jmp 0x65e7
jmp 0x65e7
movq %rax, %rbx
movl $0x18, %esi
jmp 0x65dd
jmp 0x65e7
movq %rax, %rbx
movl $0x20, %esi
movq %r15, %rdi
callq 0x21a0
jmp 0x65ea
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6603
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x22a0
nop