// File: smallsimple[P]CoreInterpreter-CSE5341/Ifc.cpp
// Function: Ifc::ParseIfc()
void Ifc::ParseIfc(){
  Tokenizer *tokensIfc;
  tokensIfc = Tokenizer::getInstance();
  string tokenTemp = tokensIfc->getToken();
  if (tokenTemp.compare("if") == 0){
    tokensIfc->skipToken();
    cond = new Cond();
    cond->ParseCond();
    tokenTemp = tokensIfc->getToken();
    if (tokenTemp.compare("then") == 0){
      tokensIfc->skipToken();
      stmtSeq1 = new StmtSeq(infile);
      stmtSeq1->ParseStmtSeq();
      tokenTemp = tokensIfc->getToken();
      if (tokenTemp.compare("end") == 0){
	tokensIfc->skipToken();
	tokenTemp = tokensIfc->getToken();
	if (tokenTemp.compare(";") == 0){
	  tokensIfc->skipToken();
	  return;
	}
	else{
	  cout << "Syntax Error: ParseIfc: \";\" not found or not in the right place." << endl;
	  cout << "program stopped." << endl;
	  exit(0);
	}
      }
      else if (tokenTemp.compare("else") == 0){
	tokensIfc->skipToken();
	stmtSeq2 = new StmtSeq(infile);
	stmtSeq2->ParseStmtSeq();
	tokenTemp = tokensIfc->getToken();
	if (tokenTemp.compare("end") == 0){
	  tokensIfc->skipToken();
	  tokenTemp = tokensIfc->getToken();
	  if (tokenTemp.compare(";") == 0){
	    tokensIfc->skipToken();
	    return;
	  }
	  else {
	    cout << "Syntax Error: ParseIfc: \";\" not found or not in the right place." << endl;
	    cout << "program stopped." << endl;
	    exit(0);
	  }
	}
	else{
	    cout << "Syntax Error: ParseIfc: \";\" not found or not in the right place." << endl;
	    cout << "program stopped." << endl;
	    exit(0);
	}
      }
      else {
	cout << "Syntax Error: ParseIfc: no \"end\" or \"else\" is found" << endl;
	cout << "program stopped." << endl;
	exit(0);
      }
    }
  }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xf0(%rbp)
callq 0x48d0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x4940
leaq -0x30(%rbp), %rdi
leaq 0x2145(%rip), %rsi      # 0xc0b0
callq 0x2090
cmpl $0x0, %eax
jne 0xa431
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0x9f84
movl $0x20, %edi
callq 0x21e0
movq %rax, -0xf8(%rbp)
jmp 0x9f97
movq -0xf8(%rbp), %rdi
callq 0xa460
jmp 0x9fa5
movq -0xf0(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, (%rax)
movq (%rax), %rdi
callq 0xa750
jmp 0x9fc0
movq -0x10(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x4940
jmp 0x9fcf
leaq -0x30(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x2290
leaq -0x60(%rbp), %rdi
callq 0x2110
leaq -0x30(%rbp), %rdi
leaq 0x28d1(%rip), %rsi      # 0xc8c1
callq 0x2090
cmpl $0x0, %eax
jne 0xa42f
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xa009
movl $0x18, %edi
callq 0x21e0
movq %rax, -0x100(%rbp)
jmp 0xa01c
movq -0x100(%rbp), %rdi
movq -0xf0(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x72b0
jmp 0xa035
movq -0xf0(%rbp), %rax
movq -0x100(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rdi
callq 0x7370
jmp 0xa052
movq -0x10(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x4940
jmp 0xa061
leaq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x2290
leaq -0x80(%rbp), %rdi
callq 0x2110
leaq -0x30(%rbp), %rdi
leaq 0x2026(%rip), %rsi      # 0xc0a8
callq 0x2090
cmpl $0x0, %eax
jne 0xa1b6
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xa09b
movq -0x10(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x4940
jmp 0xa0ad
leaq -0x30(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2290
leaq -0xa0(%rbp), %rdi
callq 0x2110
leaq -0x30(%rbp), %rdi
leaq 0x2654(%rip), %rsi      # 0xc728
callq 0x2090
cmpl $0x0, %eax
jne 0xa14d
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xa0e9
movl $0x1, -0xa4(%rbp)
jmp 0xa43b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa44d
movq -0xf8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x20, %esi
callq 0x21f0
jmp 0xa44d
movq -0x100(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x18, %esi
callq 0x21f0
jmp 0xa44d
movq 0x6e84(%rip), %rdi      # 0x10fd8
leaq 0x276b(%rip), %rsi      # 0xc8c6
callq 0x21d0
movq %rax, -0x108(%rbp)
jmp 0xa169
movq -0x108(%rbp), %rdi
movq 0x6e51(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xa17e
movq 0x6e53(%rip), %rdi      # 0x10fd8
leaq 0x1fba(%rip), %rsi      # 0xc146
callq 0x21d0
movq %rax, -0x110(%rbp)
jmp 0xa19a
movq -0x110(%rbp), %rdi
movq 0x6e20(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xa1af
xorl %edi, %edi
callq 0x2280
leaq -0x30(%rbp), %rdi
leaq 0x1ef2(%rip), %rsi      # 0xc0b3
callq 0x2090
cmpl $0x0, %eax
jne 0xa3c6
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xa1da
movl $0x18, %edi
callq 0x21e0
movq %rax, -0x118(%rbp)
jmp 0xa1ed
movq -0x118(%rbp), %rdi
movq -0xf0(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x72b0
jmp 0xa206
movq -0xf0(%rbp), %rax
movq -0x118(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq 0x10(%rax), %rdi
callq 0x7370
jmp 0xa223
movq -0x10(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x4940
jmp 0xa235
leaq -0x30(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x2290
leaq -0xc8(%rbp), %rdi
callq 0x2110
leaq -0x30(%rbp), %rdi
leaq 0x1e4c(%rip), %rsi      # 0xc0a8
callq 0x2090
cmpl $0x0, %eax
jne 0xa35d
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xa275
movq -0x10(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x4940
jmp 0xa287
leaq -0x30(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x2290
leaq -0xe8(%rbp), %rdi
callq 0x2110
leaq -0x30(%rbp), %rdi
leaq 0x247a(%rip), %rsi      # 0xc728
callq 0x2090
cmpl $0x0, %eax
jne 0xa2f4
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xa2c3
movl $0x1, -0xa4(%rbp)
jmp 0xa43b
movq -0x118(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x18, %esi
callq 0x21f0
jmp 0xa44d
movq 0x6cdd(%rip), %rdi      # 0x10fd8
leaq 0x25c4(%rip), %rsi      # 0xc8c6
callq 0x21d0
movq %rax, -0x120(%rbp)
jmp 0xa310
movq -0x120(%rbp), %rdi
movq 0x6caa(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xa325
movq 0x6cac(%rip), %rdi      # 0x10fd8
leaq 0x1e13(%rip), %rsi      # 0xc146
callq 0x21d0
movq %rax, -0x128(%rbp)
jmp 0xa341
movq -0x128(%rbp), %rdi
movq 0x6c79(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xa356
xorl %edi, %edi
callq 0x2280
movq 0x6c74(%rip), %rdi      # 0x10fd8
leaq 0x255b(%rip), %rsi      # 0xc8c6
callq 0x21d0
movq %rax, -0x130(%rbp)
jmp 0xa379
movq -0x130(%rbp), %rdi
movq 0x6c41(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xa38e
movq 0x6c43(%rip), %rdi      # 0x10fd8
leaq 0x1daa(%rip), %rsi      # 0xc146
callq 0x21d0
movq %rax, -0x138(%rbp)
jmp 0xa3aa
movq -0x138(%rbp), %rdi
movq 0x6c10(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xa3bf
xorl %edi, %edi
callq 0x2280
movq 0x6c0b(%rip), %rdi      # 0x10fd8
leaq 0x2533(%rip), %rsi      # 0xc907
callq 0x21d0
movq %rax, -0x140(%rbp)
jmp 0xa3e2
movq -0x140(%rbp), %rdi
movq 0x6bd8(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xa3f7
movq 0x6bda(%rip), %rdi      # 0x10fd8
leaq 0x1d41(%rip), %rsi      # 0xc146
callq 0x21d0
movq %rax, -0x148(%rbp)
jmp 0xa413
movq -0x148(%rbp), %rdi
movq 0x6ba7(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xa428
xorl %edi, %edi
callq 0x2280
jmp 0xa431
movl $0x0, -0xa4(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2110
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x2110
movq -0x38(%rbp), %rdi
callq 0x2370
nop