// File: Thomas1995[P]Rentz/src/./event.h
// Function: event::send(int)
void send(int fd) {
    std::vector<uint8_t> header(8, 0);
    ((uint32_t *)header.data())[0] = htonl(type);
    ((uint32_t *)header.data())[1] = htonl(len);

    std::vector<uint8_t> message;
    message.reserve(8 + len + 2);
    message.push_back(FLAG);

    for(auto &b: header) {
      append(b);
    }

    for(size_t i = 0; i < len; ++i) {
      uint8_t b = data[i];
      append(b);
    }

    message.push_back(FLAG);

    int rem = message.size();
    uint8_t *at = message.data();

    while(rem > 0) {
      const int n = ::send(fd, at, rem, 0);
      rem -= n;
      at += n;
    }
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movb $0x0, -0x29(%rbp)
leaq -0x2a(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0xd410
movq -0xa8(%rbp), %rcx
leaq -0x28(%rbp), %rdi
movl $0x8, %esi
leaq -0x29(%rbp), %rdx
callq 0x1b670
jmp 0x1219c
leaq -0x2a(%rbp), %rdi
callq 0xe380
movq -0xb0(%rbp), %rax
movl (%rax), %edi
callq 0x3240
movl %eax, -0xcc(%rbp)
leaq -0x28(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0xd320
movl -0xcc(%rbp), %edx
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movl %edx, (%rcx)
movl 0x8(%rax), %edi
callq 0x3240
movq -0xc8(%rbp), %rdi
movl %eax, -0xbc(%rbp)
callq 0xd320
movl -0xbc(%rbp), %ecx
movl %ecx, 0x4(%rax)
leaq -0x58(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0xd020
movq -0xb0(%rbp), %rax
movq -0xb8(%rbp), %rdi
movq 0x8(%rax), %rsi
addq $0xa, %rsi
callq 0xd040
jmp 0x1222b
leaq 0xc622(%rip), %rsi      # 0x1e854
leaq -0x58(%rbp), %rdi
callq 0x1b6f0
jmp 0x1223d
leaq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0xdd50
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0xdba0
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x1b760
testb $0x1, %al
jne 0x12275
jmp 0x12326
leaq -0x68(%rbp), %rdi
callq 0xddf0
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x7e, %eax
je 0x1229a
movq -0x78(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x7d, %eax
jne 0x12305
leaq 0xc5b4(%rip), %rsi      # 0x1e855
leaq -0x58(%rbp), %rdi
callq 0x1b6f0
jmp 0x122ac
movq -0x78(%rbp), %rax
movb (%rax), %al
xorb $0x20, %al
movb %al, -0x79(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x79(%rbp), %rsi
callq 0xd120
jmp 0x122c6
jmp 0x12316
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2a(%rbp), %rdi
callq 0xe380
jmp 0x12490
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xd190
leaq -0x28(%rbp), %rdi
callq 0xd190
jmp 0x12490
movq -0x78(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x1b6f0
jmp 0x12314
jmp 0x12316
jmp 0x12318
leaq -0x68(%rbp), %rdi
callq 0x1b7a0
jmp 0x1225f
movq $0x0, -0x88(%rbp)
movq -0xb0(%rbp), %rcx
movq -0x88(%rbp), %rax
cmpq 0x8(%rcx), %rax
jae 0x123dd
movq -0xb0(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x88(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x89(%rbp)
movzbl -0x89(%rbp), %eax
cmpl $0x7e, %eax
je 0x1237c
movzbl -0x89(%rbp), %eax
cmpl $0x7d, %eax
jne 0x123b0
leaq 0xc4d2(%rip), %rsi      # 0x1e855
leaq -0x58(%rbp), %rdi
callq 0x1b6f0
jmp 0x1238e
movb -0x89(%rbp), %al
xorb $0x20, %al
movb %al, -0x8a(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x8a(%rbp), %rsi
callq 0xd120
jmp 0x123ae
jmp 0x123c4
leaq -0x58(%rbp), %rdi
leaq -0x89(%rbp), %rsi
callq 0x1b6f0
jmp 0x123c2
jmp 0x123c4
jmp 0x123c6
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x12331
leaq 0xc470(%rip), %rsi      # 0x1e854
leaq -0x58(%rbp), %rdi
callq 0x1b6f0
jmp 0x123ef
leaq -0x58(%rbp), %rdi
callq 0xd670
movl %eax, -0x90(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xd320
movq %rax, -0x98(%rbp)
cmpl $0x0, -0x90(%rbp)
jle 0x12475
movl -0xc(%rbp), %edi
movq -0x98(%rbp), %rsi
movslq -0x90(%rbp), %rdx
xorl %ecx, %ecx
callq 0x3170
movq %rax, -0xd8(%rbp)
jmp 0x12438
movq -0xd8(%rbp), %rax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %ecx
movl -0x90(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x90(%rbp)
movl -0x9c(%rbp), %ecx
movq -0x98(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
jmp 0x1240e
leaq -0x58(%rbp), %rdi
callq 0xd190
leaq -0x28(%rbp), %rdi
callq 0xd190
addq $0xe0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3490
nopl (%rax)