// File: /workspace/github_cpp_makefile_star2_O1/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, %r15 # imm = 0x8000000000000000
leaq 0x58(%rsp), %rbx
movq $0x0, 0x30(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movups %xmm0, 0x18(%rbx)
movq %r15, 0x40(%rbx)
movq %rbx, %rdi
callq 0x58bc8
movq %rbx, %rdi
callq 0x58c6a
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 0x58e77
leaq 0x78(%rsp), %rax
movq -0x8(%rax), %r14
movq 0x10(%rax), %r12
movups (%rax), %xmm0
movaps %xmm0, 0xc0(%rsp)
movups 0x18(%rax), %xmm0
movaps %xmm0, 0xb0(%rsp)
movl $0x0, 0x44(%rsp)
leaq 0xe8(%rsp), %rsi
movq %r12, (%rsi)
movq $0x40, 0x8(%rsi)
movq %r15, 0x10(%rsi)
xorl %edi, %edi
callq 0x56c82
leaq 0xe8(%rsp), %rsi
movq %r12, (%rsi)
movq $0x40, 0x8(%rsi)
movq $0x1, 0x10(%rsi)
xorl %edi, %edi
callq 0x56c93
leaq 0xd8(%rsp), %rsi
movq %r12, (%rsi)
leaq 0x8(%rsp), %rdi
leaq 0x44(%rsp), %rdx
leaq 0x7(%rsp), %rcx
callq 0x56d2a
leaq 0x20(%rsp), %rbx
movq (%rbx), %r15
movups 0x8(%rbx), %xmm0
leaq 0x100(%rsp), %rdx
movups %xmm0, -0x10(%rdx)
movq %r15, -0x18(%rdx)
movq %r14, (%rdx)
movaps 0xc0(%rsp), %xmm0
movups %xmm0, 0x8(%rdx)
movq %r12, 0x18(%rdx)
movaps 0xb0(%rsp), %xmm0
movups %xmm0, 0x20(%rdx)
leaq 0xa0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x56996
movq 0xa0(%rsp), %rax
movq 0x128(%rsp), %rcx
movq 0xf0(%rsp), %rdx
movq 0x108(%rsp), %rsi
leaq (,%rax,4), %rdi
shlq $0x2, %rdx
subq 0x118(%rsp), %rax
imulq %rcx, %rax
leaq (%rdi,%rax,4), %rax
subq %rdx, %rdi
addq %rdi, %r15
shlq $0x2, %rsi
subq %rsi, %rax
addq %rax, %r14
leaq 0x4(,%rcx,4), %rax
xorl %ecx, %ecx
movl (%r14), %edx
addl %edx, (%r15,%rcx,4)
incq %rcx
addq %rax, %r14
cmpq $0x40, %rcx
jne 0x4f39e
leaq 0x18(%rsp), %rcx
movq -0x8(%rcx), %r12
movq (%rcx), %r15
movq 0x8(%rcx), %rax
movq %rax, 0x38(%rsp)
movq 0x10(%rcx), %r14
movq %rcx, -0x10(%rcx)
leaq 0x5ea7d(%rip), %rsi     # 0xade52
leaq 0x5ea88(%rip), %rdx     # 0xade64
leaq 0x8(%rsp), %rdi
movq %r15, 0x50(%rsp)
movq %r12, 0x48(%rsp)
callq 0xd0b8
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
callq 0xbf0a
leaq 0x52246(%rip), %rsi     # 0xa1654
leaq 0xe8(%rsp), %rdi
callq 0x18a16
leaq 0x5ea43(%rip), %rsi     # 0xade65
movq %rax, %rdi
callq 0x18b66
leaq 0x55ef9(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x4f456
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x2110
leaq 0x521f7(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x594f0(%rip), %rsi     # 0xa895c
movq %rax, %rdi
callq 0x18a16
leaq 0x55eaf(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x4f4a0
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x22f0
leaq 0x68ec2(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4f4d8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x5e987(%rip), %rsi     # 0xade73
leaq 0x5e998(%rip), %rdx     # 0xade8b
callq 0xd0b8
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
callq 0xbf0a
leaq 0x5213e(%rip), %rsi     # 0xa1654
leaq 0xe8(%rsp), %rdi
callq 0x18a16
leaq 0x5e962(%rip), %rsi     # 0xade8c
movq %rax, %rdi
callq 0x19340
leaq 0x55df1(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x4f55e
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x40, %esi
callq 0x21b0
leaq 0x520ef(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x5e916(%rip), %rsi     # 0xade8a
movq %rax, %rdi
callq 0x18a16
leaq 0x55da7(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x4f5a8
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x40, %esi
callq 0x21b0
leaq 0x68dba(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4f5e0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x88(%rsp), %rbx
shlq $0x2, %r14
movq 0x38(%rsp), %r13
subq %r14, %r13
movl $0x40, %r14d
leaq 0x8(%rsp), %rbp
movl (%r13,%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), %r15d
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %rbp, %rdi
leaq 0x5e863(%rip), %rsi     # 0xadea0
leaq 0x5e870(%rip), %rdx     # 0xadeb4
callq 0xd0b8
xorl %esi, %esi
cmpl %r15d, %r12d
sete %sil
leaq 0xe8(%rsp), %rdi
movq %rbp, %r15
movq %rbp, %rdx
movq %rdi, %rbp
callq 0xbf0a
movq %rbp, %rdi
leaq 0x51fe2(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x5e834(%rip), %rsi     # 0xadeb5
callq 0x18a86
movq %rax, %rdi
leaq 0x55c9a(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r12
cmpb $0x1, 0x188(%rax)
jne 0x4f6b2
movq %r12, %rdi
addq $0x10, %rdi
movl (%r13,%rbx,4), %esi
callq 0x22f0
movq %r12, %rdi
leaq 0x51f98(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x5e7e2(%rip), %rsi     # 0xadead
callq 0x18af6
movq %rax, %rdi
leaq 0x55c50(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r12
cmpb $0x1, 0x188(%rax)
jne 0x4f71b
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 0x68c44(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %rbp, %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4f74e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
incq %rbx
decq %r14
movq %r15, %rbp
jne 0x4f5ff
cmpq $0x0, 0x38(%rsp)
je 0x4f778
movq 0x50(%rsp), %rsi
shlq $0x2, %rsi
movq 0x48(%rsp), %rdi
callq 0x21f0
cmpq $0x0, 0x70(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
je 0x4f7bc
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rsp)
xorl %ebx, %ebx
movq %rbx, 0x88(%rsp)
movq %rax, 0x98(%rsp)
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %rbx, 0x60(%rsp)
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4f828
jmp 0x4f828
movq %rax, %r15
cmpq $0x0, 0x20(%rsp)
je 0x4f879
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x24e9
jmp 0x4f879
jmp 0x4f7ff
jmp 0x4f804
jmp 0x4f82d
jmp 0x4f82d
jmp 0x4f816
jmp 0x4f804
movq %rax, %r15
jmp 0x4f879
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbf62
jmp 0x4f842
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbf62
jmp 0x4f842
movq %rax, %r15
jmp 0x4f85e
movq %rax, %r15
jmp 0x4f842
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4f85e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq $0x0, 0x38(%rsp)
je 0x4f879
movq 0x50(%rsp), %rsi
shlq $0x2, %rsi
movq 0x48(%rsp), %rdi
callq 0x21f0
cmpq $0x0, 0x70(%rsp)
je 0x4f8bd
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rsp)
xorl %ebx, %ebx
movq %rbx, 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 %rbx, 0x60(%rsp)
movq %r15, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036