// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, %rbx
movabsq $0x300000001, %rax      # imm = 0x300000001
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movl $0xfffffff6, 0x8(%rsi)  # imm = 0xFFFFFFF6
leaq 0x138(%rsp), %r14
leaq 0x98(%rsp), %rcx
movl $0x3, %edx
movq %r14, %rdi
callq 0x571a
movq (%r14), %rdx
movq 0x8(%r14), %rsi
movq %rsi, %rcx
subq %rdx, %rcx
je 0x4b1b
shrq $0x2, %rcx
xorl %eax, %eax
addl (%rdx), %eax
addq $0x4, %rdx
cmpq %rsi, %rdx
jne 0x4b09
cltd
idivl %ecx
movl %eax, %ebp
jmp 0x4b1d
xorl %ebp, %ebp
cmpl $-0x2, %ebp
jne 0x4b83
movabsq $0x1fffffff6, %rax      # imm = 0x1FFFFFFF6
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movl $0x3, 0x8(%rsi)
leaq 0x98(%rsp), %rdi
leaq 0x80(%rsp), %rcx
movl $0x3, %edx
callq 0x571a
movq 0x98(%rsp), %rdx
movq 0xa0(%rsp), %rsi
movq %rsi, %rcx
subq %rdx, %rcx
je 0x4b9b
shrq $0x2, %rcx
xorl %eax, %eax
addl (%rdx), %eax
addq $0x4, %rdx
cmpq %rsi, %rdx
jne 0x4b73
cltd
idivl %ecx
jmp 0x4b9d
leaq 0xf5b0(%rip), %rsi      # 0x1413a
movl $0x28, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
jmp 0x4c01
xorl %eax, %eax
cmpl %eax, %ebp
jne 0x4bce
leaq 0x10(%rsp), %rsi
movq $0x0, (%rsi)
xorl %edi, %edi
callq 0x53c6
testb $0x1, %al
je 0x4c2e
leaq 0xf5e1(%rip), %rsi      # 0x141a0
movl $0x29, %edx
movq %rbx, %rdi
callq 0x42a0
jmp 0x4be2
leaq 0xf58e(%rip), %rsi      # 0x14163
movl $0x3c, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x4c01
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x4c1e
movq 0x148(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movl %ebp, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movups 0x1007b(%rip), %xmm0    # 0x14cb0
leaq 0x10(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movupd 0x1005a(%rip), %xmm0    # 0x14ca0
movapd %xmm0, (%rsi)
leaq 0x80(%rsp), %rdi
leaq 0x68(%rsp), %rcx
movl $0x4, %edx
callq 0x5760
movq 0x80(%rsp), %rdi
movq 0x88(%rsp), %rax
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
callq 0x520c
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4c8a
jnp 0x4ca5
leaq 0xf539(%rip), %rsi      # 0x141ca
movl $0x30, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
jmp 0x5064
movups 0x10024(%rip), %xmm0    # 0x14cd0
leaq 0x10(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movupd 0x10003(%rip), %xmm0    # 0x14cc0
movapd %xmm0, (%rsi)
leaq 0x68(%rsp), %rdi
leaq 0x50(%rsp), %rcx
movl $0x4, %edx
callq 0x5760
movq 0x68(%rsp), %rdi
movq 0x70(%rsp), %rax
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
callq 0x520c
addsd 0xf314(%rip), %xmm0     # 0x14008
andpd 0xf324(%rip), %xmm0     # 0x14020
ucomisd 0xf30c(%rip), %xmm0     # 0x14010
jae 0x4e55
leaq 0x10(%rsp), %rsi
movups 0xffba(%rip), %xmm0     # 0x14cd0
movaps %xmm0, 0x10(%rsi)
movupd 0xff9e(%rip), %xmm0     # 0x14cc0
movapd %xmm0, (%rsi)
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rcx
movl $0x4, %edx
callq 0x5760
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rax
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
callq 0x53c6
addsd 0xf2af(%rip), %xmm0     # 0x14008
andpd 0xf2bf(%rip), %xmm0     # 0x14020
ucomisd 0xf2a7(%rip), %xmm0     # 0x14010
jae 0x4e70
movupd 0xff69(%rip), %xmm0     # 0x14ce0
leaq 0x30(%rsp), %rsi
movapd %xmm0, (%rsi)
movabsq $0x4010000000000000, %r15 # imm = 0x4010000000000000
movq %r15, 0x10(%rsi)
leaq 0x10(%rsp), %rdi
leaq 0xd0(%rsp), %rcx
movl $0x3, %edx
callq 0x5760
xorl %eax, %eax
movq %rax, 0x40(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
leaq 0xd0(%rsp), %rsi
movq %rax, 0x10(%rsi)
movapd %xmm0, (%rsi)
leaq 0x120(%rsp), %rdi
callq 0x57a6
leaq 0x178(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x57a6
leaq 0x120(%rsp), %rdi
leaq 0x178(%rsp), %r14
movq %r14, %rsi
callq 0x5264
movl %eax, %ebp
movq (%r14), %rdi
testq %rdi, %rdi
je 0x4e17
movq 0x188(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x4e34
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
testb $0x1, %bpl
je 0x4e8b
leaq 0xf44b(%rip), %rsi      # 0x1428c
movl $0x2d, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
jmp 0x4feb
leaq 0xf39f(%rip), %rsi      # 0x141fb
movl $0x43, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
jmp 0x504d
leaq 0xf3c8(%rip), %rsi      # 0x1423f
movl $0x4c, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
jmp 0x5036
leaq 0xb0(%rsp), %rsi
movupd 0xfe45(%rip), %xmm0     # 0x14ce0
movapd %xmm0, (%rsi)
movq %r15, 0x10(%rsi)
leaq 0x108(%rsp), %rdi
leaq 0x190(%rsp), %rcx
movl $0x3, %edx
callq 0x5760
movupd 0xfe33(%rip), %xmm0     # 0x14cf8
leaq 0x190(%rsp), %rsi
movapd %xmm0, (%rsi)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, 0x10(%rsi)
leaq 0xb0(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movl $0x3, %edx
callq 0x5760
leaq 0xf0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x57a6
leaq 0x160(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x57a6
leaq 0xf0(%rsp), %rdi
leaq 0x160(%rsp), %r14
movq %r14, %rsi
callq 0x5264
movapd %xmm0, 0x150(%rsp)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x4f59
movq 0x170(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x4f76
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movapd 0x150(%rsp), %xmm0
addsd 0xf091(%rip), %xmm0     # 0x14018
andpd 0xf091(%rip), %xmm0     # 0x14020
ucomisd 0xf079(%rip), %xmm0     # 0x14010
setbe %bpl
jbe 0x4fb1
leaq 0xf316(%rip), %rsi      # 0x142ba
movl $0x3a, %edx
movq %rbx, %rdi
callq 0x42a0
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x4fce
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x4feb
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x5008
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x501f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5036
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x504d
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x5064
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x4be4
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x4be4
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x50b6
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x50b6
movq %rax, %rbx
jmp 0x50d3
jmp 0x5113
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x50d3
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x5116
movq 0x118(%rsp), %rsi
jmp 0x5102
movq %rax, %rbx
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x5116
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x5116
jmp 0x510e
movq %rax, %rbx
jmp 0x5161
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x5133
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x514a
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5161
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x517f
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x517f
jmp 0x517c
movq %rax, %rbx
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x519d
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x519d
jmp 0x519a
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x51c3
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x51c3
jmp 0x51c0
jmp 0x51c0
movq %rax, %rbx
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x51e7
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x51e7
jmp 0x51e4
movq %rax, %rbx
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x5204
movq 0x148(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq %rbx, %rdi
callq 0x43b0