// File: dsharlet[P]array/test/image.cpp
// Function: nda::test_image_chunky_padded_body()
TEST(image_chunky_padded) {
  chunky_image<int, 4> src({40, 30, {}});
  fill_pattern(src);
  chunky_image<int, 4> dest(src.shape(), 5);

  chunky_image_ref<const int, 3, 4> src_rgb(src.base(), {src.width(), src.height(), 3});
  chunky_image_ref<int, 3, 4> dest_rgb(dest.base(), {src.width(), src.height(), 3});
  copy(src_rgb, dest_rgb);

  for (int y = 0; y < dest.height(); y++) {
    for (int x = 0; x < dest.width(); x++) {
      ASSERT_EQ(dest(x, y, 0), src(x, y, 0));
      ASSERT_EQ(dest(x, y, 1), src(x, y, 1));
      ASSERT_EQ(dest(x, y, 2), src(x, y, 2));
      // The channel corresponding to padding should not have been
      // overwritten by the pattern.
      ASSERT_EQ(dest(x, y, 3), 5);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb60, %rsp            # imm = 0xB60
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x938(%rbp)
movl $0x28, %esi
callq 0x10b480
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x930(%rbp)
movl $0x1e, %esi
callq 0x10c20
leaq -0xc3(%rbp), %rdi
movq %rdi, -0x928(%rbp)
callq 0x10b4b0
movq -0x938(%rbp), %rsi
movq -0x930(%rbp), %rdx
movq -0x928(%rbp), %rcx
leaq -0x90(%rbp), %rdi
movq %rdi, -0x920(%rbp)
callq 0x10b4d0
movq -0x920(%rbp), %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0x918(%rbp)
callq 0x10b530
movq -0x918(%rbp), %rdi
xorl %esi, %esi
callq 0x10b5d0
jmp 0xf29dd
leaq -0x58(%rbp), %rdi
callq 0x10b600
movq %rax, -0x940(%rbp)
jmp 0xf29ef
movq -0x940(%rbp), %rsi
movl $0x5, -0x134(%rbp)
leaq -0x130(%rbp), %rdi
leaq -0x134(%rbp), %rdx
callq 0x10b620
jmp 0xf2a15
leaq -0x58(%rbp), %rdi
callq 0x10b6a0
movq %rax, -0x948(%rbp)
jmp 0xf2a27
leaq -0x58(%rbp), %rdi
callq 0x10b6c0
movq %rax, -0x950(%rbp)
jmp 0xf2a39
leaq -0x58(%rbp), %rdi
callq 0x10b6e0
movq %rax, -0x958(%rbp)
jmp 0xf2a4b
movq -0x958(%rbp), %rdx
movq -0x950(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
movl $0x3, %ecx
callq 0x10b700
jmp 0xf2a6c
movq -0x948(%rbp), %rsi
leaq -0x178(%rbp), %rdi
leaq -0x1b0(%rbp), %rdx
callq 0x10b750
jmp 0xf2a88
leaq -0x130(%rbp), %rdi
callq 0x10b6a0
movq %rax, -0x960(%rbp)
jmp 0xf2a9d
leaq -0x58(%rbp), %rdi
callq 0x10b6c0
movq %rax, -0x968(%rbp)
jmp 0xf2aaf
leaq -0x58(%rbp), %rdi
callq 0x10b6e0
movq %rax, -0x970(%rbp)
jmp 0xf2ac1
movq -0x970(%rbp), %rdx
movq -0x968(%rbp), %rsi
leaq -0x228(%rbp), %rdi
movl $0x3, %ecx
callq 0x10b700
jmp 0xf2ae2
movq -0x960(%rbp), %rsi
leaq -0x1f0(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x10b7a0
jmp 0xf2afe
leaq -0x178(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x10b7f0
jmp 0xf2b13
movl $0x0, -0x22c(%rbp)
movslq -0x22c(%rbp), %rax
movq %rax, -0x980(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x10b6e0
movq %rax, -0x978(%rbp)
jmp 0xf2b40
movq -0x980(%rbp), %rax
movq -0x978(%rbp), %rcx
cmpq %rcx, %rax
jge 0xf35c8
movl $0x0, -0x230(%rbp)
movslq -0x230(%rbp), %rax
movq %rax, -0x990(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x10b6c0
movq %rax, -0x988(%rbp)
jmp 0xf2b84
movq -0x990(%rbp), %rax
movq -0x988(%rbp), %rcx
cmpq %rcx, %rax
jge 0xf35b2
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x130(%rbp), %rdi
xorl %ecx, %ecx
callq 0x10b910
movq %rax, -0x998(%rbp)
jmp 0xf2bbe
movq -0x998(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x9a4(%rbp)
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x58(%rbp), %rdi
xorl %ecx, %ecx
callq 0x10b910
movq %rax, -0x9a0(%rbp)
jmp 0xf2bed
movl -0x9a4(%rbp), %eax
movq -0x9a0(%rbp), %rcx
movl (%rcx), %ecx
subl %ecx, %eax
sete %al
movb %al, -0x9b1(%rbp)
leaq -0x3e1(%rbp), %rdi
movq %rdi, -0x9b0(%rbp)
callq 0x33b0
movq -0x9b0(%rbp), %rdx
leaq 0xfb8fb(%rip), %rsi     # 0x1ee523
leaq -0x3e0(%rbp), %rdi
callq 0x10a90
jmp 0xf2c36
movb -0x9b1(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x3c0(%rbp), %rdi
leaq -0x3e0(%rbp), %rdx
callq 0x10f80
jmp 0xf2c57
leaq 0xe9b87(%rip), %rsi     # 0x1dc7e5
leaq -0x3c0(%rbp), %rdi
callq 0x34320
movq %rax, -0x9c0(%rbp)
jmp 0xf2c73
movq -0x9c0(%rbp), %rdi
leaq 0xfb8c0(%rip), %rsi     # 0x1ee541
callq 0x347a0
movq %rax, -0x9c8(%rbp)
jmp 0xf2c8f
movq -0x9c8(%rbp), %rdi
leaq 0xedb0f(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0x9d0(%rbp)
jmp 0xf2cab
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x130(%rbp), %rdi
xorl %ecx, %ecx
callq 0x10b910
movq %rax, -0x9d8(%rbp)
jmp 0xf2cce
movq -0x9d8(%rbp), %rsi
movq -0x9d0(%rbp), %rdi
callq 0x343a0
movq %rax, -0x9e0(%rbp)
jmp 0xf2cea
movq -0x9e0(%rbp), %rdi
leaq 0xe9aed(%rip), %rsi     # 0x1dc7e5
callq 0x34320
movq %rax, -0x9e8(%rbp)
jmp 0xf2d06
movq -0x9e8(%rbp), %rdi
leaq 0xfb820(%rip), %rsi     # 0x1ee534
callq 0x346f0
movq %rax, -0x9f0(%rbp)
jmp 0xf2d22
movq -0x9f0(%rbp), %rdi
leaq 0xeda7c(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0x9f8(%rbp)
jmp 0xf2d3e
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x58(%rbp), %rdi
xorl %ecx, %ecx
callq 0x10b910
movq %rax, -0xa00(%rbp)
jmp 0xf2d5e
movq -0xa00(%rbp), %rsi
movq -0x9f8(%rbp), %rdi
callq 0x343a0
movq %rax, -0xa08(%rbp)
jmp 0xf2d7a
movq -0xa08(%rbp), %rdi
leaq 0x1036f3(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0xf2d8f
leaq -0x3c0(%rbp), %rdi
callq 0x10ff0
jmp 0xf2d9d
leaq -0x3e0(%rbp), %rdi
callq 0x3100
leaq -0x3e1(%rbp), %rdi
callq 0x3290
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x130(%rbp), %rdi
movl $0x1, %ecx
callq 0x10b910
movq %rax, -0xa10(%rbp)
jmp 0xf2ddb
movq -0xa10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xa1c(%rbp)
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x58(%rbp), %rdi
movl $0x1, %ecx
callq 0x10b910
movq %rax, -0xa18(%rbp)
jmp 0xf2e0d
movl -0xa1c(%rbp), %eax
movq -0xa18(%rbp), %rcx
movl (%rcx), %ecx
subl %ecx, %eax
sete %al
movb %al, -0xa29(%rbp)
leaq -0x599(%rbp), %rdi
movq %rdi, -0xa28(%rbp)
callq 0x33b0
movq -0xa28(%rbp), %rdx
leaq 0xfb707(%rip), %rsi     # 0x1ee54f
leaq -0x598(%rbp), %rdi
callq 0x10a90
jmp 0xf2e56
movb -0xa29(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x578(%rbp), %rdi
leaq -0x598(%rbp), %rdx
callq 0x10f80
jmp 0xf2e77
leaq 0xe9967(%rip), %rsi     # 0x1dc7e5
leaq -0x578(%rbp), %rdi
callq 0x34320
movq %rax, -0xa38(%rbp)
jmp 0xf2e93
movq -0xa38(%rbp), %rdi
leaq 0xfb6cc(%rip), %rsi     # 0x1ee56d
callq 0x347a0
movq %rax, -0xa40(%rbp)
jmp 0xf2eaf
movq -0xa40(%rbp), %rdi
leaq 0xed8ef(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0xa48(%rbp)
jmp 0xf2ecb
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x130(%rbp), %rdi
movl $0x1, %ecx
callq 0x10b910
movq %rax, -0xa50(%rbp)
jmp 0xf2ef1
movq -0xa50(%rbp), %rsi
movq -0xa48(%rbp), %rdi
callq 0x343a0
movq %rax, -0xa58(%rbp)
jmp 0xf2f0d
movq -0xa58(%rbp), %rdi
leaq 0xe98ca(%rip), %rsi     # 0x1dc7e5
callq 0x34320
movq %rax, -0xa60(%rbp)
jmp 0xf2f29
movq -0xa60(%rbp), %rdi
leaq 0xfb629(%rip), %rsi     # 0x1ee560
callq 0x346f0
movq %rax, -0xa68(%rbp)
jmp 0xf2f45
movq -0xa68(%rbp), %rdi
leaq 0xed859(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0xa70(%rbp)
jmp 0xf2f61
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x58(%rbp), %rdi
movl $0x1, %ecx
callq 0x10b910
movq %rax, -0xa78(%rbp)
jmp 0xf2f84
movq -0xa78(%rbp), %rsi
movq -0xa70(%rbp), %rdi
callq 0x343a0
movq %rax, -0xa80(%rbp)
jmp 0xf2fa0
movq -0xa80(%rbp), %rdi
leaq 0x1034cd(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0xf2fb5
leaq -0x578(%rbp), %rdi
callq 0x10ff0
jmp 0xf2fc3
leaq -0x598(%rbp), %rdi
callq 0x3100
leaq -0x599(%rbp), %rdi
callq 0x3290
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x130(%rbp), %rdi
movl $0x2, %ecx
callq 0x10b910
movq %rax, -0xa88(%rbp)
jmp 0xf3001
movq -0xa88(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xa94(%rbp)
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x58(%rbp), %rdi
movl $0x2, %ecx
callq 0x10b910
movq %rax, -0xa90(%rbp)
jmp 0xf3033
movl -0xa94(%rbp), %eax
movq -0xa90(%rbp), %rcx
movl (%rcx), %ecx
subl %ecx, %eax
sete %al
movb %al, -0xaa1(%rbp)
leaq -0x751(%rbp), %rdi
movq %rdi, -0xaa0(%rbp)
callq 0x33b0
movq -0xaa0(%rbp), %rdx
leaq 0xfb50d(%rip), %rsi     # 0x1ee57b
leaq -0x750(%rbp), %rdi
callq 0x10a90
jmp 0xf307c
movb -0xaa1(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x730(%rbp), %rdi
leaq -0x750(%rbp), %rdx
callq 0x10f80
jmp 0xf309d
leaq 0xe9741(%rip), %rsi     # 0x1dc7e5
leaq -0x730(%rbp), %rdi
callq 0x34320
movq %rax, -0xab0(%rbp)
jmp 0xf30b9
movq -0xab0(%rbp), %rdi
leaq 0xfb4d2(%rip), %rsi     # 0x1ee599
callq 0x347a0
movq %rax, -0xab8(%rbp)
jmp 0xf30d5
movq -0xab8(%rbp), %rdi
leaq 0xed6c9(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0xac0(%rbp)
jmp 0xf30f1
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x130(%rbp), %rdi
movl $0x2, %ecx
callq 0x10b910
movq %rax, -0xac8(%rbp)
jmp 0xf3117
movq -0xac8(%rbp), %rsi
movq -0xac0(%rbp), %rdi
callq 0x343a0
movq %rax, -0xad0(%rbp)
jmp 0xf3133
movq -0xad0(%rbp), %rdi
leaq 0xe96a4(%rip), %rsi     # 0x1dc7e5
callq 0x34320
movq %rax, -0xad8(%rbp)
jmp 0xf314f
movq -0xad8(%rbp), %rdi
leaq 0xfb42f(%rip), %rsi     # 0x1ee58c
callq 0x346f0
movq %rax, -0xae0(%rbp)
jmp 0xf316b
movq -0xae0(%rbp), %rdi
leaq 0xed633(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0xae8(%rbp)
jmp 0xf3187
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x58(%rbp), %rdi
movl $0x2, %ecx
callq 0x10b910
movq %rax, -0xaf0(%rbp)
jmp 0xf31aa
movq -0xaf0(%rbp), %rsi
movq -0xae8(%rbp), %rdi
callq 0x343a0
movq %rax, -0xaf8(%rbp)
jmp 0xf31c6
movq -0xaf8(%rbp), %rdi
leaq 0x1032a7(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0xf31db
leaq -0x730(%rbp), %rdi
callq 0x10ff0
jmp 0xf31e9
leaq -0x750(%rbp), %rdi
callq 0x3100
leaq -0x751(%rbp), %rdi
callq 0x3290
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x130(%rbp), %rdi
movl $0x3, %ecx
callq 0x10b910
movq %rax, -0xb00(%rbp)
jmp 0xf3227
movq -0xb00(%rbp), %rax
movl (%rax), %eax
subl $0x5, %eax
sete %al
movb %al, -0xb09(%rbp)
leaq -0x909(%rbp), %rdi
movq %rdi, -0xb08(%rbp)
callq 0x33b0
movq -0xb08(%rbp), %rdx
leaq 0xfb34a(%rip), %rsi     # 0x1ee5a7
leaq -0x908(%rbp), %rdi
callq 0x10a90
jmp 0xf326b
movb -0xb09(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x8e8(%rbp), %rdi
leaq -0x908(%rbp), %rdx
callq 0x10f80
jmp 0xf328c
leaq 0xe9552(%rip), %rsi     # 0x1dc7e5
leaq -0x8e8(%rbp), %rdi
callq 0x34320
movq %rax, -0xb18(%rbp)
jmp 0xf32a8
movq -0xb18(%rbp), %rdi
leaq 0xfb304(%rip), %rsi     # 0x1ee5ba
callq 0x347a0
movq %rax, -0xb20(%rbp)
jmp 0xf32c4
movq -0xb20(%rbp), %rdi
leaq 0xed4da(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0xb28(%rbp)
jmp 0xf32e0
movl -0x230(%rbp), %esi
movl -0x22c(%rbp), %edx
leaq -0x130(%rbp), %rdi
movl $0x3, %ecx
callq 0x10b910
movq %rax, -0xb30(%rbp)
jmp 0xf3306
movq -0xb30(%rbp), %rsi
movq -0xb28(%rbp), %rdi
callq 0x343a0
movq %rax, -0xb38(%rbp)
jmp 0xf3322
movq -0xb38(%rbp), %rdi
leaq 0xe94b5(%rip), %rsi     # 0x1dc7e5
callq 0x34320
movq %rax, -0xb40(%rbp)
jmp 0xf333e
movq -0xb40(%rbp), %rdi
leaq 0xeb411(%rip), %rsi     # 0x1de75d
callq 0x34320
movq %rax, -0xb48(%rbp)
jmp 0xf335a
movq -0xb48(%rbp), %rdi
leaq 0xed444(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0xb50(%rbp)
jmp 0xf3376
movq -0xb50(%rbp), %rdi
movl $0x5, -0x910(%rbp)
leaq -0x910(%rbp), %rsi
callq 0x343a0
movq %rax, -0xb58(%rbp)
jmp 0xf339c
movq -0xb58(%rbp), %rdi
leaq 0x1030d1(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0xf33b1
leaq -0x8e8(%rbp), %rdi
callq 0x10ff0
jmp 0xf33bf
leaq -0x908(%rbp), %rdi
callq 0x3100
leaq -0x909(%rbp), %rdi
callq 0x3290
movl -0x230(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x230(%rbp)
jmp 0xf2b61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xf35f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xf35e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xf346f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xf3463
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x3c0(%rbp), %rdi
callq 0x10ff0
jmp 0xf3461
jmp 0xf3463
leaq -0x3e0(%rbp), %rdi
callq 0x3100
leaq -0x3e1(%rbp), %rdi
callq 0x3290
jmp 0xf35e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xf34d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xf34ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x578(%rbp), %rdi
callq 0x10ff0
jmp 0xf34c8
jmp 0xf34ca
leaq -0x598(%rbp), %rdi
callq 0x3100
leaq -0x599(%rbp), %rdi
callq 0x3290
jmp 0xf35e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xf353d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xf3531
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x730(%rbp), %rdi
callq 0x10ff0
jmp 0xf352f
jmp 0xf3531
leaq -0x750(%rbp), %rdi
callq 0x3100
leaq -0x751(%rbp), %rdi
callq 0x3290
jmp 0xf35e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xf35a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xf3598
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x8e8(%rbp), %rdi
callq 0x10ff0
jmp 0xf3596
jmp 0xf3598
leaq -0x908(%rbp), %rdi
callq 0x3100
leaq -0x909(%rbp), %rdi
callq 0x3290
jmp 0xf35e6
jmp 0xf35b4
movl -0x22c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x22c(%rbp)
jmp 0xf2b1d
leaq -0x130(%rbp), %rdi
callq 0x10b960
leaq -0x58(%rbp), %rdi
callq 0x10b960
addq $0xb60, %rsp            # imm = 0xB60
popq %rbp
retq
leaq -0x130(%rbp), %rdi
callq 0x10b960
leaq -0x58(%rbp), %rdi
callq 0x10b960
movq -0xd0(%rbp), %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x116d0
nop