// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/channel.cc
// Function: PORE::getRestrictingDiameters(int, std::vector<int, std::allocator<int>>, std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>*, std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>>>*, std::vector<double, std::allocator<double>>*, std::vector<int, std::allocator<int>>*, std::vector<double, std::allocator<double>>*, std::vector<int, std::allocator<int>>*)
void PORE::getRestrictingDiameters(int nSegments, vector<int> vorNetID, vector< vector<double> > *PLDtable, vector< vector< pair<int,int> > > *PLDEdgeTable, 
                                  vector<double> *segmentDi, vector<int> *segmentDiNodeID, vector <double> *segmentDiFinal, vector<int> *segmentDiFinalNodeID){
    //Define three access types
    const int ACCESSED   =  1;
    const int UNKNOWN      = -1;

    // flag that is used to terminate the search
    
    bool node2FoundFlag = false;

    // Make a local copy of nodes vector as it will be modified
    vector<DIJKSTRA_NODE> lnodes = nodes;
    
    // Initialize the unit cell position of each node
    vector<DELTA_POS> directions = vector<DELTA_POS> (lnodes.size(), DELTA_POS(0,0,0));
    
    // Initialize the status of each node as UNKNOWN
    vector<int> accessStatuses = vector<int> (lnodes.size(), UNKNOWN);
    unsigned int nodeIndex = 0;
    
    double di,df;

    if(nSegments < 1){
      cerr << "Number of semgents lower than 1. This function should not be called.\n" << "\n";
      abort();
      };

//debug
//for(unsigned int i=0; i<vorNetID.size();i++) cout << vorNetID[i] << "  ";


    // Need to translate IDs from the original Voronoi network to PORE ids 

    vector <int> PoreNodesSegmentIDs; // will store segment ID for each node in the current PORE

    PoreNodesSegmentIDs.resize(nodes.size(), -1);

    int nSegPresent = 0;
    for(unsigned int i=0; i<nodes.size(); i++)
       {
       int VnodeID = reverseIDMappings.find(i)->second;
       if(vorNetID[VnodeID] >= 0)
         {
         PoreNodesSegmentIDs[i] = vorNetID[VnodeID]; 
         nSegPresent++;
         };

       };

    cout << "Current PORE contains " << nSegPresent << " nodes in predefined segments. Proceeding with Restricting Diameter Calcs\n";

    // Start analysis by accepting all nodes already assigned to segments (segment seed nodes)
    // Store information about largest node pre-assigned to each segment

    for(unsigned int i=0; i<nodes.size(); i++)
       {
       if(PoreNodesSegmentIDs[i] > -1) 
          {
          accessStatuses[i] = ACCESSED;   
          directions[i] = DELTA_POS(0,0,0); // not sure about this line
          
          if(segmentDi->at(PoreNodesSegmentIDs[i]) < nodes.at(i).max_radius*2) 
             {
             segmentDi->at(PoreNodesSegmentIDs[i]) = nodes.at(i).max_radius*2;
             segmentDiNodeID->at(PoreNodesSegmentIDs[i]) = reverseIDMappings.find(i)->second;
             segmentDiFinal->at(PoreNodesSegmentIDs[i]) = segmentDi->at(PoreNodesSegmentIDs[i]);
             };
          };
       };


/* BUG BUG line (1ln) below, it probably clears segmentDiFinal too many times, moving to the above loop */
//    for(int i=0; i<nSegments; i++) segmentDiFinal->at(i) = segmentDi->at(i); // copying current segments into Final
    
/* old stuff to be removed
    // Start analysis for node of id = nodeid
    
    nodeIndex = node1; // node1 is w.r.t pore node index (use PORE reverseMapping to retrieve original node
    
    // accept the initial node
    di=lnodes.at(nodeIndex).max_radius;
    df=lnodes.at(nodeIndex).max_radius;
    
    accessStatuses[nodeIndex] = ACCESSED;
    
    directions[nodeIndex] = DELTA_POS(0,0,0);

 ends old stuff */
    
    compareConnections_ptr = &lnodes;
    HEAP< pair<int,int> > stack(compareConnections);
    
    // loop over all connections and add them to stack
    for(unsigned int n=0;  n<nodes.size(); n++)
      {
      if(accessStatuses[n] == ACCESSED)
        {
        for(unsigned int i=0; i<lnodes[n].connections.size(); i++)
          {
          if(lnodes[n].connections.at(i).max_radius > lnodes.at(lnodes[n].connections.at(i).to).max_radius)
              lnodes[n].connections.at(i).max_radius = lnodes.at(lnodes[n].connections.at(i).to).max_radius;
        
          stack.insert(pair<int,int>(n,i));
          };
        };
      };
    
    stack.reHeapify();

//
// Note: in the following blocks, we probably dont need directions[]
// to be cleaned in the future

    
    while(stack.size() != 0){
        //loop with Dijkstra-like propagation
        
        // select the path with largest opening
        pair<int,int> best = stack.pop();
        
        int best_node = lnodes[best.first].connections[best.second].to;
        
        if(accessStatuses[best_node]==UNKNOWN)
        {
            // if the node (best_node) is not assigned to segment, assign it to the current segment (determined by node best.first)
            // check new connections, add to heap or terminane
            
            accessStatuses[best_node] = ACCESSED; 
            directions[best_node] = directions[best.first];
            directions[best_node] = directions[best_node] + (lnodes[best.first].connections.at(best.second).deltaPos);
            PoreNodesSegmentIDs[best_node] = PoreNodesSegmentIDs[best.first];
           
            if(nodes.at(best_node).max_radius * 2 > segmentDiFinal->at(PoreNodesSegmentIDs[best.first])) 
               {   
               segmentDiFinal->at(PoreNodesSegmentIDs[best.first]) = nodes.at(best_node).max_radius * 2; 
               segmentDiFinalNodeID->at(PoreNodesSegmentIDs[best.first]) = reverseIDMappings.find(best_node)->second;
               };

            // going to add new connections to the heap
            for(unsigned int i=0; i<lnodes[best_node].connections.size(); i++)
            {
                if(lnodes[best_node].connections.at(i).max_radius > lnodes.at(lnodes[best_node].connections.at(i).to).max_radius)
                    lnodes[best_node].connections.at(i).max_radius = lnodes.at(lnodes[best_node].connections.at(i).to).max_radius;
                
                if(lnodes[best_node].connections[i].to!=best.first)
                    stack.insert(pair<int,int>(best_node,i));
            };	
//            stack.reHeapify(); 
//            I think reHeapify is not needed as heap.insert ensures proper sorting
        }
        
        else if(accessStatuses[best_node]==ACCESSED){
            //selected connection leads to a node that is already assigned to a segment

            // if it is of different segment, note the destricting diameter
            if(PoreNodesSegmentIDs[best_node] != PoreNodesSegmentIDs[best.first])
              {
              // record the largest resticting diameter between two segments of the same PORE
              double r = lnodes[best.first].connections.at(best.second).max_radius;

//begin debug
//cout << "PLD table size: " << PLDtable->size() << "   " << PLDtable->at(PoreNodesSegmentIDs[best_node]).size() << "\n";
//cout << "PoreNodesSegmentIDs[best_node]= " << PoreNodesSegmentIDs[best_node] << "   PoreNodesSegmentIDs[best.first]= " << PoreNodesSegmentIDs[best.first] << "\n"; 
//              if(PLDtable->size() > PoreNodesSegmentIDs[best_node] + 1 || PLDtable->at(PoreNodesSegmentIDs[best_node]).size() > PoreNodesSegmentIDs[best.first] + 1)
//    {cout << "alarm...\n";
//};
//end debug
              double stored_d = PLDtable->at(PoreNodesSegmentIDs[best_node]).at(PoreNodesSegmentIDs[best.first]);
              if(2*r> stored_d)
                {
                PLDtable->at(PoreNodesSegmentIDs[best_node]).at(PoreNodesSegmentIDs[best.first]) = 2*r;
                PLDtable->at(PoreNodesSegmentIDs[best.first]).at(PoreNodesSegmentIDs[best_node]) = 2*r;
                pair<int,int> p(reverseIDMappings.find(best_node)->second, reverseIDMappings.find(best.first)->second); 
                PLDEdgeTable->at(PoreNodesSegmentIDs[best_node]).at(PoreNodesSegmentIDs[best.first]) = p;
                PLDEdgeTable->at(PoreNodesSegmentIDs[best.first]).at(PoreNodesSegmentIDs[best_node]) = p;
                }else{
                //cerr << "Trying to store smaller diameter than already stored. This shouldnt happen. Check the code\n";
                };              
              } else
              {
              // both nodes are of the same segment, do nothing

              };
            
           /* old stuff, probably to be removed  
            if(!(directions[best_node]).equals(directions[best.first] + lnodes[best.first].connections.at(best.second).deltaPos))
            {
                // if nodes are in different unit cells (a loop is found); just update df and continue 
                if(df>nodes[best.first].connections.at(best.second).max_radius) df=nodes[best.first].connections.at(best.second).max_radius;
            };
           */
        }
        
        else{
            //
            // need this section ?
            //
        };
        
    };
   
   for(int i=0; i<nSegments; i++)
     {
     if(segmentDi->at(i)!=segmentDiFinal->at(i)) cerr << "Segment Di(" << segmentDi->at(i) << ") is different than Segment Di Final (" << segmentDiFinal->at(i) << ") for segment " << i << ".\n";
     };  

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %r9, 0x40(%rsp)
movq %r8, 0xe0(%rsp)
movq %rcx, 0x98(%rsp)
movq %rdx, %r14
movl %esi, 0x4c(%rsp)
movq %rdi, %r15
orl $-0x1, 0xac(%rsp)
leaq 0x60(%rdi), %rsi
leaq 0x50(%rsp), %r12
movq %r12, %rdi
movq %rsi, 0x68(%rsp)
callq 0x2a78c
movq (%r12), %rbx
movq 0x8(%r12), %r13
leaq 0x78(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3d328
subq %rbx, %r13
pushq $0x48
popq %rbx
movq %r13, %rax
cqto
idivq %rbx
leaq 0xc8(%rsp), %rdi
leaq 0x78(%rsp), %rdx
leaq 0xb0(%rsp), %rcx
movq %rax, %rsi
callq 0x579e8
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
cqto
idivq %rbx
leaq 0xb0(%rsp), %rdi
leaq 0xac(%rsp), %rdx
leaq 0x78(%rsp), %rcx
movq %rax, %rsi
callq 0x2a44a
cmpl $0x0, 0x4c(%rsp)
jle 0x5759f
xorpd %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
andq $0x0, 0x10(%rdi)
movapd %xmm0, (%rdi)
movq 0x68(%r15), %rax
subq 0x60(%r15), %rax
cqto
idivq %rbx
leaq 0x78(%rsp), %rdx
orl $-0x1, (%rdx)
movq %rax, %rsi
callq 0x36f18
movq %r15, 0xa0(%rsp)
leaq 0x30(%r15), %rax
movq %rax, 0x70(%rsp)
xorl %ebx, %ebx
leaq 0x78(%rsp), %rbp
xorl %r13d, %r13d
movl %ebx, %r15d
movq 0xa0(%rsp), %rcx
movq 0x68(%rcx), %rax
subq 0x60(%rcx), %rax
cqto
pushq $0x48
popq %rcx
idivq %rcx
cmpq %r15, %rax
jbe 0x56d4c
movl %ebx, 0x78(%rsp)
movq 0x70(%rsp), %rdi
movq %rbp, %rsi
callq 0x10996
movslq 0x24(%rax), %rax
movq (%r14), %rcx
movl (%rcx,%rax,4), %eax
testl %eax, %eax
js 0x56d48
movq 0x20(%rsp), %rcx
movl %eax, (%rcx,%r15,4)
incl %r13d
incl %ebx
jmp 0x56cfd
movq 0xf926d(%rip), %rdi     # 0x14ffc0
leaq 0xacdab(%rip), %rsi     # 0x103b05
callq 0x4480
movq %rax, %rdi
movl %r13d, %esi
callq 0x4760
leaq 0xacdab(%rip), %rsi     # 0x103b1c
movq %rax, %rdi
callq 0x4480
xorl %ebp, %ebp
leaq 0x78(%rsp), %r14
movq 0xa0(%rsp), %r15
pushq $0x48
popq %rbx
movl %ebp, %r13d
movq 0x68(%r15), %rax
subq 0x60(%r15), %rax
cqto
idivq %rbx
cmpq %r13, %rax
jbe 0x56edd
movq 0x20(%rsp), %rax
cmpl $0x0, (%rax,%r13,4)
js 0x56ed6
movq 0xb0(%rsp), %rax
movl $0x1, (%rax,%r13,4)
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3d328
movq 0xc8(%rsp), %rax
imulq $0xc, %r13, %rcx
movl 0x80(%rsp), %edx
movl %edx, 0x8(%rax,%rcx)
movq 0x78(%rsp), %rdx
movq %rdx, (%rax,%rcx)
movq 0x20(%rsp), %rax
movslq (%rax,%r13,4), %rsi
movq 0x40(%rsp), %rdi
callq 0xaa50
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x68(%rsp), %rdi
movq %r13, %rsi
callq 0xabe2
movsd 0x38(%rax), %xmm0
addsd %xmm0, %xmm0
ucomisd 0x10(%rsp), %xmm0
jbe 0x56ed6
movq 0x68(%rsp), %rdi
movq %r13, %rsi
callq 0xabe2
movsd 0x38(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x20(%rsp), %rax
movslq (%rax,%r13,4), %rsi
movq 0x40(%rsp), %rdi
callq 0xaa50
movsd 0x10(%rsp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, (%rax)
movl %ebp, 0x78(%rsp)
movq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x10996
movl 0x24(%rax), %ebx
movq 0x20(%rsp), %rax
movslq (%rax,%r13,4), %rsi
movq 0x120(%rsp), %rdi
callq 0xac00
movl %ebx, (%rax)
movq 0x20(%rsp), %rax
movslq (%rax,%r13,4), %rsi
movq 0x40(%rsp), %rdi
callq 0xaa50
pushq $0x48
popq %rbx
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x20(%rsp), %rax
movslq (%rax,%r13,4), %rsi
movq 0x128(%rsp), %rdi
callq 0xaa50
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
incl %ebp
jmp 0x56d8b
movq %r12, 0xf988c(%rip)     # 0x150770
leaq -0xa00(%rip), %rsi      # 0x564eb
leaq 0x78(%rsp), %r14
movq %r14, %rdi
callq 0x57a3e
xorl %ebx, %ebx
pushq $0x28
popq %rbp
movl %ebx, %ebx
movq 0x68(%r15), %rax
subq 0x60(%r15), %rax
cqto
pushq $0x48
popq %rcx
idivq %rcx
cmpq %rbx, %rax
jbe 0x5700f
movq 0xb0(%rsp), %rax
cmpl $0x1, (%rax,%rbx,4)
jne 0x57000
xorl %r13d, %r13d
imulq $0x48, %rbx, %r15
movl %r13d, %r13d
movq 0x50(%rsp), %rcx
movq 0x28(%rcx,%r15), %rax
subq 0x20(%rcx,%r15), %rax
cqto
idivq %rbp
cmpq %r13, %rax
jbe 0x57000
leaq (%rcx,%r15), %rdi
addq $0x20, %rdi
movq %r13, %rsi
callq 0x29efa
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x50(%rsp), %rax
leaq (%rax,%r15), %rdi
addq $0x20, %rdi
movq %r13, %rsi
callq 0x29efa
movslq 0x4(%rax), %rsi
movq %r12, %rdi
callq 0xabe2
movsd 0x10(%rsp), %xmm0
ucomisd 0x38(%rax), %xmm0
jbe 0x56fe6
movq 0x50(%rsp), %rax
leaq (%rax,%r15), %rdi
addq $0x20, %rdi
movq %r13, %rsi
callq 0x29efa
movslq 0x4(%rax), %rsi
movq %r12, %rdi
callq 0xabe2
movsd 0x38(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x50(%rsp), %rax
leaq (%rax,%r15), %rdi
addq $0x20, %rdi
movq %r13, %rsi
callq 0x29efa
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
movq %r13, %rsi
shlq $0x20, %rsi
orq %rbx, %rsi
movq %r14, %rdi
callq 0x57a74
incl %r13d
jmp 0x56f31
incl %ebx
movq 0xa0(%rsp), %r15
jmp 0x56efd
leaq 0x78(%rsp), %rdi
callq 0x57aa2
leaq 0x78(%rsp), %r15
leaq 0x50(%rsp), %r12
movq 0xe0(%rsp), %r13
movq 0x80(%rsp), %rax
subq 0x78(%rsp), %rax
shrq $0x3, %rax
testl %eax, %eax
je 0x57479
movq %r15, %rdi
callq 0x57ab6
movq %rax, 0x18(%rsp)
movslq %eax, %rsi
movq 0x50(%rsp), %rcx
imulq $0x48, %rsi, %rdx
sarq $0x20, %rax
movq 0x20(%rcx,%rdx), %rdi
imulq $0x28, %rax, %r8
movslq 0x4(%rdi,%r8), %rdi
movl %edi, 0xc(%rsp)
movq 0xb0(%rsp), %r8
movl (%r8,%rdi,4), %r9d
cmpl $0x1, %r9d
je 0x572f7
cmpl $-0x1, %r9d
jne 0x5702b
movl $0x1, (%r8,%rdi,4)
movslq 0x18(%rsp), %rax
movq 0xc8(%rsp), %rcx
imulq $0xc, %rax, %rdx
movslq 0xc(%rsp), %rsi
imulq $0xc, %rsi, %rbx
movl 0x8(%rcx,%rdx), %esi
movl %esi, 0x8(%rcx,%rbx)
movq (%rcx,%rdx), %rdx
movq %rdx, (%rcx,%rbx)
movq 0xc8(%rsp), %r14
movq 0x50(%rsp), %rcx
imulq $0x48, %rax, %rax
leaq (%rcx,%rax), %rdi
addq $0x20, %rdi
movslq 0x1c(%rsp), %rsi
callq 0x29efa
addq %rbx, %r14
addq $0x18, %rax
movq %r14, %rdi
movq %rax, %rsi
callq 0x3d380
movslq 0xc(%rsp), %rcx
movq 0xc8(%rsp), %rsi
imulq $0xc, %rcx, %rcx
movq %rax, (%rsi,%rcx)
movl %edx, 0x8(%rsi,%rcx)
movslq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
movl (%rcx,%rax,4), %eax
movslq 0xc(%rsp), %rdx
movl %eax, (%rcx,%rdx,4)
movslq 0xc(%rsp), %rsi
movq 0x68(%rsp), %rdi
callq 0xabe2
movq 0x70(%rsp), %rbx
movsd 0x38(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movslq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
movslq (%rcx,%rax,4), %rsi
movq 0x128(%rsp), %rdi
callq 0xaa50
movsd 0x10(%rsp), %xmm0
addsd %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x571de
movslq 0xc(%rsp), %rsi
movq 0x68(%rsp), %rdi
callq 0xabe2
movsd 0x38(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movslq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
movslq (%rcx,%rax,4), %rsi
movq 0x128(%rsp), %rdi
callq 0xaa50
movsd 0x10(%rsp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, (%rax)
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x10996
movl 0x24(%rax), %ebx
movslq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
movslq (%rcx,%rax,4), %rsi
movq 0x130(%rsp), %rdi
callq 0xac00
movl %ebx, (%rax)
xorl %r14d, %r14d
movl %r14d, %r14d
movslq 0xc(%rsp), %rax
movq 0x50(%rsp), %rcx
imulq $0x48, %rax, %rsi
movq 0x28(%rcx,%rsi), %rax
subq 0x20(%rcx,%rsi), %rax
cqto
idivq %rbp
cmpq %r14, %rax
jbe 0x5702b
leaq (%rcx,%rsi), %rdi
addq $0x20, %rdi
movq %r14, %rsi
callq 0x29efa
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movslq 0xc(%rsp), %rax
movq 0x50(%rsp), %rcx
imulq $0x48, %rax, %rax
leaq (%rcx,%rax), %rdi
addq $0x20, %rdi
movq %r14, %rsi
callq 0x29efa
movslq 0x4(%rax), %rsi
movq %r12, %rdi
callq 0xabe2
movsd 0x10(%rsp), %xmm0
ucomisd 0x38(%rax), %xmm0
jbe 0x572ba
movslq 0xc(%rsp), %rax
movq 0x50(%rsp), %rcx
imulq $0x48, %rax, %rax
leaq (%rcx,%rax), %rdi
addq $0x20, %rdi
movq %r14, %rsi
callq 0x29efa
movslq 0x4(%rax), %rsi
movq %r12, %rdi
callq 0xabe2
movsd 0x38(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movslq 0xc(%rsp), %rax
movq 0x50(%rsp), %rcx
imulq $0x48, %rax, %rax
leaq (%rcx,%rax), %rdi
addq $0x20, %rdi
movq %r14, %rsi
callq 0x29efa
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
movslq 0xc(%rsp), %rax
movq 0x50(%rsp), %rcx
imulq $0x48, %rax, %rdx
movq 0x20(%rcx,%rdx), %rcx
imulq $0x28, %r14, %rdx
movl 0x4(%rcx,%rdx), %ecx
cmpl 0x18(%rsp), %ecx
je 0x572ef
movl %eax, %eax
movq %r14, %rsi
shlq $0x20, %rsi
orq %rax, %rsi
movq %r15, %rdi
callq 0x57a74
incl %r14d
jmp 0x571e1
movq 0x20(%rsp), %r8
movl (%r8,%rdi,4), %edi
cmpl (%r8,%rsi,4), %edi
je 0x5702b
leaq (%rcx,%rdx), %rdi
addq $0x20, %rdi
movq %rax, %rsi
callq 0x29efa
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movslq 0xc(%rsp), %rax
movq 0x20(%rsp), %rcx
movslq (%rcx,%rax,4), %rsi
movq 0x98(%rsp), %rdi
callq 0x57adc
movslq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rdx
movslq (%rdx,%rcx,4), %rsi
movq %rax, %rdi
callq 0xaa50
movsd 0x10(%rsp), %xmm0
addsd %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x5702b
movsd %xmm0, 0x10(%rsp)
movslq 0xc(%rsp), %rax
movq 0x20(%rsp), %rcx
movslq (%rcx,%rax,4), %rsi
movq 0x98(%rsp), %rdi
callq 0x57adc
movslq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rdx
movslq (%rdx,%rcx,4), %rsi
movq %rax, %rdi
callq 0xaa50
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
movslq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
movslq (%rcx,%rax,4), %rsi
movq 0x98(%rsp), %rdi
callq 0x57adc
movslq 0xc(%rsp), %rcx
movq 0x20(%rsp), %rdx
movslq (%rdx,%rcx,4), %rsi
movq %rax, %rdi
callq 0xaa50
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x70(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x10996
movq %rax, %r14
movq %rbx, %rdi
leaq 0x18(%rsp), %rsi
callq 0x10996
movl 0x24(%r14), %ebx
movl 0x24(%rax), %r14d
movslq 0xc(%rsp), %rax
movq 0x20(%rsp), %rcx
movslq (%rcx,%rax,4), %rsi
movq %r13, %rdi
callq 0x57afa
movslq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rdx
movslq (%rdx,%rcx,4), %rsi
movq %rax, %rdi
callq 0x57b18
movl %ebx, (%rax)
movl %r14d, 0x4(%rax)
movslq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
movslq (%rcx,%rax,4), %rsi
movq %r13, %rdi
callq 0x57afa
movslq 0xc(%rsp), %rcx
movq 0x20(%rsp), %rdx
movslq (%rdx,%rcx,4), %rsi
movq %rax, %rdi
callq 0x57b18
movl %ebx, (%rax)
movl %r14d, 0x4(%rax)
jmp 0x5702b
movl 0x4c(%rsp), %ebx
xorl %r14d, %r14d
leaq 0xac6ec(%rip), %r13     # 0x103b73
leaq 0xac70c(%rip), %rbp     # 0x103b9a
leaq 0xb736d(%rip), %r15     # 0x10e802
cmpq %r14, %rbx
je 0x57555
movq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0xaa50
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x128(%rsp), %rdi
movq %r14, %rsi
callq 0xaa50
movsd 0x10(%rsp), %xmm0
ucomisd (%rax), %xmm0
jne 0x574d3
jnp 0x5754d
movq 0xf8b16(%rip), %rdi     # 0x14fff0
leaq 0xac686(%rip), %rsi     # 0x103b67
callq 0x4480
movq %rax, %r12
movq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0xaa50
movsd (%rax), %xmm0
movq %r12, %rdi
callq 0x46c0
movq %rax, %rdi
movq %r13, %rsi
callq 0x4480
movq %rax, %r12
movq 0x128(%rsp), %rdi
movq %r14, %rsi
callq 0xaa50
movsd (%rax), %xmm0
movq %r12, %rdi
callq 0x46c0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x4480
movq %rax, %rdi
movl %r14d, %esi
callq 0x4760
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
incq %r14
jmp 0x57495
leaq 0x78(%rsp), %rdi
callq 0x10942
leaq 0x20(%rsp), %rdi
callq 0xb290
leaq 0xb0(%rsp), %rdi
callq 0xb290
leaq 0xc8(%rsp), %rdi
callq 0xb758
leaq 0x50(%rsp), %rdi
callq 0xae22
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xf8a4a(%rip), %rdi     # 0x14fff0
leaq 0xac512(%rip), %rsi     # 0x103abf
callq 0x4480
leaq 0xaafc5(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
callq 0x4290
movq %rax, %rbx
jmp 0x57615
jmp 0x575fe
jmp 0x575f5
movq %rax, %rbx
jmp 0x57622
jmp 0x575d6
movq %rax, %rbx
jmp 0x5762f
jmp 0x575fe
jmp 0x575fe
jmp 0x575f5
jmp 0x575fe
jmp 0x575fe
jmp 0x575fe
jmp 0x575f5
jmp 0x575f5
jmp 0x575fe
jmp 0x575fe
jmp 0x575fe
jmp 0x575fe
jmp 0x575f5
movq %rax, %rbx
jmp 0x5760b
jmp 0x575fe
jmp 0x575fe
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x10942
leaq 0x20(%rsp), %rdi
callq 0xb290
leaq 0xb0(%rsp), %rdi
callq 0xb290
leaq 0xc8(%rsp), %rdi
callq 0xb758
leaq 0x50(%rsp), %rdi
callq 0xae22
movq %rbx, %rdi
callq 0x4780
nop