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

  // Transpose A using an ein_sum.
  auto AT = make_ein_sum<int, i, j>(ein<j, i>(A));

  ASSERT_EQ(AT.rank(), 2);
  ASSERT_EQ(AT.rows(), A.columns());
  ASSERT_EQ(AT.columns(), A.rows());
  for (index_t i : AT.i()) {
    for (index_t j : AT.j()) {
      ASSERT_EQ(AT(i, j), A(j, i));
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
leaq 0x38(%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 0x58ef2
movq %rbx, %rdi
callq 0x58f92
movq 0x18(%rbx), %rax
leaq 0xd8(%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)
movq %rsp, %rax
movl $0x0, (%rax)
leaq 0x80(%rsp), %rsi
movq %rax, (%rsi)
leaq 0xd0(%rsp), %rax
movq %rax, 0x8(%rsi)
callq 0x591a4
movq 0x50(%rsp), %rbx
movq 0x58(%rsp), %r15
movq 0x68(%rsp), %r13
movq 0x78(%rsp), %r14
movl $0x0, 0x34(%rsp)
leaq 0xd0(%rsp), %rdi
movq %r13, (%rdi)
movq %r12, 0x10(%rdi)
movq %r15, 0x18(%rdi)
movq %r12, 0x28(%rdi)
callq 0x5715e
leaq 0xd0(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rdi), %rcx
movq %rax, (%rdi)
movq %rcx, 0x10(%rdi)
callq 0x571db
leaq 0xd0(%rsp), %rdi
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
leaq 0x260(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm1, 0x10(%rsi)
leaq 0x34(%rsp), %rdx
leaq 0x27(%rsp), %rcx
callq 0x57362
movq 0x100(%rsp), %rbp
cmpq %r15, %rbp
jne 0x511a7
movq 0xf0(%rsp), %r12
movq %r13, 0x28(%rsp)
cmpq %r13, %r12
jne 0x511be
movq 0xe8(%rsp), %r13
movq %rsp, %rdi
movq %r12, (%rdi)
movq %rbp, 0x10(%rdi)
callq 0x571db
leaq 0xf0(%rsp), %rax
movq (%rsp), %rdx
movq 0x10(%rsp), %rsi
leaq 0xb(%rdx), %rcx
leaq (%rdx,%rdx,4), %rdi
shlq $0x4, %rdi
leaq (%rdi,%rsi,4), %rdi
shlq $0x2, %rsi
shlq $0x2, %rbp
subq %rbp, %rdi
shlq $0x4, %r12
leaq (%r12,%r12,4), %r8
subq %r8, %rdi
addq %rdi, %r13
movq %rdx, %rdi
subq 0x28(%rsp), %rdi
imulq %r14, %rdi
leaq (%rsi,%rdi,4), %rsi
shlq $0x2, %r15
subq %r15, %rsi
addq %rsi, %rbx
shlq $0x2, %r14
xorl %esi, %esi
movl (%rbx,%rsi,4), %edi
addl %edi, (%r13,%rsi,4)
incq %rsi
cmpq $0x14, %rsi
jne 0x50b4a
leaq 0x1(%rdx), %rsi
addq $0x50, %r13
addq %r14, %rbx
cmpq %rcx, %rdx
movq %rsi, %rdx
jne 0x50b48
movq $0x0, 0xb0(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%rsp)
leaq 0xd0(%rsp), %rdi
movups 0x8(%rdi), %xmm1
movups %xmm1, 0x88(%rsp)
movups %xmm0, 0x8(%rdi)
movq 0x98(%rsp), %rcx
movq 0x18(%rdi), %rdx
movq %rdx, 0x98(%rsp)
movq %rcx, 0x18(%rdi)
movups 0xa0(%rsp), %xmm0
movaps %xmm0, (%rsp)
movq 0xb0(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0xb8(%rsp), %rcx
movq %rcx, 0x18(%rsp)
movzwl 0x18(%rax), %ecx
movw %cx, 0xb8(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0xb0(%rsp)
movq (%rax), %rcx
movq %rcx, 0xa0(%rsp)
movzwl 0x8(%rax), %ecx
movw %cx, 0xa8(%rsp)
movzwl 0x18(%rsp), %ecx
movw %cx, 0x18(%rax)
movq 0x10(%rsp), %rcx
movq %rcx, 0x10(%rax)
movzwl 0x8(%rsp), %ecx
movw %cx, 0x8(%rax)
movq (%rsp), %rcx
movq %rcx, (%rax)
callq 0x577c2
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5d31a(%rip), %rsi     # 0xadf5b
leaq 0x5d321(%rip), %rdx     # 0xadf69
movq %rsp, %rdi
callq 0xd0b8
leaq 0xd0(%rsp), %rdi
movq %rsp, %rdx
movl $0x1, %esi
callq 0xbf0a
leaq 0x509e8(%rip), %rsi     # 0xa1654
leaq 0xd0(%rsp), %rdi
callq 0x18a16
leaq 0x5d2ea(%rip), %rsi     # 0xadf6a
movq %rax, %rdi
callq 0x18a86
leaq 0x5469b(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x50cb4
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x2, %esi
callq 0x2110
leaq 0x50999(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x59316(%rip), %rsi     # 0xa9fe0
movq %rax, %rdi
callq 0x18a16
leaq 0x54651(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x50cfe
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x2, %esi
callq 0x22f0
leaq 0x67664(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xd0(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x50d35
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x5d22d(%rip), %rsi     # 0xadf74
leaq 0x5d23e(%rip), %rdx     # 0xadf8c
callq 0xd0b8
leaq 0xd0(%rsp), %rdi
movq %rsp, %rdx
movl $0x1, %esi
callq 0xbf0a
leaq 0x508e5(%rip), %rsi     # 0xa1654
leaq 0xd0(%rsp), %rdi
callq 0x18a16
leaq 0x5d20a(%rip), %rsi     # 0xadf8d
movq %rax, %rdi
callq 0x18a86
leaq 0x54598(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x50db7
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x14, %esi
callq 0x21b0
leaq 0x50896(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x5d1b4(%rip), %rsi     # 0xadf81
movq %rax, %rdi
callq 0x56a5c
leaq 0x5454e(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x50e01
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x14, %esi
callq 0x21b0
leaq 0x67561(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xd0(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x50e38
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x5d14d(%rip), %rsi     # 0xadf97
leaq 0x5d15e(%rip), %rdx     # 0xadfaf
callq 0xd0b8
leaq 0xd0(%rsp), %rdi
movq %rsp, %rdx
movl $0x1, %esi
callq 0xbf0a
leaq 0x507e2(%rip), %rsi     # 0xa1654
leaq 0xd0(%rsp), %rdi
callq 0x18a16
leaq 0x5d12a(%rip), %rsi     # 0xadfb0
movq %rax, %rdi
callq 0x18b2e
leaq 0x54495(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x50eba
movq %rbx, %rdi
addq $0x10, %rdi
movl $0xc, %esi
callq 0x21b0
leaq 0x50793(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x5d0d7(%rip), %rsi     # 0xadfa7
movq %rax, %rdi
callq 0x19c24
leaq 0x5444b(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x50f04
movq %rbx, %rdi
addq $0x10, %rdi
movl $0xc, %esi
callq 0x21b0
leaq 0x6745e(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xd0(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x50f3b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0xb0(%rsp), %rcx
leaq 0x13(%rcx), %rax
movq %rax, 0xc0(%rsp)
movq %rcx, 0x28(%rsp)
leaq (,%rcx,4), %rcx
movq %rsp, %rbp
movq 0xa0(%rsp), %r15
leaq (%r15,%r15,4), %r13
shlq $0x4, %r13
movq %rcx, 0xc8(%rsp)
addq %rcx, %r13
movl $0xc, %ebx
movq 0xb0(%rsp), %rax
movq 0x98(%rsp), %rcx
movq 0xa0(%rsp), %rdx
leaq (%rdx,%rdx,4), %rdx
shlq $0x4, %rdx
leaq (%rdx,%rax,4), %rax
subq %rax, %rcx
movl (%r13,%rcx), %r14d
movq %r15, %rax
subq 0x68(%rsp), %rax
movq 0x50(%rsp), %rcx
imulq 0x78(%rsp), %rax
addq 0x28(%rsp), %rax
subq 0x58(%rsp), %rax
movl (%rcx,%rax,4), %r12d
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %rbp, %rdi
leaq 0x5cf48(%rip), %rsi     # 0xadf27
leaq 0x5cf54(%rip), %rdx     # 0xadf3a
callq 0xd0b8
xorl %esi, %esi
cmpl %r12d, %r14d
sete %sil
leaq 0xd0(%rsp), %rdi
movq %rbp, %rdx
movq %rdi, %rbp
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
callq 0xbf0a
movq %rbp, %rdi
leaq 0x50639(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x5cf11(%rip), %rsi     # 0xadf3b
callq 0x19c24
movq %rax, %rdi
leaq 0x542f1(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x51082
movq 0xb0(%rsp), %rax
movq 0x98(%rsp), %rcx
movq 0xa0(%rsp), %rdx
leaq (%rdx,%rdx,4), %rdx
shlq $0x4, %rdx
leaq (%rdx,%rax,4), %rax
subq %rax, %rcx
movq %r14, %rdi
addq $0x10, %rdi
movl (%r13,%rcx), %esi
callq 0x22f0
movq %r14, %rdi
leaq 0x505c8(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x5ce98(%rip), %rsi     # 0xadf33
callq 0x18af6
movq %rax, %rdi
leaq 0x54280(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x510e7
movq %r15, %rax
subq 0x68(%rsp), %rax
imulq 0x78(%rsp), %rax
addq 0x28(%rsp), %rax
subq 0x58(%rsp), %rax
movq 0x50(%rsp), %rcx
movq %r14, %rdi
addq $0x10, %rdi
movl (%rcx,%rax,4), %esi
callq 0x22f0
movq %r14, %rdi
leaq 0x67278(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %rbp, %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x51119
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
incq %r15
addq $0x50, %r13
decq %rbx
movq %rsp, %rbp
jne 0x50f7f
movq 0x28(%rsp), %rdx
leaq 0x1(%rdx), %rax
movq 0xc8(%rsp), %rcx
addq $0x4, %rcx
cmpq 0xc0(%rsp), %rdx
movq %rax, 0x28(%rsp)
jne 0x50f5f
leaq 0x80(%rsp), %rdi
callq 0x577c2
cmpq $0x0, 0x50(%rsp)
je 0x51195
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rsp)
xorl %ebx, %ebx
movq %rbx, 0x68(%rsp)
movq %r12, 0x78(%rsp)
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %rbx, 0x40(%rsp)
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5d702(%rip), %rdi     # 0xae8b0
leaq 0x5d71a(%rip), %rsi     # 0xae8cf
leaq 0x5df19(%rip), %rcx     # 0xaf0d5
jmp 0x511d3
leaq 0x5d6eb(%rip), %rdi     # 0xae8b0
leaq 0x5d703(%rip), %rsi     # 0xae8cf
leaq 0x5df85(%rip), %rcx     # 0xaf158
movl $0xf2, %edx
callq 0x2100
jmp 0x51315
jmp 0x5128a
jmp 0x5128a
jmp 0x5128a
jmp 0x51315
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x577c2
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
jmp 0x512d6
jmp 0x51315
jmp 0x51231
jmp 0x51239
jmp 0x5124b
jmp 0x5125d
jmp 0x51226
jmp 0x51226
movq %rax, %rbx
jmp 0x5126d
jmp 0x51239
jmp 0x5124b
jmp 0x5125d
movq %rax, %rbx
jmp 0x512d6
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xbf62
jmp 0x5126d
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xbf62
jmp 0x5126d
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5128d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
jmp 0x5128d
movq %rax, %rbx
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
jmp 0x512c9
movq %rax, %rbx
jmp 0x512ae
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x512c9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x80(%rsp), %rdi
callq 0x577c2
cmpq $0x0, 0x50(%rsp)
je 0x5130b
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rsp)
xorl %r14d, %r14d
movq %r14, 0x68(%rsp)
movq %r12, 0x78(%rsp)
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %r14, 0x40(%rsp)
movq %rbx, %rdi
callq 0x2300
jmp 0x51315
movq %rax, %rdi
callq 0xc036