// File: /workspace/github_c_makefile_star2_O0/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
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rcx, -0x110(%rbp)
movq %rdi, -0x118(%rbp)
movq %rdi, %rax
movq %rax, -0x128(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x120(%rbp)
movq 0x8(%rax), %rsi
leaq -0x28(%rbp), %rdi
callq 0x12990
movq -0x118(%rbp), %rdi
movb $0x0, -0x29(%rbp)
callq 0xf270
movq -0x110(%rbp), %rdi
callq 0xd650
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x1216c
movq -0x120(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rax
addq %rax, %rsi
movl $0x1, %edx
callq 0x117a0
movq %rax, -0x130(%rbp)
jmp 0x11e17
movq -0x130(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x11f19
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x11f14
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x148(%rbp)
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x140(%rbp)
leaq -0x89(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0xd760
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdx
movq -0x138(%rbp), %rcx
leaq -0x88(%rbp), %rdi
callq 0xd4a0
jmp 0x11e9d
movq -0x118(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xf290
jmp 0x11eb2
leaq -0x88(%rbp), %rdi
callq 0xd240
leaq -0x89(%rbp), %rdi
callq 0xd430
jmp 0x11f14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x12197
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x11f03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xd240
leaq -0x89(%rbp), %rdi
callq 0xd430
jmp 0x12197
jmp 0x1216c
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
addq %rcx, %rax
movq -0x38(%rbp), %rcx
movq %rcx, -0x158(%rbp)
subq %rcx, %rax
movq %rax, -0x160(%rbp)
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0xd760
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdx
movq -0x150(%rbp), %rcx
leaq -0xb0(%rbp), %rdi
callq 0xd4a0
jmp 0x11f6f
movq -0x110(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x12b00
movb %al, -0x161(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0xd240
leaq -0xb1(%rbp), %rdi
callq 0xd430
movb -0x161(%rbp), %al
testb $0x1, %al
jne 0x11faf
jmp 0x12090
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x180(%rbp)
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x178(%rbp)
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0xd760
movq -0x180(%rbp), %rsi
movq -0x178(%rbp), %rdx
movq -0x170(%rbp), %rcx
leaq -0xd8(%rbp), %rdi
callq 0xd4a0
jmp 0x12005
movq -0x118(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0xf290
jmp 0x1201a
leaq -0xd8(%rbp), %rdi
callq 0xd240
leaq -0xd9(%rbp), %rdi
callq 0xd430
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x12090
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xb1(%rbp), %rdi
callq 0xd430
jmp 0x12197
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x1207f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0xd240
leaq -0xd9(%rbp), %rdi
callq 0xd430
jmp 0x12197
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x12167
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x12165
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x198(%rbp)
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x190(%rbp)
leaq -0x101(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0xd760
movq -0x198(%rbp), %rsi
movq -0x190(%rbp), %rdx
movq -0x188(%rbp), %rcx
leaq -0x100(%rbp), %rdi
callq 0xd4a0
jmp 0x12102
movq -0x118(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xf290
jmp 0x12117
leaq -0x100(%rbp), %rdi
callq 0xd240
leaq -0x101(%rbp), %rdi
callq 0xd430
jmp 0x12165
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x12157
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xd240
leaq -0x101(%rbp), %rdi
callq 0xd430
jmp 0x12197
jmp 0x1216c
jmp 0x11de4
movb $0x1, -0x29(%rbp)
testb $0x1, -0x29(%rbp)
jne 0x12182
movq -0x118(%rbp), %rdi
callq 0xf580
leaq -0x28(%rbp), %rdi
callq 0x129c0
movq -0x128(%rbp), %rax
movq %rbp, %rsp
popq %rbp
retq
movq -0x118(%rbp), %rdi
callq 0xf580
leaq -0x28(%rbp), %rdi
callq 0x129c0
movq -0x60(%rbp), %rdi
callq 0xd750
nopw %cs:(%rax,%rax)