// File: /workspace/github_cpp_makefile_star2_O3/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, %r13 # imm = 0x8000000000000000
leaq 0x78(%rsp), %rbx
movq $0x0, 0x30(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movups %xmm0, 0x18(%rbx)
movq %r13, 0x40(%rbx)
movq %rbx, %rdi
callq 0x5a3a6
movq %rbx, %rdi
callq 0x5a444
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 0x38(%rsp), %rsi
movq %rax, (%rsi)
leaq 0xd0(%rsp), %rax
movq %rax, 0x8(%rsi)
callq 0x5a655
movq 0x90(%rsp), %rbx
movq 0x98(%rsp), %r15
movq 0xa8(%rsp), %r12
movq 0xb8(%rsp), %r14
movl $0x0, 0x34(%rsp)
leaq 0xd0(%rsp), %rdi
movq %r12, (%rdi)
movq %r13, 0x10(%rdi)
movq %r15, 0x18(%rdi)
movq %r13, 0x28(%rdi)
callq 0x582ae
leaq 0xd0(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rdi), %rcx
movq %rax, (%rdi)
movq %rcx, 0x10(%rdi)
callq 0x58313
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 0x5849a
cmpq %r15, 0x100(%rsp)
jne 0x5210d
cmpq %r12, 0xf0(%rsp)
jne 0x52124
movq 0xe8(%rsp), %r13
movq %rsp, %rdi
movq %r12, (%rdi)
movq %r15, 0x10(%rdi)
callq 0x58313
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, %r15
subq %r15, %rdi
movq %rdx, %r8
subq %r12, %r8
shlq $0x4, %r12
leaq (%r12,%r12,4), %r9
subq %r9, %rdi
addq %rdi, %r13
imulq %r14, %r8
leaq (%rsi,%r8,4), %rsi
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 0x51ac2
leaq 0x1(%rdx), %rsi
addq $0x50, %r13
addq %r14, %rbx
cmpq %rcx, %rdx
movq %rsi, %rdx
jne 0x51ac0
xorl %ecx, %ecx
movq %rcx, 0x68(%rsp)
movq %rcx, 0x58(%rsp)
leaq 0xd0(%rsp), %rdi
movq 0x8(%rdi), %rdx
movq %rdx, 0x40(%rsp)
movq %rcx, 0x8(%rdi)
movups 0x10(%rdi), %xmm0
movups %xmm0, 0x48(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movq 0x58(%rsp), %rcx
movq %rcx, (%rsp)
movq 0x60(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movq 0x68(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0x70(%rsp), %rcx
movq %rcx, 0x18(%rsp)
movzwl 0x18(%rax), %ecx
movw %cx, 0x70(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0x68(%rsp)
movzwl 0x8(%rax), %ecx
movw %cx, 0x60(%rsp)
movq (%rax), %rcx
movq %rcx, 0x58(%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 0x588f4
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5e2f3(%rip), %rsi     # 0xafe8b
leaq 0x5e2fa(%rip), %rdx     # 0xafe99
movq %rsp, %rdi
callq 0xd14c
leaq 0xd0(%rsp), %rdi
movq %rsp, %rdx
movl $0x1, %esi
callq 0xbf80
leaq 0x51ac1(%rip), %rsi     # 0xa3684
leaq 0xd0(%rsp), %rdi
callq 0x18fba
leaq 0x5e2c3(%rip), %rsi     # 0xafe9a
movq %rax, %rdi
callq 0x1902a
leaq 0x55670(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x51c0b
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x2, %esi
callq 0x2110
leaq 0x51a72(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x5a1cf(%rip), %rsi     # 0xabdf0
movq %rax, %rdi
callq 0x18fba
leaq 0x55626(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x51c55
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x2, %esi
callq 0x22f0
leaq 0x6863d(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0xd0(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x51c8c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x5e206(%rip), %rsi     # 0xafea4
leaq 0x5e217(%rip), %rdx     # 0xafebc
callq 0xd14c
leaq 0xd0(%rsp), %rdi
movq %rsp, %rdx
movl $0x1, %esi
callq 0xbf80
leaq 0x519be(%rip), %rsi     # 0xa3684
leaq 0xd0(%rsp), %rdi
callq 0x18fba
leaq 0x5e1e3(%rip), %rsi     # 0xafebd
movq %rax, %rdi
callq 0x1902a
leaq 0x5556d(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x51d0e
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x14, %esi
callq 0x21b0
leaq 0x5196f(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x5e18d(%rip), %rsi     # 0xafeb1
movq %rax, %rdi
callq 0x57bb2
leaq 0x55523(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x51d58
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x14, %esi
callq 0x21b0
leaq 0x6853a(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0xd0(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x51d8f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x5e126(%rip), %rsi     # 0xafec7
leaq 0x5e137(%rip), %rdx     # 0xafedf
callq 0xd14c
leaq 0xd0(%rsp), %rdi
movq %rsp, %rdx
movl $0x1, %esi
callq 0xbf80
leaq 0x518bb(%rip), %rsi     # 0xa3684
leaq 0xd0(%rsp), %rdi
callq 0x18fba
leaq 0x5e103(%rip), %rsi     # 0xafee0
movq %rax, %rdi
callq 0x190d2
leaq 0x5546a(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x51e11
movq %rbx, %rdi
addq $0x10, %rdi
movl $0xc, %esi
callq 0x21b0
leaq 0x5186c(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x5e0b0(%rip), %rsi     # 0xafed7
movq %rax, %rdi
callq 0x1a146
leaq 0x55420(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x51e5b
movq %rbx, %rdi
addq $0x10, %rdi
movl $0xc, %esi
callq 0x21b0
leaq 0x68437(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0xd0(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x51e92
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x68(%rsp), %rcx
leaq 0x13(%rcx), %rax
movq %rax, 0xc0(%rsp)
movq %rcx, 0x28(%rsp)
leaq (,%rcx,4), %rcx
movq %rsp, %rbp
movq 0x58(%rsp), %r15
leaq (%r15,%r15,4), %r13
shlq $0x4, %r13
movq %rcx, 0xc8(%rsp)
addq %rcx, %r13
movl $0xc, %ebx
movq 0x68(%rsp), %rax
movq 0x50(%rsp), %rcx
movq 0x58(%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 0xa8(%rsp), %rax
movq 0x90(%rsp), %rcx
imulq 0xb8(%rsp), %rax
addq 0x28(%rsp), %rax
subq 0x98(%rsp), %rax
movl (%rcx,%rax,4), %r12d
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %rbp, %rdi
leaq 0x5df24(%rip), %rsi     # 0xafe57
leaq 0x5df30(%rip), %rdx     # 0xafe6a
callq 0xd14c
xorl %esi, %esi
cmpl %r12d, %r14d
sete %sil
leaq 0xd0(%rsp), %rdi
movq %rbp, %r12
movq %rbp, %rdx
movq %rdi, %rbp
callq 0xbf80
movq %rbp, %rdi
leaq 0x5171c(%rip), %rsi     # 0xa3684
callq 0x18fba
movq %rax, %rdi
leaq 0x5def4(%rip), %rsi     # 0xafe6b
callq 0x1a146
movq %rax, %rdi
leaq 0x552d0(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x51fc6
movq 0x68(%rsp), %rax
movq 0x50(%rsp), %rcx
movq 0x58(%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 0x516b4(%rip), %rsi     # 0xa3684
callq 0x18fba
movq %rax, %rdi
leaq 0x5de84(%rip), %rsi     # 0xafe63
callq 0x1909a
movq %rax, %rdi
leaq 0x55268(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x52037
movq %r15, %rax
subq 0xa8(%rsp), %rax
imulq 0xb8(%rsp), %rax
addq 0x28(%rsp), %rax
subq 0x98(%rsp), %rax
movq 0x90(%rsp), %rcx
movq %r14, %rdi
addq $0x10, %rdi
movl (%rcx,%rax,4), %esi
callq 0x22f0
movq %r14, %rdi
leaq 0x68258(%rip), %rsi     # 0xba299
callq 0x18fba
movq %rbp, %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x52069
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
incq %r15
addq $0x50, %r13
decq %rbx
movq %r12, %rbp
jne 0x51ed0
movq 0x28(%rsp), %rdx
leaq 0x1(%rdx), %rax
movq 0xc8(%rsp), %rcx
addq $0x4, %rcx
cmpq 0xc0(%rsp), %rdx
movq %rax, 0x28(%rsp)
jne 0x51eb3
leaq 0x38(%rsp), %rdi
callq 0x588f4
cmpq $0x0, 0x90(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
je 0x520fb
xorps %xmm0, %xmm0
movups %xmm0, 0x90(%rsp)
movq $0x0, 0xa8(%rsp)
movq %rax, 0xb8(%rsp)
movq 0x80(%rsp), %rdi
movq 0x88(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5e6cc(%rip), %rdi     # 0xb07e0
leaq 0x5e6e4(%rip), %rsi     # 0xb07ff
leaq 0x5eee3(%rip), %rcx     # 0xb1005
jmp 0x52139
leaq 0x5e6b5(%rip), %rdi     # 0xb07e0
leaq 0x5e6cd(%rip), %rsi     # 0xb07ff
leaq 0x5ef4f(%rip), %rcx     # 0xb1088
movl $0xf2, %edx
callq 0x2100
jmp 0x52252
jmp 0x521bc
jmp 0x521bc
jmp 0x521bc
jmp 0x52252
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x588f4
jmp 0x521fb
jmp 0x52252
jmp 0x52181
jmp 0x52186
jmp 0x52198
jmp 0x521aa
jmp 0x521c1
jmp 0x521c1
jmp 0x521c1
jmp 0x52186
jmp 0x52198
jmp 0x521aa
movq %rax, %rbx
jmp 0x521fb
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xbfd8
jmp 0x521d6
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xbfd8
jmp 0x521d6
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xbfd8
jmp 0x521d6
movq %rax, %rbx
jmp 0x521f1
movq %rax, %rbx
jmp 0x521d6
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x521f1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x38(%rsp), %rdi
callq 0x588f4
cmpq $0x0, 0x90(%rsp)
je 0x52248
xorps %xmm0, %xmm0
movups %xmm0, 0x90(%rsp)
movq $0x0, 0xa8(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0xb8(%rsp)
movq 0x80(%rsp), %rdi
movq 0x88(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
jmp 0x52252
movq %rax, %rdi
callq 0xc0a9