// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/networkstorage.cc
// Function: substituteAtoms(ATOM_NETWORK*, ATOM_NETWORK*, bool, int*, bool)
bool substituteAtoms(ATOM_NETWORK *origNet, ATOM_NETWORK *newNet,
                     bool substituteSeed, int *numSubstitutions, bool radial){
    int numAtoms = origNet->numAtoms;
    double max_bond_length = 1.95;
    
    vector< vector<int> > bonds = vector< vector<int> >(numAtoms, vector<int>());
    for(int i = 0; i < numAtoms; i++){
        ATOM atom_one = origNet->atoms[i];
        for(int j = i + 1; j < numAtoms; j++){
            ATOM atom_two = origNet->atoms[j];
            if(origNet->calcDistance(atom_one, atom_two) < max_bond_length){
                if(atom_one.type.compare(atom_two.type) == 0){
                    cerr << "Atomic network substitution aborted because atoms of same type "
                    "are bonded to one another" << "\n" << "Occurred for type "
                    << atom_one.type << " between atoms " << i << " and " << j << "\n";
                    return false;
                }
                bonds[i].push_back(j);
                bonds[j].push_back(i);
            }
        }
    }
    
    for(int i = 0; i < numAtoms; i++){
        if(origNet->atoms[i].type.compare("Si") == 0){
            if(bonds[i].size() != 4){
                cerr << "Atomic network substitution aborted because Si atom bonded to "
                << bonds[i].size() << " other atoms instead of 4" << "\n"
                << "Occurred for atom " << i << "\n";
                return false;
            }
        }
        else if(origNet->atoms[i].type.compare("O") == 0){
            if(bonds[i].size() != 2){
                cerr << "Atomic network substitution aborted because O atom bonded to "
                << bonds[i].size() << " other atoms instead of 2" << "\n"
                << "Occurred for atom " << i << "\n";
                return false;
            }
        }
        else{
            cerr << "Atomic network substitution aborted because atom type other than "
            "Si or O detected" << "\n" << "Occurred for atom " << i << "\n";
            return false;
        }
    }
    
    int firstSiID = -1;
    for(int i = 0; i < numAtoms; i++){
        if(origNet->atoms[i].type.compare("Si") == 0){
            firstSiID = i;
            break;
        }
    }
    
    if(firstSiID == -1){
        cerr << "Error: Atom substitution failed because structure does not "
        "contain any Si atoms \n";
        return false;
    }
    
    vector<bool> atomProc = vector<bool>(numAtoms, false); // Whether atom has been processed
    vector<bool> atomSubs = vector<bool>(numAtoms, false); // Whether atom has been substituted
    int numProc = 0; // Number of processed atoms
    
    vector< pair<int, bool> > atomsToProcess; // Stack of atom/substituion info
    vector<int> fromIDs; // Stack of where each atom/subst came from
    
    pair<int, bool> seed(firstSiID, substituteSeed);
    atomsToProcess.push_back(seed);  // Seed with the first Si atom and not substituting it
    fromIDs.push_back(-1); // Starting node
    
    while(atomsToProcess.size() != 0){
        pair<int, bool> atomInfo = atomsToProcess.back(); atomsToProcess.pop_back();
        int id = atomInfo.first; bool subst = atomInfo.second;
        int fromID = fromIDs.back(); fromIDs.pop_back();
        
        // Atom previously processed. Ensure that atom substitution agrees with previous results for Si atoms
        if(atomProc[id] ){
            if((origNet->atoms[id].type.compare("Si") == 0) && (atomSubs[id] != subst)){
                cerr << "Atomic network substitution aborted because every other Si atom "
                "substitution criteria failed" << "\n";
                return false;
            }
        }
        // First time atom is processed
        else {
            numProc++;
            // Mark atom as processed
            atomProc[id] = true;
            
            // If oxygen, should not be substituted but reverse substituion state for next set of Si atoms
            if(origNet->atoms[id].type.compare("O") == 0){
                atomSubs[id] = false;
                subst = !subst;
            }
            // If silicon, pass on substitution state to oxygen atoms, who will then reverse it
            // Record substitution status
            else if(origNet->atoms[id].type.compare("Si") == 0){
                atomSubs[id] = subst;
            }
            // Invalid type
            else {
                cerr << "Atomic network substitution aborted because atom type other than Si or O detected" << "\n"
                << "Occurred for atom " << id << "\n";
                return false;
            }
            
            // Added bonded atoms to stack with appropriate subsitution state
            for(unsigned int j = 0; j < bonds[id].size(); j++){
                if(bonds[id][j] != fromID){
                    atomsToProcess.push_back(pair<int, bool>(bonds[id][j], subst));
                    fromIDs.push_back(id);
                }
            }
        }
    }
    
    if(numProc != numAtoms){
        cerr << "Atom network substituion failed because not all atoms are interconnected" << "\n"
        << "Visited " << numProc << " out of " << numAtoms << " atoms " << "\n";
        return false;
    }
    
    // Perform final consistency check
    for(int i = 0; i < numAtoms; i++){
        // Just check pair of atoms bonded to each oxygen
        if(origNet->atoms[i].type.compare("O") == 0){
            if(atomSubs[bonds[i][0]] && atomSubs[bonds[i][1]]){
                cerr << "Atom network substitution failed final consistency check." << "\n"
                << "Oxygen atom #" << i << " is bound to atoms " <<  bonds[i][0] << " and " << bonds[i][1] << " which are of same type. " << "\n"
                << "Algorithmic issue likely." << "\n"
                << "Please contact the source code provider" << "\n";
                return false;
            }
        }
    }
    
    // Copy original information
    origNet->copy(newNet);
    
    // Change atoms that should be subsituted
    *numSubstitutions = 0;
    for(int i = 0; i < numAtoms; i++){
        if(atomSubs[i]){
            newNet->atoms[i].type   = "Al";
            newNet->atoms[i].radius = lookupRadius("Al", radial);
            (*numSubstitutions)++;
        }
    }
    
    // Successful substitution
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movl %r8d, 0x84(%rsp)
movq %rcx, %rbx
movl %edx, %r13d
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
movslq 0x110(%rdi), %r15
xorpd %xmm0, %xmm0
leaq 0x90(%rsp), %rdx
movapd %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq 0x60(%rsp), %rdi
leaq 0x130(%rsp), %rbp
movq %r15, %rsi
movq %rdx, 0x38(%rsp)
movq %rbp, %rcx
callq 0x6757e
movq %r15, %r12
movl %r15d, %eax
movq %rax, 0x18(%rsp)
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x56066
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movl $0x0, 0x40(%rsp)
cmpl $0x0, 0x18(%rsp)
jle 0x564c9
movl %r13d, 0x80(%rsp)
movq %r14, 0x78(%rsp)
movq %rbx, 0x88(%rsp)
movl $0x80, %eax
addq %rax, 0x38(%rsp)
leaq 0x180(%rsp), %r15
leaq 0x1a0(%rsp), %r13
addq %rax, %rbp
xorl %eax, %eax
movq 0x10(%rsp), %rbx
cltq
movq 0x2f0(%rbx), %rbx
imulq $0x98, %rax, %r14
movups (%rbx,%r14), %xmm0
movupd 0x10(%rbx,%r14), %xmm1
movups 0x20(%rbx,%r14), %xmm2
movups 0x30(%rbx,%r14), %xmm3
movaps %xmm3, 0xc0(%rsp)
movaps %xmm2, 0xb0(%rsp)
movapd %xmm1, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
leaq 0xe0(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0x40(%rbx,%r14), %rsi
movq 0x48(%rbx,%r14), %rdx
addq %rsi, %rdx
leaq 0xd0(%rsp), %rdi
callq 0xf3ce
addq %r14, %rbx
leaq 0x100(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq 0x60(%rbx), %rsi
movq 0x68(%rbx), %rdx
addq %rsi, %rdx
leaq 0xf0(%rsp), %rdi
callq 0xf3ce
movb 0x90(%rbx), %al
movq 0x38(%rsp), %rcx
movb %al, 0x10(%rcx)
movupd 0x80(%rbx), %xmm0
movupd %xmm0, (%rcx)
movl 0x40(%rsp), %eax
incl %eax
movl %eax, 0x20(%rsp)
cmpl 0x18(%rsp), %eax
movq 0x10(%rsp), %rbx
jge 0x56388
cltq
movq 0x2f0(%rbx), %rbx
imulq $0x98, %rax, %r14
movups (%rbx,%r14), %xmm0
movups 0x10(%rbx,%r14), %xmm1
movups 0x20(%rbx,%r14), %xmm2
movups 0x30(%rbx,%r14), %xmm3
movaps %xmm3, 0x160(%rsp)
movaps %xmm2, 0x150(%rsp)
movaps %xmm1, 0x140(%rsp)
movaps %xmm0, 0x130(%rsp)
movq %r15, 0x170(%rsp)
movq 0x40(%rbx,%r14), %rsi
movq 0x48(%rbx,%r14), %rdx
addq %rsi, %rdx
leaq 0x170(%rsp), %rdi
callq 0xf3ce
addq %r14, %rbx
movq %r13, 0x190(%rsp)
movq 0x60(%rbx), %rsi
movq 0x68(%rbx), %rdx
addq %rsi, %rdx
leaq 0x190(%rsp), %rdi
callq 0xf3ce
movb 0x90(%rbx), %al
movb %al, 0x10(%rbp)
movups 0x80(%rbx), %xmm0
movups %xmm0, (%rbp)
movsd 0xa8(%rsp), %xmm0
movsd 0xb0(%rsp), %xmm1
movsd 0xb8(%rsp), %xmm2
movsd 0x148(%rsp), %xmm3
movsd 0x150(%rsp), %xmm4
movsd 0x158(%rsp), %xmm5
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x5339c
movsd 0xfc502(%rip), %xmm1    # 0x152770
ucomisd %xmm0, %xmm1
jbe 0x5633b
movq 0xd8(%rsp), %rbx
movq 0x178(%rsp), %r14
cmpq %rbx, %r14
movq %rbx, %rdx
cmovbq %r14, %rdx
testq %rdx, %rdx
je 0x562ba
movq 0x170(%rsp), %rsi
movq 0xd0(%rsp), %rdi
callq 0x4480
cmpq %r14, %rbx
jne 0x562c3
testl %eax, %eax
jne 0x562c3
jmp 0x564e6
cmpq %r14, %rbx
je 0x564e6
movslq 0x40(%rsp), %rcx
movq 0x60(%rsp), %rax
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x562f4
movl 0x20(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
movq 0x10(%rsp), %rbx
jmp 0x5630c
leaq 0x20(%rsp), %rdx
callq 0xf864
movq 0x10(%rsp), %rbx
movl 0x20(%rsp), %ecx
movq 0x60(%rsp), %rax
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x56331
movl 0x40(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x5633b
leaq 0x40(%rsp), %rdx
callq 0xf864
movq 0x190(%rsp), %rdi
cmpq %r13, %rdi
je 0x56358
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x170(%rsp), %rdi
cmpq %r15, %rdi
je 0x56375
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x4470
movl 0x20(%rsp), %eax
incl %eax
movl %eax, 0x20(%rsp)
cmpl %r12d, %eax
jl 0x56183
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x563ad
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x563d2
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x4470
movl 0x40(%rsp), %eax
incl %eax
movl %eax, 0x40(%rsp)
cmpl 0x18(%rsp), %eax
jl 0x560b2
cmpl $0x0, 0x18(%rsp)
jle 0x564c9
movl $0x8, %ebp
movl $0x40, %r13d
xorl %ebx, %ebx
leaq 0xf7420(%rip), %r15     # 0x14d825
movq 0x10(%rsp), %r14
movq 0x2f0(%r14), %rdi
addq %r13, %rdi
movq %r15, %rsi
callq 0x4170
testl %eax, %eax
je 0x56457
movq 0x2f0(%r14), %rdi
addq %r13, %rdi
leaq 0xf73e9(%rip), %rsi     # 0x14d81a
callq 0x4170
testl %eax, %eax
jne 0x56648
movq 0x60(%rsp), %rax
movq (%rax,%rbp), %rcx
subq -0x8(%rax,%rbp), %rcx
cmpq $0x8, %rcx
je 0x5646f
jmp 0x56694
movq 0x60(%rsp), %rax
movq (%rax,%rbp), %rcx
subq -0x8(%rax,%rbp), %rcx
cmpq $0x10, %rcx
jne 0x5670b
incq %rbx
addq $0x18, %rbp
addq $0x98, %r13
cmpq %rbx, 0x18(%rsp)
jne 0x5640a
cmpl $0x0, 0x18(%rsp)
jle 0x564c9
movl $0x40, %r13d
xorl %r15d, %r15d
leaq 0xf738a(%rip), %rbx     # 0x14d825
movq 0x10(%rsp), %rax
movq 0x2f0(%rax), %rdi
addq %r13, %rdi
movq %rbx, %rsi
callq 0x4170
testl %eax, %eax
je 0x567a3
incq %r15
addq $0x98, %r13
cmpq %r15, %r12
jne 0x5649b
movq 0x13eb20(%rip), %rdi    # 0x194ff0
leaq 0xfc786(%rip), %rsi     # 0x152c5d
movl $0x51, %edx
callq 0x44e0
jmp 0x56628
movq 0x13eb03(%rip), %rdi    # 0x194ff0
leaq 0xfc5d7(%rip), %rsi     # 0x152acb
movl $0x58, %edx
callq 0x44e0
movq 0x13eaeb(%rip), %rdi    # 0x194ff0
leaq 0xfd112(%rip), %rsi     # 0x15361e
movl $0x1, %edx
callq 0x44e0
movq 0x13ead3(%rip), %rdi    # 0x194ff0
leaq 0xfc600(%rip), %rsi     # 0x152b24
movl $0x12, %edx
callq 0x44e0
movq 0xd0(%rsp), %rsi
movq 0xd8(%rsp), %rdx
movq 0x13eaab(%rip), %rdi    # 0x194ff0
callq 0x44e0
movq %rax, %rbx
leaq 0xfc5e3(%rip), %rsi     # 0x152b37
movl $0xf, %edx
movq %rax, %rdi
callq 0x44e0
movl 0x40(%rsp), %esi
movq %rbx, %rdi
callq 0x4750
movq %rax, %rbx
leaq 0xfe265(%rip), %rsi     # 0x1547dc
movl $0x5, %edx
movq %rax, %rdi
callq 0x44e0
movl 0x20(%rsp), %esi
movq %rbx, %rdi
callq 0x4750
leaq 0xfd087(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
movq 0x190(%rsp), %rdi
cmpq %r13, %rdi
je 0x565c1
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x170(%rsp), %rdi
cmpq %r15, %rdi
je 0x565de
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x56603
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x56628
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x4470
xorl %ebx, %ebx
leaq 0x60(%rsp), %rdi
callq 0xf066
movl %ebx, %eax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x13e9a1(%rip), %rdi    # 0x194ff0
leaq 0xfc5b5(%rip), %rsi     # 0x152c0b
movl $0x51, %edx
callq 0x44e0
movq 0x13e989(%rip), %r14    # 0x194ff0
leaq 0xfcfb0(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %r14, %rdi
callq 0x44e0
leaq 0xfc51e(%rip), %rsi     # 0x152ba0
movl $0x12, %edx
movq %r14, %rdi
callq 0x44e0
jmp 0x56780
movq 0x13e955(%rip), %rdi    # 0x194ff0
leaq 0xfc511(%rip), %rsi     # 0x152bb3
movl $0x3d, %edx
callq 0x44e0
movq 0x60(%rsp), %rax
movq (%rax,%rbp), %rsi
subq -0x8(%rax,%rbp), %rsi
sarq $0x2, %rsi
movq 0x13e92b(%rip), %rdi    # 0x194ff0
callq 0x42b0
movq %rax, %r14
leaq 0xfc51d(%rip), %rsi     # 0x152bf1
movl $0x19, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xfcf36(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %r14, %rdi
callq 0x44e0
leaq 0xfc4a4(%rip), %rsi     # 0x152ba0
movl $0x12, %edx
movq %r14, %rdi
callq 0x44e0
jmp 0x56780
movq 0x13e8de(%rip), %rdi    # 0x194ff0
leaq 0xfc42e(%rip), %rsi     # 0x152b47
movl $0x3e, %edx
callq 0x44e0
movq 0x60(%rsp), %rax
movq (%rax,%rbp), %rsi
subq -0x8(%rax,%rbp), %rsi
sarq $0x2, %rsi
movq 0x13e8b4(%rip), %rdi    # 0x194ff0
callq 0x42b0
movq %rax, %r14
leaq 0xfc43b(%rip), %rsi     # 0x152b86
movl $0x19, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xfcebf(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %r14, %rdi
callq 0x44e0
leaq 0xfc42d(%rip), %rsi     # 0x152ba0
movl $0x12, %edx
movq %r14, %rdi
callq 0x44e0
movq %r14, %rdi
movl %ebx, %esi
callq 0x4750
leaq 0xfce8d(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
jmp 0x56628
leaq 0x130(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x90(%rsp), %rdi
leaq 0x40(%rsp), %rcx
movq %r12, %rsi
callq 0x37f36
leaq 0x40(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x130(%rsp), %rdi
leaq 0x20(%rsp), %rcx
movq %r12, %rsi
callq 0x37f36
movl 0x80(%rsp), %ecx
xorl %eax, %eax
leaq 0x40(%rsp), %rdi
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
movq %rax, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
leaq 0x1f0(%rsp), %rdx
movl %r15d, (%rdx)
movb %cl, 0x4(%rdx)
xorl %esi, %esi
callq 0x689f8
movq 0x28(%rsp), %rsi
movl $0xffffffff, 0x58(%rsp) # imm = 0xFFFFFFFF
cmpq 0x30(%rsp), %rsi
je 0x5683f
movl $0xffffffff, (%rsi)     # imm = 0xFFFFFFFF
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x5684e
leaq 0x20(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x14198
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
movq 0x48(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0x56b15
xorl %r13d, %r13d
leaq 0x3f(%r12), %r15
movq %r15, 0x38(%rsp)
leaq -0x8(%rax), %rsi
movslq -0x8(%rax), %rcx
movb -0x4(%rax), %bl
movq 0x28(%rsp), %rax
leaq -0x4(%rax), %rdx
leal 0x3f(%rcx), %edi
testq %rcx, %rcx
movq %rsi, 0x48(%rsp)
cmovnsl %ecx, %edi
sarl $0x6, %edi
movslq %edi, %rsi
shlq $0x3, %rsi
addq 0x90(%rsp), %rsi
movl %ecx, 0xc(%rsp)
movq %rcx, %r8
andq %r15, %r8
xorl %edi, %edi
cmpq %r12, %r8
setbe %dil
movl $0x1, %r8d
shlq %cl, %r8
movl -0x4(%rax), %r14d
movq %rdx, 0x28(%rsp)
movq -0x8(%rsi,%rdi,8), %rax
btq %rcx, %rax
jae 0x56952
movq 0x10(%rsp), %rax
movq 0x2f0(%rax), %rax
imulq $0x98, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
leaq 0xf6f2a(%rip), %rsi     # 0x14d825
callq 0x4170
testl %eax, %eax
jne 0x56b03
movslq 0xc(%rsp), %rax
leal 0x3f(%rax), %ecx
testq %rax, %rax
cmovnsl %eax, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq 0x130(%rsp), %rcx
movq %rax, %rdx
andq %r15, %rdx
xorl %esi, %esi
cmpq %r12, %rdx
setbe %sil
movq -0x8(%rcx,%rsi,8), %rcx
btq %rax, %rcx
setae %al
xorb %bl, %al
testb $0x1, %al
jne 0x56b03
jmp 0x56d93
movq %r13, %rbp
movq %r12, %r13
movl %ebx, %r15d
andb $0x1, %r15b
leaq -0x8(,%rdi,8), %rdx
orq %r8, %rax
movq %rax, (%rsi,%rdx)
movq 0x10(%rsp), %r12
movq 0x2f0(%r12), %rax
imulq $0x98, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
leaq 0xf6e89(%rip), %rsi     # 0x14d81a
callq 0x4170
movl 0xc(%rsp), %edx
movslq %edx, %rcx
testl %eax, %eax
je 0x56a1a
movq 0x2f0(%r12), %rax
imulq $0x98, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
leaq 0xf6e66(%rip), %rsi     # 0x14d825
callq 0x4170
testl %eax, %eax
jne 0x56db0
movslq 0xc(%rsp), %rcx
leal 0x3f(%rcx), %eax
testq %rcx, %rcx
cmovnsl %ecx, %eax
sarl $0x6, %eax
cltq
shlq $0x3, %rax
addq 0x130(%rsp), %rax
movq %rcx, %rdx
andq 0x38(%rsp), %rdx
xorl %esi, %esi
movq %r13, %r12
cmpq %r13, %rdx
setbe %sil
leaq -0x8(,%rsi,8), %rdx
movl $0x1, %esi
shlq %cl, %rsi
testb $0x1, %bl
je 0x56a5c
orq %rsi, (%rax,%rdx)
jmp 0x56a63
leal 0x3f(%rcx), %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
sarl $0x6, %eax
cltq
shlq $0x3, %rax
addq 0x130(%rsp), %rax
movq %rcx, %rsi
andq 0x38(%rsp), %rsi
xorl %edi, %edi
movq %r13, %r12
cmpq %r13, %rsi
setbe %dil
movq $-0x2, %rsi
rolq %cl, %rsi
andq %rsi, -0x8(%rax,%rdi,8)
xorb $0x1, %r15b
jmp 0x56a65
notq %rsi
andq %rsi, (%rax,%rdx)
movl %ecx, %edx
movq %rbp, %r13
incl %r13d
movq 0x60(%rsp), %rsi
leaq (%rcx,%rcx,2), %rcx
movq (%rsi,%rcx,8), %rax
cmpq %rax, 0x8(%rsi,%rcx,8)
leaq 0x40(%rsp), %rbp
je 0x56afe
movl $0x1, %ebx
xorl %ecx, %ecx
movl (%rax,%rcx,4), %eax
cmpl %r14d, %eax
je 0x56ad9
movl %eax, 0x58(%rsp)
movb %r15b, 0x5c(%rsp)
movq %rbp, %rdi
leaq 0x58(%rsp), %rsi
callq 0x68b3e
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x56ac6
movl 0xc(%rsp), %edx
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x56ad9
leaq 0x20(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0xf864
movl 0xc(%rsp), %edx
movl %ebx, %ecx
movslq %edx, %rax
movq 0x60(%rsp), %rsi
leaq (%rax,%rax,2), %rdi
movq (%rsi,%rdi,8), %rax
movq 0x8(%rsi,%rdi,8), %rsi
subq %rax, %rsi
sarq $0x2, %rsi
incl %ebx
cmpq %rcx, %rsi
ja 0x56a8b
movq 0x38(%rsp), %r15
movq 0x48(%rsp), %rax
cmpq 0x40(%rsp), %rax
jne 0x56875
jmp 0x56b18
xorl %r13d, %r13d
cmpl 0x18(%rsp), %r13d
jne 0x56ce8
movl $0x40, %r13d
xorl %r15d, %r15d
leaq 0xf6ce7(%rip), %r14     # 0x14d81a
leaq 0x3f(%r12), %rbp
xorl %ebx, %ebx
movq 0x10(%rsp), %rax
movq 0x2f0(%rax), %rdi
addq %r13, %rdi
movq %r14, %rsi
callq 0x4170
testl %eax, %eax
jne 0x56bcc
movq 0x60(%rsp), %rax
movq (%rax,%r15), %rcx
movslq (%rcx), %rdx
leal 0x3f(%rdx), %esi
testq %rdx, %rdx
cmovnsl %edx, %esi
movq 0x130(%rsp), %rax
sarl $0x6, %esi
movslq %esi, %rsi
leaq (%rax,%rsi,8), %rsi
movq %rdx, %rdi
andq %rbp, %rdi
xorl %r8d, %r8d
cmpq %r12, %rdi
setbe %r8b
movq -0x8(%rsi,%r8,8), %rsi
btq %rdx, %rsi
jae 0x56bcc
movslq 0x4(%rcx), %rcx
leal 0x3f(%rcx), %edx
testq %rcx, %rcx
cmovnsl %ecx, %edx
sarl $0x6, %edx
movslq %edx, %rdx
leaq (%rax,%rdx,8), %rax
movq %rcx, %rdx
andq %rbp, %rdx
xorl %esi, %esi
cmpq %r12, %rdx
setbe %sil
movq -0x8(%rax,%rsi,8), %rax
btq %rcx, %rax
jb 0x56e24
incq %rbx
addq $0x18, %r15
addq $0x98, %r13
cmpq %rbx, 0x18(%rsp)
jne 0x56b3a
movq 0x10(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x52620
movq 0x88(%rsp), %rax
movl $0x0, (%rax)
leaq 0x1e0(%rsp), %r12
movl $0x48, %r13d
xorl %r14d, %r14d
leaq 0xfc564(%rip), %rbx     # 0x15317e
leaq 0x1d0(%rsp), %r15
movzbl 0x84(%rsp), %ebp
movq 0x130(%rsp), %rax
movl %r14d, %ecx
shrl $0x6, %ecx
movq (%rax,%rcx,8), %rax
btq %r14, %rax
jae 0x56ccc
movq 0x78(%rsp), %rax
movq 0x2f0(%rax), %rax
leaq (%rax,%r13), %rdi
addq $-0x8, %rdi
movq 0x8(%rdi), %rdx
movl $0x2, %r8d
xorl %esi, %esi
movq %rbx, %rcx
callq 0x4670
movq %r12, 0x1d0(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
leaq 0xfc4fd(%rip), %rdx     # 0x153180
callq 0x22538
movq %r15, %rdi
movl %ebp, %esi
callq 0x21d5e
movq 0x78(%rsp), %rax
movq 0x2f0(%rax), %rax
movsd %xmm0, -0x18(%rax,%r13)
movq 0x1d0(%rsp), %rdi
cmpq %r12, %rdi
je 0x56cc2
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x88(%rsp), %rax
incl (%rax)
incq %r14
addq $0x98, %r13
cmpq %r14, 0x18(%rsp)
jne 0x56c2a
movb $0x1, %bl
jmp 0x56f4c
movq 0x13e301(%rip), %rdi    # 0x194ff0
leaq 0xfc016(%rip), %rsi     # 0x152d0c
movl $0x48, %edx
callq 0x44e0
movq 0x13e2e9(%rip), %rdi    # 0x194ff0
leaq 0xfc910(%rip), %rsi     # 0x15361e
movl $0x1, %edx
callq 0x44e0
movq 0x13e2d1(%rip), %rdi    # 0x194ff0
leaq 0xfc02f(%rip), %rsi     # 0x152d55
movl $0x8, %edx
callq 0x44e0
movq 0x13e2b9(%rip), %rdi    # 0x194ff0
movl %r13d, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xfaebb(%rip), %rsi     # 0x151c04
movl $0x8, %edx
movq %rax, %rdi
callq 0x44e0
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
callq 0x4750
movq %rax, %rbx
leaq 0xfbdd2(%rip), %rsi     # 0x152b3f
movl $0x7, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xfc89d(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
jmp 0x56f4a
movq 0x13e256(%rip), %rbx    # 0x194ff0
leaq 0xfbf0e(%rip), %rsi     # 0x152caf
movl $0x5c, %edx
movq %rbx, %rdi
callq 0x44e0
jmp 0x56e0b
movq 0x13e239(%rip), %rdi    # 0x194ff0
leaq 0xfbe4d(%rip), %rsi     # 0x152c0b
movl $0x51, %edx
callq 0x44e0
movq 0x13e221(%rip), %rdi    # 0x194ff0
leaq 0xfc848(%rip), %rsi     # 0x15361e
movl $0x1, %edx
callq 0x44e0
movq 0x13e209(%rip), %rdi    # 0x194ff0
leaq 0xfbdb2(%rip), %rsi     # 0x152ba0
movl $0x12, %edx
callq 0x44e0
movl 0xc(%rsp), %esi
movq 0x13e1ed(%rip), %rdi    # 0x194ff0
callq 0x4750
movq %rax, %rbx
leaq 0xfc80c(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
jmp 0x56f4a
movq 0x13e1c5(%rip), %rdi    # 0x194ff0
leaq 0xfbf2c(%rip), %rsi     # 0x152d5e
movl $0x39, %edx
callq 0x44e0
movq 0x13e1ad(%rip), %rdi    # 0x194ff0
leaq 0xfc7d4(%rip), %rsi     # 0x15361e
movl $0x1, %edx
callq 0x44e0
movq 0x13e195(%rip), %rdi    # 0x194ff0
leaq 0xfbf36(%rip), %rsi     # 0x152d98
movl $0xd, %edx
callq 0x44e0
movq 0x13e17d(%rip), %rdi    # 0x194ff0
movl %ebx, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xfbf22(%rip), %rsi     # 0x152da6
movl $0x13, %edx
movq %rax, %rdi
callq 0x44e0
movq 0x60(%rsp), %rax
movq (%rax,%r15), %rax
movl (%rax), %esi
movq %rbx, %rdi
callq 0x4750
movq %rax, %rbx
leaq 0xfd92e(%rip), %rsi     # 0x1547dc
movl $0x5, %edx
movq %rax, %rdi
callq 0x44e0
movq 0x60(%rsp), %rax
movq (%rax,%r15), %rax
movl 0x4(%rax), %esi
movq %rbx, %rdi
callq 0x4750
movq %rax, %rbx
leaq 0xfbee1(%rip), %rsi     # 0x152dba
movl $0x19, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xfc731(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0xfbed3(%rip), %rsi     # 0x152dd4
movl $0x19, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0xfc709(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0xfbec5(%rip), %rsi     # 0x152dee
movl $0x27, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0xfc6e1(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
xorl %ebx, %ebx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x56f63
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x56f7a
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x56fa3
movq 0x150(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq $0x0, 0x130(%rsp)
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x5662a
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq $0x0, 0x90(%rsp)
movl $0x0, 0x98(%rsp)
jmp 0x5662a
jmp 0x57022
jmp 0x57022
movq %rax, %rbx
jmp 0x57087
jmp 0x5711f
jmp 0x57022
jmp 0x57022
movq %rax, %rbx
movq 0x1d0(%rsp), %rdi
cmpq %r12, %rdi
je 0x57025
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x57025
jmp 0x57022
jmp 0x57022
jmp 0x57022
jmp 0x5711f
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x5703c
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x57053
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x57087
movq 0x150(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq $0x0, 0x130(%rsp)
movl $0x0, 0x138(%rsp)
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x5716a
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x90(%rsp)
movl %eax, 0x98(%rsp)
movq %rax, 0xa0(%rsp)
movl %eax, 0xa8(%rsp)
jmp 0x5716a
jmp 0x5711f
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x57174
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x57174
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x5716a
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x5716a
movq %rax, %rbx
jmp 0x5716a
jmp 0x5714d
movq %rax, %rbx
movq 0x170(%rsp), %rdi
cmpq %r15, %rdi
je 0x5715d
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x5715d
movq %rax, %rbx
jmp 0x5715d
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x2f5e8
leaq 0x90(%rsp), %rdi
callq 0x2f5e8
leaq 0x60(%rsp), %rdi
callq 0xf066
movq %rbx, %rdi
callq 0x4780