// File: /workspace/github_cpp_makefile_star2_O1/TBody[P]atomicpp/atomicpp/RateEquations.cpp
// Function: atomicpp::RateEquations::verifyNeumaierSummation(double, double, double)
void RateEquations::verifyNeumaierSummation(const double Te, const double Ne, const double NeumaierTolerance){
	// Verify that the sum over all elements equals zero (or very close to) 
	
	std::vector<double> check_dNzk(2*(Z+1), 0.0);
	std::vector<double> check_F_zk(2*(Z+1), 0.0);
	for(int k=0; k<=Z; ++k){
		check_dNzk[2*k] = dNzk[k];
		check_dNzk[2*k+1] = dNzk_correction[k];
		check_F_zk[2*k] = F_zk[k];
		check_F_zk[2*k+1] = F_zk_correction[k];
	}
	std::pair<double, double> neumaier_pair_total_dNzk = neumaierSum(check_dNzk);
	std::pair<double, double> neumaier_pair_total_F_zk = neumaierSum(check_F_zk); 

	// std::printf("Total sum: %e\n", neumaier_pair_total_dNzk.first + neumaier_pair_total_dNzk.second); 
	if(std::fabs(neumaier_pair_total_dNzk.first + neumaier_pair_total_dNzk.second) > NeumaierTolerance){ 
		std::printf("Warning: total sum of dNzk elements is non-zero (=%e) for Te = %f, Ne = %e- may result in error\n>>>in Prad.cpp/computeDerivs (May be an error with Kahan-Neumaier summation)\n", neumaier_pair_total_dNzk.first + neumaier_pair_total_dNzk.second, Te, Ne);
	}

	// std::printf("Total sum: %e\n", neumaier_pair_total_F_zk.first + neumaier_pair_total_F_zk.second); 
	if(std::fabs(neumaier_pair_total_F_zk.first + neumaier_pair_total_F_zk.second) > NeumaierTolerance){ 
		std::printf("Warning: total sum of F_zk elements is non-zero (=%e) for Te = %f, Ne = %e- may result in error\n>>>in Prad.cpp/computeDerivs (May be an error with Kahan-Neumaier summation)\n", neumaier_pair_total_F_zk.first + neumaier_pair_total_F_zk.second, Te, Ne);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movsd %xmm2, -0x70(%rbp)
movsd %xmm1, -0x68(%rbp)
movsd %xmm0, -0x60(%rbp)
movq %rdi, -0x50(%rbp)
movl 0x34(%rdi), %eax
leal 0x2(%rax,%rax), %eax
movslq %eax, %rbx
leaq -0xa8(%rbp), %r14
movq $0x0, (%r14)
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x533c
leaq -0xc0(%rbp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x18048
leaq -0x58(%rbp), %rbx
movq %rbx, %rdi
callq 0x5a80
movq -0x50(%rbp), %rax
movl 0x34(%rax), %eax
leal 0x2(,%rax,2), %eax
movslq %eax, %r14
movq $0x0, (%rbx)
leaq -0x29(%rbp), %rbx
movq %rbx, %rdi
callq 0x533c
leaq -0xa8(%rbp), %rdi
leaq -0x58(%rbp), %rdx
movq %r14, %rsi
movq %rbx, %rcx
callq 0x18048
leaq -0x29(%rbp), %rdi
callq 0x5a80
movq -0x50(%rbp), %rax
cmpl $0x0, 0x34(%rax)
js 0x206e8
movq -0x50(%rbp), %rax
leaq 0x70(%rax), %rcx
movq %rcx, -0x90(%rbp)
leaq 0xa0(%rax), %rcx
movq %rcx, -0x88(%rbp)
leaq 0x88(%rax), %rcx
movq %rcx, -0x80(%rbp)
addq $0xb8, %rax
movq %rax, -0x78(%rbp)
movq $-0x1, %rbx
movl $0x1, %r14d
leaq -0xc0(%rbp), %r15
leaq -0xa8(%rbp), %r12
incq %rbx
movq -0x90(%rbp), %rdi
movq %rbx, %rsi
callq 0x539c
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x1(%r14), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x539c
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x88(%rbp), %rdi
movq %rbx, %rsi
callq 0x539c
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x539c
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x80(%rbp), %rdi
movq %rbx, %rsi
callq 0x539c
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x539c
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x78(%rbp), %rdi
movq %rbx, %rsi
callq 0x539c
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x539c
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x50(%rbp), %rax
movslq 0x34(%rax), %rax
addq $0x2, %r14
cmpq %rax, %rbx
jl 0x20622
leaq -0xc0(%rbp), %rdi
xorpd %xmm0, %xmm0
callq 0x20f00
movsd %xmm0, -0x40(%rbp)
movapd %xmm1, -0x50(%rbp)
leaq -0xa8(%rbp), %rdi
xorpd %xmm0, %xmm0
callq 0x20f00
movapd -0x50(%rbp), %xmm3
movapd %xmm0, %xmm2
movapd %xmm1, %xmm4
addsd -0x40(%rbp), %xmm3
movapd 0x43c4(%rip), %xmm0     # 0x24af0
andpd %xmm3, %xmm0
movsd -0x70(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x20770
leaq 0x495e(%rip), %rdi      # 0x250a0
movapd %xmm3, %xmm0
movsd -0x60(%rbp), %xmm1
movapd %xmm2, -0x40(%rbp)
movsd -0x68(%rbp), %xmm2
movb $0x3, %al
movsd %xmm4, -0x50(%rbp)
callq 0x4080
movsd -0x50(%rbp), %xmm4
movapd -0x40(%rbp), %xmm2
movsd -0x70(%rbp), %xmm1
addsd %xmm4, %xmm2
movapd 0x4374(%rip), %xmm0     # 0x24af0
andpd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x207a2
leaq 0x49c1(%rip), %rdi      # 0x2514e
movapd %xmm2, %xmm0
movsd -0x60(%rbp), %xmm1
movsd -0x68(%rbp), %xmm2
movb $0x3, %al
callq 0x4080
leaq -0xa8(%rbp), %rdi
callq 0x53c6
leaq -0xc0(%rbp), %rdi
callq 0x53c6
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x29(%rbp), %rdi
callq 0x5a80
leaq -0xc0(%rbp), %rdi
callq 0x53c6
jmp 0x207f2
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x5a80
movq %rbx, %rdi
callq 0x45a0