// File: 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
movq %rsp, %rbp
subq $0xa50, %rsp            # imm = 0xA50
movq $0x32, -0x1a8(%rbp)
movq $0x40, -0x1b0(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0xc7f10
leaq -0x228(%rbp), %rdi
callq 0xc6dd0
jmp 0xb0fcb
leaq -0x1f8(%rbp), %rdi
xorl %esi, %esi
callq 0xc7f40
jmp 0xb0fdb
leaq -0x228(%rbp), %rdi
xorl %esi, %esi
callq 0xc6ee0
jmp 0xb0feb
leaq -0x2e0(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0xc7f70
jmp 0xb1000
leaq -0x2f8(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0xc8000
jmp 0xb1015
leaq -0x2b0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
leaq -0x2f8(%rbp), %rdx
callq 0xc7fb0
jmp 0xb1031
movl $0x0, -0x2fc(%rbp)
leaq -0x2fd(%rbp), %rdi
movq %rdi, -0x898(%rbp)
callq 0x10e30
movq -0x898(%rbp), %rax
leaq -0x268(%rbp), %rcx
movq %rcx, -0x68(%rbp)
leaq -0x2b0(%rbp), %rcx
movq %rcx, -0x70(%rbp)
leaq -0x2fc(%rbp), %rcx
movq %rcx, -0x78(%rbp)
movq %rax, -0x80(%rbp)
movq -0x70(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0xbcc90
jmp 0xb108c
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rcx
leaq -0xc0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xdb790
jmp 0xb10a9
movq -0x70(%rbp), %rax
movq %rax, -0x8a0(%rbp)
leaq -0x138(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xdb7d0
jmp 0xb10c9
movq -0x8a0(%rbp), %rdx
leaq -0x120(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0xdb810
jmp 0xb10e5
leaq -0x160(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq -0x120(%rbp), %rax
movq %rax, -0x20(%rbp)
movq $0x2, -0x28(%rbp)
movq -0x20(%rbp), %rdx
movq %rdx, %r8
addq $0x18, %r8
leaq -0x48(%rbp), %rdi
leaq -0x49(%rbp), %rsi
leaq -0x4a(%rbp), %rcx
callq 0xbd5a0
jmp 0xb1121
movq -0x20(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0xbde40
jmp 0xb1130
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x160(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x158(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x150(%rbp)
leaq -0x268(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xdb850
jmp 0xb11a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0xc81a0
movq -0x140(%rbp), %rcx
movl -0x144(%rbp), %eax
movq %rcx, -0x8b0(%rbp)
movl %eax, -0x8a4(%rbp)
jmp 0xb1821
leaq -0xc0(%rbp), %rdi
callq 0xc81a0
leaq -0x2fd(%rbp), %rdi
callq 0x10e50
callq 0xc8040
movq %rax, -0x8b8(%rbp)
jmp 0xb11cc
movq -0x8b8(%rbp), %rax
subq $0x1, %rax
sete %al
movb %al, -0x8c1(%rbp)
leaq -0x4b1(%rbp), %rdi
movq %rdi, -0x8c0(%rbp)
callq 0x33b0
movq -0x8c0(%rbp), %rdx
leaq 0x138ab7(%rip), %rsi    # 0x1e9cb8
leaq -0x4b0(%rbp), %rdi
callq 0x10a90
jmp 0xb120f
movb -0x8c1(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x490(%rbp), %rdi
leaq -0x4b0(%rbp), %rdx
callq 0x10f80
jmp 0xb1230
leaq 0x12b5ae(%rip), %rsi    # 0x1dc7e5
leaq -0x490(%rbp), %rdi
callq 0x34320
movq %rax, -0x8d0(%rbp)
jmp 0xb124c
movq -0x8d0(%rbp), %rdi
leaq 0x138a6d(%rip), %rsi    # 0x1e9cc7
callq 0x344d0
movq %rax, -0x8d8(%rbp)
jmp 0xb1268
movq -0x8d8(%rbp), %rdi
leaq 0x12f536(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x8e0(%rbp)
jmp 0xb1284
callq 0xc8040
movq %rax, -0x8e8(%rbp)
jmp 0xb1292
movq -0x8e0(%rbp), %rdi
movq -0x8e8(%rbp), %rax
movq %rax, -0x4c0(%rbp)
leaq -0x4c0(%rbp), %rsi
callq 0x355c0
movq %rax, -0x8f0(%rbp)
jmp 0xb12bc
movq -0x8f0(%rbp), %rdi
leaq 0x12b51b(%rip), %rsi    # 0x1dc7e5
callq 0x34320
movq %rax, -0x8f8(%rbp)
jmp 0xb12d8
movq -0x8f8(%rbp), %rdi
leaq 0x132d87(%rip), %rsi    # 0x1e406d
callq 0x34320
movq %rax, -0x900(%rbp)
jmp 0xb12f4
movq -0x900(%rbp), %rdi
leaq 0x12f4aa(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x908(%rbp)
jmp 0xb1310
movq -0x908(%rbp), %rdi
movl $0x1, -0x4c4(%rbp)
leaq -0x4c4(%rbp), %rsi
callq 0x343a0
movq %rax, -0x910(%rbp)
jmp 0xb1336
movq -0x910(%rbp), %rdi
leaq 0x145137(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0xb134b
leaq -0x490(%rbp), %rdi
callq 0x10ff0
jmp 0xb1359
leaq -0x4b0(%rbp), %rdi
callq 0x3100
leaq -0x4b1(%rbp), %rdi
callq 0x3290
leaq -0x268(%rbp), %rdi
callq 0xc8050
movq %rax, -0x918(%rbp)
jmp 0xb1386
movq -0x918(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0xc8070
movq %rax, -0x920(%rbp)
jmp 0xb13b2
movq -0x920(%rbp), %rax
subq $0x32, %rax
sete %al
movb %al, -0x929(%rbp)
leaq -0x679(%rbp), %rdi
movq %rdi, -0x928(%rbp)
callq 0x33b0
movq -0x928(%rbp), %rdx
leaq 0x1388ea(%rip), %rsi    # 0x1e9cd1
leaq -0x678(%rbp), %rdi
callq 0x10a90
jmp 0xb13f5
movb -0x929(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x658(%rbp), %rdi
leaq -0x678(%rbp), %rdx
callq 0x10f80
jmp 0xb1416
leaq 0x12b3c8(%rip), %rsi    # 0x1dc7e5
leaq -0x658(%rbp), %rdi
callq 0x34320
movq %rax, -0x938(%rbp)
jmp 0xb1432
movq -0x938(%rbp), %rdi
leaq 0x1388ad(%rip), %rsi    # 0x1e9ced
callq 0x969a0
movq %rax, -0x940(%rbp)
jmp 0xb144e
movq -0x940(%rbp), %rdi
leaq 0x12f350(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x948(%rbp)
jmp 0xb146a
leaq -0x268(%rbp), %rdi
callq 0xc8050
movq %rax, -0x950(%rbp)
jmp 0xb147f
movq -0x950(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
movq -0x948(%rbp), %rdi
movq $0x32, -0x688(%rbp)
leaq -0x688(%rbp), %rsi
callq 0x34510
movq %rax, -0x958(%rbp)
jmp 0xb14bd
movq -0x958(%rbp), %rdi
leaq 0x12b31a(%rip), %rsi    # 0x1dc7e5
callq 0x34320
movq %rax, -0x960(%rbp)
jmp 0xb14d9
movq -0x960(%rbp), %rdi
leaq 0x1387fd(%rip), %rsi    # 0x1e9ce4
callq 0x36600
movq %rax, -0x968(%rbp)
jmp 0xb14f5
movq -0x968(%rbp), %rdi
leaq 0x12f2a9(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x970(%rbp)
jmp 0xb1511
leaq -0x1f8(%rbp), %rdi
callq 0xc8070
movq %rax, -0x978(%rbp)
jmp 0xb1526
movq -0x970(%rbp), %rdi
movq -0x978(%rbp), %rax
movq %rax, -0x690(%rbp)
leaq -0x690(%rbp), %rsi
callq 0x34510
movq %rax, -0x980(%rbp)
jmp 0xb1550
movq -0x980(%rbp), %rdi
leaq 0x144f1d(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0xb1565
leaq -0x658(%rbp), %rdi
callq 0x10ff0
jmp 0xb1573
leaq -0x678(%rbp), %rdi
callq 0x3100
leaq -0x679(%rbp), %rdi
callq 0x3290
leaq -0x268(%rbp), %rdi
callq 0xc8050
movq %rax, -0x988(%rbp)
jmp 0xb15a0
movq -0x988(%rbp), %rax
movq %rax, -0x698(%rbp)
movq -0x698(%rbp), %rdi
callq 0xc8090
movq %rax, -0x990(%rbp)
jmp 0xb15c3
movq -0x990(%rbp), %rax
movq %rax, -0x6a0(%rbp)
movq -0x698(%rbp), %rdi
callq 0xc80c0
movq %rax, -0x998(%rbp)
jmp 0xb15e6
movq -0x998(%rbp), %rax
movq %rax, -0x6a8(%rbp)
leaq -0x6a0(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x6a8(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x188(%rbp), %rax
movq (%rax), %rax
movq -0x190(%rbp), %rcx
cmpq (%rcx), %rax
setne %al
movb %al, -0x999(%rbp)
movb -0x999(%rbp), %al
testb $0x1, %al
jne 0xb163c
jmp 0xb1b76
leaq -0x6a0(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x9a8(%rbp)
movq -0x9a8(%rbp), %rax
movq %rax, -0x6b0(%rbp)
movl $0x0, -0x6b4(%rbp)
leaq -0x228(%rbp), %rdi
callq 0xc6c00
movq %rax, -0x9b0(%rbp)
jmp 0xb1688
movq -0x9b0(%rbp), %rax
movq %rax, -0x6c0(%rbp)
movq -0x6c0(%rbp), %rdi
callq 0xc6c40
movq %rax, -0x9b8(%rbp)
jmp 0xb16ab
movq -0x9b8(%rbp), %rax
movq %rax, -0x6c8(%rbp)
movq -0x6c0(%rbp), %rdi
callq 0xc6c70
movq %rax, -0x9c0(%rbp)
jmp 0xb16ce
movq -0x9c0(%rbp), %rax
movq %rax, -0x6d0(%rbp)
leaq -0x6c8(%rbp), %rax
movq %rax, -0x198(%rbp)
leaq -0x6d0(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x198(%rbp), %rax
movq (%rax), %rax
movq -0x1a0(%rbp), %rcx
cmpq (%rcx), %rax
setne %al
movb %al, -0x9c1(%rbp)
movb -0x9c1(%rbp), %al
testb $0x1, %al
jne 0xb1724
jmp 0xb1931
leaq -0x6c8(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x9d0(%rbp)
movq -0x9d0(%rbp), %rax
movq %rax, -0x6d8(%rbp)
movq -0x6b0(%rbp), %rsi
movq -0x6d8(%rbp), %rdx
leaq -0x1f8(%rbp), %rdi
callq 0xc8110
movq %rax, -0x9d8(%rbp)
jmp 0xb1774
movq -0x9d8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x9e4(%rbp)
movq -0x6d8(%rbp), %rsi
leaq -0x228(%rbp), %rdi
callq 0xc6cc0
movq %rax, -0x9e0(%rbp)
jmp 0xb179f
movq -0x9e0(%rbp), %rcx
movl -0x9e4(%rbp), %eax
imull (%rcx), %eax
addl -0x6b4(%rbp), %eax
movl %eax, -0x6b4(%rbp)
leaq -0x6c8(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xb16dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0xb1bbb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0xb1baf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x8b0(%rbp)
movl %eax, -0x8a4(%rbp)
jmp 0xb1821
movq -0x8b0(%rbp), %rcx
movl -0x8a4(%rbp), %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x2fd(%rbp), %rdi
callq 0x10e50
jmp 0xb1baf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0xb1ba3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0xb18b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0xb18ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x490(%rbp), %rdi
callq 0x10ff0
jmp 0xb18ab
jmp 0xb18ad
leaq -0x4b0(%rbp), %rdi
callq 0x3100
leaq -0x4b1(%rbp), %rdi
callq 0x3290
jmp 0xb1ba3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0xb1920
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0xb1914
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x658(%rbp), %rdi
callq 0x10ff0
jmp 0xb1912
jmp 0xb1914
leaq -0x678(%rbp), %rdi
callq 0x3100
leaq -0x679(%rbp), %rdi
callq 0x3290
jmp 0xb1ba3
movq -0x6b0(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0xc8160
movq %rax, -0x9f0(%rbp)
jmp 0xb194d
movq -0x9f0(%rbp), %rax
movl (%rax), %eax
movl -0x6b4(%rbp), %ecx
subl %ecx, %eax
sete %al
movb %al, -0x9f9(%rbp)
leaq -0x889(%rbp), %rdi
movq %rdi, -0x9f8(%rbp)
callq 0x33b0
movq -0x9f8(%rbp), %rdx
leaq 0x138375(%rip), %rsi    # 0x1e9cfd
leaq -0x888(%rbp), %rdi
callq 0x10a90
jmp 0xb1996
movb -0x9f9(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x868(%rbp), %rdi
leaq -0x888(%rbp), %rdx
callq 0x10f80
jmp 0xb19b7
leaq 0x12ae27(%rip), %rsi    # 0x1dc7e5
leaq -0x868(%rbp), %rdi
callq 0x34320
movq %rax, -0xa08(%rbp)
jmp 0xb19d3
movq -0xa08(%rbp), %rdi
leaq 0x13832a(%rip), %rsi    # 0x1e9d0b
callq 0x661c0
movq %rax, -0xa10(%rbp)
jmp 0xb19ef
movq -0xa10(%rbp), %rdi
leaq 0x12edaf(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0xa18(%rbp)
jmp 0xb1a0b
movq -0x6b0(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0xc8160
movq %rax, -0xa20(%rbp)
jmp 0xb1a27
movq -0xa20(%rbp), %rsi
movq -0xa18(%rbp), %rdi
callq 0x343a0
movq %rax, -0xa28(%rbp)
jmp 0xb1a43
movq -0xa28(%rbp), %rdi
leaq 0x12ad94(%rip), %rsi    # 0x1dc7e5
callq 0x34320
movq %rax, -0xa30(%rbp)
jmp 0xb1a5f
movq -0xa30(%rbp), %rdi
leaq 0x138299(%rip), %rsi    # 0x1e9d06
callq 0x34360
movq %rax, -0xa38(%rbp)
jmp 0xb1a7b
movq -0xa38(%rbp), %rdi
leaq 0x12ed23(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0xa40(%rbp)
jmp 0xb1a97
movq -0xa40(%rbp), %rdi
leaq -0x6b4(%rbp), %rsi
callq 0x343a0
movq %rax, -0xa48(%rbp)
jmp 0xb1ab3
movq -0xa48(%rbp), %rdi
leaq 0x1449ba(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0xb1ac8
leaq -0x868(%rbp), %rdi
callq 0x10ff0
jmp 0xb1ad6
leaq -0x888(%rbp), %rdi
callq 0x3100
leaq -0x889(%rbp), %rdi
callq 0x3290
leaq -0x6a0(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x170(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xb15f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0xb1b68
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0xb1b5c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x868(%rbp), %rdi
callq 0x10ff0
jmp 0xb1b5a
jmp 0xb1b5c
leaq -0x888(%rbp), %rdi
callq 0x3100
leaq -0x889(%rbp), %rdi
callq 0x3290
jmp 0xb1ba3
leaq -0x268(%rbp), %rdi
callq 0xc81a0
leaq -0x228(%rbp), %rdi
callq 0xc6d50
leaq -0x1f8(%rbp), %rdi
callq 0xc81e0
addq $0xa50, %rsp            # imm = 0xA50
popq %rbp
retq
leaq -0x268(%rbp), %rdi
callq 0xc81a0
leaq -0x228(%rbp), %rdi
callq 0xc6d50
leaq -0x1f8(%rbp), %rdi
callq 0xc81e0
movq -0x230(%rbp), %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x116d0
nopl (%rax,%rax)