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

```asm
<formEpisode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %edx,-0x30(%rbp)
  mov    %ecx,-0x34(%rbp)
  mov    %r8,-0x40(%rbp)
  mov    %r9d,-0x38(%rbp)
  mov    0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  add    $0xc,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x38(%rbp),%edx
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <identifyEpisode@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  cmp    0x10(%rbp),%eax
  jl     L39
  mov    -0xc(%rbp),%eax
  cmp    0x18(%rbp),%eax
  jle    L28
L39:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  jmp    L56
L28:
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L95
L4:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    0x20(%rbp),%rax
  add    %rdx,%rax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x18(%rbp)
L95:
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L4
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x20,(%rax)
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x73,(%rax)
  cmpl   $0x9,-0x34(%rbp)
  jle    L1
  mov    -0x34(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  lea    0x30(%rax),%edx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x2(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    %dl,(%rax)
  mov    -0x34(%rbp),%edx
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %edx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%ecx
  mov    %ecx,%eax
  shl    $0x2,%eax
  add    %ecx,%eax
  add    %eax,%eax
  mov    %edx,%ecx
  sub    %eax,%ecx
  mov    %ecx,%eax
  lea    0x30(%rax),%edx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x3(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    %dl,(%rax)
  jmp    L6
L1:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x30,(%rax)
  mov    -0x34(%rbp),%eax
  lea    0x30(%rax),%edx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x3(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    %dl,(%rax)
L6:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x4(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x65,(%rax)
  cmpl   $0x63,-0xc(%rbp)
  jle    L94
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x38(%rbp),%eax
  cltq
  add    %rdx,%rax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  lea    0x5(%rdx),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x38(%rbp),%eax
  cltq
  add    $0x1,%rax
  add    %rdx,%rax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  lea    0x6(%rdx),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x38(%rbp),%eax
  cltq
  add    $0x2,%rax
  add    %rdx,%rax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  lea    0x7(%rdx),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  jmp    L50
L94:
  cmpl   $0x9,-0xc(%rbp)
  jle    L16
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x5(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x30,(%rax)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x38(%rbp),%eax
  cltq
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  je     L125
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x38(%rbp),%eax
  cltq
  add    %rdx,%rax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  lea    0x6(%rdx),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x38(%rbp),%eax
  cltq
  add    $0x1,%rax
  add    %rdx,%rax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  lea    0x7(%rdx),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  jmp    L50
L125:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x38(%rbp),%eax
  cltq
  add    $0x1,%rax
  add    %rdx,%rax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  lea    0x6(%rdx),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x38(%rbp),%eax
  cltq
  add    $0x2,%rax
  add    %rdx,%rax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  lea    0x7(%rdx),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  jmp    L50
L16:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x5(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x30,(%rax)
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x6(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x30,(%rax)
  mov    -0xc(%rbp),%eax
  lea    0x30(%rax),%edx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x7(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    %dl,(%rax)
L50:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x8(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2e,(%rax)
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x9(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x18(%rbp),%eax
  cltq
  lea    0xa(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x40(%rbp),%rax
  movzbl 0x1(%rax),%eax
  mov    %al,(%rdx)
  mov    -0x18(%rbp),%eax
  cltq
  lea    0xb(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x40(%rbp),%rax
  movzbl 0x2(%rax),%eax
  mov    %al,(%rdx)
  mov    -0x18(%rbp),%eax
  cltq
  lea    0xc(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
L56:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D6
datatype: string

tool: D6: Out of season episode detected: %s


assistant: ```c
char *formEpisode(char **episodes, int scanCount, int count, int season, char extension[4], int digit, int firstEp, int lastEp, char prefix[100]) {
  char *episode, prompt;
  int length, i, numEp, lenPrefix;
  lenPrefix = strlen(prefix);
  length = lenPrefix + 12;
  numEp = identifyEpisode(episodes[count], digit);
  if (numEp < firstEp || numEp > lastEp) {
    printf("Out of season episode detected: %s\n", episodes[count]);
    return NULL;
  }
  episode = malloc(sizeof(char) * length);
  for (i = 0; i < lenPrefix; i++)
    episode[i] = prefix[i];
  episode[i] = ' ';
  episode[i + 1] = 's';
  if (season >= 10) {
    episode[i + 2] = (season / 10) + '0';
    episode[i + 3] = (season % 10) + '0';
  } else {
    episode[i + 2] = '0';
    episode[i + 3] = season + '0';
  }
  episode[i + 4] = 'e';
  if (numEp >= 100) {
    episode[i + 5] = episodes[count][digit];
    episode[i + 6] = episodes[count][digit + 1];
    episode[i + 7] = episodes[count][digit + 2];
  } else if (numEp >= 10) {
    episode[i + 5] = '0';
    if (episodes[count][digit] != '0') {
      episode[i + 6] = episodes[count][digit];
      episode[i + 7] = episodes[count][digit + 1];
    } else {
      episode[i + 6] = episodes[count][digit + 1];
      episode[i + 7] = episodes[count][digit + 2];
    }
  } else {
    episode[i + 5] = '0';
    episode[i + 6] = '0';
    episode[i + 7] = numEp + '0';
  }
  episode[i + 8] = '.';
  episode[i + 9] = extension[0];
  episode[i + 10] = extension[1];
  episode[i + 11] = extension[2];
  episode[i + 12] = '\0';
  return episode;
}
```