// File: /workspace/github_cpp_makefile_star2_O1/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 0xe0a6
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 0x98422
movq %r15, (%rbx)
movq %r14, 0x8(%rbx)
leaq 0x58(%rsp), %rsi
movq %r14, %rdi
callq 0x984a0
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %r12
movq %r12, %rsi
callq 0x98550
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq %rsi, 0x30(%rsp)
callq 0x985e3
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 0x34024(%rip), %rsi     # 0xbe652
leaq 0x34039(%rip), %rdx     # 0xbe66e
leaq 0x8(%rsp), %rdi
callq 0xd0b8
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 0xbf0a
leaq 0x16faa(%rip), %rsi     # 0xa1654
leaq 0x58(%rsp), %rdi
callq 0x18a16
leaq 0x33fb4(%rip), %rsi     # 0xbe66f
movq %rax, %rdi
callq 0x1a104
leaq 0x1ac60(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x8a745
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 0x16f08(%rip), %rsi     # 0xa1654
movq %rbp, %rdi
callq 0x18a16
leaq 0x33f09(%rip), %rsi     # 0xbe664
movq %rax, %rdi
callq 0x18abe
leaq 0x1abc0(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x8a795
xorl %esi, %esi
cmpq %r12, 0x38(%rsp)
sete %sil
movq %rbp, %rdi
addq $0x10, %rdi
callq 0x22c0
leaq 0x2dbcd(%rip), %rsi     # 0xb8369
movq %rbp, %rdi
callq 0x18a16
leaq 0x58(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8a7ca
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 0x33e90(%rip), %rsi     # 0xbe67e
leaq 0x33eab(%rip), %rdx     # 0xbe6a0
callq 0xd0b8
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 0xbf0a
leaq 0x16de9(%rip), %rsi     # 0xa1654
leaq 0x58(%rsp), %rdi
callq 0x18a16
leaq 0x33e25(%rip), %rsi     # 0xbe6a1
movq %rax, %rdi
callq 0x19c5c
leaq 0x1aa9f(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r12
cmpb $0x1, 0x188(%rax)
jne 0x8a906
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 0x16d47(%rip), %rsi     # 0xa1654
movq %r12, %rdi
callq 0x18a16
leaq 0x33d77(%rip), %rsi     # 0xbe693
movq %rax, %rdi
callq 0x18b66
leaq 0x1a9ff(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x8a95b
xorl %esi, %esi
movq 0x28(%rsp), %rax
cmpq 0x30(%rsp), %rax
sete %sil
movq %r14, %rdi
addq $0x10, %rdi
callq 0x22c0
leaq 0x2da07(%rip), %rsi     # 0xb8369
movq %r14, %rdi
callq 0x18a16
leaq 0x58(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8a990
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x8a9a7
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 0x8a9c1
jmp 0x8a9c1
jmp 0x8a9c1
jmp 0x8a9c1
movq %rax, %rbx
jmp 0x8aa09
jmp 0x8a9c8
movq %rax, %rbx
jmp 0x8a9ed
jmp 0x8a9d1
jmp 0x8a9e0
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0xbf62
jmp 0x8a9ed
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8aa09
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x8aa20
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036