// File: /workspace/github_cpp_makefile_star2_O1/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 $0x218, %rsp            # imm = 0x218
leaq 0x88(%rsp), %rbp
movq $0x0, (%rbp)
movq $0xa, 0x8(%rbp)
movq $0x1, 0x10(%rbp)
movq $0x0, 0x78(%rsp)
xorl %edi, %edi
movq %rbp, %rsi
callq 0xd09f
leaq 0x8(%rsp), %r12
xorl %r14d, %r14d
movq $0x0, 0x50(%rsp)
xorl %eax, %eax
movq %rax, 0x80(%rsp)
xorl %r13d, %r13d
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r12, %rdi
leaq 0x3b749(%rip), %rsi     # 0xbce4d
leaq 0x3b760(%rip), %rdx     # 0xbce6b
callq 0xd0b8
movq %rbp, %rdi
movl $0x1, %esi
movq %r12, %r15
movq %r12, %rdx
callq 0xbf0a
movq %rbp, %rdi
leaq 0x1ff27(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x3b6f0(%rip), %rsi     # 0xbce2c
callq 0x18af6
movq %rax, %rdi
leaq 0x23bdf(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r12
movq %rbp, %rbx
movq 0x78(%rsp), %rax
leaq (%rax,%r13), %rbp
cmpb $0x1, 0x188(%r12)
jne 0x81779
movq %r12, %rdi
addq $0x10, %rdi
movq %rbp, %rsi
callq 0x21b0
movq %r12, %rdi
leaq 0x1fed1(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x3b6c6(%rip), %rsi     # 0xbce58
callq 0x19340
movq %rax, %rdi
leaq 0x23b89(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r12
cmpb $0x1, 0x188(%rax)
jne 0x817c1
movq %r12, %rdi
addq $0x10, %rdi
movq %rbp, %rsi
callq 0x21b0
movq %r12, %rdi
leaq 0x36b9e(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %rbx, %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x817f4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq %rbp, %r14
cmovgeq %rbp, %r14
movq 0x50(%rsp), %rax
cmpq %rax, %rbp
cmovgq %rbp, %rax
movq %rax, 0x50(%rsp)
incq %r13
cmpq $0xa, %r13
movq %r15, %r12
movq %rbx, %rbp
jne 0x816f0
movq 0x80(%rsp), %rax
incq %rax
addq $-0xa, 0x78(%rsp)
cmpq $0x5, %rax
jne 0x816e5
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x3b61e(%rip), %rsi     # 0xbce6c
leaq 0x3b625(%rip), %rdx     # 0xbce7a
callq 0xd0b8
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
callq 0xbf0a
leaq 0x1fddc(%rip), %rsi     # 0xa1654
leaq 0x88(%rsp), %rdi
callq 0x18a16
leaq 0x3b524(%rip), %rsi     # 0xbcdb0
movq %rax, %rdi
callq 0x19c24
leaq 0x23a8f(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x818c0
movq %r15, %rdi
addq $0x10, %rdi
movl $0x32, %esi
callq 0x2110
leaq 0x1fd8d(%rip), %rsi     # 0xa1654
movq %r15, %rdi
callq 0x18a16
leaq 0x3b5a2(%rip), %rsi     # 0xbce78
movq %rax, %rdi
callq 0x18bd6
leaq 0x23a45(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x8190a
movq %r15, %rdi
addq $0x10, %rdi
movl $0x32, %esi
callq 0x22f0
leaq 0x36a58(%rip), %rsi     # 0xb8369
movq %r15, %rdi
callq 0x18a16
leaq 0x88(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x81942
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x3b525(%rip), %rsi     # 0xbce7b
leaq 0x3b533(%rip), %rdx     # 0xbce90
callq 0xd0b8
movq 0x50(%rsp), %rbx
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
callq 0xbf0a
leaq 0x1fccf(%rip), %rsi     # 0xa1654
leaq 0x88(%rsp), %rdi
callq 0x18a16
leaq 0x3b3f9(%rip), %rsi     # 0xbcd92
movq %rax, %rdi
callq 0x4a1d8
leaq 0x23982(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x819cd
movq %r15, %rdi
addq $0x10, %rdi
movl $0x32, %esi
callq 0x2110
leaq 0x1fc80(%rip), %rsi     # 0xa1654
movq %r15, %rdi
callq 0x18a16
leaq 0x3b495(%rip), %rsi     # 0xbce78
movq %rax, %rdi
callq 0x18bd6
leaq 0x23938(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x81a17
movq %r15, %rdi
addq $0x10, %rdi
movl $0x32, %esi
callq 0x22f0
leaq 0x3694b(%rip), %rsi     # 0xb8369
movq %r15, %rdi
callq 0x18a16
leaq 0x88(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x81a4f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x3b42e(%rip), %rsi     # 0xbce91
leaq 0x3b43f(%rip), %rdx     # 0xbcea9
callq 0xd0b8
xorl %esi, %esi
cmpq $-0x28, %r14
sete %sil
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xbf0a
leaq 0x1fbc2(%rip), %rsi     # 0xa1654
leaq 0x88(%rsp), %rdi
callq 0x18a16
leaq 0x3b404(%rip), %rsi     # 0xbceaa
movq %rax, %rdi
callq 0x18b2e
leaq 0x23875(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x81adc
movq %r15, %rdi
addq $0x10, %rdi
movq $-0x28, %rsi
callq 0x21b0
leaq 0x1fb71(%rip), %rsi     # 0xa1654
movq %r15, %rdi
callq 0x18a16
leaq 0x3b3af(%rip), %rsi     # 0xbcea1
movq %rax, %rdi
callq 0x19c24
leaq 0x23829(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x81b24
movq %r15, %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x21b0
leaq 0x3683e(%rip), %rsi     # 0xb8369
movq %r15, %rdi
callq 0x18a16
leaq 0x88(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x81b5c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x3b347(%rip), %rsi     # 0xbceb7
leaq 0x3b358(%rip), %rdx     # 0xbcecf
callq 0xd0b8
xorl %esi, %esi
cmpq $0x9, %rbx
sete %sil
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xbf0a
leaq 0x1fab5(%rip), %rsi     # 0xa1654
leaq 0x88(%rsp), %rdi
callq 0x18a16
leaq 0x3b31d(%rip), %rsi     # 0xbced0
movq %rax, %rdi
callq 0x18b2e
leaq 0x23768(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x81be7
movq %r14, %rdi
addq $0x10, %rdi
movl $0x9, %esi
callq 0x21b0
leaq 0x1fa66(%rip), %rsi     # 0xa1654
movq %r14, %rdi
callq 0x18a16
leaq 0x3b2ca(%rip), %rsi     # 0xbcec7
movq %rax, %rdi
callq 0x19c24
leaq 0x2371e(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x81c2f
movq %r14, %rdi
addq $0x10, %rdi
movq %rbx, %rsi
callq 0x21b0
leaq 0x36733(%rip), %rsi     # 0xb8369
movq %r14, %rdi
callq 0x18a16
leaq 0x88(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x81c67
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
xorl %eax, %eax
leaq 0x20(%rsp), %rdx
movq %rax, -0x18(%rdx)
movq $0x3, -0x10(%rdx)
movq $-0x1, -0x8(%rdx)
movq %rax, (%rdx)
movq $0x5, 0x8(%rdx)
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
movq %rcx, 0x10(%rdx)
leaq 0x38(%rsp), %rsi
movq %rax, (%rsi)
movq $0xa, 0x8(%rsi)
movq %rcx, 0x10(%rsi)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %rbx, %rcx
callq 0x1a487
movq 0x40(%rbx), %rbx
leaq 0x68(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x3b20a(%rip), %rsi     # 0xbcedd
leaq 0x3b217(%rip), %rdx     # 0xbcef1
leaq 0x58(%rsp), %rdi
callq 0xd0b8
xorl %esi, %esi
cmpq $0x3, %rbx
sete %sil
leaq 0x88(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0xbf0a
leaq 0x1f94d(%rip), %rsi     # 0xa1654
leaq 0x88(%rsp), %rdi
callq 0x18a16
leaq 0x3b1d7(%rip), %rsi     # 0xbcef2
movq %rax, %rdi
callq 0x4a1d8
leaq 0x23600(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x81d4f
movq 0x48(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x1f8fe(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x29de4(%rip), %rsi     # 0xabb49
movq %rax, %rdi
callq 0x18a16
leaq 0x235b6(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x81d99
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x3, %esi
callq 0x22f0
leaq 0x365c9(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0x88(%rsp), %rdi
callq 0xbf62
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x81dcc
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x30(%rsp), %rbx
leaq 0x58(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x3b122(%rip), %rsi     # 0xbcf02
leaq 0x3b130(%rip), %rdx     # 0xbcf17
callq 0xd0b8
xorl %esi, %esi
cmpq $0x1e, %rbx
sete %sil
leaq 0x88(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0xbf0a
leaq 0x1f845(%rip), %rsi     # 0xa1654
leaq 0x88(%rsp), %rdi
callq 0x18a16
leaq 0x3b0f5(%rip), %rsi     # 0xbcf18
movq %rax, %rdi
callq 0x4a1d8
leaq 0x234f8(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x81e57
movq 0x30(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x1f7f6(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x3b0a8(%rip), %rsi     # 0xbcf15
movq %rax, %rdi
callq 0x18bd6
leaq 0x234ae(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x81ea1
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x1e, %esi
callq 0x22f0
leaq 0x364c1(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0x88(%rsp), %rdi
callq 0xbf62
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x81ed4
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x21f0
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x81fb2
jmp 0x81fb2
jmp 0x81fb2
jmp 0x81fb2
jmp 0x81fb2
jmp 0x81fb2
jmp 0x81f33
jmp 0x81f45
jmp 0x81f6a
jmp 0x81f7c
jmp 0x81f0e
movq %rax, %rbx
jmp 0x81f55
jmp 0x81fb9
jmp 0x81fb9
jmp 0x81fb9
jmp 0x81fb9
jmp 0x81f33
jmp 0x81f45
jmp 0x81f8e
jmp 0x81fa0
jmp 0x81f6a
jmp 0x81f7c
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbf62
jmp 0x81f55
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbf62
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x81fec
movq 0x68(%rsp), %rsi
jmp 0x81fe4
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbf62
jmp 0x81fd0
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbf62
jmp 0x81fd0
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbf62
jmp 0x81fd0
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbf62
jmp 0x81fd0
movq %rax, %rbx
jmp 0x81fec
jmp 0x81fc0
movq %rax, %rbx
jmp 0x81fd0
jmp 0x81fc0
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x81fec
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036