// File: smallsimple[P]CoreInterpreter-CSE5341/Cond.cpp
// Function: Cond::ParseCond()
void Cond::ParseCond(){
  Tokenizer *tokensCond;
  tokensCond = Tokenizer::getInstance();
  string tokenTemp = tokensCond->getToken();
  if (tokenTemp.compare("(") == 0){
    alterId = 1;
    comp = new Comp();
    comp->ParseComp();
  }
  else if (tokenTemp.compare("!") == 0){
    alterId = 2;
    tokensCond->skipToken();
    cond1 = new Cond();
    cond1->ParseCond();
  }
  else if (tokenTemp.compare("[") == 0){
    tokensCond->skipToken();
    cond1 = new Cond();
    cond2 = new Cond();
    cond1->ParseCond();
    tokenTemp = tokensCond->getToken();
    if (tokenTemp.compare("&&") == 0){
      alterId = 3;
      tokensCond->skipToken();
      cond2->ParseCond();
      tokenTemp = tokensCond->getToken();
      if (tokenTemp.compare("]") == 0){
	tokensCond->skipToken();
	return;
      }
      else {
	cout << "Error: ParseCond: \"]\" not found!" << endl;
	cout << "program stopped." << endl;
	exit(0);
      }
    }
    else if (tokenTemp.compare("||") == 0){
      alterId = 4;
      tokensCond->skipToken();
      cond2->ParseCond();
      tokenTemp = tokensCond->getToken();
      if (tokenTemp.compare("]") == 0){
	tokensCond->skipToken();
	return;
      }
      else {
	cout << "Error: ParseCond: \"]\" not found!" << endl;
	cout << "program stopped." << endl;
	exit(0);
      }
    }
    else {
      cout << "Syntax Error: <cond> is not right!" << endl;
      cout << "program stopped." << endl;
      exit(0);
    }
    
  } 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
callq 0x48d0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x4940
leaq -0x30(%rbp), %rdi
leaq 0x1948(%rip), %rsi      # 0xc0d3
callq 0x2090
cmpl $0x0, %eax
jne 0xa81b
movq -0xb0(%rbp), %rax
movl $0x1, 0x18(%rax)
movl $0x18, %edi
callq 0x21e0
movq %rax, -0xb8(%rbp)
jmp 0xa7ba
movq -0xb8(%rbp), %rdi
callq 0xac60
jmp 0xa7c8
movq -0xb0(%rbp), %rax
movq -0xb8(%rbp), %rcx
movq %rcx, (%rax)
movq (%rax), %rdi
callq 0xaff0
jmp 0xa7e3
jmp 0xac24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xac40
movq -0xb8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x18, %esi
callq 0x21f0
jmp 0xac40
leaq -0x30(%rbp), %rdi
leaq 0x18c9(%rip), %rsi      # 0xc0ef
callq 0x2090
cmpl $0x0, %eax
jne 0xa8ae
movq -0xb0(%rbp), %rax
movl $0x2, 0x18(%rax)
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xa849
movl $0x20, %edi
callq 0x21e0
movq %rax, -0xc0(%rbp)
jmp 0xa85c
movq -0xc0(%rbp), %rdi
callq 0xa460
jmp 0xa86a
movq -0xb0(%rbp), %rax
movq -0xc0(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rdi
callq 0xa750
jmp 0xa887
jmp 0xac22
movq -0xc0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x20, %esi
callq 0x21f0
jmp 0xac40
leaq -0x30(%rbp), %rdi
leaq 0x1812(%rip), %rsi      # 0xc0cb
callq 0x2090
cmpl $0x0, %eax
jne 0xac20
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xa8d2
movl $0x20, %edi
callq 0x21e0
movq %rax, -0xc8(%rbp)
jmp 0xa8e5
movq -0xc8(%rbp), %rdi
callq 0xa460
jmp 0xa8f3
movq -0xb0(%rbp), %rax
movq -0xc8(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x20, %edi
callq 0x21e0
movq %rax, -0xd0(%rbp)
jmp 0xa918
movq -0xd0(%rbp), %rdi
callq 0xa460
jmp 0xa926
movq -0xb0(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq 0x8(%rax), %rdi
callq 0xa750
jmp 0xa943
movq -0x10(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x4940
jmp 0xa952
leaq -0x30(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x2290
leaq -0x60(%rbp), %rdi
callq 0x2110
leaq -0x30(%rbp), %rdi
leaq 0x175a(%rip), %rsi      # 0xc0cd
callq 0x2090
cmpl $0x0, %eax
jne 0xaaad
movq -0xb0(%rbp), %rax
movl $0x3, 0x18(%rax)
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xa99a
movq -0xb0(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xa750
jmp 0xa9ac
movq -0x10(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x4940
jmp 0xa9bb
leaq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x2290
leaq -0x80(%rbp), %rdi
callq 0x2110
leaq -0x30(%rbp), %rdi
leaq 0x1f68(%rip), %rsi      # 0xc944
callq 0x2090
cmpl $0x0, %eax
jne 0xaa44
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xa9f1
movl $0x1, -0x84(%rbp)
jmp 0xac2e
movq -0xc8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x20, %esi
callq 0x21f0
jmp 0xac40
movq -0xd0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x20, %esi
callq 0x21f0
jmp 0xac40
movq 0x658d(%rip), %rdi      # 0x10fd8
leaq 0x1f41(%rip), %rsi      # 0xc993
callq 0x21d0
movq %rax, -0xd8(%rbp)
jmp 0xaa60
movq -0xd8(%rbp), %rdi
movq 0x655a(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xaa75
movq 0x655c(%rip), %rdi      # 0x10fd8
leaq 0x16c3(%rip), %rsi      # 0xc146
callq 0x21d0
movq %rax, -0xe0(%rbp)
jmp 0xaa91
movq -0xe0(%rbp), %rdi
movq 0x6529(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xaaa6
xorl %edi, %edi
callq 0x2280
leaq -0x30(%rbp), %rdi
leaq 0x1618(%rip), %rsi      # 0xc0d0
callq 0x2090
cmpl $0x0, %eax
jne 0xabb7
movq -0xb0(%rbp), %rax
movl $0x4, 0x18(%rax)
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xaadf
movq -0xb0(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xa750
jmp 0xaaf1
movq -0x10(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x4940
jmp 0xab03
leaq -0x30(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x2290
leaq -0xa8(%rbp), %rdi
callq 0x2110
leaq -0x30(%rbp), %rdi
leaq 0x1e1a(%rip), %rsi      # 0xc944
callq 0x2090
cmpl $0x0, %eax
jne 0xab4e
movq -0x10(%rbp), %rdi
callq 0x49c0
jmp 0xab3f
movl $0x1, -0x84(%rbp)
jmp 0xac2e
movq 0x6483(%rip), %rdi      # 0x10fd8
leaq 0x1e37(%rip), %rsi      # 0xc993
callq 0x21d0
movq %rax, -0xe8(%rbp)
jmp 0xab6a
movq -0xe8(%rbp), %rdi
movq 0x6450(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xab7f
movq 0x6452(%rip), %rdi      # 0x10fd8
leaq 0x15b9(%rip), %rsi      # 0xc146
callq 0x21d0
movq %rax, -0xf0(%rbp)
jmp 0xab9b
movq -0xf0(%rbp), %rdi
movq 0x641f(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xabb0
xorl %edi, %edi
callq 0x2280
movq 0x641a(%rip), %rdi      # 0x10fd8
leaq 0x1def(%rip), %rsi      # 0xc9b4
callq 0x21d0
movq %rax, -0xf8(%rbp)
jmp 0xabd3
movq -0xf8(%rbp), %rdi
movq 0x63e7(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xabe8
movq 0x63e9(%rip), %rdi      # 0x10fd8
leaq 0x1550(%rip), %rsi      # 0xc146
callq 0x21d0
movq %rax, -0x100(%rbp)
jmp 0xac04
movq -0x100(%rbp), %rdi
movq 0x63b6(%rip), %rsi      # 0x10fc8
callq 0x2210
jmp 0xac19
xorl %edi, %edi
callq 0x2280
jmp 0xac22
jmp 0xac24
movl $0x0, -0x84(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2110
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x2110
movq -0x38(%rbp), %rdi
callq 0x2370
nopw %cs:(%rax,%rax)
nopl (%rax)