// File: ef-gy[P]libefgy/src/test-case/matrix.cpp
// Function: testStream(std::ostream&)
bool testStream(std::ostream &log) {
  std::ostringstream stream;

  matrix<int, 3, 4> m;
  for (int i = 0; i < 3; i++) {
    for (int k = 0; k < 4; k++) {
      m[i][k] = i * k;
    }
  }

  stream << m;

  std::stringstream expected;

  expected << "0\t0\t0\t0\t\n";
  expected << "0\t1\t2\t3\t\n";
  expected << "0\t2\t4\t6\t\n";

  if (stream.str() != expected.str()) {
    log << "Unexpected characters in printable representation of matrix.\n";
    log << "Matrix: \n";
    log << m;
    log << "\nExpected:\n";
    log << expected.str();

    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3d0, %rsp            # imm = 0x3D0
movq %rdi, -0x10(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x54f0
movl $0x0, -0x1bc(%rbp)
cmpl $0x3, -0x1bc(%rbp)
jge 0x6802
movl $0x0, -0x1c0(%rbp)
cmpl $0x4, -0x1c0(%rbp)
jge 0x67ef
movl -0x1bc(%rbp), %eax
imull -0x1c0(%rbp), %eax
movl %eax, -0x3c0(%rbp)
movslq -0x1bc(%rbp), %rsi
leaq -0x1b8(%rbp), %rdi
callq 0x74b0
movq %rax, %rdi
movslq -0x1c0(%rbp), %rsi
callq 0x74e0
movl -0x3c0(%rbp), %ecx
movl %ecx, (%rax)
movl -0x1c0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c0(%rbp)
jmp 0x6798
jmp 0x67f1
movl -0x1bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1bc(%rbp)
jmp 0x6785
leaq -0x188(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x75e0
jmp 0x6817
leaq -0x358(%rbp), %rdi
callq 0x52b0
jmp 0x6825
leaq -0x348(%rbp), %rdi
leaq 0x2eb1c(%rip), %rsi     # 0x3534f
callq 0x5390
jmp 0x683a
leaq -0x348(%rbp), %rdi
leaq 0x2eb11(%rip), %rsi     # 0x35359
callq 0x5390
jmp 0x684f
leaq -0x348(%rbp), %rdi
leaq 0x2eb06(%rip), %rsi     # 0x35363
callq 0x5390
jmp 0x6864
leaq -0x378(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x53d0
jmp 0x6879
leaq -0x398(%rbp), %rdi
leaq -0x358(%rbp), %rsi
callq 0x5380
jmp 0x688e
leaq -0x378(%rbp), %rdi
leaq -0x398(%rbp), %rsi
callq 0x7680
movb %al, -0x3c1(%rbp)
leaq -0x398(%rbp), %rdi
callq 0x5230
leaq -0x378(%rbp), %rdi
callq 0x5230
movb -0x3c1(%rbp), %al
testb $0x1, %al
jne 0x68ce
jmp 0x69d2
movq -0x10(%rbp), %rdi
leaq 0x2ea94(%rip), %rsi     # 0x3536d
callq 0x5390
jmp 0x68e0
movq -0x10(%rbp), %rdi
leaq 0x2eac0(%rip), %rsi     # 0x353ab
callq 0x5390
jmp 0x68f2
movq -0x10(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x75e0
jmp 0x6904
movq -0x10(%rbp), %rdi
leaq 0x2eaa6(%rip), %rsi     # 0x353b5
callq 0x5390
jmp 0x6916
movq -0x10(%rbp), %rax
movq %rax, -0x3d0(%rbp)
leaq -0x3b8(%rbp), %rdi
leaq -0x358(%rbp), %rsi
callq 0x5380
jmp 0x6936
movq -0x3d0(%rbp), %rdi
leaq -0x3b8(%rbp), %rsi
callq 0x5350
jmp 0x694b
leaq -0x3b8(%rbp), %rdi
callq 0x5230
movb $0x0, -0x1(%rbp)
movl $0x1, -0x3bc(%rbp)
jmp 0x69e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x6a12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x6a06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x378(%rbp), %rdi
callq 0x5230
jmp 0x6a06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x3b8(%rbp), %rdi
callq 0x5230
jmp 0x6a06
movb $0x1, -0x1(%rbp)
movl $0x1, -0x3bc(%rbp)
leaq -0x358(%rbp), %rdi
callq 0x52e0
leaq -0x188(%rbp), %rdi
callq 0x50b0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x3d0, %rsp            # imm = 0x3D0
popq %rbp
retq
leaq -0x358(%rbp), %rdi
callq 0x52e0
leaq -0x188(%rbp), %rdi
callq 0x50b0
movq -0x1c8(%rbp), %rdi
callq 0x5600
nopw (%rax,%rax)