// File: atfrank[P]PCASA/lib/DTree.cpp
// Function: DTree::getDTreeClass[abi:cxx11](DTreeNode*, std::vector<double, std::allocator<double>> const&)
std::string DTree::getDTreeClass(DTreeNode *node, const std::vector<double> &fin){
  if (node->left == NULL && node->right == NULL){
    //Return class
    if (this->getClassSize() != 0){
      return this->getClass(node->leaf);
    }
    else{
      return node->leaf;
    }
  }
  else if (node->left == NULL || node->right == NULL){
    if (node->left != NULL){
      //Go deeper
      return getDTreeClass(node->left, fin);
    }
    else{
      //Go deeper
      return getDTreeClass(node->right, fin);
    }
  }
  else{
    if (node->inx >= fin.size()){
      std::cerr << "Error: Missing feature (inx = " << node->inx << " )" << std::endl;
      return "";
    }
    else if (fin.at(node->inx) <= node->key_value){
      //Go deeper
      return getDTreeClass(node->left, fin);
    }
    else{
      //Go deeper
      return getDTreeClass(node->right, fin);
    }
  }
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x20(%rsp)
movq %rdi, %rax
movq %rax, 0x28(%rsp)
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
movq %rcx, 0x68(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x70(%rsp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x3bb96
movq 0x70(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x3bb96
movq 0x30(%rsp), %rdi
callq 0x3bd30
cmpl $0x0, %eax
je 0x3bb7e
movq 0x70(%rsp), %rsi
addq $0x20, %rsi
leaq 0x48(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x51b0
movq 0x20(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x3bd50
jmp 0x3bb52
leaq 0x48(%rsp), %rdi
callq 0x5250
jmp 0x3bd17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x5250
jmp 0x3bd24
movq 0x20(%rsp), %rdi
movq 0x70(%rsp), %rsi
addq $0x20, %rsi
callq 0x51b0
jmp 0x3bd17
movq 0x70(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x3bbae
movq 0x70(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x3bbfe
movq 0x70(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x3bbdc
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rdi
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rdx
movq 0x68(%rsp), %rcx
callq 0x3bac0
jmp 0x3bd17
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rdi
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rdx
movq 0x68(%rsp), %rcx
callq 0x3bac0
jmp 0x3bd17
movq 0x70(%rsp), %rax
movl 0x8(%rax), %eax
movq %rax, 0x10(%rsp)
movq 0x68(%rsp), %rdi
callq 0x17a60
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jb 0x3bcb4
movq 0x3ff3c3(%rip), %rdi    # 0x43aff0
leaq 0x406d0(%rip), %rsi     # 0x7c304
callq 0x53f0
movq %rax, %rdi
movq 0x70(%rsp), %rax
movl 0x8(%rax), %esi
callq 0x55b0
movq %rax, %rdi
leaq 0x406d0(%rip), %rsi     # 0x7c323
callq 0x53f0
movq %rax, %rdi
movq 0x3ff346(%rip), %rsi    # 0x43afa8
callq 0x5460
leaq 0x3b(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x5730
movq 0x20(%rsp), %rdi
movq 0x8(%rsp), %rdx
leaq 0x3f72b(%rip), %rsi     # 0x7b3b2
callq 0x7900
jmp 0x3bc8e
leaq 0x3b(%rsp), %rdi
callq 0x5480
jmp 0x3bd17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
leaq 0x3b(%rsp), %rdi
callq 0x5480
jmp 0x3bd24
movq 0x68(%rsp), %rdi
movq 0x70(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
callq 0x3c7b0
movsd (%rax), %xmm1
movq 0x70(%rsp), %rax
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x3bcfa
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rdi
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rdx
movq 0x68(%rsp), %rcx
callq 0x3bac0
jmp 0x3bd17
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rdi
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rdx
movq 0x68(%rsp), %rcx
callq 0x3bac0
movq 0x28(%rsp), %rax
addq $0x88, %rsp
retq
movq 0x40(%rsp), %rdi
callq 0x5720
nop