// File: /workspace/github_cpp_makefile_star2_O1/dsharlet[P]array/test/array.cpp
// Function: nda::test_array_construct_from_bounds_body()
TEST(array_construct_from_bounds) {
  // Illustrate creating an array from incompatible compile-time
  // shapes using bounds().
  using SrcShape = shape<dense_dim<>, dim<>>;
  using DstShape = shape<dim<>, dense_dim<>>;  // dense_dim is swapped.

  SrcShape src_shape({-1, 10}, {2, 5, /*stride =*/100});
  auto src = array<int, SrcShape>(src_shape);
  auto dst = array<int, DstShape>(src.bounds());

  // min and extent are preserved.
  ASSERT_EQ(src.dim<0>().min(), dst.dim<0>().min());
  ASSERT_EQ(src.dim<0>().extent(), dst.dim<0>().extent());
  ASSERT_EQ(src.dim<1>().min(), dst.dim<1>().min());
  ASSERT_EQ(src.dim<1>().extent(), dst.dim<1>().extent());
  // Ensure that `dst` did not inherit the strides of its parent and is
  // created compact.
  ASSERT(!src.is_compact());
  ASSERT(dst.is_compact());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x578, %rsp            # imm = 0x578
movabsq $-0x8000000000000000, %r15 # imm = 0x8000000000000000
movq $-0x1, %r12
leaq 0xc8(%rsp), %rbx
movq %r12, (%rbx)
movl $0xa, %r13d
movq %r13, 0x8(%rbx)
movq $0x1, 0x10(%rbx)
xorl %edi, %edi
movq %rbx, %rsi
callq 0xd09f
xorps %xmm0, %xmm0
leaq 0x78(%rsp), %r14
movups %xmm0, 0x8(%r14)
movq $0x0, 0x18(%r14)
movq $0x2, 0x20(%r14)
movq $0x5, 0x28(%r14)
movq $0x64, 0x30(%r14)
movq %r12, 0x38(%r14)
movq %r13, 0x40(%r14)
movq %r14, %rdi
callq 0x1c19e
movq %r14, %rdi
callq 0x1c258
movq 0x38(%r14), %r12
movq 0x40(%r14), %r13
movq 0x20(%r14), %rbp
movq 0x28(%r14), %r14
movq %rbp, (%rbx)
movq %r14, 0x8(%rbx)
movq %r15, 0x10(%rbx)
leaq 0xc8(%rsp), %rsi
movl $0x1, %edi
callq 0xd09f
leaq 0x28(%rsp), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movq $0x0, 0x18(%rdi)
movq %rbp, 0x20(%rdi)
movq %r14, 0x28(%rdi)
movq %r12, 0x38(%rdi)
movq %r13, 0x40(%rdi)
movq %r15, 0x48(%rdi)
callq 0x1ce12
leaq 0x28(%rsp), %rdi
callq 0x1cecc
movq 0xb0(%rsp), %rbx
movq 0x60(%rsp), %r15
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x926e5(%rip), %rsi     # 0xa2cab
leaq 0x92706(%rip), %rdx     # 0xa2cd3
leaq 0x8(%rsp), %rdi
callq 0xd0b8
xorl %esi, %esi
cmpq %r15, %rbx
sete %sil
leaq 0xc8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xbf0a
leaq 0x9105b(%rip), %rsi     # 0xa1654
leaq 0xc8(%rsp), %rdi
callq 0x18a16
leaq 0x926c7(%rip), %rsi     # 0xa2cd4
movq %rax, %rdi
callq 0x18c46
leaq 0x94d0e(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x10644
movq 0xb0(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x91009(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x92667(%rip), %rsi     # 0xa2cc1
movq %rax, %rdi
callq 0x18c46
leaq 0x94cc1(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x1068e
movq 0x60(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0xa7cd4(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xc8(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x106c1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0xb8(%rsp), %rbx
movq 0x68(%rsp), %r15
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x9260a(%rip), %rsi     # 0xa2ce7
leaq 0x92631(%rip), %rdx     # 0xa2d15
callq 0xd0b8
xorl %esi, %esi
cmpq %r15, %rbx
sete %sil
leaq 0xc8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xbf0a
leaq 0x90f49(%rip), %rsi     # 0xa1654
leaq 0xc8(%rsp), %rdi
callq 0x18a16
leaq 0x925f7(%rip), %rsi     # 0xa2d16
movq %rax, %rdi
callq 0x18c7e
leaq 0x94bfc(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x10756
movq 0xb8(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x90ef7(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x92594(%rip), %rsi     # 0xa2d00
movq %rax, %rdi
callq 0x18c7e
leaq 0x94baf(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x107a0
movq 0x68(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0xa7bc2(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xc8(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x107d3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x98(%rsp), %rbx
movq 0x48(%rsp), %r15
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x9253d(%rip), %rsi     # 0xa2d2c
leaq 0x9255e(%rip), %rdx     # 0xa2d54
callq 0xd0b8
xorl %esi, %esi
cmpq %r15, %rbx
sete %sil
leaq 0xc8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xbf0a
leaq 0x90e37(%rip), %rsi     # 0xa1654
leaq 0xc8(%rsp), %rdi
callq 0x18a16
leaq 0x92524(%rip), %rsi     # 0xa2d55
movq %rax, %rdi
callq 0x18c46
leaq 0x94aea(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x10868
movq 0x98(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x90de5(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x924c4(%rip), %rsi     # 0xa2d42
movq %rax, %rdi
callq 0x18c46
leaq 0x94a9d(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x108b2
movq 0x48(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0xa7ab0(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xc8(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x108e5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0xa0(%rsp), %rbx
movq 0x50(%rsp), %r15
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x92467(%rip), %rsi     # 0xa2d68
leaq 0x9248e(%rip), %rdx     # 0xa2d96
callq 0xd0b8
xorl %esi, %esi
cmpq %r15, %rbx
sete %sil
leaq 0xc8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xbf0a
leaq 0x90d25(%rip), %rsi     # 0xa1654
leaq 0xc8(%rsp), %rdi
callq 0x18a16
leaq 0x92454(%rip), %rsi     # 0xa2d97
movq %rax, %rdi
callq 0x18c7e
leaq 0x949d8(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x1097a
movq 0xa0(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x90cd3(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x923f1(%rip), %rsi     # 0xa2d81
movq %rax, %rdi
callq 0x18c7e
leaq 0x9498b(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x109c4
movq 0x50(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0xa799e(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xc8(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x109f7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0xb8(%rsp), %r15
movq 0xa0(%rsp), %rbx
movq 0xa8(%rsp), %r12
leaq 0xd8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x9238b(%rip), %rsi     # 0xa2dad
leaq 0x92395(%rip), %rdx     # 0xa2dbe
leaq 0xc8(%rsp), %rdi
callq 0xd0b8
movq %r12, %rax
negq %rax
cmovsq %r12, %rax
leaq -0x1(%rbx), %rcx
imulq %rax, %rcx
leaq (%r15,%rcx), %rax
decq %rax
testq %rax, %rax
movq $-0x1, %rcx
cmovnsq %rax, %rcx
incq %rcx
imulq %r15, %rbx
xorl %eax, %eax
testq %rbx, %rbx
cmovgq %rbx, %rax
xorl %esi, %esi
cmpq %rax, %rcx
seta %sil
leaq 0x3e8(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
callq 0xbf0a
leaq 0x3e8(%rsp), %rdi
callq 0xbf62
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x10ab5
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x50(%rsp), %rbx
movq 0x68(%rsp), %r15
movq 0x70(%rsp), %r12
leaq 0xc8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x922e9(%rip), %rsi     # 0xa2dbf
leaq 0x922f2(%rip), %rdx     # 0xa2dcf
callq 0xd0b8
movq %r12, %rax
negq %rax
cmovsq %r12, %rax
leaq -0x1(%r15), %rcx
imulq %rax, %rcx
leaq (%rbx,%rcx), %rax
decq %rax
testq %rax, %rax
movq $-0x1, %rcx
cmovnsq %rax, %rcx
incq %rcx
imulq %r15, %rbx
xorl %eax, %eax
testq %rbx, %rbx
cmovgq %rbx, %rax
xorl %esi, %esi
cmpq %rax, %rcx
setbe %sil
leaq 0x258(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
callq 0xbf0a
leaq 0x258(%rsp), %rdi
callq 0xbf62
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x10b61
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x28(%rsp), %rdi
callq 0x1d2ce
leaq 0x78(%rsp), %rdi
callq 0x1cd2c
addq $0x578, %rsp            # imm = 0x578
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10c5c
jmp 0x10c5c
jmp 0x10b9b
jmp 0x10b9b
jmp 0x10b9b
jmp 0x10b9b
jmp 0x10b9b
movq %rax, %rbx
jmp 0x10c3c
jmp 0x10bdf
jmp 0x10bf1
jmp 0x10c03
jmp 0x10c15
jmp 0x10bad
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x10c3c
movq 0xd8(%rsp), %rsi
jmp 0x10c34
jmp 0x10bcd
jmp 0x10bcd
jmp 0x10bcd
movq %rax, %rbx
jmp 0x10c25
jmp 0x10bdf
jmp 0x10bf1
jmp 0x10c03
jmp 0x10c15
movq %rax, %rbx
jmp 0x10c46
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0xbf62
jmp 0x10c25
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0xbf62
jmp 0x10c25
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0xbf62
jmp 0x10c25
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0xbf62
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x10c3c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x28(%rsp), %rdi
callq 0x1d2ce
leaq 0x78(%rsp), %rdi
callq 0x1cd2c
movq %rbx, %rdi
callq 0x2300
jmp 0x10c5c
jmp 0x10c5c
movq %rax, %rdi
callq 0xc036