// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/array.cpp
// Function: nda::test_array_fill_assign_body()
TEST(array_fill_assign) {
  dense_array<int, 1> a;
  a.assign({10}, 3);
  for (int x = 0; x < 10; x++) {
    ASSERT_EQ(a(x), 3);
  }

  dense_array<int, 2> b;
  b.assign({7, 3}, 5);
  for (int y = 0; y < 3; y++) {
    for (int x = 0; x < 7; x++) {
      ASSERT_EQ(b(x, y), 5);
    }
  }

  dense_array<int, 3> c;
  c.assign({5, 9, 3}, 7);
  for (int z = 0; z < 3; z++) {
    for (int y = 0; y < 9; y++) {
      for (int x = 0; x < 5; x++) {
        ASSERT_EQ(c(x, y, z), 7);
      }
    }
  }

  array<int, shape<dim<>, dim<>>> sparse;
  auto sparse_shape = make_shape(dim<>(-2, 5, 2), dim<>(4, 10));
  sparse_shape.resolve();
  ASSERT_LT(sparse_shape.size(), sparse_shape.flat_extent());

  sparse.assign(sparse_shape, 13);
  for (int y = 4; y < 14; y++) {
    for (int x = -2; x < 3; x++) {
      ASSERT_EQ(sparse(x, y), 13);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
leaq 0xc0(%rsp), %rdi
callq 0x10e1c
leaq 0x1b0(%rsp), %rdi
pushq $0xa
popq %rsi
callq 0x106be
leaq 0x1f8(%rsp), %rdx
movl $0x3, (%rdx)
leaq 0xc0(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x10e34
xorl %ebp, %ebp
leaq 0x148(%rsp), %r14
leaq 0x1f8(%rsp), %r12
leaq 0x814c8(%rip), %r13     # 0x8d647
leaq 0x8546c(%rip), %rbx     # 0x915f2
cmpq $0x28, %rbp
je 0xc281
movq 0xd8(%rsp), %rax
movq 0xe0(%rsp), %rcx
shlq $0x2, %rcx
subq %rcx, %rax
movl (%rbp,%rax), %r15d
movq %r14, %rdi
leaq 0x82f66(%rip), %rsi     # 0x8f11c
leaq 0xf8(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0x3, %r15d
sete %sil
movq %r12, %rdi
movq %r14, %rdx
callq 0x6894
movq %r12, %rdi
movq %r13, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x82c88(%rip), %rsi     # 0x8ee75
callq 0x1071a
movq %rax, %rdi
movq %rbx, %rsi
callq 0x106fe
movq 0xd8(%rsp), %rsi
movq 0xe0(%rsp), %rcx
shlq $0x2, %rcx
subq %rcx, %rsi
addq %rbp, %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
movq %r13, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x8bcb5(%rip), %rsi     # 0x97ee9
callq 0x106fe
movq %rax, %rdi
movq %rbx, %rsi
callq 0x106fe
movl $0x3, 0x70(%rsp)
movq %rax, %rdi
leaq 0x70(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x9903f(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r12, %rdi
callq 0x68d4
movq %r14, %rdi
callq 0x2090
addq $0x4, %rbp
jmp 0xc186
leaq 0x70(%rsp), %rdi
callq 0x10e9e
leaq 0x1c8(%rsp), %rdi
pushq $0x7
popq %rsi
pushq $0x3
popq %rdx
callq 0x10754
leaq 0x1f8(%rsp), %rdx
movl $0x5, (%rdx)
leaq 0x70(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x10ec8
xorl %r15d, %r15d
leaq 0x148(%rsp), %r12
leaq 0x81377(%rip), %r13     # 0x8d647
leaq 0x8531b(%rip), %rbp     # 0x915f2
cmpq $0x3, %r15
je 0xc43b
xorl %r14d, %r14d
cmpq $0x1c, %r14
je 0xc433
movq %r13, %rbx
movq 0xa8(%rsp), %rax
movq %r15, %rcx
subq 0x90(%rsp), %rcx
imulq 0xa0(%rsp), %rcx
shlq $0x2, %rcx
shlq $0x2, %rax
subq %rax, %rcx
addq 0x88(%rsp), %rcx
movl (%r14,%rcx), %r13d
movq %r12, %rdi
leaq 0x82df8(%rip), %rsi     # 0x8f126
leaq 0x20(%rsp), %rdx
callq 0x66a0
movq %r14, 0x8(%rsp)
xorl %esi, %esi
cmpl $0x5, %r13d
sete %sil
leaq 0x1f8(%rsp), %r14
movq %r14, %rdi
movq %r12, %rdx
callq 0x6894
movq %rbx, %r13
movq %r14, %rdi
movq %rbx, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x82b49(%rip), %rsi     # 0x8eebb
callq 0x107f4
movq %rax, %rdi
movq %rbp, %rsi
callq 0x106fe
movq 0xa8(%rsp), %rcx
movq %r15, %rsi
subq 0x90(%rsp), %rsi
imulq 0xa0(%rsp), %rsi
shlq $0x2, %rsi
shlq $0x2, %rcx
subq %rcx, %rsi
addq 0x88(%rsp), %rsi
addq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
movq %r13, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x83146(%rip), %rsi     # 0x8f519
callq 0x106fe
movq %rax, %rdi
movq %rbp, %rsi
callq 0x106fe
movl $0x5, 0xf8(%rsp)
movq %rax, %rdi
leaq 0xf8(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x98e9a(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r14, %rdi
callq 0x68d4
leaq 0x148(%rsp), %r12
movq %r12, %rdi
callq 0x2090
movq 0x8(%rsp), %r14
addq $0x4, %r14
jmp 0xc2e4
incq %r15
jmp 0xc2d7
leaq 0x148(%rsp), %rdi
callq 0x10f46
leaq 0x388(%rsp), %rdi
pushq $0x5
popq %rsi
pushq $0x9
popq %rdx
pushq $0x3
popq %rcx
callq 0x10810
leaq 0x1f8(%rsp), %rdx
movl $0x7, (%rdx)
leaq 0x148(%rsp), %rdi
leaq 0x388(%rsp), %rsi
callq 0x10f78
xorl %ebx, %ebx
leaq 0xf8(%rsp), %r12
leaq 0x1f8(%rsp), %rbp
cmpl $0x3, %ebx
je 0xc5bf
xorl %r14d, %r14d
cmpl $0x9, %r14d
je 0xc5b8
xorl %r15d, %r15d
cmpl $0x5, %r15d
je 0xc5b0
leaq 0x148(%rsp), %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %ebx, %ecx
callq 0x1084a
movl (%rax), %r13d
movq %r12, %rdi
leaq 0x82c5b(%rip), %rsi     # 0x8f133
leaq 0x50(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0x7, %r13d
sete %sil
movq %rbp, %rdi
movq %r12, %rdx
callq 0x6894
movq %rbp, %rdi
leaq 0x81146(%rip), %rsi     # 0x8d647
callq 0x106fe
movq %rax, %rdi
leaq 0x82a16(%rip), %rsi     # 0x8ef26
callq 0x107d8
movq %rax, %rdi
leaq 0x850d3(%rip), %rsi     # 0x915f2
callq 0x106fe
movq %rax, %r13
leaq 0x148(%rsp), %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %ebx, %ecx
callq 0x1084a
movq %r13, %rdi
movq %rax, %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x810f6(%rip), %rsi     # 0x8d647
callq 0x106fe
movq %rax, %rdi
leaq 0x82927(%rip), %rsi     # 0x8ee87
callq 0x106fe
movq %rax, %rdi
leaq 0x85083(%rip), %rsi     # 0x915f2
callq 0x106fe
movl $0x7, 0x20(%rsp)
movq %rax, %rdi
leaq 0x20(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x98d0f(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %rbp, %rdi
callq 0x68d4
movq %r12, %rdi
callq 0x2090
incl %r15d
jmp 0xc4ac
incl %r14d
jmp 0xc49f
incl %ebx
jmp 0xc493
leaq 0xf8(%rsp), %rdi
callq 0x11008
leaq 0x20(%rsp), %rdi
movq $0x4, (%rdi)
movq $0xa, 0x8(%rdi)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x10(%rdi)
movq $-0x2, 0x18(%rdi)
movq $0x5, 0x20(%rdi)
movq $0x2, 0x28(%rdi)
callq 0x8e70
leaq 0x20(%rsp), %rdi
movq 0x8(%rdi), %rax
imulq 0x20(%rdi), %rax
xorl %r14d, %r14d
testq %rax, %rax
cmovgq %rax, %r14
callq 0x8e44
movq %rax, %rbx
leaq 0x82b51(%rip), %rsi     # 0x8f183
leaq 0x50(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpq %rbx, %r14
setb %sil
leaq 0x1f8(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x6894
leaq 0x80fe4(%rip), %rsi     # 0x8d647
leaq 0x1f8(%rsp), %rdi
callq 0x106fe
leaq 0x82b3d(%rip), %rsi     # 0x8f1b4
movq %rax, %rdi
callq 0x11036
leaq 0x84f6c(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x28(%rsp), %rcx
imulq 0x40(%rsp), %rcx
xorl %edx, %edx
testq %rcx, %rcx
cmovgq %rcx, %rdx
leaq 0x10(%rsp), %rsi
movq %rdx, (%rsi)
movq %rax, %rdi
callq 0x11052
leaq 0x80f8e(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x82ad1(%rip), %rsi     # 0x8f199
movq %rax, %rdi
callq 0x11070
leaq 0x84f1b(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x8e44
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0x11052
leaq 0x98b9f(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x1f8(%rsp), %rdi
callq 0x68d4
leaq 0x50(%rsp), %rdi
callq 0x2090
movups 0x20(%rsp), %xmm0
movups 0x30(%rsp), %xmm1
movups 0x40(%rsp), %xmm2
leaq 0x3d0(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm1, 0x10(%rsi)
movaps %xmm2, 0x20(%rsi)
leaq 0x1f8(%rsp), %rdx
movl $0xd, (%rdx)
leaq 0xf8(%rsp), %rdi
callq 0x1108c
pushq $0x4
popq %rbx
leaq 0x50(%rsp), %r12
leaq 0x1f8(%rsp), %rbp
leaq 0x84e7c(%rip), %r13     # 0x915f2
cmpl $0xe, %ebx
je 0xc880
pushq $-0x2
popq %r14
cmpl $0x3, %r14d
je 0xc879
leaq 0xf8(%rsp), %rdi
movl %r14d, %esi
movl %ebx, %edx
callq 0x108b2
movl (%rax), %r15d
movq %r12, %rdi
leaq 0x82997(%rip), %rsi     # 0x8f143
leaq 0x18(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0xd, %r15d
sete %sil
movq %rbp, %rdi
movq %r12, %rdx
callq 0x6894
movq %rbp, %rdi
leaq 0x80e72(%rip), %rsi     # 0x8d647
callq 0x106fe
movq %rax, %rdi
leaq 0x827a8(%rip), %rsi     # 0x8ef8c
callq 0x1082e
movq %rax, %rdi
movq %r13, %rsi
callq 0x106fe
movq %rax, %r15
leaq 0xf8(%rsp), %rdi
movl %r14d, %esi
movl %ebx, %edx
callq 0x108b2
movq %r15, %rdi
movq %rax, %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x80e29(%rip), %rsi     # 0x8d647
callq 0x106fe
movq %rax, %rdi
leaq 0x82926(%rip), %rsi     # 0x8f153
callq 0x10896
movq %rax, %rdi
movq %r13, %rsi
callq 0x106fe
movl $0xd, 0x10(%rsp)
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x98a46(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %rbp, %rdi
callq 0x68d4
movq %r12, %rdi
callq 0x2090
incl %r14d
jmp 0xc783
incl %ebx
jmp 0xc776
leaq 0xf8(%rsp), %rdi
callq 0x6aca
leaq 0x148(%rsp), %rdi
callq 0x69c2
leaq 0x70(%rsp), %rdi
callq 0x108fe
leaq 0xc0(%rsp), %rdi
callq 0x1090e
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc931
jmp 0xc931
jmp 0xc931
jmp 0xc931
jmp 0xc996
jmp 0xc996
jmp 0xc996
jmp 0xc936
jmp 0xc936
jmp 0xc936
jmp 0xc8fe
jmp 0xc8fe
jmp 0xc8fe
jmp 0xc940
jmp 0xc8ec
jmp 0xc8ec
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
callq 0x68d4
jmp 0xc95c
movq %rax, %rbx
jmp 0xc9d6
jmp 0xc90d
movq %rax, %rbx
jmp 0xc91d
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
callq 0x68d4
leaq 0x148(%rsp), %rdi
callq 0x2090
jmp 0xc9d6
jmp 0xc931
movq %rax, %rbx
jmp 0xc966
movq %rax, %rbx
jmp 0xc9cc
jmp 0xc94c
movq %rax, %rbx
jmp 0xc95c
jmp 0xc975
movq %rax, %rbx
jmp 0xc985
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
callq 0x68d4
leaq 0x50(%rsp), %rdi
callq 0x2090
leaq 0xf8(%rsp), %rdi
callq 0x6aca
jmp 0xc9bf
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
callq 0x68d4
leaq 0x148(%rsp), %rdi
callq 0x2090
jmp 0xc9cc
jmp 0xc996
movq %rax, %rbx
jmp 0xc9bf
jmp 0xc9a2
movq %rax, %rbx
jmp 0xc9b2
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
callq 0x68d4
leaq 0xf8(%rsp), %rdi
callq 0x2090
leaq 0x148(%rsp), %rdi
callq 0x69c2
leaq 0x70(%rsp), %rdi
callq 0x108fe
leaq 0xc0(%rsp), %rdi
callq 0x1090e
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba