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

  // Compute the dot product (x + y).z.
  int dot = 0;
  ein_reduce(ein<>(dot) += (ein<i>(x) + ein<i>(y)) * ein<i>(z));

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
leaq 0x88(%rsp), %rdi
callq 0x46c78
leaq 0x58(%rsp), %rdi
callq 0x46c78
leaq 0x28(%rsp), %rdi
callq 0x46c78
leaq 0x88(%rsp), %rdi
xorl %esi, %esi
callq 0x46ca2
leaq 0x58(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x46ca2
leaq 0x28(%rsp), %rdi
pushq $0x6
popq %rsi
callq 0x46ca2
andl $0x0, 0x14(%rsp)
movq 0xa0(%rsp), %r13
movq 0xa8(%rsp), %rsi
movq 0x70(%rsp), %rbp
movq 0x78(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rbx
movq 0x48(%rsp), %r15
leaq 0xd8(%rsp), %rdi
pushq $0x28
popq %rdx
movq %rsi, 0x20(%rsp)
xorl %ecx, %ecx
callq 0x486fa
leaq 0xd8(%rsp), %rdi
movq (%rdi), %r12
pushq $0x28
popq %rdx
movq 0x18(%rsp), %rsi
xorl %ecx, %ecx
callq 0x486fa
leaq 0xd8(%rsp), %rdi
movq (%rdi), %r14
pushq $0x28
popq %rdx
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x486fa
cmpq %r14, %r12
jne 0x42987
cmpq 0xd8(%rsp), %r12
jne 0x42987
leaq 0xd8(%rsp), %rdi
movq %r12, %rsi
callq 0x485f9
movq 0xd8(%rsp), %rax
shlq $0x2, %rax
shlq $0x2, %r15
movq %rax, %rcx
subq %r15, %rcx
addq %rcx, %rbx
movq 0x18(%rsp), %rdx
shlq $0x2, %rdx
movq %rax, %rcx
subq %rdx, %rcx
addq %rcx, %rbp
movq 0x20(%rsp), %rcx
shlq $0x2, %rcx
subq %rcx, %rax
addq %rax, %r13
xorl %eax, %eax
xorl %r14d, %r14d
cmpq $0x28, %rax
je 0x4281e
movl (%rbp,%rax,4), %ecx
addl (%r13,%rax,4), %ecx
imull (%rbx,%rax,4), %ecx
addl %ecx, %r14d
movl %r14d, 0x14(%rsp)
incq %rax
jmp 0x427fe
andl $0x0, 0x10(%rsp)
movq 0xa0(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq 0x78(%rsp), %rsi
movq 0x48(%rsp), %rdi
shlq $0x2, %rcx
shlq $0x2, %rdi
movq %rcx, %rdx
subq %rdi, %rdx
addq 0x40(%rsp), %rdx
shlq $0x2, %rsi
subq %rsi, %rcx
addq 0x70(%rsp), %rcx
xorl %esi, %esi
xorl %ebx, %ebx
cmpq $0x28, %rsi
je 0x4287b
movl (%rcx,%rsi,4), %edi
addl (%rax,%rsi,4), %edi
imull (%rdx,%rsi,4), %edi
addl %edi, %ebx
movl %ebx, 0x10(%rsp)
incq %rsi
jmp 0x42860
leaq 0x57b81(%rip), %rsi     # 0x9a403
leaq 0xb8(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl %ebx, %r14d
sete %sil
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x6894
leaq 0x4ad8e(%rip), %rsi     # 0x8d647
leaq 0xd8(%rsp), %rdi
callq 0x106fe
leaq 0x57b32(%rip), %rsi     # 0x9a3ff
movq %rax, %rdi
callq 0x1110a
leaq 0x4ed16(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x14(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x4ad4f(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x57b03(%rip), %rsi     # 0x9a40a
movq %rax, %rdi
callq 0x107f4
leaq 0x4ecdc(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x62970(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0xd8(%rsp), %rdi
callq 0x68d4
leaq 0xb8(%rsp), %rdi
callq 0x2090
leaq 0x28(%rsp), %rdi
callq 0x46cc6
leaq 0x58(%rsp), %rdi
callq 0x46cc6
leaq 0x88(%rsp), %rdi
callq 0x46cc6
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x585cf(%rip), %rdi     # 0x9af5d
leaq 0x5852a(%rip), %rsi     # 0x9aebf
leaq 0x58f3a(%rip), %rcx     # 0x9b8d6
movl $0xf7, %edx
callq 0x20e0
jmp 0x429b9
movq %rax, %rbx
jmp 0x429e5
movq %rax, %rbx
jmp 0x429ef
movq %rax, %rbx
jmp 0x429ce
jmp 0x429b9
movq %rax, %rbx
jmp 0x429db
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x68d4
leaq 0xb8(%rsp), %rdi
callq 0x2090
leaq 0x28(%rsp), %rdi
callq 0x46cc6
leaq 0x58(%rsp), %rdi
callq 0x46cc6
leaq 0x88(%rsp), %rdi
callq 0x46cc6
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba