// File: /workspace/github_c_makefile_star2_O1/patriciogonzalezvivo[P]tprint/include/serial/serial.cc
// Function: serial::Serial::readlines(unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<string>
Serial::readlines (size_t size, string eol)
{
  ScopedReadLock lock(this->pimpl_);
  std::vector<std::string> lines;
  size_t eol_len = eol.length ();
  uint8_t *buffer_ = static_cast<uint8_t*>
    (alloca (size * sizeof (uint8_t)));
  size_t read_so_far = 0;
  size_t start_of_line = 0;
  while (read_so_far < size) {
    size_t bytes_read = this->read_ (buffer_+read_so_far, 1);
    read_so_far += bytes_read;
    if (bytes_read == 0) {
      if (start_of_line != read_so_far) {
        lines.push_back (
          string (reinterpret_cast<const char*> (buffer_ + start_of_line),
            read_so_far - start_of_line));
      }
      break; // Timeout occured on reading 1 byte
    }
    if (string (reinterpret_cast<const char*>
         (buffer_ + read_so_far - eol_len), eol_len) == eol) {
      // EOL found
      lines.push_back(
        string(reinterpret_cast<const char*> (buffer_ + start_of_line),
          read_so_far - start_of_line));
      start_of_line = read_so_far;
    }
    if (read_so_far == size) {
      if (start_of_line != read_so_far) {
        lines.push_back(
          string(reinterpret_cast<const char*> (buffer_ + start_of_line),
            read_so_far - start_of_line));
      }
      break; // Reached the maximum read length
    }
  }
  return lines;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %r14
movq %rsi, -0x80(%rbp)
movq 0x8(%rsi), %rdi
movq %rdi, -0x60(%rbp)
callq 0xdf1e
xorl %ebx, %ebx
movq %rbx, 0x10(%r14)
xorps %xmm0, %xmm0
movq %r14, -0x50(%rbp)
movups %xmm0, (%r14)
xorl %eax, %eax
movq %r15, -0x70(%rbp)
subq 0x8(%r15), %rax
movq %rax, -0x78(%rbp)
movq %rsp, %rcx
leaq 0xf(%r12), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x58(%rbp)
movq %rcx, %rsp
xorl %r14d, %r14d
movq %r12, -0x68(%rbp)
cmpq %r12, %rbx
jae 0xb07d
movq -0x58(%rbp), %rax
leaq (%rax,%rbx), %rsi
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x1, %edx
callq 0xc840
addq %rax, %rbx
testq %rax, %rax
je 0xaf73
movq -0x58(%rbp), %rax
leaq (%rax,%rbx), %r15
movq -0x78(%rbp), %rax
leaq (%r15,%rax), %rsi
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
movq %r15, %rdx
callq 0x9f82
movq -0x40(%rbp), %rdx
movq -0x70(%rbp), %rax
cmpq 0x8(%rax), %rdx
jne 0xafad
testq %rdx, %rdx
je 0xafb2
movq -0x70(%rbp), %rax
movq (%rax), %rsi
movq -0x48(%rbp), %rdi
callq 0x8330
testl %eax, %eax
sete %r12b
jmp 0xafb5
cmpq %rbx, %r14
je 0xb073
movq -0x58(%rbp), %rcx
leaq (%rcx,%r14), %rsi
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq (%rcx,%rbx), %rdx
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x9f82
movq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0xa304
jmp 0xb05a
xorl %r12d, %r12d
jmp 0xafb5
movb $0x1, %r12b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xafce
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x8320
testb %r12b, %r12b
je 0xb01f
addq -0x58(%rbp), %r14
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x9f82
movq -0x68(%rbp), %r12
movq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0xa304
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xb01a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x8320
movq %rbx, %r14
jmp 0xb023
movq -0x68(%rbp), %r12
movb $0x1, %al
cmpq %r12, %rbx
jne 0xb075
cmpq %rbx, %r14
je 0xb073
movq -0x58(%rbp), %rax
leaq (%rax,%r14), %rsi
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %r13
movq %r13, %rdi
movq %r15, %rdx
callq 0x9f82
movq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0xa304
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xb073
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x8320
xorl %eax, %eax
testb %al, %al
jne 0xaef9
movq -0x60(%rbp), %rdi
callq 0xdfdc
movq -0x50(%rbp), %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb0e2
jmp 0xb0a3
jmp 0xb0c5
jmp 0xb0a3
jmp 0xb0c5
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xb0c8
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x8320
jmp 0xb0c8
jmp 0xb0c5
jmp 0xb0c5
movq %rax, %rbx
movq -0x50(%rbp), %rdi
callq 0x9e80
movq -0x60(%rbp), %rdi
callq 0xdfdc
movq %rbx, %rdi
callq 0x8600
movq %rax, %rdi
callq 0x9f28