// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/channel.cc
// Function: PORE::findChannelsAndPockets(DIJKSTRA_NETWORK*, std::vector<bool, std::allocator<bool>>*, std::vector<PORE, std::allocator<PORE>>*)
void PORE::findChannelsAndPockets(DIJKSTRA_NETWORK *dnet, vector<bool> *infoStorage,
                                  vector<PORE> *pores)
{
    //Define three access types
    const int ACCESSIBLE   =  1;
    const int INACCESSIBLE =  0;
    const int UNKNOWN      = -1;
    
    vector<DELTA_POS> directions = vector<DELTA_POS> ();
    
    // Initialize the status of each node as UNKNOWN
    vector<int> accessStatuses = vector<int> (dnet->nodes.size(), UNKNOWN);
    unsigned int nodeIndex = 0;
    
    // Get and Print basic info
    int noAccDijkNodes = 0; // number of active Dijkstra nodes (ones with radius > 0)
    int noAccDijkNodesAssigned = 0; // number of active Dijkstra nodes already assigned to pores.
    for(unsigned int i = 0; i < dnet->nodes.size(); i++)
    {
        if(dnet->nodes.at(i).active == true) noAccDijkNodes++;
        
        //debug line
        //cout << "id,active " << i << "   " << dnet->nodes.at(i).active << endl;
    };
    cout << "\nFinding channels and pockets in Dijkstra network of " << dnet->nodes.size() << " node(s). " << noAccDijkNodes << " are expected to compose pores." << endl;
    
    // Iterate over all nodes
    while(nodeIndex != accessStatuses.size()){
        //Skip node if access status already determined
        if(accessStatuses.at(nodeIndex) != UNKNOWN){
            nodeIndex++;
            continue;
        }
        
        // Start out with 0-dimensional pore w/o any basis vectors
        int dim = 0;
        int basis [3][3] = {{0,0,0},
			{0,0,0},
			{0,0,0}};
        
        // Place starting node on stack with (0,0,0) displacement
        int accessStatus = UNKNOWN;
        DELTA_POS displacement = DELTA_POS(0,0,0);
        map<int,DELTA_POS> visitedNodeDisplacement;
        vector<pair<int,DELTA_POS> > stack;
        stack.push_back(pair<int,DELTA_POS> (nodeIndex,displacement));
        visitedNodeDisplacement.insert(pair<int,DELTA_POS>(nodeIndex, displacement));
        
        while(stack.size() != 0){
            // Remove top-most node
            pair<int,DELTA_POS> nodeInfo = stack.back();
            DIJKSTRA_NODE currentNode = dnet->nodes.at(nodeInfo.first);
            stack.pop_back();
            
            // Follow all edges leading to adjoining nodes
            vector<CONN>::iterator connIter = currentNode.connections.begin();
            while(connIter != currentNode.connections.end()){
                int to = connIter->to;
                DELTA_POS newDisplacement = nodeInfo.second + connIter->deltaPos;
                int localAccessStatus = accessStatuses.at(to);
                
                if(localAccessStatus == UNKNOWN){
                    map<int,DELTA_POS>::iterator visitedNode = visitedNodeDisplacement.find(to);
                    if(visitedNode != visitedNodeDisplacement.end()){
                        if(visitedNode->second.equals(newDisplacement)){
                            // Circling back to previous node
                            // Do nothing
                        }
                        else{
                            // Nodes are ACCESSIBLE b/c same node visited in different unit cell
                            accessStatus = ACCESSIBLE;
                            DELTA_POS direction = newDisplacement - visitedNode->second;
                            
                            
                            /******* Start of Michael's code ******/
                            if(dim == 0){
                                basis[0][0] = direction.x;
                                basis[1][0] = direction.y;
                                basis[2][0] = direction.z;
                                dim++;
                            }
                            else if (dim == 1){
                                double v;
                                
                                if (basis[0][0] != 0) v = 1.0*direction.x/basis[0][0];
                                else if (basis[1][0] != 0) v = 1.0*direction.y/basis[1][0];
                                else if (basis[2][0] != 0) v = 1.0*direction.z/basis[2][0];
                                else {
                                    cerr << "Error: Pore basis vector is zero vector. Exiting..." << "\n";
                                    exit(1);
                                }
                                
                                if(!(basis[0][0]*v == direction.x && basis[1][0]*v == direction.y &&
                                     basis[2][0]*v == direction.z)){
                                    basis[0][1] = direction.x;
                                    basis[1][1] = direction.y;
                                    basis[2][1] = direction.z;
                                    dim++;
                                }
                            }
                            else if (dim == 2){
                                basis[0][2] = direction.x;
                                basis[1][2] = direction.y;
                                basis[2][2] = direction.z;
                                if(abs(calcDeterminant(basis)) < 1e-8){
                                    basis[0][2] = basis[1][2] = basis[2][2] = 0;
                                }
                                else
                                    dim++;
                            }
                            /****** End of Michael's code ******/
                        }
                    }
                    else{
                        // Node being visited for the first time
                        visitedNodeDisplacement.insert(pair<int,DELTA_POS>(to, newDisplacement));
                        stack.push_back(pair<int,DELTA_POS> (to, newDisplacement));
                    }
                }
                else{
                    // The status of a region should be determined
                    // with all of its neighbors. Otherwise, all possible nodes
                    // were not explored.
                    cerr << "Error: Illogical result  when attempting to identify channels/pockets." << "\n";
                    cerr << "Please contact the source code provider with your program input. " << "\n";
                    cerr << "Exiting ..." << "\n";
                    exit(1);
                }
                connIter++;
            }
        }
        
        // All connected nodes are inaccessible if their status is still UNKNOWN
        if((stack.size() == 0) && (accessStatus == UNKNOWN))
            accessStatus = INACCESSIBLE;
        
        // Record the access status for each node in the cycle and create
        // a list of the node ids for channel identification
        map<int,DELTA_POS>::iterator resultIter = visitedNodeDisplacement.begin();
        vector<int> listOfIDs = vector<int> ();
        while(resultIter != visitedNodeDisplacement.end()){
            
            int nodeID = resultIter->first;
            if(accessStatuses.at(nodeID) != UNKNOWN){
                // Each node should only have its accessibility determined once
                cerr << "Error: Accessibility of node was determined more than once." << "\n";
                cerr << "Please contact the source code provider with your program input. " << "\n";
                cerr << "Exiting ..." << "\n";
                exit(1);
            }
            else{
                // Store node's status
                accessStatuses.at(nodeID) = accessStatus;
                listOfIDs.push_back(nodeID);
            }
            resultIter++;
        }
        nodeIndex++;
        
        // Create CHANNEL from ACCESSIBLE nodes
        if(accessStatus == ACCESSIBLE){
            pores->push_back(PORE(listOfIDs, dnet, dim, basis));
            // store pore statistics (number of nodes included in pore)
            noAccDijkNodesAssigned += listOfIDs.size();
            //output << dim << " ";
        }else
        { // OTHERWISE create POCKET from INACCESSIBLE nodes (dim set to 0 indicates pocket)
            // additionally pockets have to be built from active nodes (this is to ensure their
            // size is larger than mix_radius)
            if(dnet->nodes[listOfIDs[0]].active == true)
            {
                pores->push_back(PORE(listOfIDs, dnet, dim, basis));
                // store pore statistics (number of nodes included in pore)
                noAccDijkNodesAssigned += listOfIDs.size();
            };
        };
        
        //more debug
        bool flg;
        for(unsigned int i=0;i<listOfIDs.size();i++)
        {
            if(i==0) flg = dnet->nodes[listOfIDs[0]].active;
            else
            {
                if(flg !=dnet->nodes[listOfIDs[i]].active) cout << "pocket error" << endl;
            };
        };
        //end of debug
    }
    // Store information in provided vector
    infoStorage -> resize(accessStatuses.size());
    for(unsigned int i = 0; i < accessStatuses.size(); i++){
        infoStorage -> at(i) = (accessStatuses.at(i) == ACCESSIBLE);
    }
    
    // Print summary
    int nchannel=0,npocket=0;
    for(unsigned int i = 0; i<pores->size(); i++)
    {
        if(pores->at(i).dimensionality>0) nchannel++; else npocket++;
    };
    cout << "Analyzed and assigned " << nodeIndex << " nodes.";
    cout << "\nIdentified " << nchannel << " channels and " << npocket << " pockets.\n";
    cout << noAccDijkNodesAssigned << " nodes assigned to pores. " << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rdx, 0x98(%rsp)
movq %rdi, %r15
leaq 0x10c(%rsp), %rdx
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
movq 0x8(%rdi), %rax
subq (%rdi), %rax
movq %rsi, 0xc0(%rsp)
sarq $0x3, %rax
movabsq $-0x71c71c71c71c71c7, %r14 # imm = 0x8E38E38E38E38E39
imulq %r14, %rax
leaq 0x48(%rsp), %rdi
leaq 0x140(%rsp), %r12
movq %rax, %rsi
movq %r12, %rcx
callq 0x38af6
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
je 0x70c5c
sarq $0x3, %rcx
imulq %r14, %rcx
addq $0x40, %rax
xorl %ebx, %ebx
movl $0x1, %edx
movzbl (%rax), %esi
addl %esi, %ebx
movl %edx, %esi
addq $0x48, %rax
incl %edx
cmpq %rsi, %rcx
ja 0x70c48
jmp 0x70c5e
xorl %ebx, %ebx
movq 0x12635b(%rip), %rdi    # 0x196fc0
leaq 0xe58bc(%rip), %rsi     # 0x156528
movl $0x35, %edx
callq 0x44e0
movq 0x8(%r15), %rsi
subq (%r15), %rsi
sarq $0x3, %rsi
imulq %r14, %rsi
movq 0x126334(%rip), %rdi    # 0x196fc0
callq 0x42b0
movq %rax, %r14
leaq 0xe58c3(%rip), %rsi     # 0x15655e
movl $0xa, %edx
movq %rax, %rdi
callq 0x44e0
movq %r14, %rdi
movl %ebx, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xe58ad(%rip), %rsi     # 0x156569
movl $0x1f, %edx
movq %rax, %rdi
callq 0x44e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4420
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42c0
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rax, %rcx
je 0x71561
leaq 0xe0(%rsp), %r14
leaq 0xa8(%r12), %rcx
movq %rcx, 0xb8(%rsp)
leaq 0xac(%rsp), %rbx
xorl %r13d, %r13d
movq $0x0, 0x28(%rsp)
xorl %ebp, %ebp
cmpq %r13, %rdx
jbe 0x717e0
cmpl $-0x1, (%rax,%r13,4)
je 0x70d5e
movl %ebp, %r13d
incl %r13d
movl %r13d, %ebp
cmpq %r13, %rdx
jne 0x70d3b
jmp 0x7156d
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movapd %xmm0, 0x60(%rsp)
movl $0x0, 0x80(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x509d8
movl $0x0, 0xe0(%rsp)
xorl %eax, %eax
movq %rax, 0xe8(%rsp)
movq %r14, 0xf0(%rsp)
movq %r14, 0xf8(%rsp)
movq %rax, 0x100(%rsp)
movq %rax, 0x40(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movl %ebp, 0x140(%rsp)
movl 0xb4(%rsp), %eax
leaq 0x144(%rsp), %rcx
movl %eax, 0x8(%rcx)
movq 0xac(%rsp), %rax
movq %rax, (%rcx)
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x70e08
movupd 0x140(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x38(%rsp)
jmp 0x70e15
leaq 0x30(%rsp), %rdi
movq %r12, %rdx
callq 0x77030
movl %ebp, 0x140(%rsp)
movl 0xb4(%rsp), %eax
leaq 0x144(%rsp), %rcx
movl %eax, 0x8(%rcx)
movq 0xac(%rsp), %rax
movq %rax, (%rcx)
leaq 0xd8(%rsp), %rdi
movq %r12, %rsi
callq 0x77170
movl %ebp, 0xa8(%rsp)
movq %r15, 0xa0(%rsp)
movq 0x38(%rsp), %rax
cmpq 0x30(%rsp), %rax
je 0x711c9
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r13d, %r13d
movupd -0x10(%rax), %xmm0
movapd %xmm0, 0x10(%rsp)
movslq 0x10(%rsp), %rsi
movq 0xa0(%rsp), %rax
movq (%rax), %rbx
movq 0x8(%rax), %rdx
subq %rbx, %rdx
sarq $0x3, %rdx
movabsq $-0x71c71c71c71c71c7, %rax # imm = 0x8E38E38E38E38E39
imulq %rax, %rdx
cmpq %rsi, %rdx
jbe 0x7188f
leaq (%rsi,%rsi,8), %r15
leaq (%rbx,%r15,8), %rsi
addq $0x20, %rsi
movupd -0x20(%rsi), %xmm0
movupd -0x10(%rsi), %xmm1
movapd %xmm1, 0x150(%rsp)
movapd %xmm0, 0x140(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x38318
leaq (%rbx,%r15,8), %rax
movb 0x40(%rax), %cl
leaq 0x144(%rsp), %rdx
movb %cl, 0x3c(%rdx)
movq 0x38(%rax), %rax
addq $-0x10, 0x38(%rsp)
movq %rax, 0x34(%rdx)
movq 0x160(%rsp), %rbx
cmpq 0x168(%rsp), %rbx
je 0x7119a
movl 0x4(%rbx), %r15d
leaq 0x18(%rbx), %rsi
leaq 0x14(%rsp), %rdi
callq 0x50a30
movslq %r15d, %rsi
movq %rax, 0x88(%rsp)
movl %edx, 0x90(%rsp)
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rcx
subq %rdi, %rcx
sarq $0x2, %rcx
cmpq %rsi, %rcx
jbe 0x7173a
cmpl $-0x1, (%rdi,%rsi,4)
jne 0x7174b
movq 0xe8(%rsp), %rsi
movq %r14, %rcx
testq %rsi, %rsi
je 0x70f8b
movq %r14, %rcx
xorl %edi, %edi
cmpl %r15d, 0x20(%rsi)
setl %dil
cmovgeq %rsi, %rcx
movq 0x10(%rsi,%rdi,8), %rsi
testq %rsi, %rsi
jne 0x70f73
movq %r14, %r12
cmpq %r14, %rcx
je 0x70f9e
cmpl 0x20(%rcx), %r15d
cmovlq %r14, %rcx
movq %rcx, %r12
cmpq %r14, %r12
je 0x71007
addq $0x24, %r12
movq %r12, %rdi
movq %rax, %rsi
callq 0x509e2
testb %al, %al
jne 0x71191
leaq 0x88(%rsp), %rdi
movq %r12, %rsi
callq 0x50a48
movl $0x1, %ebp
cmpl $0x2, %r13d
je 0x710ad
cmpl $0x1, %r13d
je 0x7109f
testl %r13d, %r13d
jne 0x71191
movl %eax, 0x60(%rsp)
shrq $0x20, %rax
movl %eax, 0x6c(%rsp)
movl %edx, 0x78(%rsp)
movl $0x1, %r13d
jmp 0x71191
movl %r15d, 0xc8(%rsp)
movl 0x90(%rsp), %eax
leaq 0xcc(%rsp), %r12
movl %eax, 0x8(%r12)
movq 0x88(%rsp), %rax
movq %rax, (%r12)
leaq 0xd8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x77170
movl %r15d, 0xc8(%rsp)
movl 0x90(%rsp), %eax
movl %eax, 0x8(%r12)
movq 0x88(%rsp), %rax
movq %rax, (%r12)
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x71088
movupd 0xc8(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x38(%rsp)
jmp 0x71191
leaq 0x30(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
callq 0x77030
jmp 0x71191
movl 0x60(%rsp), %ecx
testl %ecx, %ecx
je 0x710ee
movl %eax, %edi
movl %ecx, %esi
jmp 0x7110d
movl %eax, 0x68(%rsp)
shrq $0x20, %rax
movl %eax, 0x74(%rsp)
movl %edx, 0x80(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x8505e
movl $0x3, %r13d
testl %eax, %eax
jne 0x71191
xorl %eax, %eax
movl %eax, 0x80(%rsp)
movl %eax, 0x74(%rsp)
movl %eax, 0x68(%rsp)
jmp 0x7118b
movl 0x6c(%rsp), %esi
testl %esi, %esi
je 0x710ff
movq %rax, %rdi
shrq $0x20, %rdi
jmp 0x7110d
movl 0x78(%rsp), %esi
movl %edx, %edi
testl %esi, %esi
je 0x7189d
xorps %xmm0, %xmm0
cvtsi2sd %edi, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
divsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
mulsd %xmm0, %xmm1
cvtsi2sd %eax, %xmm2
ucomisd %xmm2, %xmm1
jne 0x7117b
jp 0x7117b
xorps %xmm1, %xmm1
cvtsi2sdl 0x6c(%rsp), %xmm1
mulsd %xmm0, %xmm1
movq %rax, %rcx
shrq $0x20, %rcx
xorps %xmm2, %xmm2
cvtsi2sd %ecx, %xmm2
ucomisd %xmm2, %xmm1
jne 0x7117b
jp 0x7117b
xorps %xmm1, %xmm1
cvtsi2sdl 0x78(%rsp), %xmm1
mulsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
ucomisd %xmm1, %xmm0
movl $0x1, %r13d
jne 0x7117b
jnp 0x71191
movl %eax, 0x64(%rsp)
shrq $0x20, %rax
movl %eax, 0x70(%rsp)
movl %edx, 0x7c(%rsp)
movl $0x2, %r13d
addq $0x28, %rbx
jmp 0x70f0a
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
je 0x711b7
movq 0x170(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x38(%rsp), %rax
cmpq 0x30(%rsp), %rax
jne 0x70e70
jmp 0x711d1
xorl %r13d, %r13d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $-0x1, %ebp
movl $0x0, %eax
cmovel %eax, %ebp
movq 0xf0(%rsp), %r12
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpq %r14, %r12
je 0x71271
movslq 0x20(%r12), %rsi
movl %esi, 0x140(%rsp)
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x717f1
cmpl $-0x1, (%rax,%rsi,4)
jne 0x717ff
movl %ebp, (%rax,%rsi,4)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x7124f
movl 0x140(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x71261
leaq 0x10(%rsp), %rdi
leaq 0x140(%rsp), %rdx
callq 0xf7b4
movq %r12, %rdi
callq 0x42d0
movq %rax, %r12
cmpq %r14, %rax
jne 0x711fc
cmpl $0x1, %ebp
jne 0x71353
leaq 0x128(%rsp), %rbx
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0xe886
movq 0xa0(%rsp), %r15
leaq 0x140(%rsp), %r12
movq 0x125d1a(%rip), %rbp    # 0x196fc0
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %r13d, %ecx
leaq 0x60(%rsp), %r8
callq 0x6fa34
movq 0x98(%rsp), %rdi
movq %r12, %rsi
callq 0x772be
movq 0xb8(%rsp), %rdi
callq 0xefda
movq 0x1d0(%rsp), %rdi
testq %rdi, %rdi
je 0x712f6
movq 0x1e0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x1b8(%rsp), %rdi
testq %rdi, %rdi
je 0x71313
movq 0x1c8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x1a0(%rsp), %rdi
callq 0xf07c
leaq 0x170(%rsp), %rdi
callq 0xf118
movq %r12, %rdi
callq 0xf118
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x71445
movq 0x138(%rsp), %rsi
jmp 0x7143d
movq 0x10(%rsp), %rax
movslq (%rax), %rax
movq 0xa0(%rsp), %r15
movq (%r15), %rcx
leaq (%rax,%rax,8), %rax
cmpb $0x1, 0x40(%rcx,%rax,8)
leaq 0x140(%rsp), %r12
movq 0x125c42(%rip), %rbp    # 0x196fc0
jne 0x7145f
leaq 0x110(%rsp), %rbx
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0xe886
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %r13d, %ecx
leaq 0x60(%rsp), %r8
callq 0x6fa34
movq 0x98(%rsp), %rdi
movq %r12, %rsi
callq 0x772be
movq 0xb8(%rsp), %rdi
callq 0xefda
movq 0x1d0(%rsp), %rdi
testq %rdi, %rdi
je 0x713e9
movq 0x1e0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x1b8(%rsp), %rdi
testq %rdi, %rdi
je 0x71406
movq 0x1c8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x1a0(%rsp), %rdi
callq 0xf07c
leaq 0x170(%rsp), %rdi
callq 0xf118
movq %r12, %rdi
callq 0xf118
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x71445
movq 0x120(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
shrq $0x2, %rax
movq 0x28(%rsp), %rcx
addl %eax, %ecx
movq %rcx, 0x28(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rdi, 0x18(%rsp)
je 0x71501
movl $0x1, %ebx
xorl %eax, %eax
cmpl $0x1, %ebx
jne 0x7148f
movslq (%rdi), %rax
movq (%r15), %rcx
leaq (%rax,%rax,8), %rax
movb 0x40(%rcx,%rax,8), %al
movb %al, 0xf(%rsp)
jmp 0x714e3
movb 0xf(%rsp), %cl
andb $0x1, %cl
movslq (%rdi,%rax,4), %rax
movq (%r15), %rdx
leaq (%rax,%rax,8), %rax
cmpb 0x40(%rdx,%rax,8), %cl
je 0x714e3
movl $0xc, %edx
movq %rbp, %rdi
leaq 0xe51cc(%rip), %rsi     # 0x156682
callq 0x44e0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x4420
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42c0
movl %ebx, %eax
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rcx
subq %rdi, %rcx
sarq $0x2, %rcx
incl %ebx
cmpq %rax, %rcx
ja 0x71476
testq %rdi, %rdi
je 0x71513
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
leaq 0xac(%rsp), %rbx
movl 0xa8(%rsp), %ebp
je 0x71539
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
incl %ebp
leaq 0xd8(%rsp), %rdi
callq 0x76efc
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
movl %ebp, %r13d
jmp 0x70d54
movq $0x0, 0x28(%rsp)
xorl %r13d, %r13d
movq 0xc0(%rsp), %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0xed48
movq 0x48(%rsp), %rax
cmpq %rax, 0x50(%rsp)
je 0x715cf
movl $0x1, %ebx
xorl %esi, %esi
movl (%rax,%rsi,4), %ebp
movq 0xc0(%rsp), %rdi
callq 0xedb6
cmpl $0x1, %ebp
jne 0x715ac
orq (%rax), %rdx
jmp 0x715b2
notq %rdx
andq (%rax), %rdx
movq %rdx, (%rax)
movl %ebx, %esi
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
incl %ebx
cmpq %rsi, %rcx
ja 0x71592
movq 0x98(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
je 0x71628
sarq $0x4, %rdx
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rdx, %rcx
addq $0x108, %rax            # imm = 0x108
xorl %ebx, %ebx
movl $0x1, %edx
xorl %ebp, %ebp
xorl %esi, %esi
xorl %edi, %edi
cmpl $0x0, (%rax)
setle %sil
setg %dil
addl %edi, %ebp
addl %esi, %ebx
movl %edx, %esi
addq $0x130, %rax            # imm = 0x130
incl %edx
cmpq %rsi, %rcx
ja 0x71604
jmp 0x7162c
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x12598d(%rip), %rdi    # 0x196fc0
leaq 0xe5055(%rip), %rsi     # 0x15668f
movl $0x16, %edx
callq 0x44e0
movq 0x125975(%rip), %rdi    # 0x196fc0
movq %r13, %rsi
callq 0x42b0
leaq 0xe504c(%rip), %rsi     # 0x1566a6
movl $0x7, %edx
movq %rax, %rdi
callq 0x44e0
movq 0x125952(%rip), %rdi    # 0x196fc0
leaq 0xe5039(%rip), %rsi     # 0x1566ae
movl $0xc, %edx
callq 0x44e0
movq 0x12593a(%rip), %rdi    # 0x196fc0
movl %ebp, %esi
callq 0x4750
movq %rax, %r14
leaq 0xe5024(%rip), %rsi     # 0x1566bb
movl $0xe, %edx
movq %rax, %rdi
callq 0x44e0
movq %r14, %rdi
movl %ebx, %esi
callq 0x4750
leaq 0xe5015(%rip), %rsi     # 0x1566ca
movl $0xa, %edx
movq %rax, %rdi
callq 0x44e0
movq 0x1258f7(%rip), %rdi    # 0x196fc0
movq 0x28(%rsp), %rsi
callq 0x4750
movq %rax, %rbx
leaq 0xe4ff8(%rip), %rsi     # 0x1566d5
movl $0x1a, %edx
movq %rax, %rdi
callq 0x44e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4420
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42c0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x71728
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xddf64(%rip), %rdi     # 0x14f6a5
movq %rcx, %rdx
xorl %eax, %eax
callq 0x4630
movq 0x12589e(%rip), %rdi    # 0x196ff0
leaq 0xe4e64(%rip), %rsi     # 0x1565bd
movl $0x46, %edx
callq 0x44e0
movq 0x125886(%rip), %rdi    # 0x196ff0
leaq 0xe3dbd(%rip), %rsi     # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0x12586e(%rip), %rdi    # 0x196ff0
leaq 0xe4e7b(%rip), %rsi     # 0x156604
movl $0x41, %edx
callq 0x44e0
movq 0x125856(%rip), %rdi    # 0x196ff0
leaq 0xe3d8d(%rip), %rsi     # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0x12583e(%rip), %rdi    # 0x196ff0
leaq 0xde38a(%rip), %rsi     # 0x14fb43
movl $0xb, %edx
callq 0x44e0
movq 0x125826(%rip), %rdi    # 0x196ff0
leaq 0xe3d5d(%rip), %rsi     # 0x15552e
callq 0x4440
movl $0x1, %edi
callq 0x710c
leaq 0xddebe(%rip), %rdi     # 0x14f6a5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xddead(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
movq 0x1257ea(%rip), %rdi    # 0x196ff0
leaq 0xe4e39(%rip), %rsi     # 0x156646
movl $0x3b, %edx
callq 0x44e0
movq 0x1257d2(%rip), %rdi    # 0x196ff0
leaq 0xe3d09(%rip), %rsi     # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0x1257ba(%rip), %rdi    # 0x196ff0
leaq 0xe4dc7(%rip), %rsi     # 0x156604
movl $0x41, %edx
callq 0x44e0
movq 0x1257a2(%rip), %rdi    # 0x196ff0
leaq 0xe3cd9(%rip), %rsi     # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0x12578a(%rip), %rdi    # 0x196ff0
leaq 0xde2d6(%rip), %rsi     # 0x14fb43
movl $0xb, %edx
callq 0x44e0
movq 0x125772(%rip), %rdi    # 0x196ff0
leaq 0xe3ca9(%rip), %rsi     # 0x15552e
callq 0x4440
jmp 0x717d6
leaq 0xdde0f(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
movq 0x12574c(%rip), %rdi    # 0x196ff0
leaq 0xe4cde(%rip), %rsi     # 0x156589
movl $0x33, %edx
callq 0x44e0
movq 0x125734(%rip), %rdi    # 0x196ff0
leaq 0xe3c6b(%rip), %rsi     # 0x15552e
callq 0x4440
jmp 0x717d6
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x76cdc
jmp 0x718e2
movq %rax, %rbx
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x7194b
movq 0x120(%rsp), %rsi
jmp 0x71927
jmp 0x71948
jmp 0x7193d
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x76cdc
jmp 0x71912
movq %rax, %rbx
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x7194b
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x7194b
jmp 0x71948
jmp 0x7193d
jmp 0x7195c
jmp 0x7196b
jmp 0x71948
jmp 0x7193d
movq %rax, %rbx
jmp 0x7198b
jmp 0x71948
jmp 0x7195c
jmp 0x7195c
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x7198b
movq 0x20(%rsp), %rsi
jmp 0x71983
movq %rax, %rbx
jmp 0x719af
jmp 0x7196b
jmp 0x7196b
jmp 0x7196b
jmp 0x7196b
jmp 0x7196b
movq %rax, %rbx
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
je 0x7198b
movq 0x170(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x719a2
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0xd8(%rsp), %rdi
callq 0x76efc
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x719c6
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780