user: Please show me the C implementation that matches the assembly code listed below:

```asm
<attoHTTPSendEvent>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    %r8,-0x48(%rbp)
  lea    D14(%rip),%rax
  mov    %rax,-0x10(%rbp)
  lea    D12(%rip),%rax
  mov    %rax,-0x8(%rbp)
  movq   $0x0,-0x20(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  jle    L84
  movq   $0x0,-0x18(%rbp)
  jmp    L85
L13:
  mov    -0x10(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <attoHTTPSetByte@plt>
  add    %rax,-0x20(%rbp)
  addq   $0x1,-0x18(%rbp)
L85:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %rax,-0x18(%rbp)
  jb     L13
  jmp    L70
L58:
  mov    -0x30(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x30(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <attoHTTPSetByte@plt>
  add    %rax,-0x20(%rbp)
L70:
  mov    -0x38(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  test   %rax,%rax
  jg     L58
  mov    -0x28(%rbp),%rax
  mov    $0xa,%esi
  mov    %rax,%rdi
  call   <attoHTTPSetByte@plt>
  add    %rax,-0x20(%rbp)
L84:
  cmpq   $0x0,-0x48(%rbp)
  jle    L27
  movq   $0x0,-0x18(%rbp)
  jmp    L30
L80:
  mov    -0x8(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <attoHTTPSetByte@plt>
  add    %rax,-0x20(%rbp)
  addq   $0x1,-0x18(%rbp)
L30:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %rax,-0x18(%rbp)
  jb     L80
  jmp    L94
L36:
  mov    -0x40(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x40(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <attoHTTPSetByte@plt>
  add    %rax,-0x20(%rbp)
L94:
  mov    -0x48(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  test   %rax,%rax
  jg     L36
  mov    -0x28(%rbp),%rax
  mov    $0xa,%esi
  mov    %rax,%rdi
  call   <attoHTTPSetByte@plt>
  add    %rax,-0x20(%rbp)
L27:
  mov    -0x28(%rbp),%rax
  mov    $0xa,%esi
  mov    %rax,%rdi
  call   <attoHTTPSetByte@plt>
  add    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D14
type_infered: string
name: unpack_data
arguments: data_tag: D12
type_infered: string

tool: D14: event:

tool: D12: data:

assistant: ```c
uint16_t attoHTTPSendEvent(void *write, char *event, uint16_t elen, char *data, uint16_t dlen) {
  char *estr = "event:";
  char *dstr = "data:";
  uint16_t ret = 0;
  uint8_t i;
  if (elen > 0) {
    for (i = 0; i < strlen(estr); i++) {
      ret += attoHTTPSetByte(write, estr[i]);
    }
    while (elen-- > 0) {
      ret += attoHTTPSetByte(write, *event++);
    }
    ret += attoHTTPSetByte(write, '\n');
  }
  if (dlen > 0) {
    for (i = 0; i < strlen(dstr); i++) {
      ret += attoHTTPSetByte(write, dstr[i]);
    }
    while (dlen-- > 0) {
      ret += attoHTTPSetByte(write, *data++);
    }
    ret += attoHTTPSetByte(write, '\n');
  }
  ret += attoHTTPSetByte(write, '\n');
  return ret;
}
```