// File: /workspace/github_cpp_makefile_star2_O3/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 $0x278, %rsp            # imm = 0x278
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
leaq 0x58(%rsp), %rbx
movq $0x0, 0x30(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movups %xmm0, 0x18(%rbx)
movq %r12, 0x40(%rbx)
movq %rbx, %rdi
callq 0x5a070
movq %rbx, %rdi
callq 0x5a112
movq 0x18(%rbx), %rax
leaq 0xf0(%rsp), %rdi
movq %rax, -0x8(%rdi)
movups 0x20(%rbx), %xmm0
movups %xmm0, (%rdi)
movups 0x30(%rbx), %xmm0
movups %xmm0, 0x10(%rdi)
movq 0x40(%rbx), %rax
movq %rax, 0x20(%rdi)
leaq 0xa0(%rsp), %rax
movl $0x0, (%rax)
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
leaq 0xe8(%rsp), %rax
movq %rax, 0x8(%rsi)
callq 0x5a32a
leaq 0x78(%rsp), %rax
movq -0x8(%rax), %r14
movq 0x10(%rax), %r15
movups (%rax), %xmm0
movaps %xmm0, 0xc0(%rsp)
movups 0x18(%rax), %xmm0
movaps %xmm0, 0xb0(%rsp)
movl $0x0, 0x44(%rsp)
leaq 0xe8(%rsp), %rsi
movq %r15, (%rsi)
movq $0x40, 0x8(%rsi)
movq %r12, 0x10(%rsi)
xorl %edi, %edi
callq 0x57dd2
leaq 0xe8(%rsp), %rsi
movq %r15, (%rsi)
movq $0x40, 0x8(%rsi)
movq $0x1, 0x10(%rsi)
xorl %edi, %edi
callq 0x57de3
leaq 0xd8(%rsp), %rsi
movq %r15, (%rsi)
leaq 0x8(%rsp), %rdi
leaq 0x44(%rsp), %rdx
leaq 0x7(%rsp), %rcx
callq 0x57e7a
leaq 0x20(%rsp), %rbx
movq (%rbx), %r12
movups 0x8(%rbx), %xmm0
leaq 0x100(%rsp), %rdx
movups %xmm0, -0x10(%rdx)
movq %r12, -0x18(%rdx)
movq %r14, (%rdx)
movaps 0xc0(%rsp), %xmm0
movups %xmm0, 0x8(%rdx)
movq %r15, 0x18(%rdx)
movaps 0xb0(%rsp), %xmm0
movups %xmm0, 0x20(%rdx)
leaq 0xa0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x57aef
movq 0xa0(%rsp), %rax
movq 0x128(%rsp), %rcx
movq 0xf0(%rsp), %rdx
movq 0x108(%rsp), %rsi
leaq (,%rax,4), %rdi
shlq $0x2, %rdx
subq %r15, %rax
imulq %rcx, %rax
leaq (%rdi,%rax,4), %rax
subq %rdx, %rdi
addq %rdi, %r12
shlq $0x2, %rsi
subq %rsi, %rax
addq %rax, %r14
leaq 0x4(,%rcx,4), %rax
xorl %ecx, %ecx
movl (%r14), %edx
addl %edx, (%r12,%rcx,4)
incq %rcx
addq %rax, %r14
cmpq $0x40, %rcx
jne 0x502e9
leaq 0x18(%rsp), %rcx
movq -0x8(%rcx), %rax
movq %rax, 0x48(%rsp)
movq (%rcx), %rax
movq %rax, 0x50(%rsp)
movq 0x8(%rcx), %rax
movq %rax, 0x38(%rsp)
movq 0x10(%rcx), %r14
movq %rcx, -0x10(%rcx)
leaq 0x5fa58(%rip), %rsi     # 0xafd82
leaq 0x5fa63(%rip), %rdx     # 0xafd94
leaq 0x8(%rsp), %rdi
callq 0xd14c
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
callq 0xbf80
leaq 0x5332b(%rip), %rsi     # 0xa3684
leaq 0xe8(%rsp), %rdi
callq 0x18fba
leaq 0x5fa28(%rip), %rsi     # 0xafd95
movq %rax, %rdi
callq 0x1910a
leaq 0x56eda(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x503a1
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x2110
leaq 0x532dc(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x5a3b5(%rip), %rsi     # 0xaa76c
movq %rax, %rdi
callq 0x18fba
leaq 0x56e90(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x503eb
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x22f0
leaq 0x69ea7(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0xe8(%rsp), %rdi
callq 0xbfd8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x50423
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x5f96c(%rip), %rsi     # 0xafda3
leaq 0x5f97d(%rip), %rdx     # 0xafdbb
callq 0xd14c
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
callq 0xbf80
leaq 0x53223(%rip), %rsi     # 0xa3684
leaq 0xe8(%rsp), %rdi
callq 0x18fba
leaq 0x5f947(%rip), %rsi     # 0xafdbc
movq %rax, %rdi
callq 0x1990c
leaq 0x56dd2(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x504a9
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x40, %esi
callq 0x21b0
leaq 0x531d4(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x5f8fb(%rip), %rsi     # 0xafdba
movq %rax, %rdi
callq 0x18fba
leaq 0x56d88(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x504f3
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x40, %esi
callq 0x21b0
leaq 0x69d9f(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0xe8(%rsp), %rdi
callq 0xbfd8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5052b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x88(%rsp), %rbx
shlq $0x2, %r14
subq %r14, 0x38(%rsp)
movl $0x40, %r13d
leaq 0x8(%rsp), %r15
leaq 0xe8(%rsp), %rbp
movq 0x38(%rsp), %rax
movl (%rax,%rbx,4), %r12d
movq %rbx, %rax
subq 0x88(%rsp), %rax
imulq 0x98(%rsp), %rax
subq 0x78(%rsp), %rax
movq 0x70(%rsp), %rcx
addq %rbx, %rax
movl (%rcx,%rax,4), %r14d
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
leaq 0x5f83f(%rip), %rsi     # 0xafdd0
leaq 0x5f84c(%rip), %rdx     # 0xafde4
callq 0xd14c
xorl %esi, %esi
cmpl %r14d, %r12d
sete %sil
movq %rbp, %rdi
movq %r15, %r14
movq %r15, %rdx
callq 0xbf80
leaq 0x530c9(%rip), %r15     # 0xa3684
movq %rbp, %rdi
movq %r15, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x5f815(%rip), %rsi     # 0xafde5
callq 0x1902a
movq %rax, %rdi
leaq 0x56c77(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r12
cmpb $0x1, 0x188(%rax)
jne 0x50604
movq %r12, %rdi
addq $0x10, %rdi
movq 0x38(%rsp), %rax
movl (%rax,%rbx,4), %esi
callq 0x22f0
movq %r12, %rdi
movq %r15, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x5f7c4(%rip), %rsi     # 0xafddd
callq 0x1909a
movq %rax, %rdi
leaq 0x56c2e(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r12
cmpb $0x1, 0x188(%rax)
jne 0x50669
movq 0x70(%rsp), %rax
movq %rbx, %rcx
subq 0x88(%rsp), %rcx
imulq 0x98(%rsp), %rcx
subq 0x78(%rsp), %rcx
addq %rbx, %rcx
movq %r12, %rdi
addq $0x10, %rdi
movl (%rax,%rcx,4), %esi
callq 0x22f0
movq %r12, %rdi
leaq 0x69c26(%rip), %rsi     # 0xba299
callq 0x18fba
movq %rbp, %rdi
callq 0xbfd8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5069c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
incq %rbx
decq %r13
movq %r14, %r15
jne 0x5054f
movq 0x50(%rsp), %rsi
shlq $0x2, %rsi
movq 0x48(%rsp), %rdi
callq 0x21f0
cmpq $0x0, 0x70(%rsp)
je 0x506ff
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rsp)
movq $0x0, 0x88(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x98(%rsp)
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x50713
movq %rax, %r15
jmp 0x5078e
movq %rax, %r15
cmpq $0x0, 0x20(%rsp)
je 0x507e1
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x24e4
jmp 0x507e1
jmp 0x50748
jmp 0x50750
jmp 0x5073f
movq %rax, %r15
jmp 0x50772
jmp 0x50762
jmp 0x50750
movq %rax, %r15
jmp 0x507e1
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbfd8
jmp 0x50772
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbfd8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5078e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq $0x0, 0x38(%rsp)
jne 0x507ce
jmp 0x507e1
movq %rax, %r15
jmp 0x507ce
movq %rax, %r15
jmp 0x507b2
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbfd8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x507ce
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x50(%rsp), %rsi
shlq $0x2, %rsi
movq 0x48(%rsp), %rdi
callq 0x21f0
cmpq $0x0, 0x70(%rsp)
je 0x50822
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rsp)
movq $0x0, 0x88(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x98(%rsp)
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %r15, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc0a9