// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/ein_reduce.cpp
// Function: nda::test_make_ein_sum_diag_body()
TEST(make_ein_sum_diag) {
  constexpr index_t N = 64;
  matrix<int, N, N> A;
  fill_pattern(A);

  // Make diag(A), the digonal of the matrix A.
  vector<int, N> a_diag = make_ein_sum<int, i>(ein<i, i>(A));

  ASSERT_EQ(a_diag.rank(), 1);
  ASSERT_EQ(a_diag.i().extent(), N);
  for (index_t i : A.i()) {
    ASSERT_EQ(a_diag(i), A(i, i));
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq $0x40, 0x50(%rsp)
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x46ac0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x46ae8
movq 0x80(%rsp), %rbx
movups 0x88(%rsp), %xmm0
movaps %xmm0, 0xb0(%rsp)
movq 0x98(%rsp), %r14
movups 0xa0(%rsp), %xmm0
movaps %xmm0, 0xf0(%rsp)
andl $0x0, 0x4(%rsp)
leaq 0x108(%rsp), %rsi
movq %r14, (%rsi)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x10(%rsi)
leaq 0x8(%rsp), %rdi
callq 0x47176
leaq 0x58(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x47144
leaq 0x8(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x4(%rsp), %rdx
leaq 0x3(%rsp), %rcx
callq 0x4734e
movq 0x20(%rsp), %r15
movups 0x28(%rsp), %xmm0
leaq 0x120(%rsp), %rdx
movups %xmm0, -0x10(%rdx)
movq %r15, -0x18(%rdx)
movq %rbx, (%rdx)
movaps 0xb0(%rsp), %xmm0
movups %xmm0, 0x8(%rdx)
movq %r14, 0x18(%rdx)
movaps 0xf0(%rsp), %xmm0
movups %xmm0, 0x20(%rdx)
leaq 0x38(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x46a60
movq 0x38(%rsp), %rax
movq 0x148(%rsp), %rcx
movq 0x110(%rsp), %rdx
movq 0x128(%rsp), %rsi
leaq (,%rax,4), %rdi
shlq $0x2, %rdx
subq %r14, %rax
imulq %rcx, %rax
leaq (%rdi,%rax,4), %rax
subq %rdx, %rdi
addq %rdi, %r15
shlq $0x2, %rsi
subq %rsi, %rax
addq %rax, %rbx
leaq 0x4(,%rcx,4), %rax
xorl %ecx, %ecx
cmpq $0x40, %rcx
je 0x40f8a
movl (%rbx), %edx
addl %edx, (%r15,%rcx,4)
incq %rcx
addq %rax, %rbx
jmp 0x40f76
leaq 0xc0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x47112
leaq 0x8(%rsp), %rdi
callq 0x46b1e
leaq 0x593a5(%rip), %rsi     # 0x9a352
leaq 0x8(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x66a0
leaq 0x108(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x8(%rsp), %rdx
callq 0x6894
leaq 0x4c66c(%rip), %rsi     # 0x8d647
leaq 0x108(%rsp), %rdi
callq 0x106fe
leaq 0x59376(%rip), %rsi     # 0x9a365
movq %rax, %rdi
callq 0x1085e
leaq 0x505f4(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x38(%rsp), %rsi
movq $0x1, (%rsi)
movq %rax, %rdi
callq 0x11052
leaq 0x4c626(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x53ccc(%rip), %rsi     # 0x94cfc
movq %rax, %rdi
callq 0x106fe
leaq 0x505b3(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x58(%rsp), %rsi
movl $0x1, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x64241(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x108(%rsp), %rdi
callq 0x68d4
leaq 0x8(%rsp), %rdi
callq 0x2090
leaq 0x592ec(%rip), %rsi     # 0x9a373
leaq 0x8(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x66a0
leaq 0x108(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x8(%rsp), %rdx
callq 0x6894
leaq 0x4c595(%rip), %rsi     # 0x8d647
leaq 0x108(%rsp), %rdi
callq 0x106fe
leaq 0x592c6(%rip), %rsi     # 0x9a38c
movq %rax, %rdi
callq 0x11036
leaq 0x5051d(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x38(%rsp), %rsi
movq $0x40, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x4c54f(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x59283(%rip), %rsi     # 0x9a38a
movq %rax, %rdi
callq 0x106fe
leaq 0x504dc(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x50(%rsp), %rsi
movq %rax, %rdi
callq 0x107ba
leaq 0x64170(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x108(%rsp), %rdi
callq 0x68d4
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x2090
movq 0x98(%rsp), %r15
leaq 0x40(%r15), %rax
movq %rax, 0x48(%rsp)
leaq 0x108(%rsp), %rbx
leaq 0x4c4d3(%rip), %rbp     # 0x8d647
cmpq 0x48(%rsp), %r15
je 0x412b8
movq %r15, %rax
subq 0xe0(%rsp), %rax
movq 0xd8(%rsp), %rcx
movl (%rcx,%rax,4), %r13d
movq 0x80(%rsp), %rax
movq %r15, %rcx
subq 0x98(%rsp), %rcx
imulq 0xa8(%rsp), %rcx
addq %r15, %rcx
subq 0x88(%rsp), %rcx
movl (%rax,%rcx,4), %r14d
movq %r12, %rdi
leaq 0x591d5(%rip), %rsi     # 0x9a3a0
leaq 0x38(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl %r14d, %r13d
sete %sil
movq %rbx, %rdi
movq %r12, %rdx
callq 0x6894
leaq 0x50402(%rip), %r12     # 0x915f2
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x591b0(%rip), %rsi     # 0x9a3b5
callq 0x1079e
movq %rax, %rdi
movq %r12, %rsi
callq 0x106fe
movq %r15, %rsi
subq 0xe0(%rsp), %rsi
shlq $0x2, %rsi
addq 0xd8(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
movq %rbp, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x59164(%rip), %rsi     # 0x9a3ad
callq 0x107f4
movq %rax, %rdi
movq %r12, %rsi
callq 0x106fe
movq %r15, %rsi
subq 0x98(%rsp), %rsi
imulq 0xa8(%rsp), %rsi
addq %r15, %rsi
subq 0x88(%rsp), %rsi
shlq $0x2, %rsi
addq 0x80(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
leaq 0x6400c(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %rbx, %rdi
callq 0x68d4
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x2090
incq %r15
jmp 0x41174
leaq 0xc0(%rsp), %rdi
callq 0x46b1e
leaq 0x68(%rsp), %rdi
callq 0x46b2e
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x41326
jmp 0x41326
jmp 0x412e7
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
jmp 0x41352
jmp 0x412fd
jmp 0x4132b
jmp 0x41302
jmp 0x4132b
jmp 0x41314
jmp 0x41302
movq %rax, %rbx
jmp 0x41357
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x68d4
jmp 0x41340
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x68d4
jmp 0x41340
movq %rax, %rbx
jmp 0x4134a
movq %rax, %rbx
jmp 0x41340
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x68d4
leaq 0x8(%rsp), %rdi
callq 0x2090
leaq 0xc0(%rsp), %rdi
callq 0x46b1e
leaq 0x68(%rsp), %rdi
callq 0x46b2e
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba