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

  // Compute trace(A) = sum(diag(A))
  int tr = make_ein_sum<int>(ein<i, i>(A));

  int tr_ref = 0;
  for (index_t i : A.i()) {
    tr_ref += A(i, i);
  }
  ASSERT_EQ(tr, tr_ref);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
leaq 0x10(%rsp), %rbx
movq $0x0, 0x30(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movups %xmm0, 0x18(%rbx)
movq %rax, 0x40(%rbx)
movq %rbx, %rdi
callq 0x58bc8
movq %rbx, %rdi
callq 0x58c6a
movq 0x18(%rbx), %rax
leaq 0x80(%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 0xc(%rsp), %rax
movl $0x0, (%rax)
leaq 0x58(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x78(%rsp), %rax
movq %rax, 0x8(%rsi)
callq 0x58e77
movq 0x28(%rsp), %rbx
movq 0x30(%rsp), %r15
movq 0x40(%rsp), %rbp
movq 0x50(%rsp), %r13
leaq 0xc(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x78(%rsp), %rdi
leaq 0xb(%rsp), %rsi
leaq 0xa(%rsp), %rcx
callq 0x56f84
leaq 0x90(%rsp), %r14
movq (%r14), %r12
leaq 0x58(%rsp), %rsi
movq %rbp, (%rsi)
movq $0x40, 0x8(%rsi)
movq $0x0, 0x10(%rsi)
xorl %edi, %edi
callq 0x56fc1
movl (%r12), %eax
shlq $0x2, %rbp
shlq $0x2, %r15
subq %r15, %rbp
addq %rbp, %rbx
leaq 0x4(,%r13,4), %rcx
movl $0x40, %edx
addl (%rbx), %eax
movl %eax, (%r12)
addq %rcx, %rbx
decq %rdx
jne 0x4fe0f
movq 0x80(%rsp), %rdi
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rax
movl (%rax), %ebp
shlq $0x2, %rsi
callq 0x21f0
movq 0x30(%rsp), %rcx
movq 0x40(%rsp), %rax
shlq $0x2, %rax
shlq $0x2, %rcx
subq %rcx, %rax
addq 0x28(%rsp), %rax
movq 0x50(%rsp), %rcx
leaq 0x4(,%rcx,4), %rcx
xorl %edx, %edx
xorl %ebx, %ebx
addl (%rax), %ebx
incq %rdx
addq %rcx, %rax
cmpq $0x40, %rdx
jne 0x4fe6b
leaq 0x68(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x5e058(%rip), %rsi     # 0xadee2
leaq 0x5e05d(%rip), %rdx     # 0xadeee
leaq 0x58(%rsp), %rdi
callq 0xd0b8
xorl %esi, %esi
cmpl %ebx, %ebp
sete %sil
leaq 0x78(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0xbf0a
leaq 0x5179b(%rip), %rsi     # 0xa1654
leaq 0x78(%rsp), %rdi
callq 0x18a16
leaq 0x5e025(%rip), %rsi     # 0xadeef
movq %rax, %rdi
callq 0x18bd6
leaq 0x55451(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x4fefb
movq %r14, %rdi
addq $0x10, %rdi
movl %ebp, %esi
callq 0x22f0
leaq 0x51752(%rip), %rsi     # 0xa1654
movq %r14, %rdi
callq 0x18a16
leaq 0x5dfd7(%rip), %rsi     # 0xadee8
movq %rax, %rdi
callq 0x56a24
leaq 0x5540a(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x4ff42
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
leaq 0x68420(%rip), %rsi     # 0xb8369
movq %r14, %rdi
callq 0x18a16
leaq 0x78(%rsp), %rdi
callq 0xbf62
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
je 0x4ff72
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq $0x0, 0x28(%rsp)
je 0x4ffb0
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rsp)
xorl %ebx, %ebx
movq %rbx, 0x40(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x50(%rsp)
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %rbx, 0x18(%rsp)
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4ffe3
movq %rax, %rbx
cmpq $0x0, 0x90(%rsp)
je 0x50011
leaq 0x78(%rsp), %rsi
movq %r14, %rdi
callq 0x250b
jmp 0x50011
jmp 0x4ffe3
movq %rax, %rbx
jmp 0x50011
movq %rax, %rbx
jmp 0x4fffa
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0xbf62
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
je 0x50011
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq $0x0, 0x28(%rsp)
je 0x50050
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rsp)
xorl %r14d, %r14d
movq %r14, 0x40(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x50(%rsp)
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %r14, 0x18(%rsp)
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036