// File: /workspace/github_c_makefile_star2_O3/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 $0x68, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %rbx
movq %rsi, -0x88(%rbp)
movq 0x8(%rsi), %rdi
movq %rdi, -0x60(%rbp)
callq 0xddf2
xorl %r12d, %r12d
movq %r12, 0x10(%rbx)
xorps %xmm0, %xmm0
movq %rbx, -0x58(%rbp)
movups %xmm0, (%rbx)
xorl %eax, %eax
movq %r14, -0x78(%rbp)
subq 0x8(%r14), %rax
movq %r15, %r14
movq %rax, -0x80(%rbp)
movq %rsp, %r13
leaq 0xf(%r15), %rax
andq $-0x10, %rax
subq %rax, %r13
movq %r13, %rsp
leaq -0x48(%rbp), %r15
movq $0x0, -0x50(%rbp)
movq %r13, -0x70(%rbp)
movq %r14, -0x68(%rbp)
cmpq %r14, %r12
jae 0xb01e
leaq (%r12,%r13), %rsi
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x1, %edx
callq 0xc778
addq %rax, %r12
testq %rax, %rax
je 0xafd5
leaq (%r12,%r13), %rbx
movq -0x80(%rbp), %rax
leaq (%rbx,%rax), %rsi
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %r15, %rdi
movq %rbx, %rdx
callq 0x9f1e
movq -0x40(%rbp), %rdx
movq -0x78(%rbp), %rax
cmpq 0x8(%rax), %rdx
jne 0xaf14
movq -0x48(%rbp), %r13
testq %rdx, %rdx
je 0xaf1d
movq -0x78(%rbp), %rax
movq (%rax), %rsi
movq %r13, %rdi
callq 0x8320
testl %eax, %eax
sete %r15b
jmp 0xaf20
movq -0x48(%rbp), %r13
xorl %r15d, %r15d
jmp 0xaf20
movb $0x1, %r15b
leaq -0x38(%rbp), %rax
cmpq %rax, %r13
je 0xaf38
movq -0x38(%rbp), %rsi
incq %rsi
movq %r13, %rdi
callq 0x8310
testb %r15b, %r15b
je 0xaf8e
movq -0x70(%rbp), %r13
movq -0x50(%rbp), %rsi
addq %r13, %rsi
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rdx
callq 0x9f1e
movq -0x68(%rbp), %r14
movq -0x58(%rbp), %rdi
movq %r15, %rsi
callq 0xa280
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xaf88
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x8310
movq %r12, -0x50(%rbp)
jmp 0xaf9a
movq -0x68(%rbp), %r14
movq -0x70(%rbp), %r13
leaq -0x48(%rbp), %r15
cmpq %r14, %r12
jne 0xae99
cmpq %r14, -0x50(%rbp)
je 0xb01e
movq -0x50(%rbp), %rsi
addq %r13, %rsi
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
movq %rax, (%rdi)
addq %r13, %r14
movq %r14, %rdx
callq 0x9f1e
leaq -0x48(%rbp), %rsi
movq -0x58(%rbp), %rdi
callq 0xa280
jmp 0xb005
cmpq %r12, -0x50(%rbp)
je 0xb01e
movq -0x50(%rbp), %rsi
addq %r13, %rsi
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
movq %rax, (%rdi)
addq %r13, %r12
movq %r12, %rdx
callq 0x9f1e
leaq -0x48(%rbp), %rsi
movq -0x58(%rbp), %rdi
callq 0xa280
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xb01e
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x8310
movq -0x60(%rbp), %rdi
callq 0xdeac
movq -0x58(%rbp), %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb044
jmp 0xb066
jmp 0xb044
jmp 0xb066
jmp 0xb083
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xb069
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x8310
jmp 0xb069
jmp 0xb066
jmp 0xb066
movq %rax, %rbx
movq -0x58(%rbp), %rdi
callq 0x9e18
movq -0x60(%rbp), %rdi
callq 0xdeac
movq %rbx, %rdi
callq 0x85f0
movq %rax, %rdi
callq 0x9ec4
nop