// File: /workspace/github_cpp_makefile_star2_O3/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 $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, %rbx
movabsq $0x300000001, %rax      # imm = 0x300000001
leaq 0x90(%rsp), %rsi
movq %rax, (%rsi)
movl $0xfffffff6, 0x8(%rsi)  # imm = 0xFFFFFFF6
leaq 0x138(%rsp), %r14
leaq 0x78(%rsp), %rcx
movl $0x3, %edx
movq %r14, %rdi
callq 0x5714
movq (%r14), %rdx
movq 0x8(%r14), %rsi
movq %rsi, %rcx
subq %rdx, %rcx
je 0x4bab
shrq $0x2, %rcx
xorl %eax, %eax
addl (%rdx), %eax
addq $0x4, %rdx
cmpq %rsi, %rdx
jne 0x4b0f
cltd
idivl %ecx
cmpl $-0x2, %eax
jne 0x4bab
movabsq $0x1fffffff6, %rax      # imm = 0x1FFFFFFF6
leaq 0x90(%rsp), %rsi
movq %rax, (%rsi)
movl $0x3, 0x8(%rsi)
leaq 0x78(%rsp), %rdi
leaq 0x60(%rsp), %rcx
movl $0x3, %edx
callq 0x5714
movq 0x78(%rsp), %rdx
movq 0x80(%rsp), %rsi
movq %rsi, %rcx
subq %rdx, %rcx
je 0x4bc3
shrq $0x2, %rcx
xorl %eax, %eax
addl (%rdx), %eax
addq $0x4, %rdx
cmpq %rsi, %rdx
jne 0x4b71
cltd
idivl %ecx
cmpl $-0x2, %eax
jne 0x4bc3
xorl %edi, %edi
xorl %esi, %esi
callq 0x53cc
testb $0x1, %al
je 0x4c22
leaq 0xf604(%rip), %rsi      # 0x141a0
movl $0x29, %edx
movq %rbx, %rdi
callq 0x42a0
jmp 0x4bd7
leaq 0xf588(%rip), %rsi      # 0x1413a
movl $0x28, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
jmp 0x4bf3
leaq 0xf599(%rip), %rsi      # 0x14163
movl $0x3c, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x4bf3
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x4c10
movq 0x148(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movl %ebp, %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movups 0x10087(%rip), %xmm0    # 0x14cb0
leaq 0x90(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movupd 0x10063(%rip), %xmm0    # 0x14ca0
movapd %xmm0, (%rsi)
leaq 0x60(%rsp), %rdi
leaq 0x48(%rsp), %rcx
movl $0x4, %edx
callq 0x575a
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x5214
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4c70
jnp 0x4c8b
leaq 0xf553(%rip), %rsi      # 0x141ca
movl $0x30, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
jmp 0x5075
movups 0x1003e(%rip), %xmm0    # 0x14cd0
leaq 0x90(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movupd 0x1001a(%rip), %xmm0    # 0x14cc0
movapd %xmm0, (%rsi)
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rcx
movl $0x4, %edx
callq 0x575a
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x5214
addsd 0xf333(%rip), %xmm0     # 0x14008
andpd 0xf343(%rip), %xmm0     # 0x14020
ucomisd 0xf32b(%rip), %xmm0     # 0x14010
jae 0x4e4a
leaq 0x90(%rsp), %rsi
movups 0xffd6(%rip), %xmm0     # 0x14cd0
movaps %xmm0, 0x10(%rsi)
movupd 0xffba(%rip), %xmm0     # 0x14cc0
movapd %xmm0, (%rsi)
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rcx
movl $0x4, %edx
callq 0x575a
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x53cc
addsd 0xf2d3(%rip), %xmm0     # 0x14008
andpd 0xf2e3(%rip), %xmm0     # 0x14020
ucomisd 0xf2cb(%rip), %xmm0     # 0x14010
jae 0x4e65
movupd 0xff8d(%rip), %xmm0     # 0x14ce0
leaq 0x10(%rsp), %rsi
movapd %xmm0, (%rsi)
movabsq $0x4010000000000000, %r12 # imm = 0x4010000000000000
movq %r12, 0x10(%rsi)
leaq 0x90(%rsp), %rdi
leaq 0x100(%rsp), %rcx
movl $0x3, %edx
callq 0x575a
xorl %eax, %eax
movq %rax, 0x20(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
leaq 0x100(%rsp), %rsi
movq %rax, 0x10(%rsi)
movapd %xmm0, (%rsi)
leaq 0xe8(%rsp), %rdi
callq 0x57a0
leaq 0x168(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x57a0
movq 0xe8(%rsp), %r14
movq 0xf0(%rsp), %rsi
movq 0x168(%rsp), %r15
movq 0x170(%rsp), %rcx
movq %r14, %rdi
movq %r15, %rdx
callq 0x526c
movl %eax, %ebp
testq %r15, %r15
je 0x4e11
movq 0x178(%rsp), %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x4240
movq 0xe8(%rsp), %r14
testq %r14, %r14
je 0x4e29
movq 0xf8(%rsp), %rsi
subq %r14, %rsi
movq %r14, %rdi
callq 0x4240
testb $0x1, %bpl
je 0x4e80
leaq 0xf456(%rip), %rsi      # 0x1428c
movl $0x2d, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
jmp 0x4ff6
leaq 0xf3aa(%rip), %rsi      # 0x141fb
movl $0x43, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
jmp 0x505e
leaq 0xf3d3(%rip), %rsi      # 0x1423f
movl $0x4c, %edx
movq %rbx, %rdi
callq 0x42a0
xorl %ebp, %ebp
jmp 0x5047
leaq 0xb0(%rsp), %rsi
movupd 0xfe50(%rip), %xmm0     # 0x14ce0
movapd %xmm0, (%rsi)
movq %r12, 0x10(%rsi)
leaq 0x120(%rsp), %rdi
leaq 0x190(%rsp), %rcx
movl $0x3, %edx
callq 0x575a
movupd 0xfe3e(%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 0x575a
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x57a0
leaq 0x150(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x57a0
movq 0xd0(%rsp), %r14
movq 0xd8(%rsp), %rsi
movq 0x150(%rsp), %r15
movq 0x158(%rsp), %rcx
movq %r14, %rdi
movq %r15, %rdx
callq 0x526c
movapd %xmm0, 0x180(%rsp)
testq %r15, %r15
je 0x4f69
movq 0x160(%rsp), %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x4240
movq 0xd0(%rsp), %r14
testq %r14, %r14
je 0x4f81
movq 0xe0(%rsp), %rsi
subq %r14, %rsi
movq %r14, %rdi
callq 0x4240
movapd 0x180(%rsp), %xmm0
addsd 0xf086(%rip), %xmm0     # 0x14018
andpd 0xf086(%rip), %xmm0     # 0x14020
ucomisd 0xf06e(%rip), %xmm0     # 0x14010
setbe %bpl
jbe 0x4fbc
leaq 0xf30b(%rip), %rsi      # 0x142ba
movl $0x3a, %edx
movq %rbx, %rdi
callq 0x42a0
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x4fd9
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x4ff6
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x5013
movq 0x110(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x502a
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x5047
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x505e
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x5075
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x4bd9
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x4bd9
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x50c1
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x50c1
movq %rax, %rbx
jmp 0x50de
jmp 0x511e
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x50de
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x5121
movq 0x130(%rsp), %rsi
jmp 0x510d
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x5121
movq 0xf8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x5121
jmp 0x5119
movq %rax, %rbx
jmp 0x5172
movq %rax, %rbx
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x513e
movq 0x110(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5155
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x5172
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5190
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x5190
jmp 0x518d
movq %rax, %rbx
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x51ae
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x51ae
jmp 0x51ab
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x51ce
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x51ce
jmp 0x51cb
jmp 0x51cb
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x51ef
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
jmp 0x51ef
jmp 0x51ec
movq %rax, %rbx
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x520c
movq 0x148(%rsp), %rsi
subq %rdi, %rsi
callq 0x4240
movq %rbx, %rdi
callq 0x43b0