// File: /workspace/github_cpp_makefile_star2_O3/joraso[P]Glassius/Integration.cpp
// Function: Integrator::Run(double)
void Integrator::Run(double t){
    /* Advanced the integration for time=t. Records into an energy file AND a 
    trajectory file as it does. Does not themostate the system. */
    
    // Cycling indeces
    int m, n; int steps = int(t/dt);
    int cycles = int(steps/Nrecord);
    
    // Retrieving the system time
    time = System->Time();
    
    // Prepping output file
    std::ofstream energyfile;
    energyfile.open(efilename, std::ios::app);
    
    // File check-stop
    if(!energyfile.is_open()){
        cout << "Error opening energy file!" << endl;
        exit(1);
    }
    
    // Integrating
    for(m=0;m<cycles;m++){
        for(n=0;n<Nrecord;n++){Propigate();}
        energyfile << time << ", ";
        energyfile << System->KE() << ", ";
        energyfile << System->PE() << ", ";
        energyfile << System->TotalEnergy() << std::endl;
        if (recordtraj) {System->SaveTrajectory();};
    }
    
    // Closing the energy file
    energyfile.close();
    
    // Storing the system time
    System->setTime(time);
    
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %rbx
divsd 0x18(%rdi), %xmm0
cvttsd2si %xmm0, %eax
cltd
idivl 0x28(%rdi)
movl %eax, %ebp
movq 0x8(%rdi), %rax
movsd 0x70(%rax), %xmm0
movsd %xmm0, 0x20(%rdi)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x2280
leaq 0x30(%rbx), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x20d0
leaq 0x78(%rsp), %rdi
callq 0x2070
testb %al, %al
je 0x417f
testl %ebp, %ebp
jle 0x4123
xorl %r13d, %r13d
leaq 0x8(%rsp), %r14
leaq 0x421e(%rip), %r15      # 0x825c
cmpl $0x0, 0x28(%rbx)
jle 0x4059
xorl %r12d, %r12d
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
incl %r12d
cmpl 0x28(%rbx), %r12d
jl 0x4047
movsd 0x20(%rbx), %xmm0
movq %r14, %rdi
callq 0x2260
movl $0x2, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21e0
movq 0x8(%rbx), %r12
movq %r12, %rdi
callq 0x35e2
movsd 0x78(%r12), %xmm0
movq %r14, %rdi
callq 0x2260
movl $0x2, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21e0
movq 0x8(%rbx), %rax
movsd 0x80(%rax), %xmm0
movq %r14, %rdi
callq 0x2260
movl $0x2, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21e0
movq 0x8(%rbx), %rax
movsd 0x78(%rax), %xmm0
addsd 0x80(%rax), %xmm0
movq %r14, %rdi
callq 0x2260
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2120
cmpb $0x1, 0x50(%rbx)
jne 0x4117
movq 0x8(%rbx), %rdi
callq 0x3378
incl %r13d
cmpl %ebp, %r13d
jne 0x403e
leaq 0x8(%rsp), %rdi
callq 0x2220
movq 0x8(%rbx), %rax
movsd 0x20(%rbx), %xmm0
movsd %xmm0, 0x70(%rax)
movq 0x6e8e(%rip), %rax      # 0xafd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x10(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x8(%rsp,%rcx)
callq 0x2180
leaq 0x100(%rsp), %rdi
callq 0x2090
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6e52(%rip), %rdi      # 0xafd8
leaq 0x40b4(%rip), %rsi      # 0x8241
movl $0x1a, %edx
callq 0x21e0
movq 0x6e3a(%rip), %rdi      # 0xafd8
callq 0x20e0
movl $0x1, %edi
callq 0x21f0
jmp 0x41b1
jmp 0x41b1
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2240
movq %rbx, %rdi
callq 0x22b0