// File: 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
movq %rsp, %rbp
subq $0x320, %rsp            # imm = 0x320
movq %rdi, %rsi
movq %rsi, -0x238(%rbp)
movq %rsi, -0x8(%rbp)
movss %xmm0, -0xc(%rbp)
movss %xmm1, -0x10(%rbp)
movss %xmm2, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5220
leaq -0x71(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0x5900
movq -0x230(%rbp), %rdx
leaq 0x16c657(%rip), %rsi    # 0x1f737d
leaq -0x70(%rbp), %rdi
callq 0x47530
jmp 0x8ad31
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x8a620
jmp 0x8ad44
leaq -0x70(%rbp), %rdi
callq 0x5300
leaq -0x71(%rbp), %rdi
callq 0x55d0
leaq -0x50(%rbp), %rdi
callq 0x5300
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
movq %rax, -0x240(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x592f0
movq %rax, %rcx
movq -0x240(%rbp), %rax
cmpq %rcx, %rax
jae 0x8af34
movl -0x88(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x59310
movq %rax, %rdi
leaq 0x167fee(%rip), %rsi    # 0x1f2d9b
callq 0x51b0
cmpl $0x0, %eax
jne 0x8ae52
leaq -0xa8(%rbp), %rdi
leaq -0xc(%rbp), %rsi
callq 0x8aab0
jmp 0x8adcd
movl -0x88(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x59310
movq %rax, %rdi
leaq -0xa8(%rbp), %rsi
callq 0x5680
leaq -0xa8(%rbp), %rdi
callq 0x5300
jmp 0x8af1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x8ae27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x5300
leaq -0x71(%rbp), %rdi
callq 0x55d0
leaq -0x50(%rbp), %rdi
callq 0x5300
jmp 0x8b72e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x8b725
movl -0x88(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x59310
movq %rax, %rdi
leaq 0x1679b6(%rip), %rsi    # 0x1f2823
callq 0x51b0
cmpl $0x0, %eax
jne 0x8aeb7
leaq -0xc8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x8aab0
jmp 0x8ae89
movl -0x88(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x59310
movq %rax, %rdi
leaq -0xc8(%rbp), %rsi
callq 0x5680
leaq -0xc8(%rbp), %rdi
callq 0x5300
jmp 0x8af1c
movl -0x88(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x59310
movq %rax, %rdi
leaq 0x167eef(%rip), %rsi    # 0x1f2dc1
callq 0x51b0
cmpl $0x0, %eax
jne 0x8af1a
leaq -0xe8(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x8aab0
jmp 0x8aeee
movl -0x88(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x59310
movq %rax, %rdi
leaq -0xe8(%rbp), %rsi
callq 0x5680
leaq -0xe8(%rbp), %rdi
callq 0x5300
jmp 0x8af1c
jmp 0x8af1e
jmp 0x8af20
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x8ad69
leaq -0x100(%rbp), %rdi
callq 0xf650
movl $0x0, -0x104(%rbp)
movl -0x104(%rbp), %eax
movq %rax, -0x248(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x592f0
movq %rax, %rcx
movq -0x248(%rbp), %rax
cmpq %rcx, %rax
jae 0x8afde
movl -0x104(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x59310
movq %rax, %rdi
callq 0x8a8a0
movsd %xmm0, -0x250(%rbp)
jmp 0x8af92
movsd -0x250(%rbp), %xmm0
movsd %xmm0, -0x110(%rbp)
leaq -0x100(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xf6d0
jmp 0x8afb7
jmp 0x8afb9
movl -0x104(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x104(%rbp)
jmp 0x8af4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x8b719
movq -0x238(%rbp), %rsi
leaq -0x148(%rbp), %rdi
callq 0x5220
jmp 0x8aff3
leaq -0x169(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x5900
movq -0x258(%rbp), %rdx
leaq 0x16c36e(%rip), %rsi    # 0x1f7382
leaq -0x168(%rbp), %rdi
callq 0x47530
jmp 0x8b022
leaq -0x128(%rbp), %rdi
leaq -0x148(%rbp), %rsi
leaq -0x168(%rbp), %rdx
callq 0x8a620
jmp 0x8b03e
leaq -0x168(%rbp), %rdi
callq 0x5300
leaq -0x169(%rbp), %rdi
callq 0x55d0
leaq -0x148(%rbp), %rdi
callq 0x5300
leaq -0x128(%rbp), %rdi
callq 0x592f0
movq %rax, -0x260(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x592f0
movq %rax, %rcx
movq -0x260(%rbp), %rax
cmpq %rcx, %rax
jne 0x8b1cc
leaq -0x128(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x59310
movq %rax, %rdi
leaq 0x16c2e6(%rip), %rsi    # 0x1f7391
callq 0x51b0
cmpl $0x0, %eax
jne 0x8b153
leaq -0x100(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xedb0
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x268(%rbp)
leaq -0x100(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xedb0
movsd -0x268(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x8b153
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x8b136
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x5300
leaq -0x169(%rbp), %rdi
callq 0x55d0
leaq -0x148(%rbp), %rdi
callq 0x5300
jmp 0x8b719
leaq -0x128(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x597a0
movq %rax, -0x180(%rbp)
leaq -0x178(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x8b7b0
movq -0x278(%rbp), %rdi
movq -0x178(%rbp), %rsi
callq 0x8b740
movq %rax, -0x270(%rbp)
jmp 0x8b19c
movq -0x270(%rbp), %rax
movq %rax, -0x188(%rbp)
jmp 0x8b1cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x59290
jmp 0x8b719
movl $0x0, -0x18c(%rbp)
movl -0x18c(%rbp), %eax
movq %rax, -0x280(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x592f0
movq %rax, %rcx
movq -0x280(%rbp), %rax
cmpq %rcx, %rax
jae 0x8b2a1
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x128(%rbp), %rdi
callq 0x59310
movq %rax, %rdi
leaq 0x16c171(%rip), %rsi    # 0x1f7391
callq 0x51b0
cmpl $0x0, %eax
jne 0x8b28b
movl -0x18c(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xedb0
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x288(%rbp)
movl -0x18c(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xedb0
movsd -0x288(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x8b28d
movl -0x18c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18c(%rbp)
jmp 0x8b1d6
movl $0x0, -0x190(%rbp)
movl -0x190(%rbp), %eax
movq %rax, -0x290(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x592f0
movq %rax, %rcx
movq -0x290(%rbp), %rax
cmpq %rcx, %rax
jae 0x8b474
movl -0x190(%rbp), %eax
movl %eax, %esi
leaq -0x128(%rbp), %rdi
callq 0x59310
movq %rax, %rdi
leaq 0x16836b(%rip), %rsi    # 0x1f3660
callq 0x51b0
cmpl $0x0, %eax
jne 0x8b45e
movl -0x190(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
movq %rdi, -0x2b0(%rbp)
callq 0xedb0
movq -0x2b0(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x2b8(%rbp)
movl -0x190(%rbp), %eax
incl %eax
movl %eax, %esi
callq 0xedb0
movsd -0x2b8(%rbp), %xmm0
movq -0x2b0(%rbp), %rdi
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x2a8(%rbp)
movl -0x190(%rbp), %eax
incl %eax
movl %eax, %esi
callq 0xedb0
movsd -0x2a8(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x128(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
callq 0x597a0
movq %rax, -0x1a8(%rbp)
movl -0x190(%rbp), %eax
movl %eax, %esi
leaq -0x1a8(%rbp), %rdi
callq 0x8b7f0
movq %rax, -0x1a0(%rbp)
leaq -0x198(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x8b7b0
movq -0x2a0(%rbp), %rdi
movq -0x198(%rbp), %rsi
callq 0x8b740
movq %rax, -0x298(%rbp)
jmp 0x8b3de
movq -0x298(%rbp), %rax
movq %rax, -0x1b0(%rbp)
leaq -0x100(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
callq 0x26bb0
movq %rax, -0x1c8(%rbp)
movl -0x190(%rbp), %eax
movl %eax, %esi
leaq -0x1c8(%rbp), %rdi
callq 0x28c00
movq %rax, -0x1c0(%rbp)
leaq -0x1b8(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x89ad0
movq -0x2c8(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
callq 0x8b830
movq %rax, -0x2c0(%rbp)
jmp 0x8b450
movq -0x2c0(%rbp), %rax
movq %rax, -0x1d0(%rbp)
jmp 0x8b460
movl -0x190(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x190(%rbp)
jmp 0x8b2ab
movl $0x0, -0x1d4(%rbp)
movl -0x1d4(%rbp), %eax
movq %rax, -0x2d0(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x592f0
movq %rax, %rcx
movq -0x2d0(%rbp), %rax
cmpq %rcx, %rax
jae 0x8b65d
movl -0x1d4(%rbp), %eax
movl %eax, %esi
leaq -0x128(%rbp), %rdi
callq 0x59310
movq %rax, %rdi
leaq 0x16becb(%rip), %rsi    # 0x1f7393
callq 0x51b0
cmpl $0x0, %eax
jne 0x8b647
movl -0x1d4(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0xedb0
movq -0x2f0(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x2f8(%rbp)
movl -0x1d4(%rbp), %eax
incl %eax
movl %eax, %esi
callq 0xedb0
movsd -0x2f8(%rbp), %xmm0
movq -0x2f0(%rbp), %rdi
movsd (%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x2e8(%rbp)
movl -0x1d4(%rbp), %eax
movl %eax, %esi
callq 0xedb0
movsd -0x2e8(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x128(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x597a0
movq %rax, -0x1f0(%rbp)
movl -0x1d4(%rbp), %eax
movl %eax, %esi
leaq -0x1f0(%rbp), %rdi
callq 0x8b7f0
movq %rax, -0x1e8(%rbp)
leaq -0x1e0(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x8b7b0
movq -0x2e0(%rbp), %rdi
movq -0x1e0(%rbp), %rsi
callq 0x8b740
movq %rax, -0x2d8(%rbp)
jmp 0x8b5af
movq -0x2d8(%rbp), %rax
movq %rax, -0x1f8(%rbp)
leaq -0x100(%rbp), %rdi
movq %rdi, -0x308(%rbp)
callq 0x26bb0
movq %rax, -0x218(%rbp)
movl -0x1d4(%rbp), %eax
movl %eax, %esi
leaq -0x218(%rbp), %rdi
callq 0x28c00
movq %rax, -0x210(%rbp)
leaq -0x210(%rbp), %rdi
movl $0x1, %esi
callq 0x28c00
movq %rax, -0x208(%rbp)
leaq -0x200(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x89ad0
movq -0x308(%rbp), %rdi
movq -0x200(%rbp), %rsi
callq 0x8b830
movq %rax, -0x300(%rbp)
jmp 0x8b639
movq -0x300(%rbp), %rax
movq %rax, -0x220(%rbp)
jmp 0x8b649
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x8b47e
movl $0x0, -0x224(%rbp)
movl -0x224(%rbp), %eax
movq %rax, -0x310(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xf990
movq %rax, %rcx
movq -0x310(%rbp), %rax
cmpq %rcx, %rax
jae 0x8b6da
movss -0x18(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x318(%rbp)
movl -0x224(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xedb0
movsd -0x318(%rbp), %xmm0
addsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x18(%rbp)
movl -0x224(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x224(%rbp)
jmp 0x8b667
movss -0x18(%rbp), %xmm0
movss %xmm0, -0x31c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x59290
leaq -0x100(%rbp), %rdi
callq 0xf9d0
leaq -0x30(%rbp), %rdi
callq 0x59290
movss -0x31c(%rbp), %xmm0
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
leaq -0x100(%rbp), %rdi
callq 0xf9d0
leaq -0x30(%rbp), %rdi
callq 0x59290
movq -0x80(%rbp), %rdi
callq 0x58f0
nopw (%rax,%rax)