// File: dsharlet[P]array/test/matrix.cpp
// Function: nda::test_matrix_slice_body()
TEST(matrix_slice) {
  matrix<float> m({10, 10}, 0);
  for_all_indices(m.shape(), [&](int i, int j) { m(i, j) = i * 10 + j; });

  for (int i = 0; i < 10; i++) {
    auto row = m(_, i);
    auto col = m(i, _);

    for (int j = 0; j < 10; j++) {
      ASSERT_EQ(row(j), j * 10 + i);
      ASSERT_EQ(col(j), i * 10 + j);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x540, %rsp            # imm = 0x540
leaq -0x80(%rbp), %rdi
movq %rdi, -0x480(%rbp)
movl $0xa, %edx
movl %edx, %esi
callq 0x149bd0
movq -0x480(%rbp), %rsi
movl $0x0, -0x84(%rbp)
leaq -0x50(%rbp), %rdi
movq %rdi, -0x478(%rbp)
leaq -0x84(%rbp), %rdx
callq 0x149c10
movq -0x478(%rbp), %rdi
callq 0x149c90
movq %rax, -0x470(%rbp)
jmp 0x146adf
movq -0x470(%rbp), %rdi
leaq -0x50(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0xa0(%rbp), %rsi
callq 0x1470b0
jmp 0x146aff
movl $0x0, -0xa4(%rbp)
cmpl $0xa, -0xa4(%rbp)
jge 0x147075
movw 0x14b86d(%rip), %ax     # 0x29238a
movw %ax, -0xca(%rbp)
movl -0xa4(%rbp), %edx
leaq -0xc8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x149cb0
jmp 0x146b3c
movl -0xa4(%rbp), %edx
movw 0x14b841(%rip), %ax     # 0x29238a
movw %ax, -0xf2(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x149d20
jmp 0x146b62
movl $0x0, -0xf8(%rbp)
cmpl $0xa, -0xf8(%rbp)
jge 0x14705f
movl -0xf8(%rbp), %esi
leaq -0xc8(%rbp), %rdi
callq 0x149d90
movq %rax, -0x488(%rbp)
jmp 0x146b94
movq -0x488(%rbp), %rax
movss (%rax), %xmm1
movl -0xf8(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %edx
movl -0xa4(%rbp), %ecx
movl %ecx, %eax
movl %edx, %ecx
leal (%rax,%rcx,2), %eax
cvtsi2ss %eax, %xmm0
cmpeqss %xmm1, %xmm0
movd %xmm0, %eax
andl $0x1, %eax
movb %al, -0x491(%rbp)
leaq -0x2a9(%rbp), %rdi
movq %rdi, -0x490(%rbp)
callq 0x33b0
movq -0x490(%rbp), %rdx
leaq 0xaf8bf(%rip), %rsi     # 0x1f64ad
leaq -0x2a8(%rbp), %rdi
callq 0x10a90
jmp 0x146bfc
movb -0x491(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x288(%rbp), %rdi
leaq -0x2a8(%rbp), %rdx
callq 0x10f80
jmp 0x146c1d
leaq 0x95bc1(%rip), %rsi     # 0x1dc7e5
leaq -0x288(%rbp), %rdi
callq 0x34320
movq %rax, -0x4a0(%rbp)
jmp 0x146c39
movq -0x4a0(%rbp), %rdi
leaq 0xaf87b(%rip), %rsi     # 0x1f64c2
callq 0xc6ea0
movq %rax, -0x4a8(%rbp)
jmp 0x146c55
movq -0x4a8(%rbp), %rdi
leaq 0x99b49(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0x4b0(%rbp)
jmp 0x146c71
movl -0xf8(%rbp), %esi
leaq -0xc8(%rbp), %rdi
callq 0x149d90
movq %rax, -0x4b8(%rbp)
jmp 0x146c8c
movq -0x4b8(%rbp), %rsi
movq -0x4b0(%rbp), %rdi
callq 0x96bd0
movq %rax, -0x4c0(%rbp)
jmp 0x146ca8
movq -0x4c0(%rbp), %rdi
leaq 0x95b2f(%rip), %rsi     # 0x1dc7e5
callq 0x34320
movq %rax, -0x4c8(%rbp)
jmp 0x146cc4
movq -0x4c8(%rbp), %rdi
leaq 0xaf7e5(%rip), %rsi     # 0x1f64b7
callq 0x34570
movq %rax, -0x4d0(%rbp)
jmp 0x146ce0
movq -0x4d0(%rbp), %rdi
leaq 0x99abe(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0x4d8(%rbp)
jmp 0x146cfc
movq -0x4d8(%rbp), %rdi
movl -0xf8(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %edx
movl -0xa4(%rbp), %ecx
movl %ecx, %eax
movl %edx, %ecx
leal (%rax,%rcx,2), %eax
movl %eax, -0x2b0(%rbp)
leaq -0x2b0(%rbp), %rsi
callq 0x343a0
movq %rax, -0x4e0(%rbp)
jmp 0x146d36
movq -0x4e0(%rbp), %rdi
leaq 0xaf737(%rip), %rsi     # 0x1f647b
callq 0x34320
jmp 0x146d4b
leaq -0x288(%rbp), %rdi
callq 0x10ff0
jmp 0x146d59
leaq -0x2a8(%rbp), %rdi
callq 0x3100
leaq -0x2a9(%rbp), %rdi
callq 0x3290
movl -0xf8(%rbp), %esi
leaq -0xf0(%rbp), %rdi
callq 0x149dd0
movq %rax, -0x4e8(%rbp)
jmp 0x146d8c
movq -0x4e8(%rbp), %rax
movss (%rax), %xmm1
movl -0xa4(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %edx
movl -0xf8(%rbp), %ecx
movl %ecx, %eax
movl %edx, %ecx
leal (%rax,%rcx,2), %eax
cvtsi2ss %eax, %xmm0
cmpeqss %xmm1, %xmm0
movd %xmm0, %eax
andl $0x1, %eax
movb %al, -0x4f1(%rbp)
leaq -0x461(%rbp), %rdi
movq %rdi, -0x4f0(%rbp)
callq 0x33b0
movq -0x4f0(%rbp), %rdx
leaq 0xaf6e3(%rip), %rsi     # 0x1f64c9
leaq -0x460(%rbp), %rdi
callq 0x10a90
jmp 0x146df4
movb -0x4f1(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x440(%rbp), %rdi
leaq -0x460(%rbp), %rdx
callq 0x10f80
jmp 0x146e15
leaq 0x959c9(%rip), %rsi     # 0x1dc7e5
leaq -0x440(%rbp), %rdi
callq 0x34320
movq %rax, -0x500(%rbp)
jmp 0x146e31
movq -0x500(%rbp), %rdi
leaq 0xaf69f(%rip), %rsi     # 0x1f64de
callq 0xc6ea0
movq %rax, -0x508(%rbp)
jmp 0x146e4d
movq -0x508(%rbp), %rdi
leaq 0x99951(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0x510(%rbp)
jmp 0x146e69
movl -0xf8(%rbp), %esi
leaq -0xf0(%rbp), %rdi
callq 0x149dd0
movq %rax, -0x518(%rbp)
jmp 0x146e84
movq -0x518(%rbp), %rsi
movq -0x510(%rbp), %rdi
callq 0x96bd0
movq %rax, -0x520(%rbp)
jmp 0x146ea0
movq -0x520(%rbp), %rdi
leaq 0x95937(%rip), %rsi     # 0x1dc7e5
callq 0x34320
movq %rax, -0x528(%rbp)
jmp 0x146ebc
movq -0x528(%rbp), %rdi
leaq 0xaf609(%rip), %rsi     # 0x1f64d3
callq 0x34570
movq %rax, -0x530(%rbp)
jmp 0x146ed8
movq -0x530(%rbp), %rdi
leaq 0x998c6(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0x538(%rbp)
jmp 0x146ef4
movq -0x538(%rbp), %rdi
movl -0xa4(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %edx
movl -0xf8(%rbp), %ecx
movl %ecx, %eax
movl %edx, %ecx
leal (%rax,%rcx,2), %eax
movl %eax, -0x468(%rbp)
leaq -0x468(%rbp), %rsi
callq 0x343a0
movq %rax, -0x540(%rbp)
jmp 0x146f2e
movq -0x540(%rbp), %rdi
leaq 0xaf53f(%rip), %rsi     # 0x1f647b
callq 0x34320
jmp 0x146f43
leaq -0x440(%rbp), %rdi
callq 0x10ff0
jmp 0x146f51
leaq -0x460(%rbp), %rdi
callq 0x3100
leaq -0x461(%rbp), %rdi
callq 0x3290
movl -0xf8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf8(%rbp)
jmp 0x146b6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x147087
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x146fea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x146fde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x10ff0
jmp 0x146fdc
jmp 0x146fde
leaq -0x2a8(%rbp), %rdi
callq 0x3100
leaq -0x2a9(%rbp), %rdi
callq 0x3290
jmp 0x147087
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x147051
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x147045
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x440(%rbp), %rdi
callq 0x10ff0
jmp 0x147043
jmp 0x147045
leaq -0x460(%rbp), %rdi
callq 0x3100
leaq -0x461(%rbp), %rdi
callq 0x3290
jmp 0x147087
jmp 0x147061
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x146b09
leaq -0x50(%rbp), %rdi
callq 0x149e10
addq $0x540, %rsp            # imm = 0x540
popq %rbp
retq
leaq -0x50(%rbp), %rdi
callq 0x149e10
movq -0x90(%rbp), %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x116d0
nopw %cs:(%rax,%rax)