// File: ef-gy[P]libefgy/src/test-case/matrix.cpp
// Function: testIterator(std::ostream&)
bool testIterator(std::ostream &log) {
  matrix<int, 3, 4> m;
  int j = 0;
  for (int i = 0; i < 3; i++) {
    for (int k = 0; k < 4; k++) {
      m[i][k] = j++;
    }
  }

  auto r = range<int>(0, 3 * 4, false);

  if (!std::equal(m.begin(), m.end(), r.begin())) {
    log << "matrix iterator and range iterator did not produce the same "
           "sequence:\n";
    for (auto i : m) {
      log << "\t" << i;
    }
    log << "\nvs. expected:\n";
    for (auto i : r) {
      log << "\t" << i;
    }
    log << "\n";
    return false;
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x10(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
cmpl $0x3, -0x48(%rbp)
jge 0x6aa8
movl $0x0, -0x4c(%rbp)
cmpl $0x4, -0x4c(%rbp)
jge 0x6a9b
movl -0x44(%rbp), %eax
movl %eax, -0xf8(%rbp)
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movslq -0x48(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x74b0
movq %rax, %rdi
movslq -0x4c(%rbp), %rsi
callq 0x74e0
movl -0xf8(%rbp), %ecx
movl %ecx, (%rax)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x6a5a
jmp 0x6a9d
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x6a4d
movl $0x0, -0x64(%rbp)
movl $0xc, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x64(%rbp), %rsi
leaq -0x68(%rbp), %rdx
xorl %ecx, %ecx
callq 0x76b0
leaq -0x40(%rbp), %rdi
callq 0x7810
movq %rax, -0x78(%rbp)
movq %rdx, -0x70(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x7840
movq %rax, -0x88(%rbp)
movq %rdx, -0x80(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x7870
movq %rax, -0x98(%rbp)
movq %rdx, -0x90(%rbp)
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq -0x80(%rbp), %rcx
movq -0x98(%rbp), %r8
movq -0x90(%rbp), %r9
callq 0x7790
testb $0x1, %al
jne 0x6c95
movq -0x10(%rbp), %rdi
leaq 0x2e883(%rip), %rsi     # 0x353c1
callq 0x5390
leaq -0x40(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdi
callq 0x7810
movq %rax, -0xb0(%rbp)
movq %rdx, -0xa8(%rbp)
movq -0xa0(%rbp), %rdi
callq 0x7840
movq %rax, -0xc0(%rbp)
movq %rdx, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x78b0
testb $0x1, %al
jne 0x6b9b
jmp 0x6bd9
leaq -0xb0(%rbp), %rdi
callq 0x7900
movl %eax, -0xc4(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x2e850(%rip), %rsi     # 0x35408
callq 0x5390
movq %rax, %rdi
movl -0xc4(%rbp), %esi
callq 0x55e0
leaq -0xb0(%rbp), %rdi
callq 0x7950
jmp 0x6b82
movq -0x10(%rbp), %rdi
leaq 0x2e826(%rip), %rsi     # 0x3540a
callq 0x5390
leaq -0x60(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x7870
movq %rax, -0xe0(%rbp)
movq %rdx, -0xd8(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x7970
movq %rax, -0xf0(%rbp)
movq %rdx, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x79b0
testb $0x1, %al
jne 0x6c41
jmp 0x6c7f
leaq -0xe0(%rbp), %rdi
callq 0x7a10
movl %eax, -0xf4(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x2e7aa(%rip), %rsi     # 0x35408
callq 0x5390
movq %rax, %rdi
movl -0xf4(%rbp), %esi
callq 0x55e0
leaq -0xe0(%rbp), %rdi
callq 0x7a30
jmp 0x6c28
movq -0x10(%rbp), %rdi
leaq 0x2e6cd(%rip), %rsi     # 0x35357
callq 0x5390
movb $0x0, -0x1(%rbp)
jmp 0x6c99
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw (%rax,%rax)