// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/shape.cpp
// Function: nda::test_shape_2d_negative_stride_body()
TEST(shape_2d_negative_stride) {
  dense_dim<> x(0, 10);
  dim<> y(0, 5, -x.extent());
  shape<dense_dim<>, dim<>> s(x, y);
  index_t flat_min = s[s.min()];
  index_t flat_max = flat_min;
  for (int i : y) {
    for (int j : x) {
      ASSERT_EQ(s(j, i), i * -x.extent() + j);
      flat_min = std::min(s(j, i), flat_min);
      flat_max = std::max(s(j, i), flat_max);
    }
  }
  ASSERT_EQ(s.size(), 50);
  ASSERT_EQ(s.flat_extent(), 50);
  ASSERT_EQ(s.flat_min(), flat_min);
  ASSERT_EQ(s.flat_max(), flat_max);

  shape_of_rank<3> s2(10, 5, {0, 3, -1});
  s2.resolve();
  ASSERT_EQ(s2.x().stride(), 3);
  ASSERT_EQ(s2.y().stride(), 30);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
leaq 0xe8(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0x290(%rsp), %rbx
andq $0x0, (%rbx)
movq $0xa, 0x8(%rsi)
movq $0x5, 0x8(%rbx)
movq $-0xa, 0x10(%rbx)
leaq 0x28(%rsp), %rdi
movq %rbx, %rdx
callq 0x1091e
andq $0x0, 0x20(%rsp)
andq $0x0, 0x18(%rsp)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
addq %rax, %rcx
movq %rcx, 0xc0(%rsp)
cmpq 0xc0(%rsp), %rax
je 0x70142
movq 0xe8(%rsp), %r15
movq 0xf0(%rsp), %rcx
movq %rax, 0xc8(%rsp)
movslq %eax, %rbp
shlq $0x20, %r15
subq $0x1, %rcx
jb 0x70132
movq %rcx, 0xd8(%rsp)
movq 0x40(%rsp), %r13
movq 0x28(%rsp), %r12
movq 0x38(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0xf0(%rsp), %r14
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
leaq 0x3a11a(%rip), %rsi     # 0xaa0d8
leaq 0xc(%rsp), %rdx
callq 0x66a0
movq %r15, 0xd0(%rsp)
sarq $0x20, %r15
movq %r15, %rax
subq %r13, %rax
movq %rbp, %rcx
subq %r12, %rcx
imulq 0xe0(%rsp), %rcx
addq %rax, %rcx
imulq %rbp, %r14
movq %r15, %rax
subq %r14, %rax
xorl %esi, %esi
cmpq %rax, %rcx
sete %sil
leaq 0x100(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
callq 0x6894
leaq 0x1d62e(%rip), %r12     # 0x8d647
leaq 0x215d2(%rip), %r13     # 0x915f2
movq %r14, %rdi
movq %r12, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x3a082(%rip), %rsi     # 0xaa0b7
callq 0x107f4
movq %rax, %rdi
movq %r13, %rsi
callq 0x106fe
movq %r15, %rcx
subq 0x40(%rsp), %rcx
movq %rbp, %rdx
subq 0x28(%rsp), %rdx
imulq 0x38(%rsp), %rdx
addq %rcx, %rdx
movq %rdx, 0x58(%rsp)
movq %rax, %rdi
leaq 0x58(%rsp), %rsi
callq 0x107ba
movq %rax, %rdi
movq %r12, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x3a05e(%rip), %rsi     # 0xaa0e3
callq 0x11036
movq %rax, %rdi
movq %r13, %rsi
callq 0x106fe
movq 0xf0(%rsp), %rcx
imulq %rbp, %rcx
movq %r15, %rdx
subq %rcx, %rdx
movq %rdx, 0x10(%rsp)
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x107ba
movq %rax, %rdi
leaq 0x351df(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r14, %rdi
callq 0x68d4
movq %rbx, %rdi
callq 0x2090
subq 0x40(%rsp), %r15
movq %rbp, %rax
subq 0x28(%rsp), %rax
imulq 0x38(%rsp), %rax
addq %r15, %rax
movq 0x20(%rsp), %rcx
cmpq %rax, %rcx
cmovgeq %rax, %rcx
movq %rcx, 0x20(%rsp)
movq 0x18(%rsp), %rcx
cmpq %rcx, %rax
cmovleq %rcx, %rax
movq %rax, 0x18(%rsp)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq 0xd0(%rsp), %r15
addq %rax, %r15
movq 0xd8(%rsp), %rcx
jmp 0x6ff7e
movq 0xc8(%rsp), %rax
incq %rax
jmp 0x6ff51
movq 0x30(%rsp), %rbx
movq 0x48(%rsp), %r14
leaq 0x39fa4(%rip), %rsi     # 0xaa0f7
leaq 0x78(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x66a0
imulq %r14, %rbx
xorl %esi, %esi
cmpq $0x32, %rbx
sete %sil
leaq 0x100(%rsp), %rdi
leaq 0x78(%rsp), %rdx
callq 0x6894
leaq 0x1d4be(%rip), %rsi     # 0x8d647
leaq 0x100(%rsp), %rdi
callq 0x106fe
leaq 0x39e9e(%rip), %rsi     # 0xaa03b
movq %rax, %rdi
callq 0x118ac
leaq 0x21446(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x30(%rsp), %rcx
imulq 0x48(%rsp), %rcx
xorl %edx, %edx
testq %rcx, %rcx
cmovgq %rcx, %rdx
leaq 0x58(%rsp), %rsi
movq %rdx, (%rsi)
movq %rax, %rdi
callq 0x11052
leaq 0x1d468(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x39f15(%rip), %rsi     # 0xaa103
movq %rax, %rdi
callq 0x10896
leaq 0x213f5(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x10(%rsp), %rsi
movl $0x32, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x35083(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x100(%rsp), %rdi
callq 0x68d4
leaq 0x78(%rsp), %rdi
callq 0x2090
leaq 0x28(%rsp), %rdi
callq 0x13ab6
movq %rax, %rbx
leaq 0x39eb4(%rip), %rsi     # 0xaa106
leaq 0x78(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpq $0x32, %rbx
sete %sil
leaq 0x100(%rsp), %rdi
leaq 0x78(%rsp), %rdx
callq 0x6894
leaq 0x1d3c3(%rip), %rsi     # 0x8d647
leaq 0x100(%rsp), %rdi
callq 0x106fe
leaq 0x39d85(%rip), %rsi     # 0xaa01d
movq %rax, %rdi
callq 0x3bfaa
leaq 0x2134b(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x13ab6
leaq 0x58(%rsp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0x11052
leaq 0x1d374(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x39e21(%rip), %rsi     # 0xaa103
movq %rax, %rdi
callq 0x10896
leaq 0x21301(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x10(%rsp), %rsi
movl $0x32, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x34f8f(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x100(%rsp), %rdi
callq 0x68d4
leaq 0x78(%rsp), %rdi
callq 0x2090
movq 0x30(%rsp), %rbx
movq 0x38(%rsp), %r15
movq 0x20(%rsp), %r14
leaq 0x39dd4(%rip), %rsi     # 0xaa11c
leaq 0x78(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x66a0
movq %r15, %rax
sarq $0x3f, %rax
andq %r15, %rax
decq %rbx
imulq %rax, %rbx
xorl %esi, %esi
cmpq %r14, %rbx
sete %sil
leaq 0x100(%rsp), %rdi
leaq 0x78(%rsp), %rdx
callq 0x6894
leaq 0x1d2bd(%rip), %rsi     # 0x8d647
leaq 0x100(%rsp), %rdi
callq 0x106fe
leaq 0x39d97(%rip), %rsi     # 0xaa135
movq %rax, %rdi
callq 0x1082e
leaq 0x21245(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
decq %rcx
movq %rdx, %rdi
sarq $0x3f, %rdi
andq %rdx, %rdi
imulq %rcx, %rdi
leaq 0x58(%rsp), %rsi
movq %rdi, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x1d260(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x39d36(%rip), %rsi     # 0xaa12c
movq %rax, %rdi
callq 0x118ac
leaq 0x211ed(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x20(%rsp), %rsi
movq %rax, %rdi
callq 0x107ba
leaq 0x34e81(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x100(%rsp), %rdi
callq 0x68d4
leaq 0x78(%rsp), %rdi
callq 0x2090
movq 0x48(%rsp), %rbx
movq 0x30(%rsp), %r15
movq 0x38(%rsp), %r12
movq 0x18(%rsp), %r14
leaq 0x39ce7(%rip), %rsi     # 0xaa142
leaq 0x78(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x66a0
xorl %eax, %eax
testq %r12, %r12
cmovgq %r12, %rax
decq %r15
imulq %rax, %r15
leaq (%rbx,%r15), %rax
decq %rax
xorl %esi, %esi
cmpq %r14, %rax
sete %sil
leaq 0x100(%rsp), %rdi
leaq 0x78(%rsp), %rdx
callq 0x6894
leaq 0x1d1a4(%rip), %rsi     # 0x8d647
leaq 0x100(%rsp), %rdi
callq 0x106fe
leaq 0x39ca4(%rip), %rsi     # 0xaa15b
movq %rax, %rdi
callq 0x1082e
leaq 0x2112c(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x48(%rsp), %rcx
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rsi
decq %rdx
xorl %edi, %edi
testq %rsi, %rsi
cmovgq %rsi, %rdi
imulq %rdx, %rdi
addq %rdi, %rcx
decq %rcx
leaq 0x58(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x1d13d(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x39c39(%rip), %rsi     # 0xaa152
movq %rax, %rdi
callq 0x118ac
leaq 0x210ca(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x107ba
leaq 0x34d5e(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x100(%rsp), %rdi
callq 0x68d4
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
callq 0x2090
andq $0x0, (%rbx)
movq $0x3, 0x8(%rbx)
orq $-0x1, 0x10(%rbx)
andq $0x0, 0x18(%rbx)
movq $0x5, 0x20(%rbx)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x28(%rbx)
andq $0x0, 0x30(%rbx)
movq $0xa, 0x38(%rbx)
movq %rax, 0x40(%rbx)
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
callq 0x11e95
movq 0x40(%rbx), %rbx
leaq 0x39bad(%rip), %rsi     # 0xaa168
leaq 0x58(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpq $0x3, %rbx
sete %sil
leaq 0x100(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x6894
leaq 0x1d05a(%rip), %rsi     # 0x8d647
leaq 0x100(%rsp), %rdi
callq 0x106fe
leaq 0x39b7c(%rip), %rsi     # 0xaa17d
movq %rax, %rdi
callq 0x3bfaa
leaq 0x20fe2(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0xb8(%rsp), %rcx
leaq 0x10(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x1d010(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x278a3(%rip), %rsi     # 0x97ee9
movq %rax, %rdi
callq 0x106fe
leaq 0x20f9d(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xc(%rsp), %rsi
movl $0x3, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x34c2b(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x100(%rsp), %rdi
callq 0x68d4
leaq 0x58(%rsp), %rdi
callq 0x2090
movq 0xa0(%rsp), %rbx
leaq 0x39ae8(%rip), %rsi     # 0xaa18d
leaq 0x58(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpq $0x1e, %rbx
sete %sil
leaq 0x100(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x6894
leaq 0x1cf70(%rip), %rsi     # 0x8d647
leaq 0x100(%rsp), %rdi
callq 0x106fe
leaq 0x39ab8(%rip), %rsi     # 0xaa1a3
movq %rax, %rdi
callq 0x3bfaa
leaq 0x20ef8(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0xa0(%rsp), %rcx
leaq 0x10(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x1cf26(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x39a70(%rip), %rsi     # 0xaa1a0
movq %rax, %rdi
callq 0x10896
leaq 0x20eb3(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xc(%rsp), %rsi
movl $0x1e, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x34b41(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x100(%rsp), %rdi
callq 0x68d4
leaq 0x58(%rsp), %rdi
callq 0x2090
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x70850
jmp 0x70850
jmp 0x70850
jmp 0x70850
jmp 0x70850
jmp 0x70850
jmp 0x707df
jmp 0x707b6
jmp 0x707f1
movq %rax, %rbx
jmp 0x70801
jmp 0x70857
jmp 0x70857
jmp 0x7081a
jmp 0x70857
jmp 0x70808
jmp 0x70857
jmp 0x707df
jmp 0x707f1
jmp 0x7082c
jmp 0x7083e
jmp 0x7081a
jmp 0x70808
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x68d4
jmp 0x70801
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x68d4
leaq 0x58(%rsp), %rdi
jmp 0x70873
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x68d4
jmp 0x7086e
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x68d4
jmp 0x7086e
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x68d4
jmp 0x7086e
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x68d4
jmp 0x7086e
movq %rax, %rbx
jmp 0x70878
jmp 0x7085e
movq %rax, %rbx
jmp 0x7086e
jmp 0x7085e
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x68d4
leaq 0x78(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba