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

  // Compute the matrix-vector product B*x.
  vector<int, M> Bx = make_ein_sum<int, i>(cast<short>(ein<i, j>(B)) * cast<short>(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 += static_cast<short>(B(i, j)) * static_cast<short>(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 0x5a0a6
movq %rbx, %rdi
callq 0x5a13a
leaq 0xa0(%rsp), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x8(%rdi)
callq 0x5a194
leaq 0xa0(%rsp), %rdi
callq 0x5a1da
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
movb $0x0, (%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
leaq 0xe8(%rsp), %rax
movq %rax, 0x8(%rsi)
callq 0x5a250
movq %r14, %rdi
leaq 0xb8(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
xorl %edx, %edx
leal (%rcx,%rdx), %esi
movb %sil, (%rax,%rdx)
incq %rdx
cmpq $0x40, %rdx
jne 0x544cd
movq 0x70(%rsp), %r14
movq 0x78(%rsp), %rbp
movq 0x88(%rsp), %rbx
movq 0x98(%rsp), %r15
movq 0xb8(%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 0x54aa8
cmpq %r13, %rbp
jne 0x54ac7
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 %r15, %rdx
addq %rcx, %rdx
subq 0x38(%rsp), %rdx
addq %rdx, %r14
movq %rcx, %rdx
subq %r13, %rdx
movq %r14, %rsi
xorl %edi, %edi
movsbl (%rsi), %r8d
movsbl (%r12,%rdx), %r9d
imull %r8d, %r9d
addl %r9d, (%rbp,%rdi,4)
incq %rdi
addq %r15, %rsi
cmpq $0x32, %rdi
jne 0x545f6
leaq 0x1(%rcx), %rdx
incq %r14
cmpq %rax, %rcx
movq %rdx, %rcx
jne 0x545eb
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 0x59bdf(%rip), %rsi     # 0xae23c
leaq 0x59be6(%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 0x4cfbe(%rip), %rsi     # 0xa1654
leaq 0xe8(%rsp), %rdi
callq 0x18a16
leaq 0x59ba1(%rip), %rsi     # 0xae24b
movq %rax, %rdi
callq 0x18a86
leaq 0x50c71(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x546de
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x2110
leaq 0x4cf6f(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x54268(%rip), %rsi     # 0xa895c
movq %rax, %rdi
callq 0x18a16
leaq 0x50c27(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x54728
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x22f0
leaq 0x63c3a(%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 0x54760
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
movq %rax, (%rdi)
leaq 0x59ae1(%rip), %rsi     # 0xae255
leaq 0x59af5(%rip), %rdx     # 0xae270
callq 0xd0b8
leaq 0xe8(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movl $0x1, %esi
callq 0xbf0a
leaq 0x4ceb6(%rip), %rsi     # 0xa1654
leaq 0xe8(%rsp), %rdi
callq 0x18a16
leaq 0x59abf(%rip), %rsi     # 0xae271
movq %rax, %rdi
callq 0x4a1d8
leaq 0x50b69(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x547e6
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x32, %esi
callq 0x21b0
leaq 0x4ce67(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x59a6c(%rip), %rsi     # 0xae268
movq %rax, %rdi
callq 0x19c24
leaq 0x50b1f(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x54830
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x32, %esi
callq 0x21b0
leaq 0x63b32(%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 0x54868
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x38(%rsp), %r14
leaq 0x31(%r14), %rax
movq %rax, 0xd0(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0xe8(%rsp), %r15
movq %r15, %rbp
movq 0xb8(%rsp), %rax
movq %r14, %rcx
subq 0x88(%rsp), %rcx
imulq 0x98(%rsp), %rcx
addq 0xc0(%rsp), %rcx
subq 0x78(%rsp), %rcx
addq 0x70(%rsp), %rcx
xorl %edx, %edx
xorl %r12d, %r12d
movsbl (%rcx,%rdx), %esi
movsbl (%rax,%rdx), %r8d
imull %esi, %r8d
addl %r8d, %r12d
incq %rdx
cmpq $0x40, %rdx
jne 0x548bc
movq %r14, %r13
subq 0x38(%rsp), %r13
movq 0x30(%rsp), %rax
movl (%rax,%r13,4), %ebx
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x5998a(%rip), %rsi     # 0xae281
leaq 0x59990(%rip), %rdx     # 0xae28e
movq %rdi, %r15
callq 0xd0b8
xorl %esi, %esi
cmpl %r12d, %ebx
sete %sil
movq %rbp, %rdi
movq %r15, %rbp
movq %r15, %rdx
movq %rdi, %r15
callq 0xbf0a
movq %r15, %rdi
leaq 0x4cd2a(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x59956(%rip), %rsi     # 0xae28f
callq 0x2ce10
movq %rax, %rdi
leaq 0x509e2(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x5496e
movq %rbx, %rdi
addq $0x10, %rdi
movq 0x30(%rsp), %rax
movl (%rax,%r13,4), %esi
callq 0x22f0
movq %rbx, %rdi
leaq 0x4ccdc(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x59903(%rip), %rsi     # 0xae28a
callq 0x18a4e
movq %rax, %rdi
leaq 0x50994(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x549b6
movq %rbx, %rdi
addq $0x10, %rdi
movl %r12d, %esi
callq 0x22f0
movq %rbx, %rdi
leaq 0x639a9(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %r15, %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x549e9
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x1(%r14), %rax
cmpq 0xd0(%rsp), %r14
movq %rax, %r14
movq %rbp, %rdi
jne 0x54886
cmpq $0x0, 0x30(%rsp)
je 0x54a1c
movq 0x50(%rsp), %rsi
shlq $0x2, %rsi
movq 0x48(%rsp), %rdi
callq 0x21f0
cmpq $0x0, 0xb8(%rsp)
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
je 0x54a60
xorps %xmm0, %xmm0
leaq 0xb8(%rsp), %rax
movups %xmm0, (%rax)
movq 0xa8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x21f0
movq $0x0, 0xa8(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x54a96
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
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 0x59e01(%rip), %rdi     # 0xae8b0
leaq 0x59e19(%rip), %rsi     # 0xae8cf
leaq 0x5b41c(%rip), %rcx     # 0xafed9
movl $0xf2, %edx
callq 0x2100
leaq 0x59e9f(%rip), %rdi     # 0xae96d
leaq 0x59dfa(%rip), %rsi     # 0xae8cf
leaq 0x59f28(%rip), %rcx     # 0xaea04
movl $0xf7, %edx
callq 0x2100
jmp 0x54b55
jmp 0x54b55
leaq 0x100(%rsp), %rsi
movq %rax, %r15
cmpq $0x0, 0x100(%rsp)
je 0x54ba6
leaq 0xe8(%rsp), %rdi
callq 0x256d
jmp 0x54ba6
jmp 0x54b2c
jmp 0x54b31
jmp 0x54b43
jmp 0x54b5a
jmp 0x54b5a
movq %rax, %r15
jmp 0x54bd4
jmp 0x54b31
jmp 0x54b43
movq %rax, %r15
jmp 0x54ba6
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbf62
jmp 0x54b6f
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbf62
jmp 0x54b6f
movq %rax, %r15
jmp 0x54b8b
movq %rax, %r15
jmp 0x54b6f
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x54b8b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq $0x0, 0x30(%rsp)
je 0x54ba6
movq 0x50(%rsp), %rsi
shlq $0x2, %rsi
movq 0x48(%rsp), %rdi
callq 0x21f0
cmpq $0x0, 0xb8(%rsp)
je 0x54bd4
leaq 0xb8(%rsp), %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq -0x10(%rbx), %rdi
movq -0x8(%rbx), %rsi
callq 0x21f0
movq $0x0, -0x10(%rbx)
cmpq $0x0, 0x70(%rsp)
je 0x54c14
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
callq 0x21f0
movq %rbx, 0x60(%rsp)
movq %r15, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036