// File: /workspace/github_cpp_makefile_star2_O3/dsharlet[P]array/test/shape.cpp
// Function: void nda::test_number_theory<nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>>(nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>)
void test_number_theory(Shape s) {
  s.resolve();

  std::vector<int> addresses(static_cast<size_t>(s.flat_extent()), 0);
  for_each_index(s, [&](const typename Shape::index_type& i) {
    addresses[static_cast<size_t>(s[i] - s.flat_min())] += 1;
  });
  bool is_compact = std::all_of(addresses.begin(), addresses.end(), [](int c) { return c >= 1; });
  bool is_one_to_one =
      std::all_of(addresses.begin(), addresses.end(), [](int c) { return c <= 1; });

  ASSERT_EQ(s.is_compact(), is_compact);
  ASSERT_EQ(s.is_one_to_one(), is_one_to_one);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rdi, %r14
leaq 0x18(%rdi), %rsi
movq %rdi, %rdx
callq 0xe37c
movq 0x20(%r14), %rax
decq %rax
movq 0x28(%r14), %rcx
movq 0x8(%r14), %rdx
movq 0x10(%r14), %rsi
decq %rdx
movq %rsi, %rdi
negq %rdi
cmovsq %rsi, %rdi
imulq %rdx, %rdi
movq %rcx, %rdx
negq %rdx
cmovsq %rcx, %rdx
imulq %rax, %rdx
addq %rdi, %rdx
movq $-0x1, %rsi
cmovnsq %rdx, %rsi
incq %rsi
leaq 0x58(%rsp), %rbx
movl $0x0, (%rbx)
leaq 0x40(%rsp), %r15
leaq 0x8(%rsp), %rcx
movq %r15, %rdi
movq %rbx, %rdx
callq 0x99ff6
movq %r15, (%rbx)
movq %r14, 0x8(%rbx)
leaq 0x58(%rsp), %rsi
movq %r14, %rdi
callq 0x9a172
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %r12
movq %r12, %rsi
callq 0x9a222
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq %rsi, 0x30(%rsp)
callq 0x9a2bd
movq %rax, 0x28(%rsp)
movq 0x20(%r14), %r15
movq 0x28(%r14), %rbx
movq 0x8(%r14), %rbp
movq 0x10(%r14), %r13
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x33be4(%rip), %rsi     # 0xc01b2
leaq 0x33bf9(%rip), %rdx     # 0xc01ce
leaq 0x8(%rsp), %rdi
callq 0xd14c
cmpq %r12, 0x38(%rsp)
sete %al
movq %r13, %rcx
negq %rcx
cmovsq %r13, %rcx
leaq -0x1(%rbp), %rdx
imulq %rcx, %rdx
movq %rbx, %rcx
negq %rcx
cmovsq %rbx, %rcx
leaq -0x1(%r15), %rsi
imulq %rcx, %rsi
addq %rdx, %rsi
movq $-0x1, %rcx
cmovnsq %rsi, %rcx
incq %rcx
imulq %r15, %rbp
xorl %edx, %edx
testq %rbp, %rbp
cmovgq %rbp, %rdx
cmpq %rdx, %rcx
seta %cl
xorb %al, %cl
movzbl %cl, %esi
leaq 0x58(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xbf80
leaq 0x1703a(%rip), %rsi     # 0xa3684
leaq 0x58(%rsp), %rdi
callq 0x18fba
leaq 0x33b74(%rip), %rsi     # 0xc01cf
movq %rax, %rdi
callq 0x1a67a
leaq 0x1abec(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x8c6e5
movq 0x10(%r14), %rax
movq %rax, %rcx
negq %rcx
cmovsq %rax, %rcx
movq 0x8(%r14), %rax
leaq -0x1(%rax), %rdx
imulq %rcx, %rdx
movq 0x28(%r14), %rcx
movq %rcx, %rsi
negq %rsi
cmovsq %rcx, %rsi
movq 0x20(%r14), %rcx
leaq -0x1(%rcx), %rdi
imulq %rsi, %rdi
addq %rdx, %rdi
movq $-0x1, %rdx
cmovnsq %rdi, %rdx
incq %rdx
imulq %rax, %rcx
xorl %eax, %eax
testq %rcx, %rcx
cmovgq %rcx, %rax
xorl %esi, %esi
cmpq %rax, %rdx
setbe %sil
movq %rbp, %rdi
addq $0x10, %rdi
callq 0x22c0
leaq 0x16f98(%rip), %rsi     # 0xa3684
movq %rbp, %rdi
callq 0x18fba
leaq 0x33ac9(%rip), %rsi     # 0xc01c4
movq %rax, %rdi
callq 0x19062
leaq 0x1ab4c(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x8c735
xorl %esi, %esi
cmpq %r12, 0x38(%rsp)
sete %sil
movq %rbp, %rdi
addq $0x10, %rdi
callq 0x22c0
leaq 0x2db5d(%rip), %rsi     # 0xba299
movq %rbp, %rdi
callq 0x18fba
leaq 0x58(%rsp), %rdi
callq 0xbfd8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8c76a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x20(%r14), %r15
movq 0x28(%r14), %rbx
movq 0x8(%r14), %r12
movq 0x10(%r14), %r13
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x33a50(%rip), %rsi     # 0xc01de
leaq 0x33a6b(%rip), %rdx     # 0xc0200
callq 0xd14c
movq 0x28(%rsp), %rax
cmpq 0x30(%rsp), %rax
sete %al
movq %r13, %rcx
negq %rcx
cmovsq %r13, %rcx
leaq -0x1(%r12), %rdx
imulq %rcx, %rdx
movq %rbx, %rcx
negq %rcx
cmovsq %rbx, %rcx
leaq -0x1(%r15), %rsi
imulq %rcx, %rsi
addq %rdx, %rsi
movq $-0x1, %rcx
cmovnsq %rsi, %rcx
incq %rcx
imulq %r15, %r12
xorl %edx, %edx
testq %r12, %r12
cmovgq %r12, %rdx
cmpq %rdx, %rcx
setb %cl
xorb %al, %cl
movzbl %cl, %esi
leaq 0x58(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xbf80
leaq 0x16e79(%rip), %rsi     # 0xa3684
leaq 0x58(%rsp), %rdi
callq 0x18fba
leaq 0x339e5(%rip), %rsi     # 0xc0201
movq %rax, %rdi
callq 0x1a17e
leaq 0x1aa2b(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %r12
cmpb $0x1, 0x188(%rax)
jne 0x8c8a6
movq 0x10(%r14), %rax
movq %rax, %rcx
negq %rcx
cmovsq %rax, %rcx
movq 0x8(%r14), %rax
leaq -0x1(%rax), %rdx
imulq %rcx, %rdx
movq 0x28(%r14), %rcx
movq %rcx, %rsi
negq %rsi
cmovsq %rcx, %rsi
movq 0x20(%r14), %rcx
leaq -0x1(%rcx), %rdi
imulq %rsi, %rdi
addq %rdx, %rdi
movq $-0x1, %rdx
cmovnsq %rdi, %rdx
incq %rdx
imulq %rax, %rcx
xorl %eax, %eax
testq %rcx, %rcx
cmovgq %rcx, %rax
xorl %esi, %esi
cmpq %rax, %rdx
setae %sil
movq %r12, %rdi
addq $0x10, %rdi
callq 0x22c0
leaq 0x16dd7(%rip), %rsi     # 0xa3684
movq %r12, %rdi
callq 0x18fba
leaq 0x33937(%rip), %rsi     # 0xc01f3
movq %rax, %rdi
callq 0x1910a
leaq 0x1a98b(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x8c8fb
xorl %esi, %esi
movq 0x28(%rsp), %rax
cmpq 0x30(%rsp), %rax
sete %sil
movq %r14, %rdi
addq $0x10, %rdi
callq 0x22c0
leaq 0x2d997(%rip), %rsi     # 0xba299
movq %r14, %rdi
callq 0x18fba
leaq 0x58(%rsp), %rdi
callq 0xbfd8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8c930
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x8c947
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8c961
jmp 0x8c961
jmp 0x8c961
jmp 0x8c961
movq %rax, %rbx
jmp 0x8c9a9
jmp 0x8c968
movq %rax, %rbx
jmp 0x8c98d
jmp 0x8c971
jmp 0x8c980
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0xbfd8
jmp 0x8c98d
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0xbfd8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8c9a9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x8c9c0
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc0a9