// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/ein_reduce.cpp
// Function: nda::test_make_ein_sum_matrix_vector_body()
TEST(make_ein_sum_matrix_vector) {
  constexpr index_t M = 50;
  constexpr index_t N = 64;
  matrix<int, M, N> B;
  vector<int, N> x;
  fill_pattern(B);
  fill_pattern(x);

  // Compute the matrix-vector product B*x.
  vector<int, M> Bx = make_ein_sum<int, i>(ein<i, j>(B) * ein<j>(x));

  ASSERT_EQ(Bx.rank(), 1);
  ASSERT_EQ(Bx.i().extent(), B.rows());
  for (index_t i : Bx.i()) {
    int Bx_i = 0;
    for (index_t j : x.i()) {
      Bx_i += B(i, j) * x(j);
    }
    ASSERT_EQ(Bx(i), Bx_i);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
leaq 0xc0(%rsp), %rdi
callq 0x46e36
leaq 0x90(%rsp), %rdi
callq 0x46b3e
leaq 0xc0(%rsp), %rdi
xorl %esi, %esi
callq 0x46e5e
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
callq 0x46b83
movq 0xd8(%rsp), %rbp
movq 0xe0(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0xf0(%rsp), %rax
movq 0x100(%rsp), %r15
movq 0xa8(%rsp), %r14
movq 0xb0(%rsp), %rbx
andl $0x0, 0x18(%rsp)
leaq 0x108(%rsp), %rsi
movq %rax, 0x58(%rsp)
movq %rax, (%rsi)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x10(%rsi)
leaq 0x20(%rsp), %rdi
callq 0x49552
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x49520
leaq 0x108(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0x4972a
movq 0x120(%rsp), %r12
movq 0x128(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
pushq $0x32
popq %rdx
movq 0x58(%rsp), %rsi
xorl %ecx, %ecx
callq 0x49b12
movq 0x10(%rsp), %rax
cmpq 0x20(%rsp), %rax
jne 0x44aff
leaq 0x20(%rsp), %rdi
pushq $0x40
popq %rdx
movq 0x50(%rsp), %rsi
xorl %ecx, %ecx
callq 0x476ca
leaq 0x20(%rsp), %rdi
movq (%rdi), %r13
pushq $0x40
popq %rdx
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x476ca
cmpq 0x20(%rsp), %r13
jne 0x44b1e
leaq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
callq 0x49a5b
movq 0x20(%rsp), %rax
movq 0x30(%rsp), %rdx
leaq 0x40(%rax), %rcx
leaq (,%rdx,4), %rsi
movq 0x10(%rsp), %rdi
shlq $0x2, %rdi
subq %rdi, %rsi
addq %rsi, %r12
subq 0x58(%rsp), %rdx
imulq %r15, %rdx
leaq (,%rax,4), %rsi
leaq (%rsi,%rdx,4), %rdx
movq 0x50(%rsp), %rsi
shlq $0x2, %rsi
subq %rsi, %rdx
addq %rdx, %rbp
shlq $0x2, %r15
cmpq %rcx, %rax
je 0x4478e
movq %rax, %rdx
subq %rbx, %rdx
movq %rbp, %rsi
xorl %edi, %edi
cmpq $0x32, %rdi
je 0x44785
movl (%r14,%rdx,4), %r8d
imull (%rsi), %r8d
addl %r8d, (%r12,%rdi,4)
incq %rdi
addq %r15, %rsi
jmp 0x4476b
incq %rax
addq $0x4, %rbp
jmp 0x4475b
leaq 0x60(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x494ee
leaq 0x108(%rsp), %rdi
callq 0x46e94
leaq 0x55f88(%rip), %rsi     # 0x9a73c
leaq 0x20(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x66a0
leaq 0x108(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x20(%rsp), %rdx
callq 0x6894
leaq 0x48e68(%rip), %rsi     # 0x8d647
leaq 0x108(%rsp), %rdi
callq 0x106fe
leaq 0x55f58(%rip), %rsi     # 0x9a74b
movq %rax, %rdi
callq 0x1079e
leaq 0x4cdf0(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x40(%rsp), %rsi
movq $0x1, (%rsi)
movq %rax, %rdi
callq 0x11052
leaq 0x48e22(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x504c8(%rip), %rsi     # 0x94cfc
movq %rax, %rdi
callq 0x106fe
leaq 0x4cdaf(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x18(%rsp), %rsi
movl $0x1, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x60a3d(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x108(%rsp), %rdi
callq 0x68d4
leaq 0x20(%rsp), %rdi
callq 0x2090
leaq 0x55eca(%rip), %rsi     # 0x9a755
leaq 0x20(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x66a0
leaq 0x108(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x20(%rsp), %rdx
callq 0x6894
leaq 0x48d91(%rip), %rsi     # 0x8d647
leaq 0x108(%rsp), %rdi
callq 0x106fe
leaq 0x55ea7(%rip), %rsi     # 0x9a771
movq %rax, %rdi
callq 0x3bfaa
leaq 0x4cd19(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x40(%rsp), %rsi
movq $0x32, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x48d4b(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x55e5d(%rip), %rsi     # 0x9a768
movq %rax, %rdi
callq 0x118ac
leaq 0x4ccd8(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x18(%rsp), %rsi
movq $0x32, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x60965(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x108(%rsp), %rdi
callq 0x68d4
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x2090
movq 0x80(%rsp), %rbp
leaq 0x32(%rbp), %rax
movq %rax, 0x10(%rsp)
leaq 0x48cd0(%rip), %r14     # 0x8d647
leaq 0x4cc74(%rip), %r12     # 0x915f2
cmpq 0x10(%rsp), %rbp
je 0x44ac9
andl $0x0, 0x40(%rsp)
movq %rbp, %rax
subq 0xf0(%rsp), %rax
imulq 0x100(%rsp), %rax
addq 0xb0(%rsp), %rax
movq 0xa8(%rsp), %rcx
subq 0xe0(%rsp), %rax
shlq $0x2, %rax
addq 0xd8(%rsp), %rax
xorl %edx, %edx
xorl %r13d, %r13d
cmpq $0x40, %rdx
je 0x449e5
movl (%rcx,%rdx,4), %esi
imull (%rax,%rdx,4), %esi
addl %esi, %r13d
movl %r13d, 0x40(%rsp)
incq %rdx
jmp 0x449cb
movq %r14, %r15
movq 0x78(%rsp), %rax
movq %rbp, %rcx
subq 0x80(%rsp), %rcx
movl (%rax,%rcx,4), %r14d
movq %rbx, %rdi
leaq 0x55d7b(%rip), %rsi     # 0x9a781
leaq 0x18(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl %r13d, %r14d
sete %sil
leaq 0x108(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rdx
callq 0x6894
movq %r15, %r14
movq %r13, %rdi
movq %r15, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x55d4b(%rip), %rsi     # 0x9a78f
callq 0x223dc
movq %rax, %rdi
movq %r12, %rsi
callq 0x106fe
movq %rbp, %rsi
subq 0x80(%rsp), %rsi
shlq $0x2, %rsi
addq 0x78(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
movq %r14, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x55d05(%rip), %rsi     # 0x9a78a
callq 0x1071a
movq %rax, %rdi
movq %r12, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x607f6(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r13, %rdi
callq 0x68d4
movq %rbx, %rdi
callq 0x2090
incq %rbp
jmp 0x4497e
leaq 0x60(%rsp), %rdi
callq 0x46e94
leaq 0x90(%rsp), %rdi
callq 0x46b1e
leaq 0xc0(%rsp), %rdi
callq 0x46ea4
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5639a(%rip), %rdi     # 0x9aea0
leaq 0x563b2(%rip), %rsi     # 0x9aebf
leaq 0x57b83(%rip), %rcx     # 0x9c697
movl $0xf2, %edx
callq 0x20e0
leaq 0x56438(%rip), %rdi     # 0x9af5d
leaq 0x56393(%rip), %rsi     # 0x9aebf
leaq 0x564c1(%rip), %rcx     # 0x9aff4
movl $0xf7, %edx
callq 0x20e0
jmp 0x44b8c
jmp 0x44b8c
jmp 0x44b7f
movq %rax, %rbx
jmp 0x44bc7
jmp 0x44b5b
jmp 0x44b91
jmp 0x44b6d
jmp 0x44b91
jmp 0x44b56
jmp 0x44b5b
jmp 0x44b6d
movq %rax, %rbx
jmp 0x44bba
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x68d4
jmp 0x44ba6
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x68d4
jmp 0x44ba6
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
jmp 0x44bb5
movq %rax, %rbx
jmp 0x44bb0
movq %rax, %rbx
jmp 0x44ba6
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x68d4
leaq 0x20(%rsp), %rdi
callq 0x2090
leaq 0x60(%rsp), %rdi
callq 0x46e94
leaq 0x90(%rsp), %rdi
callq 0x46b1e
leaq 0xc0(%rsp), %rdi
callq 0x46ea4
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba