// File: /workspace/github_cpp_makefile_star2_O2/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 0xd8(%rsp), %rdi
movq %rbx, %rsi
callq 0x45d0
leaq 0xc8b00(%rip), %rsi     # 0x1011cd
leaq 0xb8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x1b80e
movq %rbx, 0x60(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
callq 0x38311
leaq 0xb8(%rsp), %rdi
callq 0x4210
leaq 0xd8(%rsp), %rdi
callq 0x4210
xorl %r12d, %r12d
leaq 0xc4629(%rip), %r14     # 0xfcd4b
leaq 0x20(%rsp), %r15
leaq 0xc414a(%rip), %r13     # 0xfc878
leaq 0xca8bb(%rip), %rbx     # 0x102ff0
movl %r12d, %r12d
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rax
movq %rax, %rcx
subq %rdi, %rcx
sarq $0x5, %rcx
cmpq %r12, %rcx
jbe 0x387de
movq %r12, %rbp
shlq $0x5, %rbp
addq %rbp, %rdi
movq %r14, %rsi
callq 0x4190
testl %eax, %eax
je 0x387a2
movq 0x48(%rsp), %rdi
addq %rbp, %rdi
movq %r13, %rsi
callq 0x4190
testl %eax, %eax
je 0x387b1
movq 0x48(%rsp), %rdi
addq %rbp, %rdi
movq %rbx, %rsi
callq 0x4190
testl %eax, %eax
jne 0x387d6
movq %r15, %rdi
leaq 0x6c(%rsp), %rsi
callq 0x38589
jmp 0x387be
movq %r15, %rdi
leaq 0x74(%rsp), %rsi
callq 0x38589
jmp 0x387be
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
callq 0x38589
addq 0x48(%rsp), %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x4560
movq %r15, %rdi
callq 0x4210
incl %r12d
jmp 0x38735
leaq 0x20(%rsp), %rbx
andq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
xorl %r15d, %r15d
leaq 0x8(%rsp), %r14
movl %r15d, %r15d
subq %rdi, %rax
sarq $0x5, %rax
cmpq %r15, %rax
jbe 0x38834
movq %r15, %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x38473
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf9fe
incl %r15d
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rax
jmp 0x387f6
leaq 0x98(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x45d0
leaq 0xc8985(%rip), %rsi     # 0x1011d2
leaq 0x78(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1b80e
leaq 0x8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x38311
leaq 0x78(%rsp), %rdi
callq 0x4210
leaq 0x98(%rsp), %rdi
callq 0x4210
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rax
subq %rdi, %rax
movq 0x50(%rsp), %rcx
subq 0x48(%rsp), %rcx
cmpq %rcx, %rax
jne 0x388d6
leaq 0xc8934(%rip), %rsi     # 0x1011e1
callq 0x4190
testl %eax, %eax
jne 0x388c9
movq 0x20(%rsp), %rax
movsd (%rax), %xmm0
xorps 0xc7d0a(%rip), %xmm0    # 0x1005d0
movlps %xmm0, (%rax)
leaq 0x8(%rsp), %rdi
movq (%rdi), %rsi
callq 0x38b78
pushq $0x1
popq %r14
leaq 0xc8900(%rip), %rbx     # 0x1011e1
leal -0x1(%r14), %ecx
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rax
movq %rax, %rdx
subq %rdi, %rdx
sarq $0x5, %rdx
cmpq %rcx, %rdx
jbe 0x3892e
shlq $0x5, %rcx
addq %rcx, %rdi
movq %rbx, %rsi
callq 0x4190
testl %eax, %eax
jne 0x38929
movl %r14d, %eax
movq 0x20(%rsp), %rcx
movsd (%rcx,%rax,8), %xmm0
xorps 0xc7cab(%rip), %xmm0    # 0x1005d0
movlps %xmm0, (%rcx,%rax,8)
incl %r14d
jmp 0x388e1
xorl %r12d, %r12d
leaq 0xc4b4f(%rip), %rbx     # 0xfd487
leaq 0x8(%rsp), %r14
movl %r12d, %r13d
movq %rax, %rcx
subq %rdi, %rcx
sarq $0x5, %rcx
cmpq %r13, %rcx
jbe 0x389dc
movq %r13, %r15
shlq $0x5, %r15
addq %r15, %rdi
movq %rbx, %rsi
callq 0x4190
testl %eax, %eax
je 0x38971
incl %r13d
movl %r13d, %r12d
jmp 0x389cd
movq 0x20(%rsp), %rax
movsd (%rax,%r13,8), %xmm0
leal 0x1(%r13), %r12d
mulsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rax,%r12,8)
addq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x38b78
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rdx
leaq (%rax,%r13,8), %rsi
addq $0x8, %rsi
cmpq %rdx, %rsi
je 0x389c4
leaq (%rax,%r13,8), %rdi
subq %rsi, %rdx
callq 0x46d0
movq 0x28(%rsp), %rdx
addq $-0x8, %rdx
movq %rdx, 0x28(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rax
jmp 0x3893d
xorl %r12d, %r12d
leaq 0xc87fd(%rip), %rbx     # 0x1011e3
leaq 0x8(%rsp), %r14
movl %r12d, %r13d
subq %rdi, %rax
sarq $0x5, %rax
cmpq %r13, %rax
jbe 0x38a8b
movq %r13, %r15
shlq $0x5, %r15
addq %r15, %rdi
movq %rbx, %rsi
callq 0x4190
testl %eax, %eax
je 0x38a1c
incl %r13d
movl %r13d, %r12d
jmp 0x38a7c
movq 0x20(%rsp), %rax
movsd (%rax,%r13,8), %xmm0
leal 0x1(%r13), %r12d
divsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rax,%r13,8)
addq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x38b78
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rdx
leaq (%rax,%r13,8), %rsi
addq $0x10, %rsi
cmpq %rdx, %rsi
je 0x38a73
leaq (%rax,%r13,8), %rdi
addq $0x8, %rdi
subq %rsi, %rdx
callq 0x46d0
movq 0x28(%rsp), %rdx
addq $-0x8, %rdx
movq %rdx, 0x28(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rax
jmp 0x389eb
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
xorl %edx, %edx
xorps %xmm0, %xmm0
movl %edx, %edx
cmpq %rdx, %rcx
jbe 0x38ab9
cvtss2sd %xmm0, %xmm0
addsd (%rax,%rdx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
incl %edx
jmp 0x38aa1
leaq 0x8(%rsp), %rdi
movss %xmm0, 0x60(%rsp)
callq 0x244fc
leaq 0x20(%rsp), %rdi
callq 0xb25c
leaq 0x48(%rsp), %rdi
callq 0x244fc
movss 0x60(%rsp), %xmm0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x38b44
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x4210
jmp 0x38b09
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x4210
jmp 0x38b5b
jmp 0x38b58
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x4210
jmp 0x38b2f
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x4210
jmp 0x38b6f
jmp 0x38b53
jmp 0x38b53
jmp 0x38b44
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x244fc
jmp 0x38b5b
movq %rax, %rbx
jmp 0x38b65
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xb25c
leaq 0x48(%rsp), %rdi
callq 0x244fc
movq %rbx, %rdi
callq 0x4780
nop