// File: Luthaf[P]zeopp/feature.cc
// Function: FEATURE::segment_identify_connections_recurr(std::vector<int, std::allocator<int>>*, std::vector<int, std::allocator<int>>*, int*, int, int, std::vector<SEGCONN, std::allocator<SEGCONN>>*, int)
void FEATURE::segment_identify_connections_recurr(vector <int> *nodeid,vector <int> *edgeinface,int *nodes_togo,int curr_face,int curr_neigh_seg, vector <SEGCONN> *edges,int curr_edge)
{
int i;
// check node at current edge, if not assigned to face, assign, consider its neighbors


for(i=0;i<(int)edges->size();i++)
   {
   if(i!=curr_edge&&edgeinface->at(i)==-1) // only consider if not yet assigned to face
     {
     //only consider pairs of edges that connect to the same segment 
     if(curr_neigh_seg==edges->at(i).to_seg&&edges->at(curr_edge).deltaPos.equals(edges->at(i).deltaPos))
       {
       // for two edges connecting to another segment, two edges are on the same face
       // only if starting nodes of this face overlap
//       int node1id=nodeid->at(edges->at(curr_edge).from);
//       int node2id=nodeid->at(edges->at(i).from);

//       int node1id=(edges->at(curr_edge).from);
//       int node2id=(edges->at(i).from);

//       if(nodes[node1id].max_radius+nodes[node2id].max_radius>calcEuclideanDistance(nodes[node1id].x,nodes[node1id].y,nodes[node1id].z,nodes[node2id].x,nodes[node2id].y,nodes[node2id].z))
          { // starting nodes of edges overlap, assign edge to the current face
          edgeinface->at(i)=curr_face;
          *nodes_togo=(*nodes_togo)--;
          segment_identify_connections_recurr(nodeid,edgeinface,nodes_togo,curr_face,curr_neigh_seg,edges,i);
          };


       }; // end of if - overlapping nodes

     }; // end of if - the same segments
   }; // end of loop over all edges



}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x54(%rbp)
movq 0x10(%rbp), %rdi
callq 0xe0920
movq %rax, %rcx
movl -0x54(%rbp), %eax
cmpl %ecx, %eax
jge 0xdd197
movl -0x2c(%rbp), %eax
cmpl 0x18(%rbp), %eax
je 0xdd187
movq -0x18(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0x101d0
cmpl $-0x1, (%rax)
jne 0xdd187
movl -0x28(%rbp), %eax
movl %eax, -0x58(%rbp)
movq 0x10(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0xe0950
movq %rax, %rcx
movl -0x58(%rbp), %eax
cmpl 0xc(%rcx), %eax
jne 0xdd185
movq 0x10(%rbp), %rdi
movslq 0x18(%rbp), %rsi
callq 0xe0950
addq $0x24, %rax
movq %rax, -0x60(%rbp)
movq 0x10(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0xe0950
movq -0x60(%rbp), %rdi
movq 0x24(%rax), %rcx
movq %rcx, -0x38(%rbp)
movl 0x2c(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x48(%rbp), %rsi
movl -0x40(%rbp), %edx
callq 0x94040
testb $0x1, %al
jne 0xdd12e
jmp 0xdd185
movl -0x24(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0x101d0
movl -0x64(%rbp), %ecx
movq -0x50(%rbp), %rdi
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
movl %ecx, %edx
addl $-0x1, %edx
movl %edx, (%rax)
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
movq 0x10(%rbp), %r10
movl -0x2c(%rbp), %eax
movq %r10, (%rsp)
movl %eax, 0x8(%rsp)
callq 0xdd040
jmp 0xdd187
jmp 0xdd189
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xdd079
addq $0x80, %rsp
popq %rbp
retq