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

```asm
<s_decode>:
  endbr64
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
L98:
  movzbl 0x0(%r13),%eax
  test   %al,%al
  je     L177
L12:
  lea    0x1(%r13),%rdx
  xor    %ecx,%ecx
  test   %r14d,%r14d
  jne    L66
  jmp    L188
  nopl   0x0(%rax)
L157:
  cmp    $0x5c,%al
  je     L124
L22:
  movslq %ecx,%rsi
  add    $0x1,%ecx
  mov    %al,(%r12,%rsi,1)
L89:
  movzbl (%rdx),%eax
  add    $0x1,%rdx
  test   %al,%al
  je     L211
L66:
  test   %ebx,%ebx
  je     L157
  lea    0x1(%rcx),%esi
  movslq %ecx,%rcx
  add    %r12,%rcx
  cmp    $0x6e,%al
  je     L235
  cmp    $0x72,%al
  je     L114
  add    $0x1,%rdx
  mov    %al,(%rcx)
  xor    %ebx,%ebx
  mov    %esi,%ecx
  movzbl -0x1(%rdx),%eax
  test   %al,%al
  jne    L66
  nopl   0x0(%rax,%rax,1)
L211:
  add    $0x1,%r14d
L168:
  cmp    $0x2,%r14d
  jne    L98
  mov    %r13,%rdi
  mov    $0xd9,%ecx
  lea    D17(%rip),%rdx
  lea    D0(%rip),%rsi
  call   <s_internal@plt>
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L124:
  cmpb   $0x0,(%rdx)
  je     L22
  mov    $0x1,%ebx
  jmp    L89
  nopl   0x0(%rax,%rax,1)
L114:
  movb   $0xd,(%rcx)
  xor    %ebx,%ebx
  mov    %esi,%ecx
  jmp    L89
  nopl   0x0(%rax)
L235:
  movb   $0xa,(%rcx)
  xor    %ebx,%ebx
  mov    %esi,%ecx
  jmp    L89
  nopl   0x0(%rax)
L188:
  xor    %ebp,%ebp
  jmp    L201
  nopl   0x0(%rax)
L232:
  add    $0x1,%ebp
  xor    %ebx,%ebx
L238:
  movzbl (%rdx),%eax
  add    $0x1,%rdx
  test   %al,%al
  je     L42
L201:
  test   %ebx,%ebx
  jne    L232
  cmp    $0x5c,%al
  je     L214
L69:
  movzbl (%rdx),%eax
  add    $0x1,%rdx
  add    $0x1,%ebp
  test   %al,%al
  jne    L201
L42:
  mov    $0x1,%r14d
L93:
  lea    0x1(%rbp),%edi
  movslq %ebp,%rbp
  call   <alloc@plt>
  movb   $0x0,(%rax,%rbp,1)
  mov    %rax,%r12
  movzbl 0x0(%r13),%eax
  test   %al,%al
  jne    L12
L177:
  add    $0x1,%r14d
  cmp    $0x1,%r14d
  jne    L168
  xor    %ebp,%ebp
  jmp    L93
  nopl   (%rax)
L214:
  cmpb   $0x0,(%rdx)
  je     L69
  mov    $0x1,%ebx
  jmp    L238
```

tool_calls: name: parse_data
arguments: label: D17
type_guessed: string
name: parse_data
arguments: label: D0
type_guessed: string

tool: D17: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Rudolph-Miller/roswell/refs/heads/master/src/util.c

tool: D0: str

assistant: ```c
char *s_decode(char *str) {
  int count, i, write, escape = 0;
  char *ret;
  for (write = 0; write < 2; ++write) {
    for (i = 0, count = 0; str[i] != '\0'; ++i, ++count) {
      if (!escape && str[i] == '\\' && str[i + 1] != '\0')
        escape = 1, --count;
      else {
        if (write) {
          ret[count] = str[i];
          if (escape) {
            switch (str[i]) {
            case 'n':
              ret[count] = '\n';
              break;
            case 'r':
              ret[count] = '\r';
            }
          }
        }
        escape = 0;
      }
    }
    if (!write) {
      ret = alloc(sizeof(char) * (count + 1));
      ret[count] = '\0';
    }
  }
  (s_internal(str, "str", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Rudolph-Miller/roswell/refs/heads/master/src/util.c", 217));
  return ret;
}
```