// File: flightaware[P]beast-splitter/beast_output.cc
// Function: beast::SocketOutput::write_binary(modes::MessageType, unsigned long, unsigned char, std::vector<unsigned char, std::allocator<unsigned char>> const&)
void SocketOutput::write_binary(modes::MessageType type, std::uint64_t timestamp, std::uint8_t signal, const helpers::bytebuf &data) {
        prepare_write();
        outbuf->push_back(0x1A);
        outbuf->push_back(messagetype_to_byte(type));

        if (type != modes::MessageType::POSITION) {
            push_back_beast(*outbuf, (timestamp >> 40) & 0xFF);
            push_back_beast(*outbuf, (timestamp >> 32) & 0xFF);
            push_back_beast(*outbuf, (timestamp >> 24) & 0xFF);
            push_back_beast(*outbuf, (timestamp >> 16) & 0xFF);
            push_back_beast(*outbuf, (timestamp >> 8) & 0xFF);
            push_back_beast(*outbuf, timestamp & 0xFF);
            push_back_beast(*outbuf, signal);
        }

        for (auto b : data)
            push_back_beast(*outbuf, b);

        complete_write();
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %cl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movb %al, -0x19(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x60(%rbp)
callq 0x50d30
movq -0x60(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x3b1a0
movq %rax, %rdi
movb $0x1a, -0x29(%rbp)
leaq -0x29(%rbp), %rsi
callq 0x1c010
movq -0x60(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x3b1a0
movq %rax, -0x58(%rbp)
movl -0xc(%rbp), %edi
callq 0x5a880
movq -0x58(%rbp), %rdi
movb %al, -0x2a(%rbp)
leaq -0x2a(%rbp), %rsi
callq 0x1c010
cmpl $0x5, -0xc(%rbp)
je 0x509bd
movq -0x60(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x3aeb0
movq %rax, %rdi
movq -0x18(%rbp), %rax
shrq $0x28, %rax
andq $0xff, %rax
movzbl %al, %esi
callq 0x51080
movq -0x60(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x3aeb0
movq %rax, %rdi
movq -0x18(%rbp), %rax
shrq $0x20, %rax
andq $0xff, %rax
movzbl %al, %esi
callq 0x51080
movq -0x60(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x3aeb0
movq %rax, %rdi
movq -0x18(%rbp), %rax
shrq $0x18, %rax
andq $0xff, %rax
movzbl %al, %esi
callq 0x51080
movq -0x60(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x3aeb0
movq %rax, %rdi
movq -0x18(%rbp), %rax
shrq $0x10, %rax
andq $0xff, %rax
movzbl %al, %esi
callq 0x51080
movq -0x60(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x3aeb0
movq %rax, %rdi
movq -0x18(%rbp), %rax
shrq $0x8, %rax
andq $0xff, %rax
movzbl %al, %esi
callq 0x51080
movq -0x60(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x3aeb0
movq %rax, %rdi
movq -0x18(%rbp), %rax
andq $0xff, %rax
movzbl %al, %esi
callq 0x51080
movq -0x60(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x3aeb0
movq %rax, %rdi
movzbl -0x19(%rbp), %esi
callq 0x51080
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x13e30
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0x13e60
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x13e90
testb $0x1, %al
jne 0x509f2
jmp 0x50a27
leaq -0x40(%rbp), %rdi
callq 0x13ed0
movq -0x60(%rbp), %rdi
movb (%rax), %al
movb %al, -0x49(%rbp)
addq $0x100, %rdi            # imm = 0x100
callq 0x3aeb0
movq %rax, %rdi
movzbl -0x49(%rbp), %esi
callq 0x51080
leaq -0x40(%rbp), %rdi
callq 0x13ef0
jmp 0x509df
movq -0x60(%rbp), %rdi
callq 0x50db0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)