// File: /workspace/github_cpp_makefile_star2_O1/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 $0x278, %rsp            # imm = 0x278
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
leaq 0x58(%rsp), %rbx
movq $0x0, 0x30(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movups %xmm0, 0x18(%rbx)
movq %r14, 0x40(%rbx)
movq %rbx, %rdi
callq 0x59d8c
movq %rbx, %rdi
callq 0x59e28
leaq 0xa0(%rsp), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x8(%rdi)
callq 0x56e24
leaq 0xa0(%rsp), %rdi
callq 0x56e6a
movq 0x70(%rsp), %rax
leaq 0xf0(%rsp), %rdi
movq %rax, -0x8(%rdi)
movups 0x78(%rsp), %xmm0
movups %xmm0, (%rdi)
movups 0x88(%rsp), %xmm0
movups %xmm0, 0x10(%rdi)
movq 0x98(%rsp), %rax
movq %rax, 0x20(%rdi)
leaq 0xd8(%rsp), %rax
movl $0x0, (%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
leaq 0xe8(%rsp), %rax
movq %rax, 0x8(%rsi)
callq 0x5a02b
movq %r14, %rdi
leaq 0xb8(%rsp), %rax
movq (%rax), %r14
movq 0x8(%rax), %rax
xorl %ecx, %ecx
leal (%rax,%rcx), %edx
movl %edx, (%r14,%rcx,4)
incq %rcx
cmpq $0x40, %rcx
jne 0x53c91
movq 0x70(%rsp), %r15
movq 0x78(%rsp), %rbp
movq 0x88(%rsp), %rbx
movq 0x98(%rsp), %r12
movq 0xc0(%rsp), %r13
movl $0x0, 0x44(%rsp)
leaq 0xe8(%rsp), %rsi
movq %rbx, (%rsi)
movq $0x32, 0x8(%rsi)
movq %rdi, 0x10(%rsi)
xorl %edi, %edi
callq 0x583a8
leaq 0xe8(%rsp), %rsi
movq %rbx, (%rsi)
movq $0x32, 0x8(%rsi)
movq $0x1, 0x10(%rsi)
xorl %edi, %edi
callq 0x583b9
leaq 0xd8(%rsp), %rsi
movq %rbx, (%rsi)
leaq 0xe8(%rsp), %rdi
leaq 0x44(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0x58450
movq %rbx, %rax
movq 0x108(%rsp), %rbx
movq %rax, 0x30(%rsp)
cmpq %rax, %rbx
jne 0x54274
cmpq %r13, %rbp
jne 0x54293
movq %rbp, %rax
leaq 0x100(%rsp), %rcx
movq (%rcx), %rbp
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
movq %rbx, 0x10(%rdi)
movq %rax, 0x38(%rsp)
callq 0x586a9
movq 0x10(%rsp), %rcx
movq 0x20(%rsp), %rdx
leaq 0x3f(%rcx), %rax
leaq (,%rdx,4), %rsi
shlq $0x2, %rbx
subq %rbx, %rsi
addq %rsi, %rbp
subq 0x30(%rsp), %rdx
imulq %r12, %rdx
leaq (,%rcx,4), %rsi
leaq (%rsi,%rdx,4), %rdx
movq 0x38(%rsp), %rsi
shlq $0x2, %rsi
subq %rsi, %rdx
addq %rdx, %r15
shlq $0x2, %r12
movq %rcx, %rdx
subq %r13, %rdx
movq %r15, %rsi
xorl %edi, %edi
movl (%r14,%rdx,4), %r8d
imull (%rsi), %r8d
addl %r8d, (%rbp,%rdi,4)
incq %rdi
addq %r12, %rsi
cmpq $0x32, %rdi
jne 0x53dc6
leaq 0x1(%rcx), %rdx
addq $0x4, %r15
cmpq %rax, %rcx
movq %rdx, %rcx
jne 0x53dbb
movq 0xf0(%rsp), %r15
movq 0xf8(%rsp), %r14
movq 0x100(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x108(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5a413(%rip), %rsi     # 0xae23c
leaq 0x5a41a(%rip), %rdx     # 0xae24a
leaq 0x10(%rsp), %rdi
movq %r14, 0x50(%rsp)
movq %r15, 0x48(%rsp)
callq 0xd0b8
leaq 0xe8(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movl $0x1, %esi
callq 0xbf0a
leaq 0x4d7f2(%rip), %rsi     # 0xa1654
leaq 0xe8(%rsp), %rdi
callq 0x18a16
leaq 0x5a3d5(%rip), %rsi     # 0xae24b
movq %rax, %rdi
callq 0x18a86
leaq 0x514a5(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x53eaa
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x2110
leaq 0x4d7a3(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x54a9c(%rip), %rsi     # 0xa895c
movq %rax, %rdi
callq 0x18a16
leaq 0x5145b(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x53ef4
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x22f0
leaq 0x6446e(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x53f2c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
movq %rax, (%rdi)
leaq 0x5a315(%rip), %rsi     # 0xae255
leaq 0x5a329(%rip), %rdx     # 0xae270
callq 0xd0b8
leaq 0xe8(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movl $0x1, %esi
callq 0xbf0a
leaq 0x4d6ea(%rip), %rsi     # 0xa1654
leaq 0xe8(%rsp), %rdi
callq 0x18a16
leaq 0x5a2f3(%rip), %rsi     # 0xae271
movq %rax, %rdi
callq 0x4a1d8
leaq 0x5139d(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x53fb2
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x32, %esi
callq 0x21b0
leaq 0x4d69b(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x5a2a0(%rip), %rsi     # 0xae268
movq %rax, %rdi
callq 0x19c24
leaq 0x51353(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x53ffc
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x32, %esi
callq 0x21b0
leaq 0x64366(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x54034
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x38(%rsp), %r14
leaq 0x31(%r14), %rax
movq %rax, 0xd0(%rsp)
leaq 0x10(%rsp), %r15
movq %r14, %rax
subq 0x88(%rsp), %rax
imulq 0x98(%rsp), %rax
addq 0xc0(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0x78(%rsp), %rax
shlq $0x2, %rax
addq 0x70(%rsp), %rax
xorl %edx, %edx
xorl %r12d, %r12d
movl (%rcx,%rdx,4), %esi
imull (%rax,%rdx,4), %esi
addl %esi, %r12d
incq %rdx
cmpq $0x40, %rdx
jne 0x54081
movq %r14, %r13
subq 0x38(%rsp), %r13
movq 0x30(%rsp), %rax
movl (%rax,%r13,4), %ebx
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r15, %rdi
leaq 0x5a1c8(%rip), %rsi     # 0xae281
leaq 0x5a1ce(%rip), %rdx     # 0xae28e
callq 0xd0b8
xorl %esi, %esi
cmpl %r12d, %ebx
sete %sil
leaq 0xe8(%rsp), %rdi
movq %r15, %rbp
movq %r15, %rdx
movq %rdi, %r15
callq 0xbf0a
movq %r15, %rdi
leaq 0x4d566(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x5a192(%rip), %rsi     # 0xae28f
callq 0x2ce10
movq %rax, %rdi
leaq 0x5121e(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x54132
movq %rbx, %rdi
addq $0x10, %rdi
movq 0x30(%rsp), %rax
movl (%rax,%r13,4), %esi
callq 0x22f0
movq %rbx, %rdi
leaq 0x4d518(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x5a13f(%rip), %rsi     # 0xae28a
callq 0x18a4e
movq %rax, %rdi
leaq 0x511d0(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x5417a
movq %rbx, %rdi
addq $0x10, %rdi
movl %r12d, %esi
callq 0x22f0
movq %rbx, %rdi
leaq 0x641e5(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %r15, %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x541ad
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x1(%r14), %rax
cmpq 0xd0(%rsp), %r14
movq %rax, %r14
movq %rbp, %r15
jne 0x5404a
cmpq $0x0, 0x30(%rsp)
je 0x541e0
movq 0x50(%rsp), %rsi
shlq $0x2, %rsi
movq 0x48(%rsp), %rdi
callq 0x21f0
cmpq $0x0, 0xb8(%rsp)
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
je 0x54228
xorps %xmm0, %xmm0
leaq 0xb8(%rsp), %rax
movups %xmm0, (%rax)
movq 0xa8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq $0x0, 0xa8(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x54262
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rsp)
xorl %ebx, %ebx
movq %rbx, 0x88(%rsp)
movq %r14, 0x98(%rsp)
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %rbx, 0x60(%rsp)
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5a635(%rip), %rdi     # 0xae8b0
leaq 0x5a64d(%rip), %rsi     # 0xae8cf
leaq 0x5bc50(%rip), %rcx     # 0xafed9
movl $0xf2, %edx
callq 0x2100
leaq 0x5a6d3(%rip), %rdi     # 0xae96d
leaq 0x5a62e(%rip), %rsi     # 0xae8cf
leaq 0x5a75c(%rip), %rcx     # 0xaea04
movl $0xf7, %edx
callq 0x2100
jmp 0x54321
jmp 0x54321
leaq 0x100(%rsp), %rsi
movq %rax, %r15
cmpq $0x0, 0x100(%rsp)
je 0x54372
leaq 0xe8(%rsp), %rdi
callq 0x254b
jmp 0x54372
jmp 0x542f8
jmp 0x542fd
jmp 0x5430f
jmp 0x54326
jmp 0x54326
movq %rax, %r15
jmp 0x543a4
jmp 0x542fd
jmp 0x5430f
movq %rax, %r15
jmp 0x54372
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbf62
jmp 0x5433b
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbf62
jmp 0x5433b
movq %rax, %r15
jmp 0x54357
movq %rax, %r15
jmp 0x5433b
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x54357
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq $0x0, 0x30(%rsp)
je 0x54372
movq 0x50(%rsp), %rsi
shlq $0x2, %rsi
movq 0x48(%rsp), %rdi
callq 0x21f0
cmpq $0x0, 0xb8(%rsp)
je 0x543a4
leaq 0xb8(%rsp), %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq -0x10(%rbx), %rdi
movq -0x8(%rbx), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq $0x0, -0x10(%rbx)
cmpq $0x0, 0x70(%rsp)
je 0x543e8
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rsp)
xorl %ebx, %ebx
movq %rbx, 0x88(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x98(%rsp)
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %rbx, 0x60(%rsp)
movq %r15, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036