// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %rax
movq %rdi, %rbx
cmpb $0x1, 0x18d(%rdi)
jne 0x94d0a
movsd 0x138(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jne 0x94ce3
jnp 0x94fba
movq 0x100306(%rip), %rdi    # 0x194ff0
leaq 0xc12d5(%rip), %rsi     # 0x155fc6
callq 0x4440
leaq 0xc1314(%rip), %rsi     # 0x156011
movq %rax, %rdi
callq 0x4440
callq 0x4260
movq 0x60(%rbx), %rax
movq 0x68(%rbx), %rcx
movsd %xmm0, 0x138(%rbx)
subq %rax, %rcx
je 0x94d4d
sarq $0x6, %rcx
addq $0x18, %rax
xorl %ebp, %ebp
movl $0x1, %edx
movsd (%rax), %xmm1
xorl %esi, %esi
ucomisd %xmm0, %xmm1
seta %sil
addl %esi, %ebp
movl %edx, %esi
addq $0x40, %rax
incl %edx
cmpq %rsi, %rcx
ja 0x94d2e
jmp 0x94d4f
xorl %ebp, %ebp
leaq 0x18(%rbx), %r14
movq 0x100266(%rip), %r15    # 0x194fc0
leaq 0xc11ff(%rip), %rsi     # 0x155f60
movl $0x15, %edx
movq %r15, %rdi
callq 0x44e0
movq 0x68(%rbx), %rsi
subq 0x60(%rbx), %rsi
sarq $0x6, %rsi
movq %r15, %rdi
callq 0x42b0
movq %rax, %r15
leaq 0xbacd1(%rip), %rsi     # 0x14fa5d
movl $0x8, %edx
movq %rax, %rdi
callq 0x44e0
movq %r15, %rdi
movl %ebp, %esi
callq 0x4750
movq %rax, %r15
leaq 0xc11c9(%rip), %rsi     # 0x155f76
movl $0x19, %edx
movq %rax, %rdi
callq 0x44e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4420
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42c0
movsd 0x138(%rbx), %xmm0
leaq 0xe0(%rbx), %rsi
leaq 0xc0(%rbx), %rdx
movq %r14, %rdi
callq 0x70d00
leaq 0x108(%rbx), %r14
movq 0xf0(%rbx), %rax
movl 0xf8(%rbx), %ecx
subq 0xe0(%rbx), %rax
leaq (%rcx,%rax,8), %rsi
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leaq 0x4(%rsp), %rdx
movl %ebp, (%rdx)
movq %r14, %rdi
callq 0x48a3e
leaq 0x120(%rbx), %r15
movq 0xf0(%rbx), %rax
subq 0xe0(%rbx), %rax
movl 0xf8(%rbx), %ecx
leaq (%rcx,%rax,8), %rsi
movq %rsp, %rdx
movl %ebp, (%rdx)
movq %r15, %rdi
callq 0x48a3e
movq 0xc0(%rbx), %rax
movq 0xc8(%rbx), %rdx
movq $0x0, 0xd8(%rbx)
subq %rax, %rdx
je 0x94fb3
sarq $0x4, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rdx, %rcx
movq (%r15), %rdx
movq (%r14), %rsi
xorl %edi, %edi
movabsq $-0x71c71c71c71c71c7, %r8 # imm = 0x8E38E38E38E38E39
imulq $0x130, %rdi, %r15      # imm = 0x130
leaq (%rax,%r15), %r9
movq 0x60(%rax,%r15), %r11
movq 0x68(%rax,%r15), %r14
movq %r14, %r10
subq %r11, %r10
sarq $0x3, %r10
imulq %r8, %r10
cmpl $0x0, 0x108(%rax,%r15)
jle 0x94f3c
cmpq %r11, %r14
je 0x94f34
movq 0x40(%r9), %r11
addq $0x38, %r9
xorl %r14d, %r14d
movq %r9, %r12
testq %r11, %r11
je 0x94f1d
movq %r11, %r12
movq %r9, %r15
xorl %r13d, %r13d
cmpl %r14d, 0x20(%r12)
setl %r13b
cmovgeq %r12, %r15
movq 0x10(%r12,%r13,8), %r12
testq %r12, %r12
jne 0x94ef0
movq %r9, %r12
cmpq %r9, %r15
je 0x94f1d
cmpl 0x20(%r15), %r14d
cmovlq %r9, %r15
movq %r15, %r12
movl 0xd8(%rbx), %ebp
movslq 0x24(%r12), %r15
movl %ebp, (%rsi,%r15,4)
incl %r14d
cmpq %r14, %r10
ja 0x94ee2
incl 0xd8(%rbx)
jmp 0x94fa4
cmpq %r11, %r14
je 0x94f9e
movq 0x40(%r9), %r11
addq $0x38, %r9
xorl %r14d, %r14d
movq %r9, %r12
testq %r11, %r11
je 0x94f87
movq %r11, %r12
movq %r9, %r15
xorl %r13d, %r13d
cmpl %r14d, 0x20(%r12)
setl %r13b
cmovgeq %r12, %r15
movq 0x10(%r12,%r13,8), %r12
testq %r12, %r12
jne 0x94f5a
movq %r9, %r12
cmpq %r9, %r15
je 0x94f87
cmpl 0x20(%r15), %r14d
cmovlq %r9, %r15
movq %r15, %r12
movl 0xdc(%rbx), %ebp
movslq 0x24(%r12), %r15
movl %ebp, (%rdx,%r15,4)
incl %r14d
cmpq %r14, %r10
ja 0x94f4c
incl 0xdc(%rbx)
incq %rdi
movl %edi, %r9d
cmpq %r9, %rcx
ja 0x94ea4
movb $0x1, 0x18d(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop