// File: joraso[P]Glassius/Protocol.cpp
// Function: Protocol::KobAndersonReplication(double, double, Stopwatch*)
void Protocol::KobAndersonReplication(double Temp, double relax, Stopwatch* timer){
    /* Replication run of the 1995 Kob-Anderson paper. */
    
    std::cout <<"\n"<< "Replication of Kob-Anderson Glass" <<"\n"<< std::endl;
    std::cout << "Using Parameters:" << std::endl;
    std::cout << "Temperature = " << Temp << std::endl;
    std::cout << "RelaxationTime =  " << relax << std::endl;
    
    double rho = 1000 / (9.4*9.4*9.4);
    
    std::cout << "Density = " << rho << std::endl;
    std::cout << "Boxlength = 9.4" << std::endl;
    
    std::cout << "\n" << "Setting up System..." << std::endl;
    Glass System(rho, 5.0, 10);
    timer->StampComplete();
    
    std::cout << "\n" << "Setting up Simulation..." << std::endl;
    Verlet Simulation(&System, 5, 0.01, 10);
    timer->StampComplete();
    
    
    std::cout << "\n" << "Equilibrating at T = 5.0" << std::endl;
     std::cout << "Running for t = 100" << std::endl;
    std::cout << "Recording every = " << Simulation.GetRecord() << std::endl;
    std::cout << "Thermostating every 50 timesteps" << std::endl;
    Simulation.Equilibrate(1000, 50);
    timer->StampComplete();
    
    std::cout << "\n" << "Equilibrating at T = " << Temp << std::endl;
    std::cout << "Running for t = " << relax << std::endl;
    std::cout << "Recording every = " << Simulation.GetRecord() << std::endl;
    std::cout << "Thermostating every 50 timesteps" << std::endl;
    Simulation.SetTemp(Temp);
    System.Thermalize(Temp);
    Simulation.Equilibrate(relax, 50);
    timer->StampComplete();
    
    std::cout << "\n" << "Begining Production Run" << std::endl;
    std::cout << "Running for t = " << relax << std::endl;
    if(Temp<1.0){
        Simulation.Setdt(0.02);
    }
    double dt = Simulation.Getdt();
    std::cout << "Timestep = " << dt << std::endl;
    int Npoints = 10000;
    std::cout << "Total Data Points = " << Npoints << std::endl;
    int Nrec = int( relax / (dt*Npoints) );
    Simulation.SetRecord(Nrec);
    std::cout << "Recording every = " << Simulation.GetRecord() << std::endl;
    Simulation.Run(relax);
    timer->StampComplete();
    
    return;
}

// Assembly:
subq $0x238, %rsp            # imm = 0x238
movsd %xmm0, 0x230(%rsp)
movsd %xmm1, 0x228(%rsp)
movq %rdi, 0x220(%rsp)
movq 0x61f8(%rip), %rdi      # 0xbfd0
movq %rdi, 0xf8(%rsp)
leaq 0x34a9(%rip), %rsi      # 0x9290
movq %rsi, 0x100(%rsp)
callq 0x2140
movq %rax, %rdi
leaq 0x3494(%rip), %rsi      # 0x9292
callq 0x2140
movq 0x100(%rsp), %rsi
movq %rax, %rdi
callq 0x2140
movq %rax, %rdi
movq 0x619b(%rip), %rsi      # 0xbfb8
movq %rsi, 0x108(%rsp)
callq 0x2150
movq 0xf8(%rsp), %rdi
leaq 0x347b(%rip), %rsi      # 0x92b4
callq 0x2140
movq 0x108(%rsp), %rsi
movq %rax, %rdi
callq 0x2150
movq 0xf8(%rsp), %rdi
leaq 0x3469(%rip), %rsi      # 0x92c6
callq 0x2140
movq %rax, %rdi
movsd 0x230(%rsp), %xmm0
callq 0x2240
movq 0x108(%rsp), %rsi
movq %rax, %rdi
callq 0x2150
movq 0xf8(%rsp), %rdi
leaq 0x3443(%rip), %rsi      # 0x92d5
callq 0x2140
movq %rax, %rdi
movsd 0x228(%rsp), %xmm0
callq 0x2240
movq 0x108(%rsp), %rsi
movq %rax, %rdi
callq 0x2150
movq 0xf8(%rsp), %rdi
movabsq $0x3ff343784bba4763, %rax # imm = 0x3FF343784BBA4763
movq %rax, 0x218(%rsp)
leaq 0x340f(%rip), %rsi      # 0x92e8
callq 0x2140
movq %rax, %rdi
movsd 0x218(%rsp), %xmm0
callq 0x2240
movq 0x108(%rsp), %rsi
movq %rax, %rdi
callq 0x2150
movq 0xf8(%rsp), %rdi
leaq 0x33e5(%rip), %rsi      # 0x92f3
callq 0x2140
movq 0x108(%rsp), %rsi
movq %rax, %rdi
callq 0x2150
movq 0xf8(%rsp), %rdi
movq 0x100(%rsp), %rsi
callq 0x2140
movq %rax, %rdi
leaq 0x33c1(%rip), %rsi      # 0x9303
callq 0x2140
movq 0x108(%rsp), %rsi
movq %rax, %rdi
callq 0x2150
movsd 0x218(%rsp), %xmm0
leaq 0x188(%rsp), %rdi
movsd 0x32d8(%rip), %xmm1     # 0x9248
movsd 0x32d8(%rip), %xmm2     # 0x9250
callq 0x84f0
movq 0x220(%rsp), %rdi
callq 0x30c0
jmp 0x5f8c
movq 0x603d(%rip), %rdi      # 0xbfd0
leaq 0x32f6(%rip), %rsi      # 0x9290
callq 0x2140
movq %rax, 0xf0(%rsp)
jmp 0x5fa9
movq 0xf0(%rsp), %rdi
leaq 0x3360(%rip), %rsi      # 0x9318
callq 0x2140
movq %rax, 0xe8(%rsp)
jmp 0x5fc7
movq 0xe8(%rsp), %rdi
movq 0x5fe2(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x5fdd
leaq 0x120(%rsp), %rdi
leaq 0x188(%rsp), %rsi
movsd 0x3253(%rip), %xmm0     # 0x9248
movsd 0x325b(%rip), %xmm1     # 0x9258
movl $0xa, %edx
callq 0x85b0
jmp 0x6009
movq 0x220(%rsp), %rdi
callq 0x30c0
jmp 0x6018
movq 0x5fb1(%rip), %rdi      # 0xbfd0
leaq 0x326a(%rip), %rsi      # 0x9290
callq 0x2140
movq %rax, 0xe0(%rsp)
jmp 0x6035
movq 0xe0(%rsp), %rdi
leaq 0x32ed(%rip), %rsi      # 0x9331
callq 0x2140
movq %rax, 0xd8(%rsp)
jmp 0x6053
movq 0xd8(%rsp), %rdi
movq 0x5f56(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x6069
movq 0x5f60(%rip), %rdi      # 0xbfd0
leaq 0x32d3(%rip), %rsi      # 0x934a
callq 0x2140
movq %rax, 0xd0(%rsp)
jmp 0x6086
movq 0xd0(%rsp), %rdi
movq 0x5f23(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x609c
movq 0x5f2d(%rip), %rdi      # 0xbfd0
leaq 0x32b4(%rip), %rsi      # 0x935e
callq 0x2140
movq %rax, 0xc8(%rsp)
jmp 0x60b9
leaq 0x120(%rsp), %rdi
callq 0x8640
movl %eax, 0xc4(%rsp)
jmp 0x60cf
movl 0xc4(%rsp), %esi
movq 0xc8(%rsp), %rdi
callq 0x21f0
movq %rax, 0xb8(%rsp)
jmp 0x60ed
movq 0xb8(%rsp), %rdi
movq 0x5ebc(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x6103
movq 0x5ec6(%rip), %rdi      # 0xbfd0
leaq 0x3260(%rip), %rsi      # 0x9371
callq 0x2140
movq %rax, 0xb0(%rsp)
jmp 0x6120
movq 0xb0(%rsp), %rdi
movq 0x5e89(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x6136
leaq 0x120(%rsp), %rdi
movsd 0x311a(%rip), %xmm0     # 0x9260
movl $0x32, %esi
callq 0x4f10
jmp 0x6152
movq 0x220(%rsp), %rdi
callq 0x30c0
jmp 0x6161
movq 0x5e68(%rip), %rdi      # 0xbfd0
leaq 0x3121(%rip), %rsi      # 0x9290
callq 0x2140
movq %rax, 0xa8(%rsp)
jmp 0x617e
movq 0xa8(%rsp), %rdi
leaq 0x3205(%rip), %rsi      # 0x9392
callq 0x2140
movq %rax, 0xa0(%rsp)
jmp 0x619c
movq 0xa0(%rsp), %rdi
movsd 0x230(%rsp), %xmm0
callq 0x2240
movq %rax, 0x98(%rsp)
jmp 0x61bc
movq 0x98(%rsp), %rdi
movq 0x5ded(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x61d2
movq 0x5df7(%rip), %rdi      # 0xbfd0
leaq 0x31c8(%rip), %rsi      # 0x93a8
callq 0x2140
movq %rax, 0x90(%rsp)
jmp 0x61ef
movq 0x90(%rsp), %rdi
movsd 0x228(%rsp), %xmm0
callq 0x2240
movq %rax, 0x88(%rsp)
jmp 0x620f
movq 0x88(%rsp), %rdi
movq 0x5d9a(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x6225
movq 0x5da4(%rip), %rdi      # 0xbfd0
leaq 0x312b(%rip), %rsi      # 0x935e
callq 0x2140
movq %rax, 0x80(%rsp)
jmp 0x6242
leaq 0x120(%rsp), %rdi
callq 0x8640
movl %eax, 0x7c(%rsp)
jmp 0x6255
movl 0x7c(%rsp), %esi
movq 0x80(%rsp), %rdi
callq 0x21f0
movq %rax, 0x70(%rsp)
jmp 0x626d
movq 0x70(%rsp), %rdi
movq 0x5d3f(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x6280
movq 0x5d49(%rip), %rdi      # 0xbfd0
leaq 0x30e3(%rip), %rsi      # 0x9371
callq 0x2140
movq %rax, 0x68(%rsp)
jmp 0x629a
movq 0x68(%rsp), %rdi
movq 0x5d12(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x62ad
movsd 0x230(%rsp), %xmm0
leaq 0x120(%rsp), %rdi
callq 0x8650
jmp 0x62c5
movsd 0x230(%rsp), %xmm0
leaq 0x188(%rsp), %rdi
callq 0x4050
jmp 0x62dd
movsd 0x228(%rsp), %xmm0
leaq 0x120(%rsp), %rdi
movl $0x32, %esi
callq 0x4f10
jmp 0x62fa
movq 0x220(%rsp), %rdi
callq 0x30c0
jmp 0x6309
movq 0x5cc0(%rip), %rdi      # 0xbfd0
leaq 0x2f79(%rip), %rsi      # 0x9290
callq 0x2140
movq %rax, 0x60(%rsp)
jmp 0x6323
movq 0x60(%rsp), %rdi
leaq 0x308a(%rip), %rsi      # 0x93b9
callq 0x2140
movq %rax, 0x58(%rsp)
jmp 0x633b
movq 0x58(%rsp), %rdi
movq 0x5c71(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x634e
movq 0x5c7b(%rip), %rdi      # 0xbfd0
leaq 0x304c(%rip), %rsi      # 0x93a8
callq 0x2140
movq %rax, 0x50(%rsp)
jmp 0x6368
movq 0x50(%rsp), %rdi
movsd 0x228(%rsp), %xmm0
callq 0x2240
movq %rax, 0x48(%rsp)
jmp 0x6382
movq 0x48(%rsp), %rdi
movq 0x5c2a(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x6395
movsd 0x2cbb(%rip), %xmm0     # 0x9058
ucomisd 0x230(%rsp), %xmm0
jbe 0x6400
leaq 0x120(%rsp), %rdi
movsd 0x2eb0(%rip), %xmm0     # 0x9268
callq 0x8670
jmp 0x63bf
jmp 0x6400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x180(%rsp)
movl %eax, 0x17c(%rsp)
jmp 0x659d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x180(%rsp)
movl %eax, 0x17c(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x86c0
jmp 0x659d
leaq 0x120(%rsp), %rdi
callq 0x8690
movsd %xmm0, 0x40(%rsp)
jmp 0x6415
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x118(%rsp)
movq 0x5ba5(%rip), %rdi      # 0xbfd0
leaq 0x2f9f(%rip), %rsi      # 0x93d1
callq 0x2140
movq %rax, 0x38(%rsp)
jmp 0x643e
movq 0x38(%rsp), %rdi
movsd 0x118(%rsp), %xmm0
callq 0x2240
movq %rax, 0x30(%rsp)
jmp 0x6458
movq 0x30(%rsp), %rdi
movq 0x5b54(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x646b
movl $0x2710, 0x114(%rsp) # imm = 0x2710
movq 0x5b53(%rip), %rdi      # 0xbfd0
leaq 0x2f59(%rip), %rsi      # 0x93dd
callq 0x2140
movq %rax, 0x28(%rsp)
jmp 0x6490
movq 0x28(%rsp), %rdi
movl 0x114(%rsp), %esi
callq 0x21f0
movq %rax, 0x20(%rsp)
jmp 0x64a8
movq 0x20(%rsp), %rdi
movq 0x5b04(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x64bb
movsd 0x228(%rsp), %xmm0
movsd 0x118(%rsp), %xmm1
cvtsi2sdl 0x114(%rsp), %xmm2
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x110(%rsp)
movl 0x110(%rsp), %esi
leaq 0x120(%rsp), %rdi
callq 0x86a0
jmp 0x64ff
movq 0x5aca(%rip), %rdi      # 0xbfd0
leaq 0x2e51(%rip), %rsi      # 0x935e
callq 0x2140
movq %rax, 0x18(%rsp)
jmp 0x6519
leaq 0x120(%rsp), %rdi
callq 0x8640
movl %eax, 0x14(%rsp)
jmp 0x652c
movl 0x14(%rsp), %esi
movq 0x18(%rsp), %rdi
callq 0x21f0
movq %rax, 0x8(%rsp)
jmp 0x6541
movq 0x8(%rsp), %rdi
movq 0x5a6b(%rip), %rsi      # 0xbfb8
callq 0x2150
jmp 0x6554
movsd 0x228(%rsp), %xmm0
leaq 0x120(%rsp), %rdi
callq 0x5230
jmp 0x656c
movq 0x220(%rsp), %rdi
callq 0x30c0
jmp 0x657b
leaq 0x120(%rsp), %rdi
callq 0x86c0
leaq 0x188(%rsp), %rdi
callq 0x86d0
addq $0x238, %rsp            # imm = 0x238
retq
leaq 0x188(%rsp), %rdi
callq 0x86d0
movq 0x180(%rsp), %rdi
callq 0x2210
nopw (%rax,%rax)