// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rdi, %rbx
callq 0x8e70
movq %rbx, %rdi
callq 0x8e44
leaq 0x48(%rsp), %r14
andl $0x0, (%r14)
leaq 0x10(%rsp), %r15
leaq 0x28(%rsp), %rcx
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x84ac6
movq %r15, (%r14)
movq %rbx, 0x8(%r14)
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x84c14
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x84b1c
movb %al, 0xc(%rsp)
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x84b2d
movl %eax, %ebp
movb %al, 0xf(%rsp)
movq %rbx, %rdi
callq 0x7955c
movl %eax, %r14d
movb 0xc(%rsp), %r15b
leaq 0x34002(%rip), %rsi     # 0xab96f
leaq 0x28(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpb %r14b, %r15b
sete %sil
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x6894
leaq 0x15cac(%rip), %rsi     # 0x8d647
leaq 0x48(%rsp), %rdi
callq 0x106fe
leaq 0x33fe0(%rip), %rsi     # 0xab98c
movq %rax, %rdi
callq 0x11bb4
leaq 0x19c37(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq %rax, %r14
movq %rbx, %rdi
callq 0x7955c
leaq 0xd(%rsp), %rsi
movb %al, (%rsi)
movq %r14, %rdi
callq 0x84b3e
leaq 0x15c63(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x33f8e(%rip), %rsi     # 0xab981
movq %rax, %rdi
callq 0x107d8
leaq 0x19bf0(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xc(%rsp), %rsi
movq %rax, %rdi
callq 0x84b3e
leaq 0x2d884(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x48(%rsp), %rdi
callq 0x68d4
leaq 0x28(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x79580
movl %eax, %r14d
leaq 0x33f4f(%rip), %rsi     # 0xab99b
leaq 0x28(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x66a0
xorb %r14b, %bpl
xorb $0x1, %bpl
movzbl %bpl, %esi
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x6894
leaq 0x15bcb(%rip), %rsi     # 0x8d647
leaq 0x48(%rsp), %rdi
callq 0x106fe
leaq 0x33f31(%rip), %rsi     # 0xab9be
movq %rax, %rdi
callq 0x118c8
leaq 0x19b56(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq %rax, %r14
movq %rbx, %rdi
callq 0x79580
leaq 0xd(%rsp), %rsi
movb %al, (%rsi)
movq %r14, %rdi
callq 0x84b3e
leaq 0x15b82(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x33edc(%rip), %rsi     # 0xab9b0
movq %rax, %rdi
callq 0x1085e
leaq 0x19b0f(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xf(%rsp), %rsi
movq %rax, %rdi
callq 0x84b3e
leaq 0x2d7a3(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x48(%rsp), %rdi
callq 0x68d4
leaq 0x28(%rsp), %rdi
callq 0x2090
leaq 0x10(%rsp), %rdi
callq 0x84b88
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x77b3f
jmp 0x77b3f
jmp 0x77b3f
jmp 0x77b3f
jmp 0x77b3f
jmp 0x77b3f
movq %rax, %rbx
jmp 0x77b75
jmp 0x77b46
movq %rax, %rbx
jmp 0x77b6b
jmp 0x77b4f
jmp 0x77b5e
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x68d4
jmp 0x77b6b
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x68d4
leaq 0x28(%rsp), %rdi
callq 0x2090
leaq 0x10(%rsp), %rdi
callq 0x84b88
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba