// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/networkaccessibility.cc
// Function: AccessibilityClassNINF::FindChannels(double)
void AccessibilityClassNINF::FindChannels(double r_pr){

 if(alreadySegmentedFlag == true)
   {
   if(r_pr != r_probe)
     {
     cerr << "Trying to segment the net that has been already semented with different r\n"
          << "(use new accessibility class)\n";
     abort();
     };
   } else
   { // everything seems OK; proceed with segmentation

   r_probe = r_pr;

   //  Print vornet summary
   int noAccVorNodes = 0;
   for(unsigned int i = 0; i < vornet.nodes.size(); i++)
      {
      if(vornet.nodes.at(i).rad_stat_sphere > r_probe) noAccVorNodes++;
      };
   cout << "Voronoi network with " << vornet.nodes.size() << " nodes. " << noAccVorNodes << " of them are accessible. " << endl;

   PORE::findChannelsAndPockets(&vornet, r_probe, &accessInfo, &pores);

   channelMapping.resize(accessInfo.size(),-1);
   pocketMapping.resize(accessInfo.size(),-1);
   n_channels = 0; n_pockets = 0; // number of channels and pockets
   for(unsigned int i = 0; i < pores.size(); i++)
      {
      if(pores[i].dimensionality>0)
        { // Channels
        for(unsigned int j = 0; j < pores[i].nodes.size(); j++)
          {
          channelMapping[pores[i].reverseIDMappings.find(j)->second] = n_channels;
          };
        n_channels++;
        }else
        { // Pockets
        for(unsigned int j = 0; j < pores[i].nodes.size(); j++)
          {
          pocketMapping[pores[i].reverseIDMappings.find(j)->second] = n_pockets;
          };
        n_pockets++;
        };
     };
   alreadySegmentedFlag = true;
   }; // ends else{

/* DEBUG

for(unsigned int i = 0; i < accessInfo.size(); i++)
  {
  cout << "DEBUG: NodeID, radius, channelID, pocketID = " << i << "  ,   " << vornet.nodes.at(i).rad_stat_sphere << " ,  " << channelMapping[i] << "  ,  " << pocketMapping[i] << endl;
  };

END DEBUG */

// cout << "Accessibility setup: no channels = " << n_channels << " and no pockets = " << n_pockets << "/n";

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpb $0x1, 0x18d(%rdi)
jne 0x6f21b
movsd 0x138(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jne 0x6f1f4
jnp 0x6f44e
movq 0xe0df5(%rip), %rdi     # 0x14fff0
leaq 0x95d04(%rip), %rsi     # 0x104f06
callq 0x4480
leaq 0x95d43(%rip), %rsi     # 0x104f51
movq %rax, %rdi
callq 0x4480
callq 0x4290
movsd %xmm0, 0x138(%rbx)
leaq 0x60(%rbx), %r14
xorl %ebp, %ebp
xorl %eax, %eax
movl %eax, %r15d
movq 0x68(%rbx), %rax
subq 0x60(%rbx), %rax
sarq $0x6, %rax
cmpq %r15, %rax
jbe 0x6f264
movq %r14, %rdi
movq %r15, %rsi
callq 0xa848
movsd 0x18(%rax), %xmm0
xorl %eax, %eax
ucomisd 0x138(%rbx), %xmm0
seta %al
addl %eax, %ebp
leal 0x1(%r15), %eax
jmp 0x6f22b
leaq 0x18(%rbx), %r15
movq 0xe0d51(%rip), %rdi     # 0x14ffc0
leaq 0x95c2a(%rip), %rsi     # 0x104ea0
callq 0x4480
movq 0x68(%rbx), %rsi
subq 0x60(%rbx), %rsi
sarq $0x6, %rsi
movq %rax, %rdi
callq 0x42e0
leaq 0x8f783(%rip), %rsi     # 0xfea19
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movl %ebp, %esi
callq 0x4760
leaq 0x95c07(%rip), %rsi     # 0x104eb6
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
callq 0x4230
movsd 0x138(%rbx), %xmm0
leaq 0xe0(%rbx), %rsi
leaq 0xc0(%rbx), %r14
movq %r15, %rdi
movq %r14, %rdx
callq 0x536c2
leaq 0x108(%rbx), %r15
movq 0xf0(%rbx), %rax
movl 0xf8(%rbx), %ecx
subq 0xe0(%rbx), %rax
leaq (%rcx,%rax,8), %rsi
leaq 0x4(%rsp), %r12
orl $-0x1, (%r12)
movq %r15, %rdi
movq %r12, %rdx
callq 0x36f18
leaq 0x120(%rbx), %rdi
movq 0xf0(%rbx), %rax
movl 0xf8(%rbx), %ecx
subq 0xe0(%rbx), %rax
leaq (%rcx,%rax,8), %rsi
orl $-0x1, (%r12)
leaq 0x4(%rsp), %rdx
movq %rdi, 0x10(%rsp)
callq 0x36f18
andq $0x0, 0xd8(%rbx)
movq 0xc0(%rbx), %rdi
xorl %ecx, %ecx
movl %ecx, %ecx
movq 0xc8(%rbx), %rax
subq %rdi, %rax
cqto
movl $0x130, %esi            # imm = 0x130
idivq %rsi
cmpq %rcx, %rax
jbe 0x6f447
movq %rcx, 0x8(%rsp)
imulq $0x130, %rcx, %r13      # imm = 0x130
cmpl $0x0, 0x108(%rdi,%r13)
jle 0x6f3e3
xorl %r12d, %r12d
movl %r12d, %ecx
movq 0x68(%rdi,%r13), %rax
subq 0x60(%rdi,%r13), %rax
cqto
pushq $0x48
popq %rsi
idivq %rsi
movl 0xd8(%rbx), %ebp
cmpq %rcx, %rax
jbe 0x6f3d9
addq %r13, %rdi
addq $0x30, %rdi
movl %r12d, 0x4(%rsp)
leaq 0x4(%rsp), %rsi
callq 0x10996
movslq 0x24(%rax), %rax
movq (%r15), %rcx
movl %ebp, (%rcx,%rax,4)
incl %r12d
movq (%r14), %rdi
jmp 0x6f391
incl %ebp
movl %ebp, 0xd8(%rbx)
jmp 0x6f43b
xorl %r12d, %r12d
movl %r12d, %ecx
movq 0x68(%rdi,%r13), %rax
subq 0x60(%rdi,%r13), %rax
cqto
pushq $0x48
popq %rsi
idivq %rsi
movl 0xdc(%rbx), %ebp
cmpq %rcx, %rax
jbe 0x6f433
addq %r13, %rdi
addq $0x30, %rdi
movl %r12d, 0x4(%rsp)
leaq 0x4(%rsp), %rsi
callq 0x10996
movslq 0x24(%rax), %rax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movl %ebp, (%rcx,%rax,4)
incl %r12d
movq (%r14), %rdi
jmp 0x6f3e6
incl %ebp
movl %ebp, 0xdc(%rbx)
movq 0x8(%rsp), %rcx
incl %ecx
jmp 0x6f358
movb $0x1, 0x18d(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop