// File: /workspace/github_cpp_makefile_star2_O2/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
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
callq 0x46ba6
movq %rbx, %rdi
xorl %esi, %esi
callq 0x46bce
movq 0x70(%rsp), %r13
movq 0x78(%rsp), %rbx
movq 0x88(%rsp), %rax
andl $0x0, 0x8(%rsp)
movq 0x98(%rsp), %rbp
leaq 0x18(%rsp), %rdx
movq %rax, 0x10(%rsp)
movq %rax, (%rdx)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x10(%rdx)
leaq 0x100(%rsp), %rsi
movq %rbx, (%rsi)
movq %rax, 0x10(%rsi)
leaq 0x118(%rsp), %rdi
callq 0x47b80
leaq 0xa0(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x47b38
leaq 0x118(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0x47ec4
movq 0x130(%rsp), %r14
movq 0x138(%rsp), %r15
movq 0x148(%rsp), %r12
leaq 0x18(%rsp), %rdi
pushq $0x14
popq %rdx
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x47a2e
cmpq 0x18(%rsp), %r12
jne 0x425e1
leaq 0x18(%rsp), %rdi
pushq $0xc
popq %rdx
movq 0x10(%rsp), %rsi
xorl %ecx, %ecx
callq 0x47a86
cmpq 0x18(%rsp), %r15
jne 0x425f8
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4850c
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rdx
leaq 0xc(%rax), %rcx
imulq $0x50, %rax, %rsi
leaq (%rsi,%rdx,4), %rsi
shlq $0x2, %rdx
shlq $0x2, %r12
subq %r12, %rsi
imulq $0x50, %r15, %rdi
subq %rdi, %rsi
addq %rsi, %r14
movq %rax, %rsi
subq 0x10(%rsp), %rsi
imulq %rbp, %rsi
leaq (%rdx,%rsi,4), %rdx
shlq $0x2, %rbx
subq %rbx, %rdx
addq %rdx, %r13
shlq $0x2, %rbp
cmpq %rcx, %rax
je 0x4211c
xorl %edx, %edx
cmpq $0x14, %rdx
je 0x42110
movl (%r13,%rdx,4), %esi
addl %esi, (%r14,%rdx,4)
incq %rdx
jmp 0x420fc
incq %rax
addq $0x50, %r14
addq %rbp, %r13
jmp 0x420f5
leaq 0xc0(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x47b06
leaq 0x118(%rsp), %rdi
callq 0x46c68
leaq 0x58316(%rip), %rsi     # 0x9a45b
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x66a0
leaq 0x118(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x18(%rsp), %rdx
callq 0x6894
leaq 0x4b4d7(%rip), %rsi     # 0x8d647
leaq 0x118(%rsp), %rdi
callq 0x106fe
leaq 0x582e6(%rip), %rsi     # 0x9a46a
movq %rax, %rdi
callq 0x1079e
leaq 0x4f45f(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xa0(%rsp), %rsi
movq $0x2, (%rsi)
movq %rax, %rdi
callq 0x11052
leaq 0x4b48e(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x541b8(%rip), %rsi     # 0x96380
movq %rax, %rdi
callq 0x106fe
leaq 0x4f41b(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x100(%rsp), %rsi
movl $0x2, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x630a6(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x118(%rsp), %rdi
callq 0x68d4
leaq 0x18(%rsp), %rdi
callq 0x2090
leaq 0x58252(%rip), %rsi     # 0x9a474
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x66a0
leaq 0x118(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x18(%rsp), %rdx
callq 0x6894
leaq 0x4b3fa(%rip), %rsi     # 0x8d647
leaq 0x118(%rsp), %rdi
callq 0x106fe
leaq 0x5822c(%rip), %rsi     # 0x9a48d
movq %rax, %rdi
callq 0x1079e
leaq 0x4f382(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xa0(%rsp), %rsi
movq $0x14, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x4b3b1(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x581dc(%rip), %rsi     # 0x9a481
movq %rax, %rdi
callq 0x46c4c
leaq 0x4f33e(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x100(%rsp), %rsi
movq $0x14, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x62fc8(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x118(%rsp), %rdi
callq 0x68d4
leaq 0x18(%rsp), %rdi
callq 0x2090
leaq 0x58197(%rip), %rsi     # 0x9a497
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x66a0
leaq 0x118(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x18(%rsp), %rdx
callq 0x6894
leaq 0x4b31c(%rip), %rsi     # 0x8d647
leaq 0x118(%rsp), %rdi
callq 0x106fe
leaq 0x58171(%rip), %rsi     # 0x9a4b0
movq %rax, %rdi
callq 0x1082e
leaq 0x4f2a4(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xa0(%rsp), %rsi
movq $0xc, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x4b2d3(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x58124(%rip), %rsi     # 0x9a4a7
movq %rax, %rdi
callq 0x118ac
leaq 0x4f260(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x100(%rsp), %rsi
movq $0xc, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x62eea(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x118(%rsp), %rdi
callq 0x68d4
leaq 0x18(%rsp), %rdi
callq 0x2090
movq 0xf0(%rsp), %r13
leaq 0x14(%r13), %rax
movq %rax, 0x40(%rsp)
leaq (,%r13,4), %rax
leaq 0x118(%rsp), %rbp
leaq 0x4b248(%rip), %rbx     # 0x8d647
cmpq 0x40(%rsp), %r13
je 0x425b8
movq 0xe0(%rsp), %rsi
imulq $0x50, %rsi, %rdi
movq %rax, 0x48(%rsp)
addq %rax, %rdi
pushq $0xc
popq %r15
subq $0x1, %r15
jb 0x425a7
movq %r15, 0x50(%rsp)
movq %rbx, %r15
movq 0xd8(%rsp), %rax
movq 0xf0(%rsp), %rcx
imulq $0x50, 0xe0(%rsp), %rdx
leaq (%rdx,%rcx,4), %rcx
subq %rcx, %rax
movq %rdi, 0x10(%rsp)
movl (%rdi,%rax), %r12d
movq 0x70(%rsp), %rax
movq %rsi, 0x38(%rsp)
movq %rsi, %rcx
subq 0x88(%rsp), %rcx
imulq 0x98(%rsp), %rcx
movq %r13, %rbx
addq %r13, %rcx
subq 0x78(%rsp), %rcx
movl (%rax,%rcx,4), %r13d
leaq 0x18(%rsp), %r14
movq %r14, %rdi
leaq 0x57f8e(%rip), %rsi     # 0x9a427
leaq 0xa0(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl %r13d, %r12d
sete %sil
movq %rbp, %rdi
movq %r14, %rdx
callq 0x6894
movq %rbx, %r13
movq %r15, %rbx
leaq 0x4f12b(%rip), %r15     # 0x915f2
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x57f5f(%rip), %rsi     # 0x9a43b
callq 0x118ac
movq %rax, %rdi
movq %r15, %rsi
callq 0x106fe
movq 0xd8(%rsp), %rsi
imulq $0x50, 0xe0(%rsp), %rcx
movq 0xf0(%rsp), %rdx
leaq (%rcx,%rdx,4), %rcx
subq %rcx, %rsi
addq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
movq %rbx, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x57f05(%rip), %rsi     # 0x9a433
callq 0x107f4
movq %rax, %rdi
movq %r15, %rsi
callq 0x106fe
movq 0x38(%rsp), %rsi
subq 0x88(%rsp), %rsi
imulq 0x98(%rsp), %rsi
addq %r13, %rsi
subq 0x78(%rsp), %rsi
shlq $0x2, %rsi
addq 0x70(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
leaq 0x62d2b(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %rbp, %rdi
callq 0x68d4
movq %r14, %rdi
callq 0x2090
movq 0x38(%rsp), %rsi
incq %rsi
movq 0x10(%rsp), %rdi
addq $0x50, %rdi
movq 0x50(%rsp), %r15
jmp 0x42422
incq %r13
movq 0x48(%rsp), %rax
addq $0x4, %rax
jmp 0x423ff
leaq 0xc0(%rsp), %rdi
callq 0x46c68
leaq 0x58(%rsp), %rdi
callq 0x46c3c
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x588b8(%rip), %rdi     # 0x9aea0
leaq 0x588d0(%rip), %rsi     # 0x9aebf
leaq 0x59163(%rip), %rcx     # 0x9b759
jmp 0x4260d
leaq 0x588a1(%rip), %rdi     # 0x9aea0
leaq 0x588b9(%rip), %rsi     # 0x9aebf
leaq 0x591cf(%rip), %rcx     # 0x9b7dc
movl $0xf2, %edx
callq 0x20e0
jmp 0x4267b
jmp 0x4267b
jmp 0x4267b
jmp 0x42633
jmp 0x42640
jmp 0x42645
jmp 0x42680
jmp 0x42657
jmp 0x42680
jmp 0x42669
jmp 0x42680
jmp 0x42645
jmp 0x42657
jmp 0x42669
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
jmp 0x426a7
movq %rax, %rbx
jmp 0x426ac
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x68d4
jmp 0x42695
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x68d4
jmp 0x42695
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x68d4
jmp 0x42695
movq %rax, %rbx
jmp 0x4269f
movq %rax, %rbx
jmp 0x42695
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x68d4
leaq 0x18(%rsp), %rdi
callq 0x2090
leaq 0xc0(%rsp), %rdi
callq 0x46c68
leaq 0x58(%rsp), %rdi
callq 0x46c3c
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba