// File: 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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movb 0x18d(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xfe9ff
movq -0x50(%rbp), %rax
movsd -0x10(%rbp), %xmm0
ucomisd 0x138(%rax), %xmm0
jne 0xfe9d3
jp 0xfe9d3
jmp 0xfe9fa
movq 0x174616(%rip), %rdi    # 0x272ff0
leaq 0xfe1dd(%rip), %rsi     # 0x1fcbbe
callq 0x5540
movq %rax, %rdi
leaq 0xfe219(%rip), %rsi     # 0x1fcc09
callq 0x5540
callq 0x52b0
jmp 0xfed9f
movq -0x50(%rbp), %rax
movsd -0x10(%rbp), %xmm0
movsd %xmm0, 0x138(%rax)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x50(%rbp), %rdi
movl -0x18(%rbp), %eax
movq %rax, -0x58(%rbp)
addq $0x18, %rdi
addq $0x48, %rdi
callq 0xf270
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
jae 0xfea84
movq -0x50(%rbp), %rdi
addq $0x18, %rdi
addq $0x48, %rdi
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0xf390
movq %rax, %rcx
movq -0x50(%rbp), %rax
movsd 0x18(%rcx), %xmm0
ucomisd 0x138(%rax), %xmm0
jbe 0xfea77
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xfea79
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xfea1e
movq 0x174535(%rip), %rdi    # 0x272fc0
leaq 0xfe0c6(%rip), %rsi     # 0x1fcb58
callq 0x5540
movq -0x50(%rbp), %rdi
movq %rax, -0x70(%rbp)
addq $0x18, %rdi
addq $0x48, %rdi
callq 0xf270
movq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0x5160
movq %rax, %rdi
leaq 0xf5fdd(%rip), %rsi     # 0x1f4a9f
callq 0x5540
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x58d0
movq %rax, %rdi
leaq 0xfe092(%rip), %rsi     # 0x1fcb6e
callq 0x5540
movq %rax, %rdi
movq 0x1744ad(%rip), %rsi    # 0x272f98
callq 0x55b0
movq -0x50(%rbp), %rdx
movq %rdx, %rdi
addq $0x18, %rdi
movsd 0x138(%rdx), %xmm0
movq %rdx, %rsi
addq $0xe0, %rsi
addq $0xc0, %rdx
callq 0xc6740
movq -0x50(%rbp), %rdi
movq %rdi, %rax
addq $0x108, %rax            # imm = 0x108
movq %rax, -0x68(%rbp)
addq $0xe0, %rdi
callq 0x27d50
movq -0x68(%rbp), %rdi
movq %rax, %rsi
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
leaq -0x1c(%rbp), %rdx
callq 0x84b00
movq -0x50(%rbp), %rdi
movq %rdi, %rax
addq $0x120, %rax            # imm = 0x120
movq %rax, -0x60(%rbp)
addq $0xe0, %rdi
callq 0x27d50
movq -0x60(%rbp), %rdi
movq %rax, %rsi
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
leaq -0x20(%rbp), %rdx
callq 0x84b00
movq -0x50(%rbp), %rax
movl $0x0, 0xd8(%rax)
movl $0x0, 0xdc(%rax)
movl $0x0, -0x24(%rbp)
movq -0x50(%rbp), %rdi
movl -0x24(%rbp), %eax
movq %rax, -0x78(%rbp)
addq $0xc0, %rdi
callq 0x10230
movq %rax, %rcx
movq -0x78(%rbp), %rax
cmpq %rcx, %rax
jae 0xfed94
movq -0x50(%rbp), %rdi
addq $0xc0, %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x10260
cmpl $0x0, 0x108(%rax)
jle 0xfecb6
movl $0x0, -0x28(%rbp)
movq -0x50(%rbp), %rdi
movl -0x28(%rbp), %eax
movq %rax, -0x80(%rbp)
addq $0xc0, %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x10260
movq %rax, %rdi
addq $0x60, %rdi
callq 0x10100
movq %rax, %rcx
movq -0x80(%rbp), %rax
cmpq %rcx, %rax
jae 0xfec9e
movq -0x50(%rbp), %rdi
movl 0xd8(%rdi), %eax
movl %eax, -0x84(%rbp)
movq %rdi, %rax
addq $0x108, %rax            # imm = 0x108
movq %rax, -0x90(%rbp)
addq $0xc0, %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x10260
movq %rax, %rdi
addq $0x30, %rdi
movl -0x28(%rbp), %eax
movl %eax, -0x34(%rbp)
leaq -0x34(%rbp), %rsi
callq 0x102e0
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x10350
movq -0x90(%rbp), %rdi
movslq 0x4(%rax), %rsi
callq 0xed60
movl -0x84(%rbp), %ecx
movl %ecx, (%rax)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xfebf0
movq -0x50(%rbp), %rax
movl 0xd8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xd8(%rax)
jmp 0xfed84
movl $0x0, -0x38(%rbp)
movq -0x50(%rbp), %rdi
movl -0x38(%rbp), %eax
movq %rax, -0x98(%rbp)
addq $0xc0, %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x10260
movq %rax, %rdi
addq $0x60, %rdi
callq 0x10100
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
jae 0xfed71
movq -0x50(%rbp), %rdi
movl 0xdc(%rdi), %eax
movl %eax, -0x9c(%rbp)
movq %rdi, %rax
addq $0x120, %rax            # imm = 0x120
movq %rax, -0xa8(%rbp)
addq $0xc0, %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x10260
movq %rax, %rdi
addq $0x30, %rdi
movl -0x38(%rbp), %eax
movl %eax, -0x44(%rbp)
leaq -0x44(%rbp), %rsi
callq 0x102e0
movq %rax, -0x40(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x10350
movq -0xa8(%rbp), %rdi
movslq 0x4(%rax), %rsi
callq 0xed60
movl -0x9c(%rbp), %ecx
movl %ecx, (%rax)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xfecbd
movq -0x50(%rbp), %rax
movl 0xdc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xdc(%rax)
jmp 0xfed86
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xfeba0
movq -0x50(%rbp), %rax
movb $0x1, 0x18d(%rax)
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)