// File: /workspace/github_cpp_makefile_star2_O2/kaityo256[P]thermostats/thermostats.cpp
// Function: void integrate<RungeKutta<KineticMoments>>(RungeKutta<KineticMoments>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void integrate(Method f, std::string name) {
  Vars v;
  v.q = 1.0;
  double t = 0;
  std::string pfile = name + "_ps.dat";
  std::ofstream ofs_p(pfile.c_str());
  std::cout << name << std::endl;
  std::vector<double> data_e;
  for (int i = 0; i < LOOP; i++) {
    t += dt;
    v = f(v);
    if (i % O_LOOP == 0) {
      ofs_p << t << " ";
      ofs_p << v.p << " ";
      ofs_p << v.q << " ";
      ofs_p << f.H(v) << std::endl;
      data_e.push_back(v.p * v.p * 0.5 + v.q * v.q * 0.5);
    }
  }
  std::sort(data_e.begin(), data_e.end());
  const int n = data_e.size();
  const double nd = static_cast<double>(n);
  std::string efile = name + ".dat";
  std::ofstream ofs(efile.c_str());
  for (int i = 0; i < n; i++) {
    ofs << data_e[i] << " " << static_cast<double>(i) / nd << std::endl;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x528, %rsp            # imm = 0x528
movq %rdi, %r14
leaq 0x32f9(%rip), %rdx      # 0x514c
leaq 0x100(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31ff
movq (%rbx), %rsi
leaq 0x328(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x1120
movq 0x6158(%rip), %rdi      # 0x7fd8
movq %r14, %rsi
callq 0x10e0
movq %rax, %rdi
callq 0x1060
movq %r14, 0x98(%rsp)
leaq 0x560(%rsp), %r14
leaq 0x50(%rsp), %rax
andq $0x0, 0x10(%rax)
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movhpd 0x3206(%rip), %xmm0     # xmm0 = xmm0[0],mem[0]
movapd %xmm0, 0x30(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x80(%rsp)
movapd %xmm1, (%rax)
xorl %r12d, %r12d
leaq 0x328(%rsp), %r13
leaq 0x3271(%rip), %rbp      # 0x5154
xorpd %xmm0, %xmm0
movsd %xmm0, 0x40(%rsp)
xorl %ebx, %ebx
movsd %xmm0, 0x48(%rsp)
movl %ebx, %eax
xorl %edx, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
divl %ecx
cmpl $0xff676980, %r12d      # imm = 0xFF676980
je 0x20d3
movl %eax, %r15d
movsd 0x48(%rsp), %xmm0
addsd 0x3192(%rip), %xmm0     # 0x50b0
movsd %xmm0, 0x48(%rsp)
movaps 0x30(%rsp), %xmm0
movaps %xmm0, 0xa0(%rsp)
movaps 0x80(%rsp), %xmm0
movaps %xmm0, 0xb0(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x20(%rsp)
movaps 0xa0(%rsp), %xmm0
movapd 0xb0(%rsp), %xmm1
movupd %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x120(%rsp), %rdi
movq %r14, %rsi
callq 0x3c24
imull $0xfffffc18, %r15d, %eax # imm = 0xFFFFFC18
movaps 0x120(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movaps 0x130(%rsp), %xmm0
movaps %xmm0, 0x80(%rsp)
movsd 0x140(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
cmpl %r12d, %eax
jne 0x20c9
movq %r13, %rdi
movsd 0x48(%rsp), %xmm0
callq 0x1160
movq %rax, %rdi
movq %rbp, %rsi
callq 0x1100
movq %r13, %rdi
movapd 0x30(%rsp), %xmm0
callq 0x1160
movq %rax, %rdi
movq %rbp, %rsi
callq 0x1100
movapd 0x30(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movq %r13, %rdi
movapd %xmm0, 0x70(%rsp)
callq 0x1160
movq %rax, %rdi
movq %rbp, %rsi
callq 0x1100
movapd 0x30(%rsp), %xmm1
mulsd %xmm1, %xmm1
movsd 0x309d(%rip), %xmm3     # 0x50c8
mulsd %xmm3, %xmm1
movapd %xmm1, 0xd0(%rsp)
addsd 0x3090(%rip), %xmm1     # 0x50d0
movapd 0x70(%rsp), %xmm4
mulsd %xmm4, %xmm4
mulsd %xmm3, %xmm4
movapd 0x80(%rsp), %xmm0
mulpd %xmm0, %xmm0
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
divsd 0x10(%r14), %xmm2
movapd %xmm4, 0x70(%rsp)
addsd %xmm4, %xmm1
addsd %xmm1, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
mulsd %xmm3, %xmm0
divsd 0x18(%r14), %xmm0
addsd %xmm2, %xmm0
addsd 0x40(%rsp), %xmm0
movq %r13, %rdi
callq 0x1160
movq %rax, %rdi
callq 0x1060
movapd 0xd0(%rsp), %xmm0
addsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x120(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x3580
incl %ebx
decl %r12d
jmp 0x1ef5
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x36e7
movq 0x58(%rsp), %r15
subq 0x50(%rsp), %r15
leaq 0x305c(%rip), %rdx      # 0x514f
leaq 0xe0(%rsp), %rdi
movq 0x98(%rsp), %rsi
callq 0x31ff
movq 0xe0(%rsp), %rsi
leaq 0x120(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x1120
shrq $0x3, %r15
cvtsi2sd %r15d, %xmm0
movsd %xmm0, 0x30(%rsp)
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
leaq 0x120(%rsp), %rbx
leaq 0x300c(%rip), %r14      # 0x5154
cmpq %r12, %r15
je 0x218b
movq 0x50(%rsp), %rax
movsd (%rax,%r12,8), %xmm0
movq %rbx, %rdi
callq 0x1160
movq %rax, %rdi
movq %r14, %rsi
callq 0x1100
cvtsi2sd %r12d, %xmm0
divsd 0x30(%rsp), %xmm0
movq %rax, %rdi
callq 0x1160
movq %rax, %rdi
callq 0x1060
incq %r12
jmp 0x2148
leaq 0x120(%rsp), %rdi
callq 0x1140
leaq 0xe0(%rsp), %rdi
callq 0x1050
leaq 0x50(%rsp), %rdi
callq 0x3b54
leaq 0x328(%rsp), %rdi
callq 0x1140
leaq 0x100(%rsp), %rdi
callq 0x1050
addq $0x528, %rsp            # imm = 0x528
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x2202
jmp 0x2211
jmp 0x2211
movq %rax, %rbx
jmp 0x222b
movq %rax, %rbx
jmp 0x221e
jmp 0x2211
jmp 0x2211
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
callq 0x1140
leaq 0xe0(%rsp), %rdi
callq 0x1050
jmp 0x2214
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x3b54
leaq 0x328(%rsp), %rdi
callq 0x1140
leaq 0x100(%rsp), %rdi
callq 0x1050
movq %rbx, %rdi
callq 0x1180