// File: PeterDenton[P]Nu-Pert/src/Verify.cpp
// Function: Verify::Precision_Scan(double (*)(int, int, double, double, double, int), int, double)
void Precision_Scan(double (*P_To_Verify)(int, int, double, double, double, int), int order, double Precision)
{
	double YerhoE_max = 40;
	double a_max = Y_to_a * YerhoE_max;
	double LE_max = 2500;
	int N_Steps = 10;
	std::ofstream out_file("data/Precision_Scan.txt", std::fstream::app);

	std::string flavor_names[3] = {"e ", "mu", "tau"};
	int N_Total, N_Passed;
	double P_Tilde, P_Exact;

	for (int alpha = 0; alpha <= 1; alpha++)
	{
		for (int beta = 0; beta <= alpha; beta++)
		{
			N_Total = 0;
			N_Passed = 0;
			Progress_Bar Pbar;
			for (double a = -a_max; a <= a_max; a += 2 * a_max / N_Steps)
			{
				for (double LE = -LE_max; LE <= LE_max; LE += 2 * LE_max / N_Steps)
				{
					for (double delta = 0; delta <= 2 * M_PI; delta += 2 * M_PI / N_Steps)
					{
						for (int ord = 0; ord <= 1; ord++)
						{
							set_ordering(ord == 0);
							P_Tilde = P_To_Verify(alpha, beta, a, LE, delta, order);
							P_Exact = Exact::Palphabeta(alpha, beta, a, LE, delta);
							N_Total++;
							if (is_accurate(P_Tilde, P_Exact, Precision))
								N_Passed++;
						} // ord
					} // delta
				} // LE
				Pbar.update(-a_max, a_max, a, true);
			} // a
			out_file << flavor_names[alpha] << " -> " << flavor_names[beta] << ": ";
			out_file << std::setprecision(3) << std::setw(5) << (double)N_Passed / N_Total;
			out_file << " passed, ord = " << order << ", prec = " << Precision << std::endl;
		} // beta
	} // alpha
	out_file << std::setfill('=') << std::setw(60) << "=" << std::setfill(' ') << std::endl;
	out_file.close();
}

// Assembly:
subq $0xa98, %rsp            # imm = 0xA98
movq %rdi, 0xa90(%rsp)
movl %esi, 0xa8c(%rsp)
movsd %xmm0, 0xa80(%rsp)
movabsq $0x4044000000000000, %rax # imm = 0x4044000000000000
movq %rax, 0xa78(%rsp)
leaq 0xfa8(%rip), %rax       # 0x122e0
movsd (%rax), %xmm0
movsd 0xa78(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0xa70(%rsp)
movabsq $0x40a3880000000000, %rax # imm = 0x40A3880000000000
movq %rax, 0xa68(%rsp)
movl $0xa, 0xa64(%rsp)
leaq 0x1a0a(%rip), %rsi      # 0x12d80
leaq 0x860(%rsp), %rdi
movl $0x1, %edx
callq 0x21a0
movb $0x1, 0x7e1(%rsp)
leaq 0x800(%rsp), %rax
movq %rax, 0x108(%rsp)
movq %rax, 0x7f8(%rsp)
leaq 0x7f7(%rsp), %rdi
movq %rdi, 0x110(%rsp)
callq 0x22c0
movq 0x108(%rsp), %rdi
movq 0x110(%rsp), %rdx
leaq 0x19c4(%rip), %rsi      # 0x12d98
callq 0x2210
jmp 0x113db
leaq 0x820(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq %rax, 0x7f8(%rsp)
leaq 0x7e3(%rsp), %rdi
movq %rdi, 0x100(%rsp)
callq 0x22c0
movq 0xf8(%rsp), %rdi
movq 0x100(%rsp), %rdx
leaq 0x197c(%rip), %rsi      # 0x12d9b
callq 0x2210
jmp 0x11426
leaq 0x840(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq %rax, 0x7f8(%rsp)
leaq 0x7e2(%rsp), %rdi
movq %rdi, 0xf0(%rsp)
callq 0x22c0
movq 0xe8(%rsp), %rdi
movq 0xf0(%rsp), %rdx
leaq 0x1934(%rip), %rsi      # 0x12d9e
callq 0x2210
jmp 0x11471
movb $0x0, 0x7e1(%rsp)
leaq 0x7e2(%rsp), %rdi
callq 0x2190
leaq 0x7e3(%rsp), %rdi
callq 0x2190
leaq 0x7f7(%rsp), %rdi
callq 0x2190
movl $0x0, 0x7c4(%rsp)
cmpl $0x1, 0x7c4(%rsp)
jg 0x11ab4
movl $0x0, 0x7c0(%rsp)
movl 0x7c0(%rsp), %eax
cmpl 0x7c4(%rsp), %eax
jg 0x11a9c
movl $0x0, 0x7dc(%rsp)
movl $0x0, 0x7d8(%rsp)
leaq 0x148(%rsp), %rdi
callq 0xf570
jmp 0x114fd
movsd 0xa70(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x140(%rsp)
movsd 0x140(%rsp), %xmm1
movsd 0xa70(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x118ce
movsd 0xa68(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x138(%rsp)
movsd 0x138(%rsp), %xmm1
movsd 0xa68(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x11863
xorps %xmm0, %xmm0
movsd %xmm0, 0x130(%rsp)
movsd 0x17cd(%rip), %xmm0     # 0x12d68
ucomisd 0x130(%rsp), %xmm0
jb 0x1182c
movl $0x0, 0x12c(%rsp)
cmpl $0x1, 0x12c(%rsp)
jg 0x117fe
movl 0x12c(%rsp), %eax
testl %eax, %eax
sete %al
movzbl %al, %edi
callq 0x49f0
jmp 0x115d9
movq 0xa90(%rsp), %rax
movl 0x7c4(%rsp), %edi
movl 0x7c0(%rsp), %esi
movsd 0x140(%rsp), %xmm0
movsd 0x138(%rsp), %xmm1
movsd 0x130(%rsp), %xmm2
movl 0xa8c(%rsp), %edx
callq *%rax
movsd %xmm0, 0xe0(%rsp)
jmp 0x1161e
movsd 0xe0(%rsp), %xmm0
movsd %xmm0, 0x7d0(%rsp)
movl 0x7c4(%rsp), %edi
movl 0x7c0(%rsp), %esi
movsd 0x140(%rsp), %xmm0
movsd 0x138(%rsp), %xmm1
movsd 0x130(%rsp), %xmm2
callq 0x6c30
movsd %xmm0, 0xd8(%rsp)
jmp 0x11669
movsd 0xd8(%rsp), %xmm0
movsd %xmm0, 0x7c8(%rsp)
movl 0x7dc(%rsp), %eax
incl %eax
movl %eax, 0x7dc(%rsp)
movsd 0x7d0(%rsp), %xmm0
movsd 0x7c8(%rsp), %xmm1
movsd 0xa80(%rsp), %xmm2
callq 0x11280
movb %al, 0xd7(%rsp)
jmp 0x116b4
movb 0xd7(%rsp), %al
testb $0x1, %al
jne 0x116c4
jmp 0x117e6
movl 0x7d8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7d8(%rsp)
jmp 0x117e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7e8(%rsp)
movl %eax, 0x7e4(%rsp)
jmp 0x11734
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7e8(%rsp)
movl %eax, 0x7e4(%rsp)
jmp 0x11727
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7e8(%rsp)
movl %eax, 0x7e4(%rsp)
leaq 0x7e2(%rsp), %rdi
callq 0x2190
leaq 0x7e3(%rsp), %rdi
callq 0x2190
leaq 0x7f7(%rsp), %rdi
callq 0x2190
testb $0x1, 0x7e1(%rsp)
jne 0x1174d
jmp 0x117a2
movq 0x7f8(%rsp), %rax
leaq 0x800(%rsp), %rcx
cmpq %rax, %rcx
movq %rax, 0xc8(%rsp)
je 0x117a0
movq 0xc8(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0xc0(%rsp)
callq 0x20c0
movq 0xc0(%rsp), %rax
leaq 0x800(%rsp), %rcx
cmpq %rcx, %rax
movq %rax, 0xc8(%rsp)
jne 0x1176a
jmp 0x117a2
jmp 0x11c1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7e8(%rsp)
movl %eax, 0x7e4(%rsp)
jmp 0x11bde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7e8(%rsp)
movl %eax, 0x7e4(%rsp)
leaq 0x148(%rsp), %rdi
callq 0xf870
jmp 0x11bde
jmp 0x117e8
movl 0x12c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x12c(%rsp)
jmp 0x115b5
jmp 0x11800
cvtsi2sdl 0xa64(%rsp), %xmm1
movsd 0x1557(%rip), %xmm0     # 0x12d68
divsd %xmm1, %xmm0
addsd 0x130(%rsp), %xmm0
movsd %xmm0, 0x130(%rsp)
jmp 0x11593
jmp 0x1182e
movsd 0x7d2(%rip), %xmm0      # 0x12008
mulsd 0xa68(%rsp), %xmm0
cvtsi2sdl 0xa64(%rsp), %xmm1
divsd %xmm1, %xmm0
addsd 0x138(%rsp), %xmm0
movsd %xmm0, 0x138(%rsp)
jmp 0x1156b
movsd 0xa70(%rsp), %xmm1
movaps %xmm1, %xmm0
movaps 0x7aa(%rip), %xmm2      # 0x12020
pxor %xmm2, %xmm0
movsd 0x140(%rsp), %xmm2
leaq 0x148(%rsp), %rdi
movl $0x1, %esi
callq 0xfb10
jmp 0x11897
jmp 0x11899
movsd 0x767(%rip), %xmm0      # 0x12008
mulsd 0xa70(%rsp), %xmm0
cvtsi2sdl 0xa64(%rsp), %xmm1
divsd %xmm1, %xmm0
addsd 0x140(%rsp), %xmm0
movsd %xmm0, 0x140(%rsp)
jmp 0x11526
movslq 0x7c4(%rsp), %rax
shlq $0x5, %rax
leaq 0x800(%rsp,%rax), %rsi
leaq 0x860(%rsp), %rdi
callq 0x2120
movq %rax, 0xb8(%rsp)
jmp 0x118f9
movq 0xb8(%rsp), %rdi
leaq 0x149a(%rip), %rsi      # 0x12da2
callq 0x2160
movq %rax, 0xb0(%rsp)
jmp 0x11917
movq 0xb0(%rsp), %rdi
movslq 0x7c0(%rsp), %rax
shlq $0x5, %rax
leaq 0x800(%rsp,%rax), %rsi
callq 0x2120
movq %rax, 0xa8(%rsp)
jmp 0x11942
movq 0xa8(%rsp), %rdi
leaq 0x1231(%rip), %rsi      # 0x12b82
callq 0x2160
jmp 0x11958
movl $0x3, %edi
callq 0x11e90
movl %eax, 0xa4(%rsp)
jmp 0x1196b
movl 0xa4(%rsp), %eax
movl %eax, 0x128(%rsp)
movl 0x128(%rsp), %esi
leaq 0x860(%rsp), %rdi
callq 0x2260
movq %rax, 0x98(%rsp)
jmp 0x11997
movl $0x5, %edi
callq 0x11eb0
movl %eax, 0x94(%rsp)
jmp 0x119aa
movq 0x98(%rsp), %rdi
movl 0x94(%rsp), %eax
movl %eax, 0x124(%rsp)
movl 0x124(%rsp), %esi
callq 0x21b0
movq %rax, 0x88(%rsp)
jmp 0x119d6
movq 0x88(%rsp), %rdi
cvtsi2sdl 0x7d8(%rsp), %xmm0
cvtsi2sdl 0x7dc(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x22e0
jmp 0x119fb
leaq 0x13a5(%rip), %rsi      # 0x12da7
leaq 0x860(%rsp), %rdi
callq 0x2160
movq %rax, 0x80(%rsp)
jmp 0x11a19
movq 0x80(%rsp), %rdi
movl 0xa8c(%rsp), %esi
callq 0x2290
movq %rax, 0x78(%rsp)
jmp 0x11a34
movq 0x78(%rsp), %rdi
leaq 0x1377(%rip), %rsi      # 0x12db7
callq 0x2160
movq %rax, 0x70(%rsp)
jmp 0x11a4c
movq 0x70(%rsp), %rdi
movsd 0xa80(%rsp), %xmm0
callq 0x22e0
movq %rax, 0x68(%rsp)
jmp 0x11a66
movq 0x68(%rsp), %rdi
movq 0x5556(%rip), %rsi      # 0x16fc8
callq 0x2180
jmp 0x11a79
leaq 0x148(%rsp), %rdi
callq 0xf870
movl 0x7c0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c0(%rsp)
jmp 0x114c4
jmp 0x11a9e
movl 0x7c4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c4(%rsp)
jmp 0x114ab
movl $0x3d, %edi
callq 0x11ed0
movb %al, 0x67(%rsp)
jmp 0x11ac4
movb 0x67(%rsp), %al
movb %al, 0x123(%rsp)
movzbl 0x123(%rsp), %esi
leaq 0x860(%rsp), %rdi
callq 0x2250
movq %rax, 0x58(%rsp)
jmp 0x11aeb
movl $0x3c, %edi
callq 0x11eb0
movl %eax, 0x54(%rsp)
jmp 0x11afb
movq 0x58(%rsp), %rdi
movl 0x54(%rsp), %eax
movl %eax, 0x11c(%rsp)
movl 0x11c(%rsp), %esi
callq 0x21b0
movq %rax, 0x48(%rsp)
jmp 0x11b1e
movq 0x48(%rsp), %rdi
leaq 0x1065(%rip), %rsi      # 0x12b8f
callq 0x2160
movq %rax, 0x40(%rsp)
jmp 0x11b36
movl $0x20, %edi
callq 0x11ed0
movb %al, 0x3f(%rsp)
jmp 0x11b46
movq 0x40(%rsp), %rdi
movb 0x3f(%rsp), %al
movb %al, 0x11b(%rsp)
movzbl 0x11b(%rsp), %esi
callq 0x2250
movq %rax, 0x30(%rsp)
jmp 0x11b6a
movq 0x30(%rsp), %rdi
movq 0x5452(%rip), %rsi      # 0x16fc8
callq 0x2180
jmp 0x11b7d
leaq 0x860(%rsp), %rdi
callq 0x2220
jmp 0x11b8c
leaq 0x800(%rsp), %rax
movq %rax, 0x20(%rsp)
addq $0x60, %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x18(%rsp)
callq 0x20c0
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x28(%rsp)
jne 0x11ba2
leaq 0x860(%rsp), %rdi
callq 0x2230
addq $0xa98, %rsp            # imm = 0xA98
retq
leaq 0x800(%rsp), %rax
movq %rax, 0x8(%rsp)
addq $0x60, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, (%rsp)
callq 0x20c0
movq 0x8(%rsp), %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x10(%rsp)
jne 0x11bf4
jmp 0x11c1b
leaq 0x860(%rsp), %rdi
callq 0x2230
movq 0x7e8(%rsp), %rdi
callq 0x22b0
nopw %cs:(%rax,%rax)