// File: /workspace/github_cpp_makefile_star2_O1/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 0x96d84
movsd 0x138(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jne 0x96d5d
jnp 0x97034
movq 0x10028c(%rip), %rdi    # 0x196ff0
leaq 0xc10fb(%rip), %rsi     # 0x157e66
callq 0x4440
leaq 0xc113a(%rip), %rsi     # 0x157eb1
movq %rax, %rdi
callq 0x4440
callq 0x4260
movq 0x60(%rbx), %rax
movq 0x68(%rbx), %rcx
movsd %xmm0, 0x138(%rbx)
subq %rax, %rcx
je 0x96dc7
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 0x96da8
jmp 0x96dc9
xorl %ebp, %ebp
leaq 0x18(%rbx), %r14
movq 0x1001ec(%rip), %r15    # 0x196fc0
leaq 0xc1025(%rip), %rsi     # 0x157e00
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 0xbabe7(%rip), %rsi     # 0x1519ed
movl $0x8, %edx
movq %rax, %rdi
callq 0x44e0
movq %r15, %rdi
movl %ebp, %esi
callq 0x4750
movq %rax, %r15
leaq 0xc0fef(%rip), %rsi     # 0x157e16
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 0x719ce
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 0x49326
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 0x49326
movq 0xc0(%rbx), %rax
movq 0xc8(%rbx), %rdx
movq $0x0, 0xd8(%rbx)
subq %rax, %rdx
je 0x9702d
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 0x96fb6
cmpq %r11, %r14
je 0x96fae
movq 0x40(%r9), %r11
addq $0x38, %r9
xorl %r14d, %r14d
movq %r9, %r15
testq %r11, %r11
je 0x96f84
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 0x96f6a
movq %r9, %r12
cmpq %r9, %r15
je 0x96f97
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 0x96f5c
incl 0xd8(%rbx)
jmp 0x9701e
cmpq %r11, %r14
je 0x97018
movq 0x40(%r9), %r11
addq $0x38, %r9
xorl %r14d, %r14d
movq %r9, %r15
testq %r11, %r11
je 0x96fee
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 0x96fd4
movq %r9, %r12
cmpq %r9, %r15
je 0x97001
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 0x96fc6
incl 0xdc(%rbx)
incq %rdi
movl %edi, %r9d
cmpq %r9, %rcx
ja 0x96f1e
movb $0x1, 0x18d(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop