// File: /workspace/github_cpp_makefile_star2_O2/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 $0x298, %rsp            # imm = 0x298
leaq 0xc0(%rsp), %rdi
callq 0x46eb4
leaq 0x90(%rsp), %rdi
callq 0x46edc
leaq 0xc0(%rsp), %rdi
xorl %esi, %esi
callq 0x46f06
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
callq 0x46f3b
movq 0xd8(%rsp), %rbp
movq 0xe0(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0xf0(%rsp), %rax
movq 0x100(%rsp), %r14
movq 0xa8(%rsp), %r15
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 0x4511a
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 0x45139
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 %r14, %rdx
addq %rax, %rdx
subq 0x50(%rsp), %rdx
addq %rdx, %rbp
cmpq %rcx, %rax
je 0x44da9
movq %rax, %rdx
subq %rbx, %rdx
movq %rbp, %rsi
xorl %edi, %edi
cmpq $0x32, %rdi
je 0x44da1
movsbl (%rsi), %r8d
movsbl (%r15,%rdx), %r9d
imull %r8d, %r9d
addl %r9d, (%r12,%rdi,4)
incq %rdi
addq %r14, %rsi
jmp 0x44d82
incq %rax
incq %rbp
jmp 0x44d72
leaq 0x60(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x494ee
leaq 0x108(%rsp), %rdi
callq 0x46e94
leaq 0x5596d(%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 0x4884d(%rip), %rsi     # 0x8d647
leaq 0x108(%rsp), %rdi
callq 0x106fe
leaq 0x5593d(%rip), %rsi     # 0x9a74b
movq %rax, %rdi
callq 0x1079e
leaq 0x4c7d5(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x40(%rsp), %rsi
movq $0x1, (%rsi)
movq %rax, %rdi
callq 0x11052
leaq 0x48807(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x4fead(%rip), %rsi     # 0x94cfc
movq %rax, %rdi
callq 0x106fe
leaq 0x4c794(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x18(%rsp), %rsi
movl $0x1, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x60422(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x108(%rsp), %rdi
callq 0x68d4
leaq 0x20(%rsp), %rdi
callq 0x2090
leaq 0x558af(%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 0x48776(%rip), %rsi     # 0x8d647
leaq 0x108(%rsp), %rdi
callq 0x106fe
leaq 0x5588c(%rip), %rsi     # 0x9a771
movq %rax, %rdi
callq 0x3bfaa
leaq 0x4c6fe(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x40(%rsp), %rsi
movq $0x32, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x48730(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x55842(%rip), %rsi     # 0x9a768
movq %rax, %rdi
callq 0x118ac
leaq 0x4c6bd(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x18(%rsp), %rsi
movq $0x32, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x6034a(%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 0x486b5(%rip), %r14     # 0x8d647
leaq 0x4c659(%rip), %r12     # 0x915f2
cmpq 0x10(%rsp), %rbp
je 0x450e4
andl $0x0, 0x40(%rsp)
movq 0xa8(%rsp), %rax
movq %rbp, %rcx
subq 0xf0(%rsp), %rcx
imulq 0x100(%rsp), %rcx
addq 0xb0(%rsp), %rcx
subq 0xe0(%rsp), %rcx
addq 0xd8(%rsp), %rcx
xorl %edx, %edx
xorl %r13d, %r13d
cmpq $0x40, %rdx
je 0x45000
movsbl (%rcx,%rdx), %esi
movsbl (%rax,%rdx), %edi
imull %esi, %edi
addl %edi, %r13d
movl %r13d, 0x40(%rsp)
incq %rdx
jmp 0x44fe2
movq %r14, %r15
movq 0x78(%rsp), %rax
movq %rbp, %rcx
subq 0x80(%rsp), %rcx
movl (%rax,%rcx,4), %r14d
movq %rbx, %rdi
leaq 0x55760(%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 0x55730(%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 0x556ea(%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 0x601db(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r13, %rdi
callq 0x68d4
movq %rbx, %rdi
callq 0x2090
incq %rbp
jmp 0x44f99
leaq 0x60(%rsp), %rdi
callq 0x46e94
leaq 0x90(%rsp), %rdi
callq 0x46f5e
leaq 0xc0(%rsp), %rdi
callq 0x46f6e
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x55d7f(%rip), %rdi     # 0x9aea0
leaq 0x55d97(%rip), %rsi     # 0x9aebf
leaq 0x57568(%rip), %rcx     # 0x9c697
movl $0xf2, %edx
callq 0x20e0
leaq 0x55e1d(%rip), %rdi     # 0x9af5d
leaq 0x55d78(%rip), %rsi     # 0x9aebf
leaq 0x55ea6(%rip), %rcx     # 0x9aff4
movl $0xf7, %edx
callq 0x20e0
jmp 0x451a7
jmp 0x451a7
jmp 0x4519a
movq %rax, %rbx
jmp 0x451e2
jmp 0x45176
jmp 0x451ac
jmp 0x45188
jmp 0x451ac
jmp 0x45171
jmp 0x45176
jmp 0x45188
movq %rax, %rbx
jmp 0x451d5
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x68d4
jmp 0x451c1
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x68d4
jmp 0x451c1
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
jmp 0x451d0
movq %rax, %rbx
jmp 0x451cb
movq %rax, %rbx
jmp 0x451c1
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 0x46f5e
leaq 0xc0(%rsp), %rdi
callq 0x46f6e
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba