// File: /workspace/github_cpp_makefile_star2_O2/dfrodriguezp[P]PiCM-cpp/functions.cc
// Function: boris(std::vector<std::valarray<double>, std::allocator<std::valarray<double>>>&, std::vector<double, std::allocator<double>> const&, std::vector<unsigned int, std::allocator<unsigned int>> const&, std::vector<std::valarray<double>, std::allocator<std::valarray<double>>> const&, std::valarray<double> const&, double const&, unsigned int const&)
void boris(VecArr &velocities,
           const std::vector<Real> &QoverM,
           const std::vector<Int> &moves,
           const VecArr &E, const Array &B,
           const Real &dt, const Int &N)
{
    Array t;
    Real t_2;
    Array s;
    Array v_minus;
    Array v_prime;
    Array v_plus;

    for (Int p = 0; p < N; ++p)
    {
        if (moves.at(p))
        {
            t = 0.5 * QoverM.at(p) * B * dt;
            t_2 = norm(t) * norm(t);
            s = (2.0 * t) / (1.0 + t_2);
            v_minus = velocities.at(p) + 0.5 * QoverM.at(p) * E[p] * dt;
            v_prime = v_minus + cross(v_minus, t);
            v_plus = v_minus + cross(v_prime, s);
            velocities.at(p) = v_plus + 0.5 * QoverM.at(p) * E[p] * dt;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r9, 0x28(%rsp)
movq %r8, 0xa0(%rsp)
movq %rcx, 0x40(%rsp)
movq %rdx, 0xa8(%rsp)
movq %rsi, %r13
movq %rdi, 0x48(%rsp)
xorpd %xmm0, %xmm0
leaq 0x30(%rsp), %rax
movapd %xmm0, (%rax)
leaq 0x70(%rsp), %rax
movapd %xmm0, (%rax)
leaq 0x60(%rsp), %rax
movapd %xmm0, (%rax)
leaq 0x90(%rsp), %rax
movapd %xmm0, (%rax)
leaq 0x50(%rsp), %rax
movapd %xmm0, (%rax)
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
xorl %r12d, %r12d
movq 0xf0(%rsp), %rax
movl (%rax), %eax
cmpq %rax, %r12
jae 0x73ba
movq 0xa8(%rsp), %rdi
movq %r12, %rsi
callq 0x78b2
cmpl $0x0, (%rax)
je 0x73ae
movq %r13, %rdi
movq %r12, %rsi
callq 0x7768
leaq 0x30(%rsp), %rbp
movsd (%rax), %xmm0
mulsd 0x1e35(%rip), %xmm0     # 0x9020
movsd %xmm0, 0x8(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x78d4
movq %rbp, %rdi
callq 0x602e
movsd %xmm0, 0xb0(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x602e
movsd 0xb0(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x1dc8(%rip), %xmm1     # 0x9010
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, 0x8(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movsd %xmm1, 0x18(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x7934
movq 0x48(%rsp), %rdi
movq %r12, %rsi
callq 0x4d3a
movq %rax, %rbp
movq %r13, %rdi
movq %r12, %rsi
callq 0x7768
leaq 0x60(%rsp), %rbx
movsd (%rax), %xmm0
mulsd 0x1d80(%rip), %xmm0     # 0x9020
movq 0x40(%rsp), %rax
movq (%rax), %rax
addq %r14, %rax
movq 0x28(%rsp), %rcx
movsd (%rcx), %xmm1
movsd %xmm0, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movsd %xmm1, 0x20(%rsp)
movq %rbp, 0x8(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7994
leaq 0x80(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0x30(%rsp), %rdx
callq 0x79f2
movq %rbx, 0x8(%rsp)
movq %rbp, 0x10(%rsp)
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7a6e
movq 0x88(%rsp), %rdi
callq 0x2230
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0x70(%rsp), %rdx
callq 0x79f2
leaq 0x60(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %rbp, 0x10(%rsp)
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0x7a6e
movq 0x88(%rsp), %rdi
callq 0x2230
movq %r13, %rdi
movq %r12, %rsi
callq 0x7768
movsd (%rax), %xmm0
mulsd 0x1cb9(%rip), %xmm0     # 0x9020
movq 0x40(%rsp), %rax
movq (%rax), %rax
addq %r14, %rax
movq 0x28(%rsp), %rcx
movsd (%rcx), %xmm1
movsd %xmm0, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movsd %xmm1, 0x20(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rsp), %rdi
movq %r12, %rsi
callq 0x4d3a
movq %rax, %rdi
movq %r15, %rsi
callq 0x7994
incq %r12
addq $0x10, %r14
jmp 0x71a3
movq 0x58(%rsp), %rdi
callq 0x2230
movq 0x98(%rsp), %rdi
callq 0x2230
movq 0x68(%rsp), %rdi
callq 0x2230
movq 0x78(%rsp), %rdi
callq 0x2230
movq 0x38(%rsp), %rdi
callq 0x2230
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7423
jmp 0x7423
jmp 0x7423
jmp 0x7409
movq %rax, %rbx
movq 0x88(%rsp), %rdi
callq 0x2230
jmp 0x7426
jmp 0x7423
jmp 0x7423
jmp 0x7423
jmp 0x7423
movq %rax, %rbx
movq 0x58(%rsp), %rdi
callq 0x2230
movq 0x98(%rsp), %rdi
callq 0x2230
movq 0x68(%rsp), %rdi
callq 0x2230
movq 0x78(%rsp), %rdi
callq 0x2230
movq 0x38(%rsp), %rdi
callq 0x2230
movq %rbx, %rdi
callq 0x2430