// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/Trainer.cpp
// Function: Trainer::ParseCondition(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Trainer::ParseCondition(const std::string &content) {
  Trainer::Condition *nowCondition = mpEndCondition; //当前条件层
  bool beforeEquator = true;
  int n = 0;
  char name[128];
  char buffer[128];

  for (std::string::const_iterator it = content.begin(); it != content.end();
       it++) {
    switch (*it) {
    case '(':
      nowCondition = nowCondition->AddSubCondition(
          Condition(this, ET_Null, 0, 0, nowCondition, mConverse));
      break;
    case ')':
      buffer[n] = 0;
      if (n != 0)
        AddCondition(nowCondition, name, buffer);
      nowCondition = nowCondition->GetSuperCondition();
      beforeEquator = true;
      n = 0;
      break;
    case '&':
      buffer[n] = 0;
      if (nowCondition->GetConditionType() == ET_ORComplex) {
        Trainer::Condition *tmp;
        nowCondition->SetSuperCondition(
            new Trainer::Condition(this, ET_ANDComplex, 0, 0, 0, mConverse));
        tmp = nowCondition->GetSuperCondition();
        if (nowCondition == mpEndCondition) {
          mpEndCondition = tmp;
        }
        nowCondition = tmp;
        tmp = NULL;
      } else {
        nowCondition->SetConditionType(ET_ANDComplex);
      }
      if (n != 0)
        AddCondition(nowCondition, name, buffer);
      beforeEquator = true;
      n = 0;
      break;
    case '|':
      buffer[n] = 0;
      if (nowCondition->GetConditionType() ==
          ET_ANDComplex) //如果发生冲突，降一级
      {
        Trainer::Condition *tmp;
        nowCondition->SetSuperCondition(
            new Trainer::Condition(this, ET_ANDComplex, 0, 0, 0, mConverse));
        tmp = nowCondition->GetSuperCondition();
        if (nowCondition == mpEndCondition) {
          mpEndCondition = tmp;
        }
        nowCondition = tmp;
        tmp = NULL;
      } else {
        nowCondition->SetConditionType(ET_ORComplex);
      }
      if (n != 0)
        AddCondition(nowCondition, name, buffer);
      beforeEquator = true;
      n = 0;
      break;
    case '=':
      name[n] = 0;
      beforeEquator = !beforeEquator;
      n = 0;
      break;
    case ' ': //跳过空格
      break;
    default:
      if (beforeEquator) {
        name[n++] = *it;
      } else {
        buffer[n++] = *it;
      }
      break;
    }
  }
  if (n != 0) {
    buffer[n] = 0;
    AddCondition(nowCondition, name, buffer);
  }
  mpEndCondition->OptimizeConditionTree();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq 0x158(%rax), %rax
movq %rax, -0x18(%rbp)
movb $0x1, -0x19(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa550
movq %rax, -0x128(%rbp)
movq -0x10(%rbp), %rdi
callq 0xab40
movq %rax, -0x130(%rbp)
leaq -0x128(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x989e0
testb $0x1, %al
jne 0x96b90
jmp 0x96fd6
leaq -0x128(%rbp), %rdi
callq 0x98a20
movsbl (%rax), %eax
movl %eax, -0x1bc(%rbp)
subl $0x20, %eax
je 0x96f6a
jmp 0x96bb0
movl -0x1bc(%rbp), %eax
subl $0x26, %eax
je 0x96ce2
jmp 0x96bc1
movl -0x1bc(%rbp), %eax
subl $0x28, %eax
je 0x96c04
jmp 0x96bce
movl -0x1bc(%rbp), %eax
subl $0x29, %eax
je 0x96c95
jmp 0x96bdf
movl -0x1bc(%rbp), %eax
subl $0x3d, %eax
je 0x96f4b
jmp 0x96bf0
movl -0x1bc(%rbp), %eax
subl $0x7c, %eax
je 0x96e18
jmp 0x96f6c
movq -0x1b8(%rbp), %rsi
movq -0x18(%rbp), %rcx
movq %rcx, -0x1d8(%rbp)
movzbl 0x33(%rsi), %r8d
andl $0x1, %r8d
leaq -0x188(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
xorl %edx, %edx
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x97a10
movq -0x1d8(%rbp), %rdi
movq -0x1d0(%rbp), %rsi
callq 0x98a40
movq %rax, -0x1c8(%rbp)
jmp 0x96c56
movq -0x1c8(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x97c30
jmp 0x96fba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x190(%rbp)
movl %eax, -0x194(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x97c30
jmp 0x97022
movslq -0x20(%rbp), %rax
movb $0x0, -0x120(%rbp,%rax)
cmpl $0x0, -0x20(%rbp)
je 0x96cc5
movq -0x1b8(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
callq 0x97030
movq -0x18(%rbp), %rdi
callq 0x98a90
movq %rax, -0x18(%rbp)
movb $0x1, -0x19(%rbp)
movl $0x0, -0x20(%rbp)
jmp 0x96fba
movslq -0x20(%rbp), %rax
movb $0x0, -0x120(%rbp,%rax)
movq -0x18(%rbp), %rdi
callq 0x98ab0
cmpl $0xa, %eax
jne 0x96dd6
movq -0x18(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movl $0x58, %edi
callq 0xa5c0
movq -0x1b8(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x1e0(%rbp)
movzbl 0x33(%rsi), %r8d
andl $0x1, %r8d
xorl %eax, %eax
movl %eax, %ecx
movl $0x9, %edx
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x97a10
jmp 0x96d48
movq -0x1e0(%rbp), %rsi
movq -0x1e8(%rbp), %rdi
callq 0x98ac0
movq -0x18(%rbp), %rdi
callq 0x98a90
movq -0x1b8(%rbp), %rcx
movq %rax, -0x1a0(%rbp)
movq -0x18(%rbp), %rax
cmpq 0x158(%rcx), %rax
jne 0x96dbe
movq -0x1b8(%rbp), %rax
movq -0x1a0(%rbp), %rcx
movq %rcx, 0x158(%rax)
jmp 0x96dbe
movq -0x1e0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x190(%rbp)
movl %eax, -0x194(%rbp)
movl $0x58, %esi
callq 0xa5e0
jmp 0x97022
movq -0x1a0(%rbp), %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x1a0(%rbp)
jmp 0x96de4
movq -0x18(%rbp), %rdi
movl $0x9, %esi
callq 0x98ae0
cmpl $0x0, -0x20(%rbp)
je 0x96e08
movq -0x1b8(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
callq 0x97030
movb $0x1, -0x19(%rbp)
movl $0x0, -0x20(%rbp)
jmp 0x96fba
movslq -0x20(%rbp), %rax
movb $0x0, -0x120(%rbp,%rax)
movq -0x18(%rbp), %rdi
callq 0x98ab0
cmpl $0x9, %eax
jne 0x96f0c
movq -0x18(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movl $0x58, %edi
callq 0xa5c0
movq -0x1b8(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x1f0(%rbp)
movzbl 0x33(%rsi), %r8d
andl $0x1, %r8d
xorl %eax, %eax
movl %eax, %ecx
movl $0x9, %edx
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x97a10
jmp 0x96e7e
movq -0x1f0(%rbp), %rsi
movq -0x1f8(%rbp), %rdi
callq 0x98ac0
movq -0x18(%rbp), %rdi
callq 0x98a90
movq -0x1b8(%rbp), %rcx
movq %rax, -0x1a8(%rbp)
movq -0x18(%rbp), %rax
cmpq 0x158(%rcx), %rax
jne 0x96ef4
movq -0x1b8(%rbp), %rax
movq -0x1a8(%rbp), %rcx
movq %rcx, 0x158(%rax)
jmp 0x96ef4
movq -0x1f0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x190(%rbp)
movl %eax, -0x194(%rbp)
movl $0x58, %esi
callq 0xa5e0
jmp 0x97022
movq -0x1a8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x1a8(%rbp)
jmp 0x96f1a
movq -0x18(%rbp), %rdi
movl $0xa, %esi
callq 0x98ae0
cmpl $0x0, -0x20(%rbp)
je 0x96f3e
movq -0x1b8(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
callq 0x97030
movb $0x1, -0x19(%rbp)
movl $0x0, -0x20(%rbp)
jmp 0x96fba
movslq -0x20(%rbp), %rax
movb $0x0, -0xa0(%rbp,%rax)
movb -0x19(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x19(%rbp)
movl $0x0, -0x20(%rbp)
jmp 0x96fba
jmp 0x96fba
testb $0x1, -0x19(%rbp)
je 0x96f96
leaq -0x128(%rbp), %rdi
callq 0x98a20
movb (%rax), %cl
movl -0x20(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
cltq
movb %cl, -0xa0(%rbp,%rax)
jmp 0x96fb8
leaq -0x128(%rbp), %rdi
callq 0x98a20
movb (%rax), %cl
movl -0x20(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
cltq
movb %cl, -0x120(%rbp,%rax)
jmp 0x96fba
jmp 0x96fbc
leaq -0x128(%rbp), %rdi
xorl %esi, %esi
callq 0x98b00
movq %rax, -0x1b0(%rbp)
jmp 0x96b64
cmpl $0x0, -0x20(%rbp)
je 0x97006
movq -0x1b8(%rbp), %rdi
movslq -0x20(%rbp), %rax
movb $0x0, -0x120(%rbp,%rax)
movq -0x18(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
callq 0x97030
movq -0x1b8(%rbp), %rax
movq 0x158(%rax), %rdi
callq 0x967f0
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
movq -0x190(%rbp), %rdi
callq 0xaa60
nop