// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
cmpq $0x0, 0x8(%rsi)
je 0x5247d
movq %rsi, %r12
movq 0x158(%rdi), %r13
movq (%rsi), %r15
leaq -0x78(%rbp), %r14
movb $0x1, %r8b
xorl %ebx, %ebx
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movb (%r15), %al
movzbl %al, %ecx
leal -0x20(%rcx), %edx
cmpl $0x9, %edx
ja 0x5228c
leaq 0x1ab04(%rip), %rsi     # 0x6cd68
movslq (%rsi,%rdx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movslq %ebx, %rax
movb $0x0, -0x110(%rbp,%rax)
cmpl $0xa, (%r13)
je 0x522b4
movl $0x9, (%r13)
jmp 0x52403
cmpl $0x3d, %ecx
je 0x523dc
cmpl $0x7c, %ecx
jne 0x52323
movslq %ebx, %rax
movb $0x0, -0x110(%rbp,%rax)
cmpl $0x9, (%r13)
jne 0x523fb
movl $0x58, %edi
callq 0x94c0
movq -0x30(%rbp), %rdi
movq %rax, %r12
movb 0x33(%rdi), %al
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r12)
movups %xmm0, 0x28(%r12)
movq %rdi, 0x38(%r12)
movl $0x9, (%r12)
movl $0x0, 0x40(%r12)
movups %xmm0, 0x8(%r12)
movss 0x1aacd(%rip), %xmm0    # 0x6cdc8
movups %xmm0, 0x44(%r12)
movb %al, 0x54(%r12)
movq %r12, 0x30(%r13)
cmpq 0x158(%rdi), %r13
jne 0x52406
movq %r12, 0x158(%rdi)
jmp 0x52406
movslq %ebx, %rcx
incl %ebx
testb $0x1, %r8b
je 0x523ef
movb %al, -0x190(%rbp,%rcx)
movb $0x1, %r8b
jmp 0x5243b
movslq %ebx, %rax
movb $0x0, -0x110(%rbp,%rax)
testl %ebx, %ebx
je 0x5236e
movq -0x30(%rbp), %rdi
movq %r13, %rsi
leaq -0x190(%rbp), %rdx
leaq -0x110(%rbp), %rcx
callq 0x524ae
movq -0x30(%rbp), %rdi
movq 0x30(%r13), %r13
movb $0x1, %r8b
jmp 0x523eb
movl %r8d, %r12d
movb 0x33(%rdi), %al
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movq %rdi, -0x58(%rbp)
xorl %ecx, %ecx
movl %ecx, -0x90(%rbp)
movups %xmm0, -0x10(%r14)
movsd 0x1a8cb(%rip), %xmm0    # 0x6cc70
movups %xmm0, -0x50(%rbp)
movl %ecx, -0x40(%rbp)
movb %al, -0x3c(%rbp)
movq %r13, -0x60(%rbp)
leaq 0x18(%r13), %rdi
leaq -0x90(%rbp), %rsi
callq 0x53070
movq 0x20(%r13), %r13
addq $-0x58, %r13
movq %r14, %rdi
callq 0x53018
movq -0x30(%rbp), %rdi
movl %r12d, %r8d
jmp 0x52437
movslq %ebx, %rax
movb $0x0, -0x190(%rbp,%rax)
xorb $0x1, %r8b
xorl %ebx, %ebx
jmp 0x5243b
movb %al, -0x110(%rbp,%rcx)
xorl %r8d, %r8d
jmp 0x5243b
movl $0xa, (%r13)
movq %r13, %r12
movb $0x1, %r8b
testl %ebx, %ebx
je 0x5242e
movq -0x30(%rbp), %rdi
movq %r12, %rsi
leaq -0x190(%rbp), %rdx
leaq -0x110(%rbp), %rcx
callq 0x524ae
movb $0x1, %r8b
movq -0x30(%rbp), %rdi
xorl %ebx, %ebx
movq %r12, %r13
leaq -0x78(%rbp), %r14
movq -0x38(%rbp), %r12
incq %r15
movq (%r12), %rax
addq 0x8(%r12), %rax
cmpq %rax, %r15
jne 0x5224f
testl %ebx, %ebx
je 0x5247d
movslq %ebx, %rax
movb $0x0, -0x110(%rbp,%rax)
leaq -0x190(%rbp), %rdx
leaq -0x110(%rbp), %rcx
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0x524ae
movq -0x30(%rbp), %rdi
movq 0x158(%rdi), %rdi
callq 0x51fb8
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x53018
movq %rbx, %rdi
callq 0x98b0