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

```asm
<set_dedx_filename>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x28,%rsp
  call   <strlen@plt>
  mov    %eax,0xc(%rsp)
  mov    %eax,%r13d
  cmp    $0x1,%eax
  jle    L156
  lea    -0x1(%rax),%r12d
  cmp    $0x2,%eax
  je     L146
  mov    %rbp,%r15
  mov    $0x1,%r14d
  nopl   0x0(%rax,%rax,1)
L157:
  movsbl 0x2(%r15),%edx
  movsbl 0x1(%r15),%esi
  add    $0x1,%r14d
  movsbl (%r15),%edi
  call   <camel_split@plt>
  cmp    $0x1,%rax
  sbb    $0xffffffff,%r13d
  add    $0x1,%r15
  cmp    %r14d,%r12d
  jg     L157
  cmp    %r14d,0xc(%rsp)
  jle    L147
L48:
  movslq 0xc(%rsp),%r15
  movslq %r14d,%r14
  nopl   0x0(%rax,%rax,1)
L53:
  movsbl 0x0(%rbp,%r14,1),%esi
  movsbl -0x1(%rbp,%r14,1),%edi
  movsbl -0x1(%rbp,%r15,1),%edx
  call   <camel_split@plt>
  cmp    $0x1,%rax
  sbb    $0xffffffff,%r13d
  add    $0x1,%r14
  cmp    %r14d,0xc(%rsp)
  jg     L53
  mov    (%rbx),%rdi
  lea    0x5(%r13),%esi
  call   <reallocate@plt>
  mov    %rax,(%rbx)
  movsbl 0x0(%rbp),%edi
  mov    %rax,%r14
  call   <tolower@plt>
  mov    %al,(%r14)
  cmp    $0x1,%r12d
  jne    L184
  movl   $0x1,0x10(%rsp)
L108:
  movslq 0x10(%rsp),%rbx
  nopw   0x0(%rax,%rax,1)
L97:
  movsbl -0x1(%rbp,%r15,1),%edx
  movsbl 0x0(%rbp,%rbx,1),%esi
  movsbl -0x1(%rbp,%rbx,1),%edi
  call   <camel_split@plt>
  test   %rax,%rax
  movslq %r12d,%rax
  je     L31
  movb   $0x5f,(%r14,%rax,1)
  lea    0x1(%r12),%eax
  movsbl 0x0(%rbp,%rbx,1),%edi
  add    $0x2,%r12d
  cltq
  add    $0x1,%rbx
  add    %r14,%rax
  mov    %rax,0x10(%rsp)
  call   <tolower@plt>
  mov    0x10(%rsp),%rcx
  mov    %al,(%rcx)
  cmp    %ebx,0xc(%rsp)
  jg     L97
L159:
  movslq %r13d,%r13
  movb   $0x2e,(%r14,%r13,1)
  movb   $0x74,0x1(%r14,%r13,1)
  movb   $0x78,0x2(%r14,%r13,1)
  movb   $0x74,0x3(%r14,%r13,1)
  movb   $0x0,0x4(%r14,%r13,1)
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L31:
  movsbl 0x0(%rbp,%rbx,1),%edi
  add    %r14,%rax
  add    $0x1,%r12d
  add    $0x1,%rbx
  mov    %rax,0x10(%rsp)
  call   <tolower@plt>
  mov    0x10(%rsp),%rcx
  mov    %al,(%rcx)
  cmp    %ebx,0xc(%rsp)
  jg     L97
  jmp    L159
  nopl   (%rax)
L147:
  mov    (%rbx),%rdi
  lea    0x5(%r13),%esi
  call   <reallocate@plt>
  mov    %rax,(%rbx)
  movsbl 0x0(%rbp),%edi
  mov    %rax,%r14
  call   <tolower@plt>
  mov    %al,(%r14)
  xchg   %ax,%ax
L184:
  movl   $0x1,0x10(%rsp)
  mov    %rbp,%rbx
  mov    $0x1,%r15d
  nopl   0x0(%rax)
L164:
  movsbl 0x2(%rbx),%edx
  movsbl 0x1(%rbx),%esi
  movsbl (%rbx),%edi
  addl   $0x1,0x10(%rsp)
  call   <camel_split@plt>
  test   %rax,%rax
  movslq %r15d,%rax
  je     L87
  movb   $0x5f,(%r14,%rax,1)
  lea    0x1(%r15),%eax
  movsbl 0x1(%rbx),%edi
  add    $0x2,%r15d
  cltq
  add    $0x1,%rbx
  lea    (%r14,%rax,1),%rcx
  mov    %rcx,0x18(%rsp)
  call   <tolower@plt>
  mov    0x18(%rsp),%rcx
  mov    %al,(%rcx)
  cmp    0x10(%rsp),%r12d
  jg     L164
  mov    %r15d,%r12d
  movslq 0xc(%rsp),%r15
  cmp    0x10(%rsp),%r15d
  jg     L108
  jmp    L159
L87:
  movsbl 0x1(%rbx),%edi
  add    %r14,%rax
  add    $0x1,%r15d
  add    $0x1,%rbx
  mov    %rax,0x18(%rsp)
  call   <tolower@plt>
  mov    0x18(%rsp),%rcx
  mov    %al,(%rcx)
  cmp    0x10(%rsp),%r12d
  jg     L164
  mov    %r15d,%r12d
  movslq 0xc(%rsp),%r15
  cmp    0x10(%rsp),%r15d
  jg     L108
  jmp    L159
  nopl   0x0(%rax,%rax,1)
L146:
  mov    $0x1,%r14d
  jmp    L48
  nopl   0x0(%rax,%rax,1)
L156:
  mov    (%rbx),%rdi
  lea    0x5(%rax),%esi
  call   <reallocate@plt>
  mov    %rax,(%rbx)
  movsbl 0x0(%rbp),%edi
  mov    %rax,%r14
  call   <tolower@plt>
  mov    %al,(%r14)
  jmp    L159
```

assistant: ```c
void set_dedx_filename(const char *name, char **filename_ptr) {
  const int n0 = strlen(name);
  int i, n = n0;
  for (i = 1; i < n0; i++) {
    const char c = (i < n0 - 1) ? name[i + 1] : name[n0 - 1];
    if (camel_split(name[i - 1], name[i], c))
      n++;
  }
  char *filename = reallocate(*filename_ptr, n + 5);
  *filename_ptr = filename;
  filename[0] = tolower(name[0]);
  int j;
  for (i = 1, j = 1; i < n0; i++, j++) {
    const char c = (i < n0 - 1) ? name[i + 1] : name[n0 - 1];
    if (camel_split(name[i - 1], name[i], c)) {
      filename[j] = '_';
      j++;
    }
    filename[j] = tolower(name[i]);
  }
  filename[n + 0] = '.';
  filename[n + 1] = 't';
  filename[n + 2] = 'x';
  filename[n + 3] = 't';
  filename[n + 4] = 0x0;
}
```