// File: /workspace/github_cpp_makefile_star2_O2/ef-gy[P]libefgy/src/test-case/statistics.cpp
// Function: testStatistics(std::ostream&)
bool testStatistics(std::ostream &log) {
  std::vector<int> v;
  std::optional<int> avg = average<int>(v);
  if (avg) {
    log << "average of an empty set is not defined";
    return false;
  }

  std::vector<int> v2{1, 3, -10};

  std::optional<int> avg2 = average<int>(v2);
  if ((*avg2) != -2) {
    log << "average of {1, 3, -10} expected to be -2";
    return false;
  }

  std::vector<int> v3{-10, 1, 3};
  std::optional<int> avg3 = average<int>(v3);
  if ((*avg2) != (*avg3)) {
    log << "averages of {1, 3, -10} and {-10, 1, 3} expected to be equal";
    return false;
  }

  std::vector<double> v4;
  auto var0 = variance<double>(v4);
  if (var0) {
    log << "variance of an empty list is not defined.";
    return false;
  }

  std::vector<double> v5 = {1, 1, 1, 1};
  auto var1 = variance<double>(v5.begin(), v5.end());
  if (*var1 != 0.0) {
    log << "variance of equal values (1) differs from zero.\n";
    return false;
  }

  std::vector<double> v6 = {1, 2, 3, 4};
  auto var2 = variance<double>(v6.begin(), v6.end());

  if (fabs(*var2 - 1.25) >= 1e-14) {
    log << "variance of descending values (1...4) differs from expected "
           "value.\n";
    return false;
  }

  std::vector<double> v7 = {1, 2, 3, 4};
  auto var3 = variance(v7);

  if (fabs(*var3 - 1.25) >= 1e-14) {
    log << "variance of a vector (1...4) without iterators differs from "
           "expected value.\n";
    return false;
  }

  std::vector<double> v1111{0.0, 2.0, 4.0};

  std::vector<double> v8_measurement;
  std::vector<double> v8;
  auto chi0 = chi_square(v8, v8_measurement);
  if (chi0) {
    log << "chi_square of no measurements is not defined\n";
    return false;
  }

  std::vector<double> v10_measurement{0.0, 2.0, 4.0};
  std::vector<double> v10{0.0, 1.0, 2.0};
  auto chi2 = chi_square(v10, v10_measurement);
  if (fabs(*chi2 - (45.0 / 64.0)) > 1e-14) {
    log << "chi_square of descending values is not the expected value\n";
    return false;
  }

  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdi, %rbx
movl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
xorpd %xmm0, %xmm0
leaq 0x140(%rsp), %rdi
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
callq 0x4e78
leaq 0x2(%r14), %rcx
testq %rcx, %rax
je 0x48fd
leaq 0xd84c(%rip), %rsi      # 0x1213a
movq %rbx, %rdi
callq 0x4260
xorl %ebp, %ebp
jmp 0x4d67
movabsq $0x300000001, %rax      # imm = 0x300000001
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movl $0xfffffff6, 0x8(%rsi)  # imm = 0xFFFFFFF6
leaq 0x118(%rsp), %rdi
pushq $0x3
popq %rdx
leaq 0xa8(%rsp), %rcx
callq 0x52ca
leaq 0x118(%rsp), %rdi
callq 0x4e78
cmpl %r14d, %eax
jne 0x49b7
movabsq $0x1fffffff6, %rax      # imm = 0x1FFFFFFF6
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movl $0x3, 0x8(%rsi)
leaq 0xa8(%rsp), %rdi
pushq $0x3
popq %rdx
leaq 0xe0(%rsp), %rcx
callq 0x52ca
leaq 0xa8(%rsp), %rdi
callq 0x4e78
cmpl %r14d, %eax
jne 0x49cd
xorpd %xmm0, %xmm0
leaq 0xe0(%rsp), %rdi
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
callq 0x4eaf
testb $0x1, %al
je 0x49e3
leaq 0xd81f(%rip), %rsi      # 0x121c7
movq %rbx, %rdi
callq 0x4260
xorl %ebp, %ebp
jmp 0x4d40
leaq 0xd7a3(%rip), %rsi      # 0x12161
movq %rbx, %rdi
callq 0x4260
xorl %ebp, %ebp
jmp 0x4d5a
leaq 0xd7b6(%rip), %rsi      # 0x1218a
movq %rbx, %rdi
callq 0x4260
xorl %ebp, %ebp
jmp 0x4d4d
movups 0xe2ee(%rip), %xmm0     # 0x12cd8
leaq 0x10(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movupd 0xe2cd(%rip), %xmm0     # 0x12cc8
movapd %xmm0, (%rsi)
leaq 0x90(%rsp), %rdi
pushq $0x4
popq %rdx
leaq 0x48(%rsp), %rcx
callq 0x5300
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rax
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
callq 0x4ec7
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4a3d
jnp 0x4a53
leaq 0xd7ad(%rip), %rsi      # 0x121f1
movq %rbx, %rdi
callq 0x4260
xorl %ebp, %ebp
jmp 0x4d33
movups 0xe29e(%rip), %xmm0     # 0x12cf8
leaq 0x10(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movupd 0xe27d(%rip), %xmm0     # 0x12ce8
movapd %xmm0, (%rsi)
leaq 0x48(%rsp), %rdi
pushq $0x4
popq %rdx
leaq 0x78(%rsp), %rcx
callq 0x5300
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rax
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
callq 0x4ec7
addsd 0xd568(%rip), %xmm0     # 0x12008
andpd 0xd578(%rip), %xmm0     # 0x12020
ucomisd 0xd560(%rip), %xmm0     # 0x12010
jae 0x4bc9
leaq 0x10(%rsp), %rsi
movups 0xe236(%rip), %xmm0     # 0x12cf8
movaps %xmm0, 0x10(%rsi)
movupd 0xe21a(%rip), %xmm0     # 0x12ce8
movapd %xmm0, (%rsi)
leaq 0x78(%rsp), %rdi
pushq $0x4
popq %rdx
leaq 0x30(%rsp), %rcx
callq 0x5300
leaq 0x78(%rsp), %rdi
callq 0x4eaf
addsd 0xd512(%rip), %xmm0     # 0x12008
andpd 0xd522(%rip), %xmm0     # 0x12020
ucomisd 0xd50a(%rip), %xmm0     # 0x12010
jae 0x4bdf
movupd 0xe1f4(%rip), %xmm0     # 0x12d08
leaq 0x30(%rsp), %rsi
movapd %xmm0, (%rsi)
movabsq $0x4010000000000000, %r12 # imm = 0x4010000000000000
movq %r12, 0x10(%rsi)
leaq 0x10(%rsp), %rdi
pushq $0x3
popq %rdx
leaq 0xc0(%rsp), %rcx
callq 0x5300
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
leaq 0xc0(%rsp), %rsi
movapd %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
leaq 0x178(%rsp), %rdi
callq 0x5336
leaq 0x1c8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x5336
leaq 0x178(%rsp), %r14
leaq 0x1c8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x4f20
movl %eax, %ebp
movq %r15, %rdi
callq 0x11c1a
movq %r14, %rdi
callq 0x11c1a
testb $0x1, %bpl
je 0x4bf5
leaq 0xd6f9(%rip), %rsi      # 0x122b3
movq %rbx, %rdi
callq 0x4260
xorl %ebp, %ebp
jmp 0x4cfe
leaq 0xd652(%rip), %rsi      # 0x12222
movq %rbx, %rdi
callq 0x4260
xorl %ebp, %ebp
jmp 0x4d29
leaq 0xd680(%rip), %rsi      # 0x12266
movq %rbx, %rdi
callq 0x4260
xorl %ebp, %ebp
jmp 0x4d1f
leaq 0x60(%rsp), %rsi
movupd 0xe106(%rip), %xmm0     # 0x12d08
movapd %xmm0, (%rsi)
movq %r12, 0x10(%rsi)
leaq 0x100(%rsp), %rdi
pushq $0x3
popq %rdx
leaq 0x190(%rsp), %rcx
callq 0x5300
movupd 0xe0f6(%rip), %xmm0     # 0x12d20
leaq 0x190(%rsp), %rsi
movapd %xmm0, (%rsi)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, 0x10(%rsi)
leaq 0x60(%rsp), %rdi
pushq $0x3
popq %rdx
leaq 0xf(%rsp), %rcx
callq 0x5300
leaq 0x160(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x5336
leaq 0x1b0(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x5336
leaq 0x160(%rsp), %r14
leaq 0x1b0(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x4f20
movapd %xmm0, 0x130(%rsp)
movq %r15, %rdi
callq 0x11c1a
movq %r14, %rdi
callq 0x11c1a
movapd 0x130(%rsp), %xmm0
addsd 0xd356(%rip), %xmm0     # 0x12018
andpd 0xd356(%rip), %xmm0     # 0x12020
ucomisd 0xd33e(%rip), %xmm0     # 0x12010
setbe %bpl
jbe 0x4ce7
leaq 0xd602(%rip), %rsi      # 0x122e1
movq %rbx, %rdi
callq 0x4260
leaq 0x60(%rsp), %rdi
callq 0x11c1a
leaq 0x100(%rsp), %rdi
callq 0x11c1a
leaq 0xc0(%rsp), %rdi
callq 0x11c1a
leaq 0x30(%rsp), %rdi
callq 0x11c1a
leaq 0x10(%rsp), %rdi
callq 0x11c1a
leaq 0x78(%rsp), %rdi
callq 0x11c1a
leaq 0x48(%rsp), %rdi
callq 0x11c1a
leaq 0x90(%rsp), %rdi
callq 0x11c1a
leaq 0xe0(%rsp), %rdi
callq 0x11c1a
leaq 0xa8(%rsp), %rdi
callq 0x11b34
leaq 0x118(%rsp), %rdi
callq 0x11b34
leaq 0x140(%rsp), %rdi
callq 0x11b34
movl %ebp, %eax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x11c1a
jmp 0x4da2
movq %rax, %rbx
jmp 0x4dac
jmp 0x4dcf
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x11c1a
leaq 0x100(%rsp), %rdi
jmp 0x4dc1
movq %rax, %rbx
leaq 0x178(%rsp), %rdi
callq 0x11c1a
jmp 0x4dd2
jmp 0x4dca
movq %rax, %rbx
jmp 0x4df3
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x11c1a
leaq 0x30(%rsp), %rdi
callq 0x11c1a
leaq 0x10(%rsp), %rdi
callq 0x11c1a
leaq 0x78(%rsp), %rdi
callq 0x11c1a
jmp 0x4e04
jmp 0x4e01
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x11c1a
jmp 0x4e15
jmp 0x4e12
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x11c1a
jmp 0x4e29
jmp 0x4e26
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x11c1a
jmp 0x4e3b
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x11b34
jmp 0x4e4f
jmp 0x4e4c
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x11b34
jmp 0x4e63
jmp 0x4e60
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x11b34
movq %rbx, %rdi
callq 0x4400