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

  // Compute the outer product x^T*y.
  auto outer = make_ein_sum<int, i, j>(ein<i>(x) * ein<j>(y));

  ASSERT_EQ(outer.rank(), 2);
  ASSERT_EQ(outer.rows(), x.i().extent());
  ASSERT_EQ(outer.columns(), y.i().extent());
  for (index_t i : outer.i()) {
    for (index_t j : outer.j()) {
      ASSERT_EQ(outer(i, j), x(i) * y(j));
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
leaq 0xa0(%rsp), %rdi
callq 0x46b3e
leaq 0x70(%rsp), %rdi
callq 0x46c78
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
callq 0x46b83
leaq 0x70(%rsp), %rdi
pushq $0x8
popq %rsi
callq 0x46ca2
movq 0xb8(%rsp), %r13
movq 0xc0(%rsp), %rcx
movq 0x88(%rsp), %rbp
andl $0x0, (%rsp)
movq 0x90(%rsp), %rbx
leaq 0x10(%rsp), %rdx
movq %rbx, (%rdx)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x10(%rdx)
leaq 0xd0(%rsp), %rsi
movq %rcx, 0x8(%rsp)
movq %rcx, (%rsi)
movq %rax, 0x10(%rsi)
leaq 0x128(%rsp), %rdi
callq 0x48a04
leaq 0x50(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0x489bc
leaq 0x128(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movq %rsp, %rdx
leaq 0x7(%rsp), %rcx
callq 0x48c86
movq 0x140(%rsp), %r14
movq 0x148(%rsp), %r15
movq 0x158(%rsp), %r12
leaq 0x10(%rsp), %rdi
pushq $0x40
popq %rdx
movq 0x8(%rsp), %rsi
xorl %ecx, %ecx
callq 0x476ca
cmpq 0x10(%rsp), %r12
jne 0x44071
leaq 0x10(%rsp), %rdi
pushq $0x28
popq %rdx
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x486fa
cmpq 0x10(%rsp), %r15
jne 0x44088
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x492ba
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rdx
leaq 0x28(%rax), %rcx
movq %rax, %rsi
shlq $0x8, %rsi
leaq (%rsi,%rdx,4), %rsi
shlq $0x2, %rdx
shlq $0x2, %r12
subq %r12, %rsi
shlq $0x8, %r15
subq %r15, %rsi
addq %rsi, %r14
movq 0x8(%rsp), %rsi
shlq $0x2, %rsi
subq %rsi, %rdx
addq %rdx, %r13
cmpq %rcx, %rax
je 0x43b7c
movq %rax, %rdx
subq %rbx, %rdx
xorl %esi, %esi
cmpq $0x40, %rsi
je 0x43b70
movl (%rbp,%rdx,4), %edi
imull (%r13,%rsi,4), %edi
addl %edi, (%r14,%rsi,4)
incq %rsi
jmp 0x43b57
incq %rax
addq $0x100, %r14            # imm = 0x100
jmp 0x43b4a
leaq 0xe8(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0x4898a
leaq 0x128(%rsp), %rdi
callq 0x46dee
leaq 0x56ac7(%rip), %rsi     # 0x9a66c
leaq 0x10(%rsp), %rdi
movq %rsp, %rdx
callq 0x66a0
leaq 0x128(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x49a79(%rip), %rsi     # 0x8d647
leaq 0x128(%rsp), %rdi
callq 0x106fe
leaq 0x56a9c(%rip), %rsi     # 0x9a67e
movq %rax, %rdi
callq 0x1082e
leaq 0x4da01(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x50(%rsp), %rsi
movq $0x2, (%rsi)
movq %rax, %rdi
callq 0x11052
leaq 0x49a33(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x5275d(%rip), %rsi     # 0x96380
movq %rax, %rdi
callq 0x106fe
leaq 0x4d9c0(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xd0(%rsp), %rsi
movl $0x2, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x6164b(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x128(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0x56a0e(%rip), %rsi     # 0x9a68b
leaq 0x10(%rsp), %rdi
movq %rsp, %rdx
callq 0x66a0
leaq 0x128(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x499a1(%rip), %rsi     # 0x8d647
leaq 0x128(%rsp), %rdi
callq 0x106fe
leaq 0x569f0(%rip), %rsi     # 0x9a6aa
movq %rax, %rdi
callq 0x1082e
leaq 0x4d929(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x50(%rsp), %rsi
movq $0x40, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x4995b(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x569a0(%rip), %rsi     # 0x9a69b
movq %rax, %rdi
callq 0x11bb4
leaq 0x4d8e8(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xd0(%rsp), %rsi
movq $0x40, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x61572(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x128(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0x56961(%rip), %rsi     # 0x9a6b7
leaq 0x10(%rsp), %rdi
movq %rsp, %rdx
callq 0x66a0
leaq 0x128(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x498c8(%rip), %rsi     # 0x8d647
leaq 0x128(%rsp), %rdi
callq 0x106fe
leaq 0x56946(%rip), %rsi     # 0x9a6d9
movq %rax, %rdi
callq 0x3bfaa
leaq 0x4d850(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x50(%rsp), %rsi
movq $0x28, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x49882(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x568f6(%rip), %rsi     # 0x9a6ca
movq %rax, %rdi
callq 0x11bb4
leaq 0x4d80f(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xd0(%rsp), %rsi
movq $0x28, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x61499(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x128(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
movq 0x118(%rsp), %r13
leaq 0x40(%r13), %rax
movq %rax, 0x30(%rsp)
leaq (,%r13,4), %rax
leaq 0x128(%rsp), %r14
cmpq 0x30(%rsp), %r13
je 0x4403b
movq 0x108(%rsp), %rbp
movq %rbp, %rsi
shlq $0x8, %rsi
movq %rax, 0x38(%rsp)
addq %rax, %rsi
pushq $0x28
popq %r15
subq $0x1, %r15
jb 0x4402a
movq %r15, 0x40(%rsp)
movq %r14, %r15
movq 0x118(%rsp), %rax
movq 0x100(%rsp), %rcx
movq 0x108(%rsp), %rdx
shlq $0x8, %rdx
leaq (%rdx,%rax,4), %rax
subq %rax, %rcx
movq %rsi, 0x8(%rsp)
movl (%rsi,%rcx), %r14d
movq 0xb8(%rsp), %rax
movq %r13, %r12
movq %r13, %rcx
subq 0xc0(%rsp), %rcx
movl (%rax,%rcx,4), %r13d
movq 0x88(%rsp), %rax
movq 0x90(%rsp), %rcx
shlq $0x2, %rcx
subq %rcx, %rax
movq %rbp, 0x48(%rsp)
movl (%rax,%rbp,4), %ebx
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
leaq 0x567f4(%rip), %rsi     # 0x9a6e9
leaq 0xd0(%rsp), %rdx
callq 0x66a0
imull %r13d, %ebx
xorl %esi, %esi
cmpl %ebx, %r14d
sete %sil
movq %r15, %r14
movq %r15, %rdi
movq %rbp, %rdx
callq 0x6894
movq %rbp, %rbx
movq %r12, %r13
leaq 0x4971d(%rip), %r15     # 0x8d647
leaq 0x4d6c1(%rip), %r12     # 0x915f2
movq 0x48(%rsp), %rbp
movq %r14, %rdi
movq %r15, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x567b9(%rip), %rsi     # 0x9a704
callq 0x46c4c
movq %rax, %rdi
movq %r12, %rsi
callq 0x106fe
movq 0x118(%rsp), %rcx
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
shlq $0x8, %rdx
leaq (%rdx,%rcx,4), %rcx
subq %rcx, %rsi
addq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
movq %r15, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x56758(%rip), %rsi     # 0x9a6f8
callq 0x46c4c
movq %rax, %rdi
movq %r12, %rsi
callq 0x106fe
movq 0xb8(%rsp), %rcx
movq %r13, %rdx
subq 0xc0(%rsp), %rdx
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdi
shlq $0x2, %rdi
subq %rdi, %rsi
movl (%rsi,%rbp,4), %esi
imull (%rcx,%rdx,4), %esi
movl %esi, 0x50(%rsp)
movq %rax, %rdi
leaq 0x50(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x612a6(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r14, %rdi
callq 0x68d4
movq %rbx, %rdi
callq 0x2090
incq %rbp
movq 0x8(%rsp), %rsi
addq $0x100, %rsi            # imm = 0x100
movq 0x40(%rsp), %r15
jmp 0x43e6f
incq %r13
movq 0x38(%rsp), %rax
addq $0x4, %rax
jmp 0x43e49
leaq 0xe8(%rsp), %rdi
callq 0x46dee
leaq 0x70(%rsp), %rdi
callq 0x46cc6
leaq 0xa0(%rsp), %rdi
callq 0x46b1e
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x56e28(%rip), %rdi     # 0x9aea0
leaq 0x56e40(%rip), %rsi     # 0x9aebf
leaq 0x56e54(%rip), %rcx     # 0x9aeda
jmp 0x4409d
leaq 0x56e11(%rip), %rdi     # 0x9aea0
leaq 0x56e29(%rip), %rsi     # 0x9aebf
leaq 0x57e86(%rip), %rcx     # 0x9bf23
movl $0xf2, %edx
callq 0x20e0
jmp 0x44113
jmp 0x44113
jmp 0x44113
jmp 0x440cb
movq %rax, %rbx
jmp 0x44150
jmp 0x440dd
jmp 0x4411a
jmp 0x440ef
jmp 0x4411a
jmp 0x44101
jmp 0x4411a
jmp 0x440d8
jmp 0x440dd
jmp 0x440ef
jmp 0x44101
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
jmp 0x44141
movq %rax, %rbx
jmp 0x44146
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x68d4
jmp 0x4412f
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x68d4
jmp 0x4412f
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x68d4
jmp 0x4412f
movq %rax, %rbx
jmp 0x44139
jmp 0x4411f
movq %rax, %rbx
jmp 0x4412f
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0xe8(%rsp), %rdi
callq 0x46dee
leaq 0x70(%rsp), %rdi
callq 0x46cc6
leaq 0xa0(%rsp), %rdi
callq 0x46b1e
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba