user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<md_set_file_ext>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  test   %rdi,%rdi
  je     L21
  mov    %rdi,%r12
  mov    %rdx,%rdi
  mov    %rsi,%rbx
  mov    %rdx,%r13
  call   <strlen@plt>
  lea    D5(%rip),%rsi
  mov    %rsi,(%rsp)
  test   %eax,%eax
  jle    L6
  mov    %rbx,%rdi
  call   <strlen@plt>
  lea    D16(%rip),%rsi
  mov    %rsi,(%rsp)
  test   %eax,%eax
  jle    L6
  mov    %r12,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jle    L150
  mov    %r12,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  js     L150
  cltq
  jmp    L56
  nopl   0x0(%rax,%rax,1)
L221:
  sub    $0x1,%rax
  test   %eax,%eax
  js     L150
L56:
  cmpb   $0x2e,(%r12,%rax,1)
  mov    %eax,%ebp
  jne    L221
  jmp    L227
  nopl   0x0(%rax,%rax,1)
L21:
  movq   $0x0,(%rsp)
L6:
  mov    (%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L150:
  mov    %r12,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jle    L216
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,%ebp
L227:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %r13,%rdi
  mov    %eax,%r14d
  call   <strlen@plt>
  lea    0x3(%r14,%rbp,1),%edx
  movl   $0x0,0xc(%rsp)
  add    %edx,%eax
  mov    %eax,0x8(%rsp)
L140:
  mov    0x8(%rsp),%r15d
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %r13,(%rsp)
  mov    %rax,%r14
  test   %rax,%rax
  je     L6
  mov    %rax,(%rsp)
  test   %r15d,%r15d
  jle    L79
  movslq %r15d,%rdx
  xor    %esi,%esi
  mov    %rax,%rdi
  call   <memset@plt>
L79:
  cmpl   $0x1,0xc(%rsp)
  je     L235
  test   %ebp,%ebp
  jle    L210
  lea    -0x1(%rbp),%eax
  sub    %r14,%r12
  lea    0x1(%r14,%rax,1),%rcx
  mov    %r14,%rax
  nopl   0x0(%rax)
L222:
  movzbl (%r12,%rax,1),%edx
  add    $0x1,%rax
  mov    %dl,-0x1(%rax)
  cmp    %rcx,%rax
  jne    L222
L210:
  xor    %r15d,%r15d
  movslq %ebp,%r12
  jmp    L121
  nopl   0x0(%rax)
L152:
  movzbl (%rbx,%r15,1),%ecx
  lea    (%r14,%r15,1),%rax
  add    $0x1,%r15
  mov    %cl,(%rax,%r12,1)
L121:
  mov    %rbx,%rdi
  call   <strlen@plt>
  lea    0x0(%rbp,%r15,1),%ecx
  add    %ebp,%eax
  cmp    %ecx,%eax
  jge    L152
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %rbx,%rdi
  add    %ebp,%eax
  cltq
  movb   $0x2e,(%r14,%rax,1)
  call   <strlen@plt>
  lea    0x1(%rbp,%rax,1),%r12d
  mov    0x8(%rsp),%eax
  cmp    %r12d,%eax
  jle    L6
  mov    %r12d,%r15d
  sub    %ebp,%eax
  movslq %r12d,%r12
  mov    %eax,0x8(%rsp)
  sub    %ebp,%r15d
  add    %r14,%r12
  jmp    L153
  nopl   0x0(%rax,%rax,1)
L40:
  mov    %rbx,%rdi
  add    $0x1,%r12
  call   <strlen@plt>
  mov    %eax,%r8d
  mov    %r15d,%eax
  add    $0x1,%r15d
  sub    %r8d,%eax
  cltq
  movzbl -0x1(%r13,%rax,1),%eax
  mov    %al,-0x1(%r12)
  cmp    0x8(%rsp),%r15d
  je     L6
L153:
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %rbx,%rdi
  lea    (%rax,%rbp,1),%r14d
  call   <strlen@plt>
  add    %eax,%r14d
  lea    (%r15,%rbp,1),%eax
  cmp    %eax,%r14d
  jge    L40
  jmp    L6
  cs nopw 0x0(%rax,%rax,1)
L216:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %r13,%rdi
  mov    %eax,%ebp
  call   <strlen@plt>
  movl   $0x1,0xc(%rsp)
  lea    0x4(%rbp,%rax,1),%eax
  mov    $0x1,%ebp
  mov    %eax,0x8(%rsp)
  jmp    L140
  nopl   0x0(%rax)
L235:
  movb   $0x6d,(%r14)
  jmp    L210
```

tool_calls: name: extract_symbolic_data
arguments: tag: D5
datatype: string
name: extract_symbolic_data
arguments: tag: D16
datatype: string

tool: D5: ERR-EXT.txt

tool: D16: ERR-LAB.txt

assistant: ```c
char *md_set_file_ext(char *str, char *lab, char *ext) {
  char *tmp = NULL;
  int tmplen = 0;
  int dotpos = -1;
  int empty = 0;
  int i;
  if (str == NULL) {
    return (NULL);
  }
  if (strlen(ext) < 1) {
    return ("ERR-EXT.txt");
  }
  if (strlen(lab) < 1) {
    return ("ERR-LAB.txt");
  }
  if (strlen(str) >= 1) {
    for (i = (strlen(str) - 1); i >= 0; i--) {
      if (str[i] == '.') {
        dotpos = i;
        break;
      }
    }
  }
  if (dotpos == -1) {
    if (strlen(str) >= 1) {
      dotpos = strlen(str);
      tmplen = strlen(lab) + dotpos + 3 + strlen(ext);
    } else {
      tmplen = strlen(lab) + 4 + strlen(ext);
      dotpos = 1;
      empty = 1;
    }
  } else {
    tmplen = dotpos + strlen(lab) + 3 + strlen(ext);
  }
  if ((tmp = (char *)malloc(tmplen * sizeof(char))) == NULL) {
    return (ext);
  }
  for (i = 0; i < tmplen; i++) {
    tmp[i] = '\0';
  }
  if (empty == 1) {
    tmp[0] = 'm';
  } else {
    for (i = 0; i < dotpos; i++) {
      tmp[i] = str[i];
    }
  }
  for (i = dotpos; i < (dotpos + strlen(lab) + 1); i++) {
    tmp[i] = lab[i - dotpos];
  }
  tmp[dotpos + strlen(lab)] = '.';
  for (i = (dotpos + strlen(lab) + 1); i < tmplen; i++) {
    if (i > dotpos + strlen(ext) + strlen(lab)) {
      break;
    }
    tmp[i] = ext[i - dotpos - strlen(lab) - 1];
  }
  if (tmp == NULL) {
    return (ext);
  } else {
    return (tmp);
  }
}
```