// File: /workspace/github_cpp_makefile_star2_O3/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 $0xe8, %rsp
movq %rdi, %rbx
movss %xmm0, 0x64(%rsp)
movss %xmm1, 0x60(%rsp)
movss %xmm2, 0x5c(%rsp)
leaq 0xd8(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %rdi
callq 0xf3ce
leaq 0xb8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x107975(%rip), %rsi    # 0x15225d
leaq 0x107972(%rip), %rdx    # 0x152261
leaq 0xa8(%rsp), %rdi
callq 0x22538
leaq 0x38(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x4a3cc
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4a933
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x4a950
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x4470
movq %rbx, 0x50(%rsp)
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rax
cmpq %rdi, %rax
je 0x4aa36
leaq 0x10(%rsp), %r12
movl $0x1, %ebx
xorl %ebp, %ebp
leaq 0x1033d0(%rip), %r14    # 0x14dd4b
movq %rsp, %r15
leaq 0x102f2d(%rip), %r13    # 0x14d8b2
shlq $0x5, %rbp
addq %rbp, %rdi
movq %r14, %rsi
callq 0x4170
testl %eax, %eax
je 0x4a9d3
movq 0x38(%rsp), %rdi
addq %rbp, %rdi
movq %r13, %rsi
callq 0x4170
testl %eax, %eax
je 0x4a9e2
movq 0x38(%rsp), %rdi
addq %rbp, %rdi
leaq 0x1096d5(%rip), %rsi    # 0x154090
callq 0x4170
testl %eax, %eax
jne 0x4aa15
movq %r15, %rdi
leaq 0x5c(%rsp), %rsi
callq 0x4a743
jmp 0x4a9ef
movq %r15, %rdi
leaq 0x64(%rsp), %rsi
callq 0x4a743
jmp 0x4a9ef
movq %r15, %rdi
leaq 0x60(%rsp), %rsi
callq 0x4a743
addq 0x38(%rsp), %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x4540
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x4aa15
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4470
movl %ebx, %ebp
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rax
movq %rax, %rcx
subq %rdi, %rcx
sarq $0x5, %rcx
incl %ebx
cmpq %rbp, %rcx
ja 0x4a985
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
cmpq %rdi, %rax
je 0x4aab1
movl $0x1, %ebp
xorl %eax, %eax
movq %rsp, %rbx
leaq 0x20(%rsp), %r14
shlq $0x5, %rax
addq %rdi, %rax
movq %rax, %rdi
callq 0x4a5c7
movsd %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x4aa8c
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x4aa97
movq %rbx, %rdi
movq %r14, %rdx
callq 0x1391c
movl %ebp, %eax
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rcx
subq %rdi, %rcx
sarq $0x5, %rcx
incl %ebp
cmpq %rax, %rcx
ja 0x4aa5c
leaq 0x98(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x50(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0xf3ce
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x107779(%rip), %rsi    # 0x152262
leaq 0x107780(%rip), %rdx    # 0x152270
leaq 0x68(%rsp), %rdi
callq 0x22538
leaq 0x20(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x4a3cc
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x4ab28
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x4ab45
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
movq %rax, %rcx
subq %rdi, %rcx
movq 0x40(%rsp), %rdx
subq 0x38(%rsp), %rdx
cmpq %rdx, %rcx
jne 0x4ab9f
leaq 0x107706(%rip), %rsi    # 0x152271
callq 0x4170
testl %eax, %eax
jne 0x4ab88
movq (%rsp), %rax
movsd (%rax), %xmm0
xorpd 0x106abc(%rip), %xmm0   # 0x151640
movlpd %xmm0, (%rax)
leaq 0x20(%rsp), %rdi
movq (%rdi), %rsi
callq 0x4aeaa
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
cmpq %rdi, %rax
je 0x4ad5f
movl $0x1, %ebp
xorl %ecx, %ecx
leaq 0x1076bb(%rip), %rbx    # 0x152271
shlq $0x5, %rcx
addq %rdi, %rcx
movq %rcx, %rdi
movq %rbx, %rsi
callq 0x4170
movl %ebp, %ecx
testl %eax, %eax
jne 0x4abe4
movq (%rsp), %rax
movsd (%rax,%rcx,8), %xmm0
xorpd 0x106a61(%rip), %xmm0   # 0x151640
movlpd %xmm0, (%rax,%rcx,8)
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
movq %rax, %rdx
subq %rdi, %rdx
sarq $0x5, %rdx
leal 0x1(%rcx), %ebp
cmpq %rcx, %rdx
ja 0x4abb6
cmpq %rdi, %rax
je 0x4ad5f
xorl %r13d, %r13d
leaq 0x103874(%rip), %rbx    # 0x14e487
leaq 0x20(%rsp), %r14
xorl %r12d, %r12d
movq %r13, %r15
shlq $0x5, %r15
addq %r15, %rdi
movq %rbx, %rsi
callq 0x4170
testl %eax, %eax
je 0x4ac36
incl %r12d
jmp 0x4ac8f
movq (%rsp), %rax
movsd (%rax,%r13,8), %xmm0
incl %r12d
mulsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rax,%r12,8)
addq 0x20(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x4aeaa
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
leaq (%rax,%r13,8), %rsi
addq $0x8, %rsi
cmpq %rdx, %rsi
je 0x4ac86
leaq (%rax,%r13,8), %rdi
subq %rsi, %rdx
callq 0x46c0
movq 0x8(%rsp), %rdx
addq $-0x8, %rdx
movq %rdx, 0x8(%rsp)
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
movq %rax, %rcx
subq %rdi, %rcx
sarq $0x5, %rcx
movq %r12, %r13
cmpq %r12, %rcx
ja 0x4ac1b
cmpq %rdi, %rax
je 0x4ad5f
xorl %r13d, %r13d
leaq 0x1075b1(%rip), %rbx    # 0x152273
leaq 0x20(%rsp), %r14
xorl %r12d, %r12d
movq %r13, %r15
shlq $0x5, %r15
addq %r15, %rdi
movq %rbx, %rsi
callq 0x4170
testl %eax, %eax
je 0x4ace5
incl %r12d
jmp 0x4ad42
movq (%rsp), %rax
movsd (%rax,%r13,8), %xmm0
incl %r12d
divsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rax,%r13,8)
addq 0x20(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x4aeaa
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
leaq (%rax,%r13,8), %rsi
addq $0x10, %rsi
cmpq %rdx, %rsi
je 0x4ad39
leaq (%rax,%r13,8), %rdi
addq $0x8, %rdi
subq %rsi, %rdx
callq 0x46c0
movq 0x8(%rsp), %rdx
addq $-0x8, %rdx
movq %rdx, 0x8(%rsp)
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
subq %rdi, %rax
sarq $0x5, %rax
movq %r12, %r13
cmpq %r12, %rax
ja 0x4acca
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
je 0x4ad90
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 0x4ad77
jmp 0x4ad94
xorpd %xmm0, %xmm0
movss %xmm0, 0x50(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x2f4c2
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x4adba
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x38(%rsp), %rdi
callq 0x2f4c2
movss 0x50(%rsp), %xmm0
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4ae69
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x4ae00
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x4ae00
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x4ae82
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x4ae82
jmp 0x4ae7f
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4ae46
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x4ae46
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x4aea2
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x4aea2
jmp 0x4ae69
jmp 0x4ae7a
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2f4c2
jmp 0x4ae82
jmp 0x4ae7a
movq %rax, %rbx
jmp 0x4ae98
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x4ae98
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x38(%rsp), %rdi
callq 0x2f4c2
movq %rbx, %rdi
callq 0x4780