// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/symbcalc.cc
// Function: symbCalc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, float, float, float)
float symbCalc(string expresion,float x,float y,float z){
  float val=0;
  vector<string> numbers = split(expresion,"+-/*");
  
  //This will replace all x,y,z with there "value"
  for (unsigned int i=0;i<numbers.size();i++){
    if (numbers[i].compare("x")==0){
      numbers[i] = doubleToString(x);
    }
    else if (numbers[i].compare("y")==0){
      numbers[i] = doubleToString(y);
    }
    else if (numbers[i].compare("z")==0){
      numbers[i] = doubleToString(z);
    }
  }

  vector<double> nums;
  for (unsigned int i=0;i<numbers.size();i++){
    nums.push_back(convertToDouble(numbers[i]));
  }
  
  vector<string> opperator = split(expresion,"1234567890.xyz");
  
  //To get rid of the +- before the expresion
  if (opperator.size() == numbers.size()){
    if (opperator[0].compare("-")==0){
      nums[0]=-nums[0]; //negate the element
    }
    opperator.erase(opperator.begin());
  }
  
  //deal with - signs
  for (unsigned int i=0;i<opperator.size();i++){
    if (opperator[i].compare("-")==0){
      nums[i+1]=-nums[i+1]; //negate the element
    }
  }
  
  //deal with * signs
  for (unsigned int i=0;i<opperator.size();i++){
    if (opperator[i].compare("*")==0){
      nums[i+1]=nums[i]*nums[i+1];
      opperator.erase(opperator.begin()+i);
      nums.erase(nums.begin()+i); //I chose i+1 becuase i stored value in i
    }
  }

  //deal with / signs
  for (unsigned int i=0;i<opperator.size();i++){
    if (opperator[i].compare("/")==0){
      nums[i]=nums[i]/nums[i+1];
      opperator.erase(opperator.begin()+i);
      nums.erase(nums.begin()+i+1); //I chose i+1 becuase i stored value in i  
    }
  }

  //since only + is left lets add up all the values!!
  for (unsigned int i=0;i<nums.size();i++){
    val = val + nums[i];
  }
  
  return val;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdi, %rbx
movss %xmm0, 0x74(%rsp)
movss %xmm1, 0x70(%rsp)
movss %xmm2, 0x6c(%rsp)
leaq 0xe8(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
addq %rsi, %rdx
leaq 0xd8(%rsp), %rdi
callq 0xf32a
leaq 0xc8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1095bd(%rip), %rsi    # 0x1541ad
leaq 0x1095ba(%rip), %rdx    # 0x1541b1
leaq 0xb8(%rsp), %rdi
callq 0x2263c
leaq 0x48(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
callq 0x4a6d4
movq 0xb8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4ac3b
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x4470
movq %rbx, 0x60(%rsp)
movq 0xd8(%rsp), %rdi
cmpq %r14, %rdi
je 0x4ac5d
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x48(%rsp), %rdi
cmpq %rdi, 0x50(%rsp)
je 0x4ad3b
leaq 0x30(%rsp), %r12
movl $0x1, %ebp
xorl %ebx, %ebx
leaq 0x10505b(%rip), %r14    # 0x14fcdb
leaq 0x20(%rsp), %r15
leaq 0x104bd6(%rip), %r13    # 0x14f862
shlq $0x5, %rbx
addq %rbx, %rdi
movq %r14, %rsi
callq 0x4170
testl %eax, %eax
je 0x4acda
movq 0x48(%rsp), %rdi
addq %rbx, %rdi
movq %r13, %rsi
callq 0x4170
testl %eax, %eax
je 0x4ace9
movq 0x48(%rsp), %rdi
addq %rbx, %rdi
leaq 0x10b2de(%rip), %rsi    # 0x155fa0
callq 0x4170
testl %eax, %eax
jne 0x4ad1d
movq %r15, %rdi
leaq 0x6c(%rsp), %rsi
callq 0x4aa4b
jmp 0x4acf6
movq %r15, %rdi
leaq 0x74(%rsp), %rsi
callq 0x4aa4b
jmp 0x4acf6
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
callq 0x4aa4b
addq 0x48(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4540
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x4ad1d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4470
movl %ebp, %ebx
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rax
subq %rdi, %rax
sarq $0x5, %rax
incl %ebp
cmpq %rbx, %rax
ja 0x4ac8c
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x48(%rsp), %rax
cmpq %rax, 0x50(%rsp)
je 0x4adbd
movl $0x1, %ebp
xorl %edi, %edi
leaq 0x20(%rsp), %rbx
leaq 0x8(%rsp), %r14
shlq $0x5, %rdi
addq %rax, %rdi
callq 0x4a8cf
movsd %xmm0, 0x8(%rsp)
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x4ad98
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x4ada3
movq %rbx, %rdi
movq %r14, %rdx
callq 0x139c2
movl %ebp, %edi
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
incl %ebp
cmpq %rdi, %rcx
ja 0x4ad6b
leaq 0xa8(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x60(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x98(%rsp), %rdi
callq 0xf32a
leaq 0x88(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1093ba(%rip), %rsi    # 0x1541b2
leaq 0x1093c1(%rip), %rdx    # 0x1541c0
leaq 0x78(%rsp), %rdi
callq 0x2263c
leaq 0x8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x4a6d4
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x4ae3a
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x4ae57
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rax
subq %rdi, %rax
movq 0x50(%rsp), %rcx
subq 0x48(%rsp), %rcx
cmpq %rcx, %rax
jne 0x4aea5
leaq 0x109347(%rip), %rsi    # 0x1541c1
callq 0x4170
testl %eax, %eax
jne 0x4ae98
movq 0x20(%rsp), %rax
movsd (%rax), %xmm0
xorpd 0x10871c(%rip), %xmm0   # 0x1535b0
movlpd %xmm0, (%rax)
leaq 0x8(%rsp), %rdi
movq (%rdi), %rsi
callq 0x4b1b0
movq 0x8(%rsp), %rax
cmpq %rax, 0x10(%rsp)
je 0x4af03
movl $0x1, %ebp
xorl %edi, %edi
leaq 0x109302(%rip), %rbx    # 0x1541c1
shlq $0x5, %rdi
addq %rax, %rdi
movq %rbx, %rsi
callq 0x4170
movl %ebp, %edi
testl %eax, %eax
jne 0x4aeeb
movq 0x20(%rsp), %rax
movsd (%rax,%rdi,8), %xmm0
xorpd 0x1086ca(%rip), %xmm0   # 0x1535b0
movlpd %xmm0, (%rax,%rdi,8)
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
incl %ebp
cmpq %rdi, %rcx
ja 0x4aebf
movq 0x8(%rsp), %rdi
cmpq %rdi, 0x10(%rsp)
je 0x4afaf
movl $0x1, %ebp
xorl %r12d, %r12d
leaq 0x1054f5(%rip), %rbx    # 0x150417
leaq 0x8(%rsp), %r14
movq %r12, %r15
shlq $0x5, %r15
addq %r15, %rdi
movq %rbx, %rsi
callq 0x4170
movl %ebp, %r13d
testl %eax, %eax
jne 0x4af90
movq 0x20(%rsp), %rax
movsd (%rax,%r12,8), %xmm0
mulsd (%rax,%r13,8), %xmm0
movsd %xmm0, (%rax,%r13,8)
addq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x4b1b0
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rdx
leaq (%rax,%r12,8), %rsi
addq $0x8, %rsi
cmpq %rdx, %rsi
je 0x4af8a
leaq (%rax,%r12,8), %rdi
subq %rsi, %rdx
callq 0x46c0
addq $-0x8, 0x28(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rax
subq %rdi, %rax
sarq $0x5, %rax
incl %ebp
movq %r13, %r12
cmpq %r13, %rax
ja 0x4af27
movq 0x8(%rsp), %rdi
cmpq %rdi, 0x10(%rsp)
je 0x4b05f
movl $0x1, %ebp
xorl %r13d, %r13d
leaq 0x1091f5(%rip), %rbx    # 0x1541c3
leaq 0x8(%rsp), %r14
movq %r13, %r15
shlq $0x5, %r15
addq %r15, %rdi
movq %rbx, %rsi
callq 0x4170
movl %ebp, %r12d
testl %eax, %eax
jne 0x4b040
movq 0x20(%rsp), %rax
movsd (%rax,%r13,8), %xmm0
divsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rax,%r13,8)
addq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x4b1b0
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rdx
leaq (%rax,%r13,8), %rsi
addq $0x10, %rsi
cmpq %rdx, %rsi
je 0x4b03a
leaq (%rax,%r13,8), %rdi
addq $0x8, %rdi
subq %rsi, %rdx
callq 0x46c0
addq $-0x8, 0x28(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rax
subq %rdi, %rax
sarq $0x5, %rax
incl %ebp
movq %r12, %r13
cmpq %r12, %rax
ja 0x4afd3
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
je 0x4b091
sarq $0x3, %rcx
xorpd %xmm0, %xmm0
xorl %edx, %edx
cvtss2sd %xmm0, %xmm0
addsd (%rax,%rdx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
incq %rdx
movl %edx, %esi
cmpq %rsi, %rcx
ja 0x4b078
jmp 0x4b095
xorpd %xmm0, %xmm0
movss %xmm0, 0x60(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x2f6f0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x4b0bc
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x48(%rsp), %rdi
callq 0x2f6f0
movss 0x60(%rsp), %xmm0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4b170
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x4b105
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x4b105
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x4b187
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x4b187
jmp 0x4b184
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4b14b
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x4b14b
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r14, %rdi
je 0x4b1a8
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x4b1a8
jmp 0x4b17f
jmp 0x4b17f
jmp 0x4b170
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2f6f0
jmp 0x4b187
movq %rax, %rbx
jmp 0x4b19e
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x4b19e
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x48(%rsp), %rdi
callq 0x2f6f0
movq %rbx, %rdi
callq 0x4780