// File: /workspace/github_cpp_makefile_star2_O1/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, %ebx
movq %rcx, 0x98(%rsp)
movl %edx, %ebp
movq %rsi, 0x80(%rsp)
movq %rdi, %r12
movslq 0x110(%rdi), %rsi
xorpd %xmm0, %xmm0
leaq 0xa0(%rsp), %rdx
movapd %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq 0x68(%rsp), %rdi
leaq 0x140(%rsp), %r15
movq %rsi, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movq %r15, %rcx
callq 0x67eb0
movl %ebp, 0x58(%rsp)
movl %ebx, 0x94(%rsp)
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x56387
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movl $0x0, 0x40(%rsp)
cmpl $0x0, 0x10(%rsp)
jle 0x566d4
movl $0x80, %eax
addq %rax, 0x18(%rsp)
leaq 0x190(%rsp), %r14
leaq 0x1b0(%rsp), %rbx
addq %rax, %r15
xorl %eax, %eax
cltq
movq 0x2f0(%r12), %rbp
imulq $0x98, %rax, %r13
movups (%rbp,%r13), %xmm0
movupd 0x10(%rbp,%r13), %xmm1
movups 0x20(%rbp,%r13), %xmm2
movups 0x30(%rbp,%r13), %xmm3
movaps %xmm3, 0xd0(%rsp)
movaps %xmm2, 0xc0(%rsp)
movapd %xmm1, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
leaq 0xf0(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0x40(%rbp,%r13), %rsi
movq 0x48(%rbp,%r13), %rdx
addq %rsi, %rdx
leaq 0xe0(%rsp), %rdi
callq 0xf32a
addq %r13, %rbp
leaq 0x110(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x60(%rbp), %rsi
movq 0x68(%rbp), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %rdi
callq 0xf32a
movb 0x90(%rbp), %al
movq 0x18(%rsp), %rcx
movb %al, 0x10(%rcx)
movupd 0x80(%rbp), %xmm0
movupd %xmm0, (%rcx)
movl 0x40(%rsp), %eax
incl %eax
movl %eax, 0x20(%rsp)
cmpl 0x10(%rsp), %eax
jge 0x56676
cltq
movq 0x2f0(%r12), %rbp
imulq $0x98, %rax, %r13
movups (%rbp,%r13), %xmm0
movups 0x10(%rbp,%r13), %xmm1
movups 0x20(%rbp,%r13), %xmm2
movups 0x30(%rbp,%r13), %xmm3
movaps %xmm3, 0x170(%rsp)
movaps %xmm2, 0x160(%rsp)
movaps %xmm1, 0x150(%rsp)
movaps %xmm0, 0x140(%rsp)
movq %r14, 0x180(%rsp)
movq 0x40(%rbp,%r13), %rsi
movq 0x48(%rbp,%r13), %rdx
addq %rsi, %rdx
leaq 0x180(%rsp), %rdi
callq 0xf32a
addq %r13, %rbp
movq %rbx, 0x1a0(%rsp)
movq 0x60(%rbp), %rsi
movq 0x68(%rbp), %rdx
addq %rsi, %rdx
leaq 0x1a0(%rsp), %rdi
callq 0xf32a
movb 0x90(%rbp), %al
movb %al, 0x10(%r15)
movups 0x80(%rbp), %xmm0
movups %xmm0, (%r15)
movsd 0xb8(%rsp), %xmm0
movsd 0xc0(%rsp), %xmm1
movsd 0xc8(%rsp), %xmm2
movsd 0x158(%rsp), %xmm3
movsd 0x160(%rsp), %xmm4
movsd 0x168(%rsp), %xmm5
movq %r12, %rdi
callq 0x5369a
movsd 0xfe158(%rip), %xmm1    # 0x1546c8
ucomisd %xmm0, %xmm1
jbe 0x56633
movq 0xe8(%rsp), %rbp
movq 0x188(%rsp), %r13
cmpq %rbp, %r13
movq %rbp, %rdx
cmovbq %r13, %rdx
testq %rdx, %rdx
je 0x565b5
movq 0x180(%rsp), %rsi
movq 0xe0(%rsp), %rdi
callq 0x4480
testl %eax, %eax
sete %al
jmp 0x565b7
movb $0x1, %al
cmpq %r13, %rbp
setne %cl
xorb $0x1, %al
orb %cl, %al
je 0x567c6
movslq 0x40(%rsp), %rax
movq 0x68(%rsp), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x565f3
movl 0x20(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x565fd
leaq 0x20(%rsp), %rdx
callq 0xf7b4
movslq 0x20(%rsp), %rax
movq 0x68(%rsp), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x56629
movl 0x40(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x56633
leaq 0x40(%rsp), %rdx
callq 0xf7b4
movq 0x1a0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x56650
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x180(%rsp), %rdi
cmpq %r14, %rdi
je 0x5666d
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x4470
movl 0x20(%rsp), %eax
jmp 0x56477
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x5669b
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x566c0
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4470
movl 0x40(%rsp), %eax
incl %eax
movl %eax, 0x40(%rsp)
cmpl 0x10(%rsp), %eax
jl 0x563b9
cmpl $0x0, 0x10(%rsp)
jle 0x56772
movl $0x8, %ebx
movl $0x40, %ebp
xorl %r14d, %r14d
leaq 0xf90e2(%rip), %r15     # 0x14f7d5
leaq 0xf90d0(%rip), %r13     # 0x14f7ca
movq 0x2f0(%r12), %rdi
addq %rbp, %rdi
movq %r15, %rsi
callq 0x4170
testl %eax, %eax
je 0x56745
movq 0x2f0(%r12), %rdi
addq %rbp, %rdi
movq %r13, %rsi
callq 0x4170
testl %eax, %eax
jne 0x569ce
movq 0x68(%rsp), %rax
movq (%rax,%rbx), %rcx
subq -0x8(%rax,%rbx), %rcx
cmpq $0x8, %rcx
je 0x5675d
jmp 0x56a1a
movq 0x68(%rsp), %rax
movq (%rax,%rbx), %rcx
subq -0x8(%rax,%rbx), %rcx
cmpq $0x10, %rcx
jne 0x571c9
incq %r14
addq $0x18, %rbx
addq $0x98, %rbp
cmpq %r14, 0x10(%rsp)
jne 0x566fa
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x10(%rsp), %r14
testl %r14d, %r14d
jle 0x56919
movl $0x40, %r13d
xorl %r15d, %r15d
leaq 0xf9040(%rip), %r14     # 0x14f7d5
movq 0x2f0(%r12), %rdi
addq %r13, %rdi
movq %r14, %rsi
callq 0x4170
testl %eax, %eax
je 0x56911
incq %r15
addq $0x98, %r13
cmpq %r15, 0x10(%rsp)
jne 0x56795
jmp 0x56914
movq 0x140823(%rip), %rdi    # 0x196ff0
leaq 0xfe207(%rip), %rsi     # 0x1549db
movl $0x58, %edx
callq 0x44e0
movq 0x14080b(%rip), %rdi    # 0x196ff0
leaq 0xfed42(%rip), %rsi     # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0x1407f3(%rip), %rdi    # 0x196ff0
leaq 0xfe230(%rip), %rsi     # 0x154a34
movl $0x12, %edx
callq 0x44e0
movq 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %rdx
movq 0x1407cb(%rip), %rdi    # 0x196ff0
callq 0x44e0
movq %rax, %r15
leaq 0xfe213(%rip), %rsi     # 0x154a47
movl $0xf, %edx
movq %rax, %rdi
callq 0x44e0
movl 0x40(%rsp), %esi
movq %r15, %rdi
callq 0x4750
movq %rax, %r15
leaq 0xffe6d(%rip), %rsi     # 0x1566c4
movl $0x5, %edx
movq %rax, %rdi
callq 0x44e0
movl 0x20(%rsp), %esi
movq %r15, %rdi
callq 0x4750
leaq 0xfecb7(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
movq 0x1a0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x568a1
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x180(%rsp), %rdi
cmpq %r14, %rdi
je 0x568be
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x568e3
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x5725d
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x5725d
movl %r15d, %ebx
movq 0x10(%rsp), %r14
cmpl $-0x1, %ebx
je 0x569b1
leaq 0x140(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0xa0(%rsp), %rdi
leaq 0x40(%rsp), %rcx
movq %r14, %rsi
callq 0x383b0
leaq 0x40(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x140(%rsp), %rdi
leaq 0x20(%rsp), %rcx
movq %r14, %rsi
callq 0x383b0
xorl %eax, %eax
movq %rax, 0x50(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq %rax, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movl %ebx, 0x88(%rsp)
movl 0x58(%rsp), %eax
movb %al, 0x8c(%rsp)
movq 0x48(%rsp), %rsi
testq %rsi, %rsi
je 0x56a94
movq 0x88(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x48(%rsp)
jmp 0x56aa6
movq 0x140638(%rip), %rdi    # 0x196ff0
leaq 0xfe1ae(%rip), %rsi     # 0x154b6d
movl $0x51, %edx
callq 0x44e0
jmp 0x5725d
movq 0x14061b(%rip), %rdi    # 0x196ff0
leaq 0xfe13f(%rip), %rsi     # 0x154b1b
movl $0x51, %edx
callq 0x44e0
movq 0x140603(%rip), %rbx    # 0x196ff0
leaq 0xfeb3a(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0xfe0a8(%rip), %rsi     # 0x154ab0
movl $0x12, %edx
movq %rbx, %rdi
callq 0x44e0
jmp 0x5723e
movq 0x1405cf(%rip), %rdi    # 0x196ff0
leaq 0xfe09b(%rip), %rsi     # 0x154ac3
movl $0x3d, %edx
callq 0x44e0
movq 0x68(%rsp), %rax
movq (%rax,%rbx), %rsi
subq -0x8(%rax,%rbx), %rsi
sarq $0x2, %rsi
movq 0x1405a5(%rip), %rdi    # 0x196ff0
callq 0x42b0
movq %rax, %rbx
leaq 0xfe0a7(%rip), %rsi     # 0x154b01
movl $0x19, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xfeac0(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0xfe02e(%rip), %rsi     # 0x154ab0
movl $0x12, %edx
movq %rbx, %rdi
callq 0x44e0
jmp 0x5723e
leaq 0x40(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x69398
movl $0xffffffff, 0x60(%rsp) # imm = 0xFFFFFFFF
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x56acb
movl $0xffffffff, (%rsi)     # imm = 0xFFFFFFFF
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x56ada
leaq 0x20(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x1422c
movabsq $-0x8000000000000000, %r13 # imm = 0x8000000000000000
movq $0x0, 0x58(%rsp)
leaq 0x3f(%r13), %rax
movq %rax, 0x18(%rsp)
movq 0x1404f3(%rip), %r15    # 0x196ff0
movq 0x48(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0x56e5c
leaq -0x8(%rax), %rdx
movslq -0x8(%rax), %rcx
movb -0x4(%rax), %r14b
movq %rdx, 0x48(%rsp)
movl %ecx, 0xc(%rsp)
movq 0x28(%rsp), %rdi
movl -0x4(%rdi), %ebx
addq $-0x4, %rdi
leaq 0x3f(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq 0xa0(%rsp), %rax
movq %rcx, %rsi
andq 0x18(%rsp), %rsi
xorl %edx, %edx
cmpq %r13, %rsi
setbe %dl
movl $0x1, %esi
shlq %cl, %rsi
movq %rdi, 0x28(%rsp)
movq -0x8(%rax,%rdx,8), %rdi
btq %rcx, %rdi
jae 0x56c18
movq 0x2f0(%r12), %rax
imulq $0x98, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
leaq 0xf8c42(%rip), %rsi     # 0x14f7d5
callq 0x4170
movb $0x1, %bpl
testl %eax, %eax
jne 0x56e4e
movslq 0xc(%rsp), %rax
leaq 0x3f(%rax), %rcx
testq %rax, %rax
cmovnsq %rax, %rcx
sarq $0x6, %rcx
shlq $0x3, %rcx
addq 0x140(%rsp), %rcx
movq %rax, %rdx
andq 0x18(%rsp), %rdx
xorl %esi, %esi
cmpq %r13, %rdx
setbe %sil
movq -0x8(%rcx,%rsi,8), %rcx
btq %rax, %rcx
setae %al
xorb %r14b, %al
testb $0x1, %al
jne 0x56e4e
movl $0x5c, %edx
movq %r15, %rdi
leaq 0xfdfc5(%rip), %rsi     # 0x154bbf
callq 0x44e0
movl $0x1, %edx
movq %r15, %rdi
leaq 0xfe920(%rip), %rsi     # 0x15552e
callq 0x44e0
jmp 0x56d02
movq %r13, %r15
movl %r14d, %r13d
andb $0x1, %r13b
leaq -0x8(,%rdx,8), %rdx
movq 0x58(%rsp), %r8
incl %r8d
movq %r8, 0x58(%rsp)
orq %rsi, %rdi
movq %rdi, (%rax,%rdx)
movq 0x2f0(%r12), %rax
imulq $0x98, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
leaq 0xf8b6e(%rip), %rsi     # 0x14f7ca
callq 0x4170
movslq 0xc(%rsp), %rcx
testl %eax, %eax
je 0x56d09
movq 0x2f0(%r12), %rax
imulq $0x98, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
leaq 0xf8b49(%rip), %rsi     # 0x14f7d5
callq 0x4170
testl %eax, %eax
je 0x56d4a
movl $0x51, %edx
movq 0x14034b(%rip), %rbx    # 0x196ff0
movq %rbx, %rdi
leaq 0xfde6c(%rip), %rsi     # 0x154b1b
callq 0x44e0
movq %r15, %r13
movq %rbx, %r15
movl $0x1, %edx
movq %rbx, %rdi
leaq 0xfe865(%rip), %rsi     # 0x15552e
callq 0x44e0
movl $0x12, %edx
movq %r15, %rdi
leaq 0xfddd3(%rip), %rsi     # 0x154ab0
callq 0x44e0
movl 0xc(%rsp), %esi
movq %r15, %rdi
callq 0x4750
movl $0x1, %edx
movq %rax, %rdi
leaq 0xfe831(%rip), %rsi     # 0x15552e
callq 0x44e0
xorl %ebp, %ebp
jmp 0x56e4e
leaq 0x3f(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq 0x140(%rsp), %rax
movq %rcx, %rdx
andq 0x18(%rsp), %rdx
xorl %esi, %esi
cmpq %r15, %rdx
setbe %sil
movq $-0x2, %rdx
rolq %cl, %rdx
andq %rdx, -0x8(%rax,%rsi,8)
xorb $0x1, %r13b
jmp 0x56d9e
movslq 0xc(%rsp), %rcx
leaq 0x3f(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq 0x140(%rsp), %rax
movq %rcx, %rdx
andq 0x18(%rsp), %rdx
xorl %esi, %esi
cmpq %r15, %rdx
setbe %sil
leaq -0x8(,%rsi,8), %rdx
movl $0x1, %esi
shlq %cl, %rsi
testb $0x1, %r14b
je 0x56d97
orq %rsi, (%rax,%rdx)
jmp 0x56d9e
notq %rsi
andq %rsi, (%rax,%rdx)
movslq 0xc(%rsp), %rax
movq 0x68(%rsp), %rcx
leaq (%rax,%rax,2), %rdx
movq (%rcx,%rdx,8), %rax
movb $0x1, %bpl
cmpq %rax, 0x8(%rcx,%rdx,8)
je 0x56e44
leaq (%rcx,%rdx,8), %rcx
movl $0x1, %r14d
xorl %edx, %edx
cmpl %ebx, (%rax,%rdx,4)
je 0x56e19
movq (%rcx), %rax
movl (%rax,%rdx,4), %eax
movl %eax, 0x60(%rsp)
movb %r13b, 0x64(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x694de
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x56e0a
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x56e19
leaq 0x20(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0xf7b4
movl %r14d, %edx
movslq 0xc(%rsp), %rax
movq 0x68(%rsp), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rsi
subq %rax, %rsi
sarq $0x2, %rsi
incl %r14d
cmpq %rdx, %rsi
ja 0x56dca
movq %r15, %r13
movq 0x1401a2(%rip), %r15    # 0x196ff0
testb %bpl, %bpl
jne 0x56afd
jmp 0x57106
movq 0x10(%rsp), %rbx
cmpl %ebx, 0x58(%rsp)
jne 0x57061
testl %ebx, %ebx
jle 0x56f3f
movq %r13, %r15
movq 0x10(%rsp), %rax
leaq (,%rax,8), %rax
leaq (%rax,%rax,2), %rbx
xorl %r14d, %r14d
movl $0x40, %r13d
xorl %ebp, %ebp
movq 0x2f0(%r12), %rdi
addq %r13, %rdi
leaq 0xf8926(%rip), %rsi     # 0x14f7ca
callq 0x4170
testl %eax, %eax
jne 0x56f28
movq 0x68(%rsp), %rax
movq (%rax,%rbp), %rcx
movslq (%rcx), %rdx
movq 0x140(%rsp), %rax
leaq 0x3f(%rdx), %rsi
testq %rdx, %rdx
cmovnsq %rdx, %rsi
sarq $0x6, %rsi
leaq (%rax,%rsi,8), %rsi
movq %rdx, %rdi
andq 0x18(%rsp), %rdi
xorl %r8d, %r8d
cmpq %r15, %rdi
setbe %r8b
movq -0x8(%rsi,%r8,8), %rsi
btq %rdx, %rsi
jae 0x56f28
movslq 0x4(%rcx), %rcx
leaq 0x3f(%rcx), %rdx
testq %rcx, %rcx
cmovnsq %rcx, %rdx
sarq $0x6, %rdx
leaq (%rax,%rdx,8), %rax
movq %rcx, %rdx
andq 0x18(%rsp), %rdx
xorl %esi, %esi
cmpq %r15, %rdx
setbe %sil
movq -0x8(%rax,%rsi,8), %rax
btq %rcx, %rax
jb 0x5727d
addq $0x18, %rbp
incl %r14d
addq $0x98, %r13
cmpq %rbp, %rbx
jne 0x56e92
movq %r12, %rdi
movq 0x80(%rsp), %rsi
callq 0x528f4
movq 0x10(%rsp), %rax
movq 0x98(%rsp), %rcx
movl $0x0, (%rcx)
movb $0x1, %bpl
testl %eax, %eax
jle 0x57108
movl $0x48, %r15d
xorl %ebx, %ebx
leaq 0xfe112(%rip), %r14     # 0x15508e
leaq 0x1d8(%rsp), %r12
movzbl 0x94(%rsp), %r13d
movq 0x140(%rsp), %rax
movq %rbx, %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rax
btq %rbx, %rax
jae 0x57047
movq 0x80(%rsp), %rax
movq 0x2f0(%rax), %rax
leaq (%rax,%r15), %rdi
addq $-0x8, %rdi
movq 0x8(%rdi), %rdx
movl $0x2, %r8d
xorl %esi, %esi
movq %r14, %rcx
callq 0x4670
leaq 0x1e8(%rsp), %rax
movq %rax, 0x1d8(%rsp)
movq %r12, %rdi
movq %r14, %rsi
leaq 0xfe09e(%rip), %rdx     # 0x155090
callq 0x2263c
movq %r12, %rdi
movl %r13d, %esi
callq 0x21e42
movq 0x80(%rsp), %rax
movq 0x2f0(%rax), %rax
movsd %xmm0, -0x18(%rax,%r15)
movq 0x1d8(%rsp), %rdi
leaq 0x1e8(%rsp), %rax
cmpq %rax, %rdi
je 0x5703d
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x98(%rsp), %rax
incl (%rax)
incq %rbx
addq $0x98, %r15
cmpq %rbx, 0x10(%rsp)
jne 0x56f8d
jmp 0x57108
movq 0x13ff88(%rip), %rdi    # 0x196ff0
leaq 0xfdbad(%rip), %rsi     # 0x154c1c
movl $0x48, %edx
callq 0x44e0
movq 0x13ff70(%rip), %rdi    # 0x196ff0
leaq 0xfe4a7(%rip), %rsi     # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0x13ff58(%rip), %rdi    # 0x196ff0
leaq 0xfdbc6(%rip), %rsi     # 0x154c65
movl $0x8, %edx
callq 0x44e0
movq 0x13ff40(%rip), %rdi    # 0x196ff0
movq 0x58(%rsp), %rsi
callq 0x4750
movq %rax, %r14
leaq 0xfca90(%rip), %rsi     # 0x153b54
movl $0x8, %edx
movq %rax, %rdi
callq 0x44e0
movq %r14, %rdi
movl %ebx, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xfd96a(%rip), %rsi     # 0x154a4f
movl $0x7, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xfe435(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
xorl %ebp, %ebp
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x5711f
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x57136
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x5717b
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x140(%rsp)
movl %eax, 0x148(%rsp)
movq %rax, 0x150(%rsp)
movl %eax, 0x158(%rsp)
movq %rax, 0x160(%rsp)
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x5725f
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0xa0(%rsp)
movl %eax, 0xa8(%rsp)
movq %rax, 0xb0(%rsp)
movl %eax, 0xb8(%rsp)
movq %rax, 0xc0(%rsp)
jmp 0x5725f
movq 0x13fe20(%rip), %rdi    # 0x196ff0
leaq 0xfd880(%rip), %rsi     # 0x154a57
movl $0x3e, %edx
callq 0x44e0
movq 0x68(%rsp), %rax
movq (%rax,%rbx), %rsi
subq -0x8(%rax,%rbx), %rsi
sarq $0x2, %rsi
movq 0x13fdf6(%rip), %rdi    # 0x196ff0
callq 0x42b0
movq %rax, %rbx
leaq 0xfd88d(%rip), %rsi     # 0x154a96
movl $0x19, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xfe311(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0xfd87f(%rip), %rsi     # 0x154ab0
movl $0x12, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x4750
leaq 0xfe2de(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
xorl %ebp, %ebp
leaq 0x68(%rsp), %rdi
callq 0xefda
movl %ebp, %eax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x13fd6c(%rip), %rdi    # 0x196ff0
leaq 0xfd9e3(%rip), %rsi     # 0x154c6e
movl $0x39, %edx
callq 0x44e0
movq 0x13fd54(%rip), %rdi    # 0x196ff0
leaq 0xfe28b(%rip), %rsi     # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0x13fd3c(%rip), %rdi    # 0x196ff0
leaq 0xfd9ed(%rip), %rsi     # 0x154ca8
movl $0xd, %edx
callq 0x44e0
movq 0x13fd24(%rip), %rdi    # 0x196ff0
movl %r14d, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xfd9d8(%rip), %rsi     # 0x154cb6
movl $0x13, %edx
movq %rax, %rdi
callq 0x44e0
movq 0x68(%rsp), %rax
movq (%rax,%rbp), %rax
movl (%rax), %esi
movq %rbx, %rdi
callq 0x4750
movq %rax, %rbx
leaq 0xff3bc(%rip), %rsi     # 0x1566c4
movl $0x5, %edx
movq %rax, %rdi
callq 0x44e0
movq 0x68(%rsp), %rax
movq (%rax,%rbp), %rax
movl 0x4(%rax), %esi
movq %rbx, %rdi
callq 0x4750
movq %rax, %rbx
leaq 0xfd997(%rip), %rsi     # 0x154cca
movl $0x19, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xfe1e7(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0xfd989(%rip), %rsi     # 0x154ce4
movl $0x19, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0xfe1bf(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0xfd97b(%rip), %rsi     # 0x154cfe
movl $0x27, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0xfe197(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
jmp 0x57106
jmp 0x57469
jmp 0x57469
jmp 0x5745c
movq %rax, %r15
jmp 0x574df
jmp 0x5745c
jmp 0x57469
movq %rax, %r15
movq 0x1d8(%rsp), %rdi
leaq 0x1e8(%rsp), %rax
cmpq %rax, %rdi
je 0x5746c
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x5746c
jmp 0x57469
jmp 0x57469
movq %rax, %r15
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x57574
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x57574
jmp 0x5745c
jmp 0x57469
jmp 0x57469
movq %rax, %r15
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x5756a
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x5756a
movq %rax, %r15
jmp 0x5756a
jmp 0x5754d
movq %rax, %r15
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x57483
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x5749a
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x574df
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x140(%rsp)
movl %eax, 0x148(%rsp)
movq %rax, 0x150(%rsp)
movl %eax, 0x158(%rsp)
movq %rax, 0x160(%rsp)
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x5756a
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0xa0(%rsp)
movl %eax, 0xa8(%rsp)
movq %rax, 0xb0(%rsp)
movl %eax, 0xb8(%rsp)
movq %rax, 0xc0(%rsp)
jmp 0x5756a
movq %rax, %r15
jmp 0x5755d
movq %rax, %r15
movq 0x180(%rsp), %rdi
cmpq %r14, %rdi
je 0x5755d
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x5755d
movq %rax, %r15
leaq 0x140(%rsp), %rdi
callq 0x2f814
leaq 0xa0(%rsp), %rdi
callq 0x2f814
leaq 0x68(%rsp), %rdi
callq 0xefda
movq %r15, %rdi
callq 0x4780