// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/networkanalysis.cc
// Function: TRAVERSAL_NETWORK::findMaxFreeSphere()
PATH TRAVERSAL_NETWORK::findMaxFreeSphere(){
  double maxR = -1;
  PATH bestPath;
  vector<bool> haveVisited = vector<bool> (dnet->nodes.size(), false);
  HEAP<PATH> heap (hasLowerMaxR);
  
  // Initialize the stack with all nodes connected to the source nodes
  for(unsigned int i = 0; i < sourceNodeIDs.size(); i++){
    DIJKSTRA_NODE sourceNode = dnet->nodes.at(sourceNodeIDs.at(i));
    vector<CONN> viableConns = connectToSink.at(sourceNode.id);
    for(unsigned int j = 0; j <  viableConns.size(); j++){
      CONN nextConn = viableConns.at(j);
      DIJKSTRA_NODE nextNode = dnet->nodes.at(nextConn.to);
      PATH newPath = PATH(nextNode, nextConn.max_radius, max(sourceNode.max_radius, nextNode.max_radius), nextConn.length);
      newPath.visitedIDs.push_back(sourceNode.id);
      heap.insert(newPath);
    }
  }

  while(heap.size() != 0){
    PATH best = heap.pop();
    best.visitedIDs.push_back(best.currentNode.id);
    
    //Done searching if max radius path leads to sink node
    if(best.toSink){
      maxR = best.max_radius;
      bestPath = best;
      break;
    }
    
    // Mark nodes that have been visited or abandon current path if node
    // already visited
    if(haveVisited.at(best.currentNode.id))
      continue;
    else
      haveVisited.at(best.currentNode.id) = true;
    
    // Add all nodes that are connected within the unit cell to the stack
    vector<CONN> regConns = regConnections.at(best.currentNode.id);
    for(unsigned int i = 0; i < regConns.size(); i++){
      CONN nextConn = regConns.at(i);
      if(!haveVisited.at(nextConn.to)){
	DIJKSTRA_NODE nextNode = dnet->nodes.at(nextConn.to);
	PATH nextPath = PATH(nextNode,min(best.max_radius,nextConn.max_radius), max(best.max_inc_radius, nextNode.max_radius), best.length + nextConn.length);
	nextPath.visitedIDs = best.visitedIDs;
	heap.insert(nextPath);
      }
    }

    // Add all nodes that are connected in the sink to the stack
    vector<CONN> sinkConns = connectToSink.at(best.currentNode.id);
    for(unsigned int i = 0; i < sinkConns.size(); i++){
      CONN nextConn = sinkConns.at(i);
      DIJKSTRA_NODE nextNode = dnet->nodes.at(nextConn.to);
      PATH nextPath = PATH(nextNode, min(best.max_radius, nextConn.max_radius), max(best.max_inc_radius, nextNode.max_radius), best.length + nextConn.length);
      nextPath.toSink = true;
      nextPath.visitedIDs = best.visitedIDs;
      heap.insert(nextPath);
    }
  }
  return bestPath;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5c8, %rsp            # imm = 0x5C8
movq %rsi, %rbx
movq %rdi, 0x28(%rsp)
callq 0x25a6c
movq 0x70(%rbx), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
pushq $0x48
popq %rcx
cqto
idivq %rcx
leaq 0x1d0(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0xe0(%rsp), %rdi
leaq 0x108(%rsp), %rcx
movq %rax, %rsi
callq 0x2a0d6
leaq -0x12f3(%rip), %rsi     # 0x25f10
leaq 0x58(%rsp), %rdi
callq 0x2a13a
movq %rbx, 0x20(%rsp)
leaq 0x48(%rbx), %rax
movq %rax, 0x48(%rsp)
xorl %esi, %esi
leaq 0x30(%rsp), %r14
leaq 0x98(%rsp), %r15
leaq 0x328(%rsp), %rbp
leaq 0x1d0(%rsp), %r13
leaq 0x500(%rsp), %rbx
movl %esi, %esi
movq 0x20(%rsp), %rdi
movq 0x8(%rdi), %rax
subq (%rdi), %rax
sarq $0x2, %rax
cmpq %rsi, %rax
jbe 0x273b6
movq 0x70(%rdi), %r12
movq %rsi, 0x8(%rsp)
callq 0xac00
movslq (%rax), %rsi
movq %r12, %rdi
callq 0xabe2
leaq 0x108(%rsp), %rdi
movq %rax, %rsi
callq 0x29ebe
movslq 0x108(%rsp), %rsi
movq 0x48(%rsp), %rdi
callq 0x2a050
movq %r14, %rdi
movq %rax, %rsi
callq 0x2a06e
xorl %r12d, %r12d
movl %r12d, %r12d
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
cqto
pushq $0x28
popq %rcx
idivq %rcx
cmpq %r12, %rax
jbe 0x27395
movq %r14, %rdi
movq %r12, %rsi
callq 0x29efa
movslq 0x4(%rax), %rsi
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x70(%rax), %rdi
callq 0xabe2
movq %r15, %rdi
movq %rax, %rsi
callq 0x29ebe
movq %rbp, %rdi
movq %r15, %rsi
callq 0x29ebe
movsd 0xd0(%rsp), %xmm1
maxsd 0x140(%rsp), %xmm1
movq %r13, %rdi
movq %rbp, %rsi
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm2
callq 0x25b74
leaq 0x348(%rsp), %rdi
callq 0xaf14
leaq 0x250(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x9434
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2a18a
leaq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x2a170
movq %rbx, %rdi
callq 0xadf4
movq %r13, %rdi
callq 0xadf4
leaq 0xb8(%rsp), %rdi
callq 0xaf14
incl %r12d
jmp 0x272a6
movq %r14, %rdi
callq 0xaf14
leaq 0x128(%rsp), %rdi
callq 0xaf14
movq 0x8(%rsp), %rsi
incl %esi
jmp 0x27242
movl $0x80, %r12d
leaq (%r12,%r13), %rax
movq %rax, 0x8(%rsp)
leaq 0x18(%rdi), %rax
movq %rax, 0x78(%rsp)
leaq 0x108(%rsp), %rax
addq %rax, %r12
leaq 0x98(%rsp), %rbx
leaq 0x370(%rsp), %rbp
movq %r12, 0x50(%rsp)
movq 0x60(%rsp), %rax
subq 0x58(%rsp), %rax
cqto
movl $0xc8, %ecx
idivq %rcx
testl %eax, %eax
je 0x27754
movq %r13, %rdi
leaq 0x58(%rsp), %rsi
callq 0x2a216
movq 0x8(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0x9434
movb 0x248(%rsp), %al
movb %al, 0x7(%rsp)
cmpb $0x1, %al
jne 0x2744a
movq 0x28(%rsp), %rdi
movq %r13, %rsi
callq 0x2a256
jmp 0x27741
movslq 0x1e8(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0xaba4
testq %rdx, (%rax)
jne 0x27741
movslq 0x1e8(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0xaba4
orq %rdx, (%rax)
movslq 0x1e8(%rsp), %rsi
movq 0x78(%rsp), %rdi
callq 0x2a050
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x2a06e
xorl %r14d, %r14d
movl %r14d, %r14d
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
cqto
pushq $0x28
popq %rcx
idivq %rcx
cmpq %r14, %rax
jbe 0x275dd
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x29efa
movslq 0x4(%rax), %r12
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0xe0(%rsp), %rdi
movq %r12, %rsi
callq 0xaba4
testq %rdx, (%rax)
jne 0x275d5
movq 0x20(%rsp), %rax
movq 0x70(%rax), %rdi
movq %r12, %rsi
callq 0xabe2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x29ebe
movq %rbx, %rsi
leaq 0x2e0(%rsp), %r15
movq %r15, %rdi
callq 0x29ebe
movq 0x50(%rsp), %r12
movsd 0x10(%rsp), %xmm0
minsd 0x230(%rsp), %xmm0
movsd 0xd0(%rsp), %xmm1
maxsd 0x238(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
addsd 0x240(%rsp), %xmm2
leaq 0x108(%rsp), %rdi
movq %r15, %rsi
callq 0x25b74
leaq 0x300(%rsp), %rdi
callq 0xaf14
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xc178
leaq 0x438(%rsp), %r15
movq %r15, %rdi
leaq 0x108(%rsp), %rsi
callq 0x2a18a
leaq 0x58(%rsp), %rdi
movq %r15, %rsi
callq 0x2a170
movq %r15, %rdi
callq 0xadf4
leaq 0x108(%rsp), %rdi
callq 0xadf4
leaq 0xb8(%rsp), %rdi
callq 0xaf14
incl %r14d
jmp 0x274a2
movslq 0x1e8(%rsp), %rsi
movq 0x48(%rsp), %rdi
callq 0x2a050
movq 0x50(%rsp), %r12
leaq 0x80(%rsp), %rdi
movq %rax, %rsi
callq 0x2a06e
xorl %r14d, %r14d
movl %r14d, %r14d
movq 0x88(%rsp), %rax
subq 0x80(%rsp), %rax
cqto
pushq $0x28
popq %rcx
idivq %rcx
cmpq %r14, %rax
jbe 0x2772a
leaq 0x80(%rsp), %rdi
movq %r14, %rsi
callq 0x29efa
movslq 0x4(%rax), %rsi
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x70(%rax), %rdi
callq 0xabe2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x29ebe
leaq 0x298(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x29ebe
movsd 0x10(%rsp), %xmm0
minsd 0x230(%rsp), %xmm0
movsd 0xd0(%rsp), %xmm1
maxsd 0x238(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
addsd 0x240(%rsp), %xmm2
leaq 0x108(%rsp), %rdi
movq %r15, %rsi
callq 0x25b74
leaq 0x2b8(%rsp), %rdi
callq 0xaf14
movb $0x1, 0x180(%rsp)
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xc178
movq %rbp, %rdi
leaq 0x108(%rsp), %rsi
callq 0x2a18a
leaq 0x58(%rsp), %rdi
movq %rbp, %rsi
callq 0x2a170
movq %rbp, %rdi
callq 0xadf4
leaq 0x108(%rsp), %rdi
callq 0xadf4
leaq 0xb8(%rsp), %rdi
callq 0xaf14
incl %r14d
jmp 0x27607
leaq 0x80(%rsp), %rdi
callq 0xaf14
leaq 0x30(%rsp), %rdi
callq 0xaf14
movq %r13, %rdi
callq 0xadf4
cmpb $0x0, 0x7(%rsp)
je 0x273ee
leaq 0x58(%rsp), %rdi
callq 0x2aae8
leaq 0xe0(%rsp), %rdi
callq 0xa976
movq 0x28(%rsp), %rax
addq $0x5c8, %rsp            # imm = 0x5C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x278ec
jmp 0x2779a
jmp 0x2781c
jmp 0x2779a
jmp 0x2779a
jmp 0x27821
movq %rax, %r14
jmp 0x27862
movq %rax, %r14
leaq 0x300(%rsp), %rdi
callq 0xaf14
jmp 0x277e3
movq %rax, %r14
leaq 0x438(%rsp), %rdi
callq 0xadf4
jmp 0x277d6
movq %rax, %r14
jmp 0x277e3
movq %rax, %r14
jmp 0x278c8
movq %rax, %r14
leaq 0x108(%rsp), %rdi
callq 0xadf4
leaq 0xb8(%rsp), %rdi
jmp 0x27853
jmp 0x2781c
movq %rax, %r14
leaq 0x2b8(%rsp), %rdi
callq 0xaf14
jmp 0x27839
movq %rax, %r14
leaq 0x370(%rsp), %rdi
callq 0xadf4
jmp 0x2782c
jmp 0x27848
movq %rax, %r14
jmp 0x27839
jmp 0x2781c
movq %rax, %r14
jmp 0x27858
movq %rax, %r14
jmp 0x278d5
movq %rax, %r14
leaq 0x108(%rsp), %rdi
callq 0xadf4
leaq 0xb8(%rsp), %rdi
callq 0xaf14
jmp 0x2784b
movq %rax, %r14
leaq 0x80(%rsp), %rdi
callq 0xaf14
leaq 0x30(%rsp), %rdi
callq 0xaf14
leaq 0x1d0(%rsp), %rdi
callq 0xadf4
jmp 0x278d5
movq %rax, %r14
leaq 0x348(%rsp), %rdi
callq 0xaf14
jmp 0x278ac
movq %rax, %r14
leaq 0x500(%rsp), %rdi
callq 0xadf4
jmp 0x2789f
jmp 0x278bb
movq %rax, %r14
jmp 0x278ac
movq %rax, %r14
leaq 0x1d0(%rsp), %rdi
callq 0xadf4
leaq 0xb8(%rsp), %rdi
callq 0xaf14
jmp 0x278be
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0xaf14
leaq 0x128(%rsp), %rdi
callq 0xaf14
leaq 0x58(%rsp), %rdi
callq 0x2aae8
leaq 0xe0(%rsp), %rdi
callq 0xa976
movq 0x28(%rsp), %rdi
callq 0xadf4
movq %r14, %rdi
callq 0x4780