// File: /workspace/github_cpp_makefile_star2_O1/flightaware[P]beast-splitter/beast_input_serial.cc
// Function: beast::SerialInput::start_reading(boost::system::error_code const&)
void SerialInput::start_reading(const boost::system::error_code &ec) {
    if (ec) {
        assert(ec == boost::asio::error::operation_aborted);
        return;
    }

    auto self(std::static_pointer_cast<SerialInput>(shared_from_this()));
    std::shared_ptr<helpers::bytebuf> buf;

    buf.swap(readbuf);
    if (buf) {
        buf->resize(read_buffer_size);
    } else {
        buf = std::make_shared<helpers::bytebuf>(read_buffer_size);
    }

    read_timer.expires_from_now(read_interval);
    port.async_read_some(boost::asio::buffer(*buf), [this, self, buf](const boost::system::error_code &ec, std::size_t len) {
        if (ec) {
            readbuf = buf;
            handle_error(ec);
        } else {
            buf->resize(len);
            parse_input(*buf);
            check_framing_errors();
            readbuf = buf;

            // If we didn't get a full-ish buffer, then wait a bit before the next read so we don't
            // spin reading only a few bytes each time.

            // (unfortunately, boost::asio's edge-triggered epoll still gets woken repeatedly each time a
            // little more data arrives, but at least we don't have to do a bunch of work on every one of
            // those)
            if (len < read_buffer_size * 3 / 4) {
                read_timer.async_wait(std::bind(&SerialInput::start_reading, self, std::placeholders::_1));
            } else {
                start_reading();
            }
        }
    });
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
cmpb $0x1, 0x4(%rsi)
jne 0x1a8ee
cmpl $0x7d, (%rsi)
jne 0x1a8cf
movq 0x8(%rsi), %rax
movabsq $-0x70502de1da3a1f65, %rcx # imm = 0x8FAFD21E25C5E09B
cmpq %rcx, 0x8(%rax)
je 0x1abbe
leaq 0x3685b(%rip), %rdi     # 0x51131
leaq 0x36880(%rip), %rsi     # 0x5115d
leaq 0x3688f(%rip), %rcx     # 0x51173
movl $0xae, %edx
callq 0xf440
movq %rdi, %r15
leaq 0x8(%rdi), %rsi
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x19994
movq (%rbx), %rbp
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
je 0x1a923
movq 0x5866b(%rip), %rax     # 0x72f80
cmpb $0x0, (%rax)
je 0x1a91f
incl 0x8(%rcx)
jmp 0x1a923
lock
incl 0x8(%rcx)
movq %rcx, 0x38(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1a937
callq 0x1581a
movq 0x430(%r15), %r12
movq 0x438(%r15), %r13
xorps %xmm0, %xmm0
movups %xmm0, 0x430(%r15)
testq %r12, %r12
je 0x1a96b
movq 0x2a0(%r15), %rsi
movq %r12, %rdi
callq 0x1c9ea
movq %r13, 0x8(%rsp)
jmp 0x1a9c1
leaq 0x2a0(%r15), %rcx
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x1db0e
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
testq %r13, %r13
je 0x1a9b2
movq %r13, %rdi
callq 0x1581a
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1a9c1
callq 0x1581a
imulq $0xf4240, 0x2a8(%r15), %rax # imm = 0xF4240
leaq 0x10(%rsp), %r13
movq %rax, (%r13)
leaq 0x3c0(%r15), %rdi
movq %r13, %rsi
callq 0x14326
movq (%r12), %rax
movq 0x8(%r12), %rbx
xorl %r14d, %r14d
movq %rbx, 0x58(%rsp)
subq %rax, %rbx
movq %rax, 0x60(%rsp)
cmovneq %rax, %r14
movq %r15, 0x10(%rsp)
movq %rbp, 0x18(%rsp)
movq 0x38(%rsp), %rcx
movq %rcx, 0x20(%rsp)
testq %rcx, %rcx
movq 0x8(%rsp), %rdx
je 0x1aa34
movq 0x5855a(%rip), %rax     # 0x72f80
cmpb $0x0, (%rax)
je 0x1aa30
incl 0x8(%rcx)
jmp 0x1aa34
lock
incl 0x8(%rcx)
movq %r12, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
testq %rdx, %rdx
je 0x1aa58
movq 0x58536(%rip), %rax     # 0x72f80
cmpb $0x0, (%rax)
je 0x1aa54
incl 0x8(%rdx)
jmp 0x1aa58
lock
incl 0x8(%rdx)
movq 0x2d0(%r15), %r12
movq %r13, 0x40(%rsp)
movq %fs:-0x8, %rax
testq %rax, %rax
je 0x1aa78
movq 0x8(%rax), %rdi
jmp 0x1aa7a
xorl %edi, %edi
movl $0xa8, %esi
callq 0x148a2
movq %rax, %r13
leaq 0x2d8(%r15), %rbp
addq $0x2e8, %r15            # imm = 0x2E8
movq %rax, 0x48(%rsp)
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movl (%rbp), %ecx
movq %rax, (%r13)
leaq 0x14d7(%rip), %rdx      # 0x1bf86
movq %rdx, 0x8(%r13)
movl $0x0, 0x10(%r13)
movups 0x58(%r12), %xmm0
addq $0x28, %r12
movups %xmm0, 0x18(%r13)
movq %rax, 0x28(%r13)
leaq 0x2d27(%rip), %rdx      # 0x1d7fc
movq %rdx, 0x30(%r13)
movl %ecx, 0x38(%r13)
movq %r14, 0x40(%r13)
movq %rbx, 0x48(%r13)
movq 0x10(%rsp), %rcx
movq %rcx, 0x50(%r13)
movq 0x18(%rsp), %rcx
movq %rcx, 0x58(%r13)
movq %rax, 0x60(%r13)
movq 0x20(%rsp), %rcx
movq %rax, 0x20(%rsp)
movq %rcx, 0x60(%r13)
movq %rax, 0x18(%rsp)
movq 0x28(%rsp), %rcx
movq %rcx, 0x68(%r13)
movq %rax, 0x70(%r13)
movq 0x30(%rsp), %rcx
movq %rax, 0x30(%rsp)
movq %rcx, 0x70(%r13)
movq %rax, 0x28(%rsp)
movq %r13, %rdi
addq $0x78, %rdi
movq %r15, %rsi
callq 0x15310
movq %r13, 0x50(%rsp)
xorl %eax, %eax
movq 0x58(%rsp), %rcx
cmpq 0x60(%rsp), %rcx
sete %al
movl %eax, (%rsp)
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
movq %r13, %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x1cc46
leaq 0x48(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
leaq 0x40(%rsp), %rdi
callq 0x1c29e
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1ab91
callq 0x1581a
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1aba0
callq 0x1581a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1abaf
callq 0x1581a
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x1abbe
callq 0x1581a
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1abcf
movq %rax, %r15
movq %r13, 0x8(%rsp)
jmp 0x1ac04
jmp 0x1abea
movq %rax, %r15
leaq 0x40(%rsp), %rdi
callq 0x1c29e
jmp 0x1abf5
movq %rax, %rdi
callq 0x10886
movq %rax, %r15
leaq 0x10(%rsp), %rdi
callq 0x1b174
jmp 0x1ac04
movq %rax, %r15
cmpq $0x0, 0x8(%rsp)
je 0x1ac16
movq 0x8(%rsp), %rdi
callq 0x1581a
cmpq $0x0, 0x38(%rsp)
je 0x1ac28
movq 0x38(%rsp), %rdi
callq 0x1581a
movq %r15, %rdi
callq 0xfb40