// File: /workspace/github_cpp_makefile_star2_O1/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 $0x178, %rsp            # imm = 0x178
movq 0x158(%rdi), %r13
cmpq $0x0, 0x8(%rsi)
movq %rdi, -0x30(%rbp)
je 0x53ba5
movq (%rsi), %r15
leaq -0x80(%rbp), %r14
movb $0x1, %r9b
movq %r13, %r12
xorl %ebx, %ebx
movq %rsi, -0x38(%rbp)
movb (%r15), %al
movzbl %al, %ecx
leal -0x20(%rcx), %edx
cmpl $0x9, %edx
ja 0x539ce
leaq 0x1b3f2(%rip), %r8      # 0x6ed98
movslq (%r8,%rdx,4), %rcx
addq %r8, %rcx
jmpq *%rcx
movslq %ebx, %rax
movb $0x0, -0x120(%rbp,%rax)
cmpl $0xa, (%r12)
je 0x539f6
movl $0x9, (%r12)
jmp 0x53b58
cmpl $0x3d, %ecx
je 0x53b31
cmpl $0x7c, %ecx
jne 0x53a63
movslq %ebx, %rax
movb $0x0, -0x120(%rbp,%rax)
cmpl $0x9, (%r12)
jne 0x53b50
movl $0x58, %edi
callq 0x94c0
movq -0x30(%rbp), %rdi
movq %rax, %r13
movb 0x33(%rdi), %al
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r13)
movups %xmm0, 0x28(%r13)
movq %rdi, 0x38(%r13)
movl $0x9, (%r13)
movl $0x0, 0x40(%r13)
movups %xmm0, 0x8(%r13)
movss 0x1b3c0(%rip), %xmm0    # 0x6edf8
movups %xmm0, 0x44(%r13)
movb %al, 0x54(%r13)
movq %r13, 0x30(%r12)
cmpq 0x158(%rdi), %r12
jne 0x53a56
movq %r13, 0x158(%rdi)
leaq -0x80(%rbp), %r14
movq -0x38(%rbp), %rsi
jmp 0x53b5b
movslq %ebx, %rcx
incl %ebx
testb $0x1, %r9b
je 0x53b44
movb %al, -0x1a0(%rbp,%rcx)
jmp 0x53b4b
movslq %ebx, %rax
movb $0x0, -0x120(%rbp,%rax)
testl %ebx, %ebx
je 0x53ab3
movq -0x30(%rbp), %rdi
movq %r12, %rsi
leaq -0x1a0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
callq 0x53c06
movq -0x38(%rbp), %rsi
leaq -0x80(%rbp), %r14
movq -0x30(%rbp), %rdi
movq 0x30(%r12), %r13
movb $0x1, %r9b
jmp 0x53b8b
movl %ebx, -0x3c(%rbp)
movl %r9d, %ebx
movb 0x33(%rdi), %al
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movq %rdi, -0x60(%rbp)
xorl %ecx, %ecx
movl %ecx, -0x98(%rbp)
movups %xmm0, -0x10(%r14)
movq %r12, -0x68(%rbp)
movsd 0x1b1ab(%rip), %xmm0    # 0x6eca0
movups %xmm0, -0x58(%rbp)
movl %ecx, -0x48(%rbp)
movb %al, -0x44(%rbp)
leaq 0x18(%r12), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5485c
movq 0x20(%r12), %r13
addq $-0x58, %r13
movq %r14, %rdi
callq 0x5480a
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl %ebx, %r9d
movl -0x3c(%rbp), %ebx
jmp 0x53b8d
movslq %ebx, %rax
movb $0x0, -0x1a0(%rbp,%rax)
xorb $0x1, %r9b
xorl %ebx, %ebx
jmp 0x53b4b
movb %al, -0x120(%rbp,%rcx)
movq %r12, %r13
jmp 0x53b8d
movl $0xa, (%r12)
movq %r12, %r13
movb $0x1, %r9b
testl %ebx, %ebx
je 0x53b8b
movq -0x30(%rbp), %rdi
movq %r13, %rsi
leaq -0x1a0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
callq 0x53c06
movb $0x1, %r9b
movq -0x38(%rbp), %rsi
leaq -0x80(%rbp), %r14
movq -0x30(%rbp), %rdi
xorl %ebx, %ebx
incq %r15
movq (%rsi), %rax
addq 0x8(%rsi), %rax
movq %r13, %r12
cmpq %rax, %r15
jne 0x53991
jmp 0x53ba7
xorl %ebx, %ebx
testl %ebx, %ebx
je 0x53bd4
movslq %ebx, %rax
movb $0x0, -0x120(%rbp,%rax)
leaq -0x1a0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0x53c06
movq -0x30(%rbp), %rdi
movq 0x158(%rdi), %rdi
callq 0x536ee
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x5480a
movq %rbx, %rdi
callq 0x98b0
nop