// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/ein_reduce.cpp
// Function: nda::test_make_ein_sum_dot_body()
TEST(make_ein_sum_dot) {
  constexpr index_t N = 64;
  vector<int, N> x;
  vector<int, N> y;
  fill_pattern(x);
  fill_pattern(y, 2);

  // Compute the dot product x.y using an ein_sum.
  int dot = make_ein_sum<int>(ein<i>(x) * ein<i>(y));

  int dot_ref = 0;
  for (index_t i : x.i()) {
    dot_ref += x(i) * y(i);
  }
  ASSERT_EQ(dot, dot_ref);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
leaq 0x50(%rsp), %rdi
callq 0x46b3e
leaq 0x20(%rsp), %rdi
callq 0x46b3e
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
callq 0x46b83
leaq 0x20(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x46b83
movq 0x68(%rsp), %r12
movq 0x70(%rsp), %rbx
movq 0x38(%rsp), %r13
movq 0x40(%rsp), %r14
leaq 0x18(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0xa8(%rsp), %rdi
leaq 0x7(%rsp), %rsi
leaq 0x6(%rsp), %rcx
callq 0x4776a
movq 0xc0(%rsp), %rbp
leaq 0x8(%rsp), %rdi
pushq $0x40
popq %rdx
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x476ca
leaq 0x8(%rsp), %rdi
movq (%rdi), %r15
pushq $0x40
popq %rdx
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x476ca
cmpq 0x8(%rsp), %r15
jne 0x41b08
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x477b2
movq 0x8(%rsp), %rcx
movl (%rbp), %eax
shlq $0x2, %rcx
shlq $0x2, %r14
movq %rcx, %rdx
subq %r14, %rdx
addq %rdx, %r13
shlq $0x2, %rbx
subq %rbx, %rcx
addq %rcx, %r12
xorl %ecx, %ecx
cmpq $0x40, %rcx
je 0x41991
movl (%r13,%rcx,4), %edx
imull (%r12,%rcx,4), %edx
addl %edx, %eax
movl %eax, (%rbp)
incq %rcx
jmp 0x41977
leaq 0x80(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3cf8a
leaq 0xa8(%rsp), %rdi
callq 0x6baa
leaq 0x80(%rsp), %rdi
movq 0x18(%rdi), %rax
movl (%rax), %ebx
callq 0x6baa
andl $0x0, 0x8(%rsp)
movl %ebx, 0x1c(%rsp)
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rcx
movq 0x40(%rsp), %rdx
shlq $0x2, %rcx
shlq $0x2, %rdx
subq %rdx, %rcx
addq 0x38(%rsp), %rcx
xorl %edx, %edx
xorl %ebp, %ebp
cmpq $0x40, %rdx
je 0x41a0a
movl (%rcx,%rdx,4), %esi
imull (%rax,%rdx,4), %esi
addl %esi, %ebp
movl %ebp, 0x8(%rsp)
incq %rdx
jmp 0x419f2
leaq 0x589f2(%rip), %rsi     # 0x9a403
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl %ebp, %ebx
sete %sil
leaq 0xa8(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x6894
leaq 0x4bc00(%rip), %rsi     # 0x8d647
leaq 0xa8(%rsp), %rdi
callq 0x106fe
leaq 0x589a4(%rip), %rsi     # 0x9a3ff
movq %rax, %rdi
callq 0x1110a
leaq 0x4fb88(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x1c(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x4bbc1(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x58975(%rip), %rsi     # 0x9a40a
movq %rax, %rdi
callq 0x107f4
leaq 0x4fb4e(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x637e2(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0xa8(%rsp), %rdi
callq 0x68d4
leaq 0x80(%rsp), %rdi
callq 0x2090
leaq 0x20(%rsp), %rdi
callq 0x46b1e
leaq 0x50(%rsp), %rdi
callq 0x46b1e
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5944e(%rip), %rdi     # 0x9af5d
leaq 0x593a9(%rip), %rsi     # 0x9aebf
leaq 0x594d7(%rip), %rcx     # 0x9aff4
movl $0xf7, %edx
callq 0x20e0
jmp 0x41b37
jmp 0x41b3c
jmp 0x41b37
movq %rax, %rbx
jmp 0x41b75
movq %rax, %rbx
jmp 0x41b5e
movq %rax, %rbx
jmp 0x41b6b
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x6baa
jmp 0x41b6b
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x68d4
leaq 0x80(%rsp), %rdi
callq 0x2090
leaq 0x20(%rsp), %rdi
callq 0x46b1e
leaq 0x50(%rsp), %rdi
callq 0x46b1e
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba