// File: /workspace/github_c_makefile_star2_O0/patriciogonzalezvivo[P]tprint/include/serial/unix.cc
// Function: serial::Serial::SerialImpl::open()
void
Serial::SerialImpl::open ()
{
  if (port_.empty ()) {
    throw invalid_argument ("Empty port is invalid.");
  }
  if (is_open_ == true) {
    throw SerialException ("Serial port already open.");
  }

  fd_ = ::open (port_.c_str(), O_RDWR | O_NOCTTY | O_NONBLOCK);

  if (fd_ == -1) {
    switch (errno) {
    case EINTR:
      // Recurse because this is a recoverable error.
      open ();
      return;
    case ENFILE:
    case EMFILE:
      THROW (IOException, "Too many file handles open.");
    default:
      THROW (IOException, errno);
    }
  }

  reconfigurePort();
  is_open_ = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x70(%rbp)
addq $0x8, %rdi
callq 0xd6f0
testb $0x1, %al
jne 0x14396
jmp 0x143e9
movl $0x10, %edi
callq 0xd1e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x78(%rbp)
leaq 0x18dcf(%rip), %rsi     # 0x2d180
callq 0xd7d0
jmp 0x143b8
movq -0x78(%rbp), %rdi
movq 0x21c15(%rip), %rsi     # 0x35fd8
movq 0x21bfe(%rip), %rdx     # 0x35fc8
callq 0xd720
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0xd2c0
jmp 0x1464d
movq -0x70(%rbp), %rax
movb 0x2c(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x1444d
movl $0x28, %edi
callq 0xd1e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x80(%rbp)
leaq 0x18d82(%rip), %rsi     # 0x2d197
callq 0x17ff0
jmp 0x1441c
movq -0x80(%rbp), %rdi
leaq 0x21879(%rip), %rsi     # 0x35ca0
leaq 0x3d02(%rip), %rdx      # 0x18130
callq 0xd720
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0xd2c0
jmp 0x1464d
movq -0x70(%rbp), %rdi
addq $0x8, %rdi
callq 0xd170
movq %rax, %rdi
movl $0x902, %esi            # imm = 0x902
movb $0x0, %al
callq 0xd2d0
movl %eax, %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x28(%rax)
cmpl $-0x1, 0x28(%rax)
jne 0x14633
callq 0xd060
movl (%rax), %eax
movl %eax, -0x84(%rbp)
subl $0x4, %eax
je 0x144a3
jmp 0x14490
movl -0x84(%rbp), %eax
addl $-0x17, %eax
subl $0x2, %eax
jb 0x144b1
jmp 0x14575
movq -0x70(%rbp), %rdi
callq 0x14370
jmp 0x14644
movb $0x1, -0x3a(%rbp)
movl $0x58, %edi
callq 0xd1e0
movq %rax, -0x98(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0xd760
movq -0x90(%rbp), %rdx
leaq 0x18ccd(%rip), %rsi     # 0x2d1b1
leaq -0x38(%rbp), %rdi
callq 0xf2c0
jmp 0x144ef
movq -0x98(%rbp), %rdi
leaq 0x18ccb(%rip), %rcx     # 0x2d1c8
leaq -0x38(%rbp), %rsi
movl $0x96, %edx
callq 0x18170
jmp 0x1450d
movq -0x98(%rbp), %rdi
movb $0x0, -0x3a(%rbp)
leaq 0x21799(%rip), %rsi     # 0x35cb8
leaq 0x3e4a(%rip), %rdx      # 0x18370
callq 0xd720
jmp 0x14656
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x14553
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xd240
leaq -0x39(%rbp), %rdi
callq 0xd430
testb $0x1, -0x3a(%rbp)
jne 0x14564
jmp 0x14570
movq -0x98(%rbp), %rdi
callq 0xd2c0
jmp 0x1464d
movb $0x1, -0x62(%rbp)
movl $0x58, %edi
callq 0xd1e0
movq %rax, -0xa8(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0xd760
movq -0xa0(%rbp), %rdx
leaq 0x18c09(%rip), %rsi     # 0x2d1b1
leaq -0x60(%rbp), %rdi
callq 0xf2c0
jmp 0x145b3
callq 0xd060
movq -0xa8(%rbp), %rdi
movl (%rax), %ecx
leaq -0x60(%rbp), %rsi
movl $0x98, %edx
callq 0x183c0
jmp 0x145d1
movq -0xa8(%rbp), %rdi
movb $0x0, -0x62(%rbp)
leaq 0x216d5(%rip), %rsi     # 0x35cb8
leaq 0x3d86(%rip), %rdx      # 0x18370
callq 0xd720
jmp 0x14656
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x14614
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xd240
leaq -0x61(%rbp), %rdi
callq 0xd430
testb $0x1, -0x62(%rbp)
jne 0x14625
jmp 0x14631
movq -0xa8(%rbp), %rdi
callq 0xd2c0
jmp 0x1464d
movq -0x70(%rbp), %rdi
callq 0x14810
movq -0x70(%rbp), %rax
movb $0x1, 0x2c(%rax)
addq $0xb0, %rsp
popq %rbp
retq
movq -0x10(%rbp), %rdi
callq 0xd750
nopw %cs:(%rax,%rax)