// File: dsharlet[P]array/test/ein_reduce.cpp
// Function: nda::test_ein_reduce_outer_body()
TEST(ein_reduce_outer) {
  constexpr index_t N = 64;
  constexpr index_t M = 40;
  vector<int, N> x;
  vector<int, M> y;
  fill_pattern(x);
  fill_pattern(y, 4);

  // Compute the outer product x^T*y.
  matrix<int, N, M> outer;
  ein_reduce(ein<i, j>(outer) = ein<i>(x) * ein<j>(y));

  for (index_t i : outer.i()) {
    for (index_t j : outer.j()) {
      ASSERT_EQ(outer(i, j), x(i) * y(j));
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x550, %rsp            # imm = 0x550
movq $0x40, -0x90(%rbp)
movq $0x28, -0x98(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xc6dd0
leaq -0xf8(%rbp), %rdi
callq 0xc74b0
jmp 0xb090b
leaq -0xc8(%rbp), %rdi
xorl %esi, %esi
callq 0xc6ee0
jmp 0xb091b
leaq -0xf8(%rbp), %rdi
movl $0x4, %esi
callq 0xc74e0
jmp 0xb092e
leaq -0x150(%rbp), %rdi
callq 0xc7d90
jmp 0xb093c
leaq -0x1f8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xc6e00
jmp 0xb0951
leaq -0x210(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0xc7c30
jmp 0xb0966
leaq -0x1e0(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
leaq -0x210(%rbp), %rdx
callq 0xc7be0
jmp 0xb0982
leaq -0x240(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0xc7dc0
jmp 0xb0997
leaq -0x1b0(%rbp), %rdi
leaq -0x240(%rbp), %rsi
leaq -0x1e0(%rbp), %rdx
callq 0xc7e00
jmp 0xb09b3
leaq -0x270(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x1b0(%rbp), %rax
movq %rax, -0x10(%rbp)
movq $0x2, -0x18(%rbp)
movq -0x10(%rbp), %rdx
movq %rdx, %r8
addq $0x30, %r8
leaq -0x40(%rbp), %rdi
leaq -0x41(%rbp), %rsi
leaq -0x42(%rbp), %rcx
callq 0xbc020
jmp 0xb09ef
movq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xbc950
jmp 0xb09fe
movq -0x10(%rbp), %rsi
leaq -0x270(%rbp), %rdi
movl $0x30, %edx
callq 0x31c0
leaq -0x150(%rbp), %rdi
callq 0xc7e40
movq %rax, -0x470(%rbp)
jmp 0xb0a28
movq -0x470(%rbp), %rax
movq %rax, -0x278(%rbp)
movq -0x278(%rbp), %rdi
callq 0xc6c40
movq %rax, -0x478(%rbp)
jmp 0xb0a4b
movq -0x478(%rbp), %rax
movq %rax, -0x280(%rbp)
movq -0x278(%rbp), %rdi
callq 0xc6c70
movq %rax, -0x480(%rbp)
jmp 0xb0a6e
movq -0x480(%rbp), %rax
movq %rax, -0x288(%rbp)
leaq -0x280(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x288(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rax
movq (%rax), %rax
movq -0x78(%rbp), %rcx
cmpq (%rcx), %rax
setne %al
movb %al, -0x481(%rbp)
movb -0x481(%rbp), %al
testb $0x1, %al
jne 0xb0ab8
jmp 0xb0f21
leaq -0x280(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x490(%rbp)
movq -0x490(%rbp), %rax
movq %rax, -0x290(%rbp)
leaq -0x150(%rbp), %rdi
callq 0xc7e60
movq %rax, -0x498(%rbp)
jmp 0xb0af4
movq -0x498(%rbp), %rax
movq %rax, -0x298(%rbp)
movq -0x298(%rbp), %rdi
callq 0xc76a0
movq %rax, -0x4a0(%rbp)
jmp 0xb0b17
movq -0x4a0(%rbp), %rax
movq %rax, -0x2a0(%rbp)
movq -0x298(%rbp), %rdi
callq 0xc76d0
movq %rax, -0x4a8(%rbp)
jmp 0xb0b3a
movq -0x4a8(%rbp), %rax
movq %rax, -0x2a8(%rbp)
leaq -0x2a0(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x2a8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq -0x88(%rbp), %rcx
cmpq (%rcx), %rax
setne %al
movb %al, -0x4a9(%rbp)
movb -0x4a9(%rbp), %al
testb $0x1, %al
jne 0xb0b8a
jmp 0xb0f01
leaq -0x2a0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x4b8(%rbp)
movq -0x4b8(%rbp), %rax
movq %rax, -0x2b0(%rbp)
movq -0x290(%rbp), %rsi
movq -0x2b0(%rbp), %rdx
leaq -0x150(%rbp), %rdi
callq 0xc7e80
movq %rax, -0x4c0(%rbp)
jmp 0xb0bd4
movq -0x4c0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4cc(%rbp)
movq -0x290(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0xc6cc0
movq %rax, -0x4c8(%rbp)
jmp 0xb0bff
movq -0x4c8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4dc(%rbp)
movq -0x2b0(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0xc7720
movq %rax, -0x4d8(%rbp)
jmp 0xb0c2a
movl -0x4cc(%rbp), %eax
movl -0x4dc(%rbp), %ecx
movq -0x4d8(%rbp), %rdx
movl (%rdx), %edx
imull %edx, %ecx
subl %ecx, %eax
sete %al
movb %al, -0x4e9(%rbp)
leaq -0x461(%rbp), %rdi
movq %rdi, -0x4e8(%rbp)
callq 0x33b0
movq -0x4e8(%rbp), %rdx
leaq 0x138ff7(%rip), %rsi    # 0x1e9c65
leaq -0x460(%rbp), %rdi
callq 0x10a90
jmp 0xb0c7c
movb -0x4e9(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x440(%rbp), %rdi
leaq -0x460(%rbp), %rdx
callq 0x10f80
jmp 0xb0c9d
leaq 0x12bb41(%rip), %rsi    # 0x1dc7e5
leaq -0x440(%rbp), %rdi
callq 0x34320
movq %rax, -0x4f8(%rbp)
jmp 0xb0cb9
movq -0x4f8(%rbp), %rdi
leaq 0x138fb9(%rip), %rsi    # 0x1e9c80
callq 0xc7360
movq %rax, -0x500(%rbp)
jmp 0xb0cd5
movq -0x500(%rbp), %rdi
leaq 0x12fac9(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x508(%rbp)
jmp 0xb0cf1
movq -0x290(%rbp), %rsi
movq -0x2b0(%rbp), %rdx
leaq -0x150(%rbp), %rdi
callq 0xc7e80
movq %rax, -0x510(%rbp)
jmp 0xb0d14
movq -0x510(%rbp), %rsi
movq -0x508(%rbp), %rdi
callq 0x343a0
movq %rax, -0x518(%rbp)
jmp 0xb0d30
movq -0x518(%rbp), %rdi
leaq 0x12baa7(%rip), %rsi    # 0x1dc7e5
callq 0x34320
movq %rax, -0x520(%rbp)
jmp 0xb0d4c
movq -0x520(%rbp), %rdi
leaq 0x138f1a(%rip), %rsi    # 0x1e9c74
callq 0xc7360
movq %rax, -0x528(%rbp)
jmp 0xb0d68
movq -0x528(%rbp), %rdi
leaq 0x12fa36(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x530(%rbp)
jmp 0xb0d84
movq -0x290(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0xc6cc0
movq %rax, -0x538(%rbp)
jmp 0xb0da0
movq -0x538(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x544(%rbp)
movq -0x2b0(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0xc7720
movq %rax, -0x540(%rbp)
jmp 0xb0dcb
movq -0x530(%rbp), %rdi
movl -0x544(%rbp), %eax
movq -0x540(%rbp), %rcx
movl (%rcx), %ecx
imull %ecx, %eax
movl %eax, -0x468(%rbp)
leaq -0x468(%rbp), %rsi
callq 0x343a0
movq %rax, -0x550(%rbp)
jmp 0xb0dff
movq -0x550(%rbp), %rdi
leaq 0x14566e(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0xb0e14
leaq -0x440(%rbp), %rdi
callq 0x10ff0
jmp 0xb0e22
leaq -0x460(%rbp), %rdi
callq 0x3100
leaq -0x461(%rbp), %rdi
callq 0x3290
leaq -0x2a0(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xb0b48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0xb0f66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0xb0f5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0xb0f4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0xb0ef3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0xb0ee7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x440(%rbp), %rdi
callq 0x10ff0
jmp 0xb0ee5
jmp 0xb0ee7
leaq -0x460(%rbp), %rdi
callq 0x3100
leaq -0x461(%rbp), %rdi
callq 0x3290
jmp 0xb0f4e
jmp 0xb0f03
leaq -0x280(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xb0a7c
leaq -0x150(%rbp), %rdi
callq 0xc7ed0
leaq -0xf8(%rbp), %rdi
callq 0xc7760
leaq -0xc8(%rbp), %rdi
callq 0xc6d50
addq $0x550, %rsp            # imm = 0x550
popq %rbp
retq
leaq -0x150(%rbp), %rdi
callq 0xc7ed0
leaq -0xf8(%rbp), %rdi
callq 0xc7760
leaq -0xc8(%rbp), %rdi
callq 0xc6d50
movq -0x100(%rbp), %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x116d0
nopw %cs:(%rax,%rax)