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

```asm
<mid_trunc>:
  endbr64
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  xor    %edi,%edi
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmp    $0x8,%rdx
  movl   $0x2d2d2d,0x4(%rsp)
  seta   %dil
  call   <assert@plt>
  test   %rbp,%rbp
  je     L184
  cmpb   $0x0,0x0(%rbp)
  jne    L254
L184:
  test   %rbx,%rbx
  je     L313
  lea    0x4(%rsp),%rsi
  mov    %rbx,%rdi
  call   <strcpy@plt>
  mov    %rbx,%rax
L318:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L387
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L254:
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %rax,%r13
  cmp    %rax,%r12
  jae    L372
  test   %rbx,%rbx
  je     L471
L446:
  mov    %r12,%rsi
  shr    %rsi
  mov    %rsi,%rdx
  sub    $0x3,%rdx
  je     L132
  lea    0x1(%rbp),%rdi
  mov    %rbx,%rcx
  lea    -0x4(%rsi),%rax
  sub    %rdi,%rcx
  cmp    $0xe,%rcx
  jbe    L369
  cmp    $0x6,%rax
  jbe    L369
  cmp    $0xe,%rax
  jbe    L322
  mov    %rdx,%rcx
  xor    %eax,%eax
  and    $0xfffffffffffffff0,%rcx
  nopl   (%rax)
L91:
  movdqu 0x0(%rbp,%rax,1),%xmm0
  movups %xmm0,(%rbx,%rax,1)
  add    $0x10,%rax
  cmp    %rcx,%rax
  jne    L91
  mov    %rdx,%rax
  and    $0xfffffffffffffff0,%rax
  test   $0xf,%dl
  je     L44
  mov    %rsi,%rcx
  sub    %rax,%rcx
  lea    -0x3(%rcx),%rdi
  sub    $0x4,%rcx
  cmp    $0x6,%rcx
  jbe    L324
L209:
  mov    0x0(%rbp,%rax,1),%rcx
  mov    %rcx,(%rbx,%rax,1)
  mov    %rdi,%rcx
  and    $0xfffffffffffffff8,%rcx
  add    %rcx,%rax
  cmp    %rcx,%rdi
  je     L44
L324:
  movzbl 0x0(%rbp,%rax,1),%ecx
  mov    %cl,(%rbx,%rax,1)
  lea    0x1(%rax),%rcx
  cmp    %rcx,%rdx
  jbe    L44
  movzbl 0x1(%rbp,%rax,1),%ecx
  mov    %cl,0x1(%rbx,%rax,1)
  lea    0x2(%rax),%rcx
  cmp    %rcx,%rdx
  jbe    L44
  movzbl 0x2(%rbp,%rax,1),%ecx
  mov    %cl,0x2(%rbx,%rax,1)
  lea    0x3(%rax),%rcx
  cmp    %rcx,%rdx
  jbe    L44
  movzbl 0x3(%rbp,%rax,1),%ecx
  mov    %cl,0x3(%rbx,%rax,1)
  lea    0x4(%rax),%rcx
  cmp    %rcx,%rdx
  jbe    L44
  movzbl 0x4(%rbp,%rax,1),%ecx
  mov    %cl,0x4(%rbx,%rax,1)
  lea    0x5(%rax),%rcx
  cmp    %rcx,%rdx
  jbe    L44
  movzbl 0x5(%rbp,%rax,1),%ecx
  mov    %cl,0x5(%rbx,%rax,1)
  lea    0x6(%rax),%rcx
  cmp    %rcx,%rdx
  jbe    L44
  movzbl 0x6(%rbp,%rax,1),%ecx
  mov    %cl,0x6(%rbx,%rax,1)
L44:
  add    %rbx,%rdx
  lea    -0x2(%rsi),%rdi
  lea    -0x1(%rsi),%rax
  mov    %rsi,%rcx
L440:
  movb   $0x2e,(%rdx)
  mov    %r13,%rdx
  movb   $0x2e,(%rbx,%rdi,1)
  sub    %rsi,%rdx
  movb   $0x2e,(%rbx,%rax,1)
  cmp    %rcx,%r12
  jbe    L395
  lea    (%rbx,%rcx,1),%r8
  lea    0x1(%rdx),%rax
  mov    %r12,%rdi
  lea    0x0(%rbp,%rax,1),%r11
  mov    %r8,%r10
  sub    %rcx,%rdi
  sub    %r11,%r10
  lea    -0x1(%rdi),%r9
  cmp    $0xe,%r10
  jbe    L474
  cmp    $0x6,%r9
  jbe    L474
  cmp    $0xe,%r9
  jbe    L454
  mov    %rdi,%r9
  lea    0x0(%rbp,%rdx,1),%rsi
  xor    %eax,%eax
  and    $0xfffffffffffffff0,%r9
  nopl   0x0(%rax)
L346:
  movdqu (%rsi,%rax,1),%xmm1
  movups %xmm1,(%r8,%rax,1)
  add    $0x10,%rax
  cmp    %r9,%rax
  jne    L346
  mov    %rdi,%r9
  and    $0xfffffffffffffff0,%r9
  lea    (%rcx,%r9,1),%rax
  add    %r9,%rdx
  cmp    %r9,%rdi
  je     L340
  sub    %r9,%rdi
  lea    -0x1(%rdi),%rcx
  cmp    $0x6,%rcx
  jbe    L156
L165:
  mov    (%rsi,%r9,1),%rcx
  mov    %rcx,(%r8,%r9,1)
  mov    %rdi,%rcx
  and    $0xfffffffffffffff8,%rcx
  add    %rcx,%rax
  add    %rcx,%rdx
  cmp    %rdi,%rcx
  je     L340
L156:
  movzbl 0x0(%rbp,%rdx,1),%ecx
  mov    %cl,(%rbx,%rax,1)
  lea    0x1(%rax),%rcx
  cmp    %rcx,%r12
  jbe    L340
  movzbl 0x1(%rbp,%rdx,1),%ecx
  mov    %cl,0x1(%rbx,%rax,1)
  lea    0x2(%rax),%rcx
  cmp    %rcx,%r12
  jbe    L340
  movzbl 0x2(%rbp,%rdx,1),%ecx
  mov    %cl,0x2(%rbx,%rax,1)
  lea    0x3(%rax),%rcx
  cmp    %rcx,%r12
  jbe    L340
  movzbl 0x3(%rbp,%rdx,1),%ecx
  mov    %cl,0x3(%rbx,%rax,1)
  lea    0x4(%rax),%rcx
  cmp    %rcx,%r12
  jbe    L340
  movzbl 0x4(%rbp,%rdx,1),%ecx
  mov    %cl,0x4(%rbx,%rax,1)
  lea    0x5(%rax),%rcx
  cmp    %rcx,%r12
  jbe    L340
  movzbl 0x5(%rbp,%rdx,1),%ecx
  mov    %cl,0x5(%rbx,%rax,1)
  lea    0x6(%rax),%rcx
  cmp    %rcx,%r12
  jbe    L340
  movzbl 0x6(%rbp,%rdx,1),%edx
  mov    %dl,0x6(%rbx,%rax,1)
L340:
  movb   $0x0,(%rbx,%r12,1)
  mov    %rbx,%rax
  jmp    L318
  nopw   0x0(%rax,%rax,1)
L313:
  lea    0x4(%rsp),%rdi
  call   <mkstring@plt>
  jmp    L318
  nop
L372:
  test   %rbx,%rbx
  je     L334
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strcpy@plt>
  mov    %rbx,%rax
  jmp    L318
  nopl   0x0(%rax,%rax,1)
L334:
  mov    %rbp,%rdi
  call   <mkstring@plt>
  jmp    L318
  nopl   (%rax)
L471:
  lea    0x1(%r12),%rdi
  call   <malloc@plt>
  mov    %rax,%rdx
  xor    %eax,%eax
  test   %rdx,%rdx
  je     L318
  mov    %rdx,%rbx
  jmp    L446
L369:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L207:
  movzbl 0x0(%rbp,%rax,1),%ecx
  mov    %cl,(%rbx,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L207
  jmp    L44
  xchg   %ax,%ax
L474:
  sub    %r13,%rsi
  lea    (%r12,%rdx,1),%rdi
  add    %rcx,%rsi
  sub    %rcx,%rdi
  add    %rbx,%rsi
  jmp    L127
  nopw   0x0(%rax,%rax,1)
L93:
  add    $0x1,%rax
L127:
  movzbl 0x0(%rbp,%rdx,1),%ecx
  mov    %cl,(%rsi,%rdx,1)
  mov    %rax,%rdx
  cmp    %rdi,%rax
  jne    L93
  jmp    L340
  nopl   0x0(%rax)
L395:
  mov    %rcx,%r12
  jmp    L340
L132:
  mov    %rbx,%rdx
  mov    $0x3,%ecx
  mov    $0x2,%eax
  mov    $0x1,%edi
  jmp    L440
L454:
  mov    %rcx,%rax
  xor    %r9d,%r9d
  lea    0x0(%rbp,%rdx,1),%rsi
  jmp    L165
L322:
  mov    %rdx,%rdi
  xor    %eax,%eax
  jmp    L209
L387:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *mid_trunc(char *str, const char *input, unsigned long len) {
  unsigned long ilen;
  unsigned long middle;
  unsigned long i, j;
  char defstr[4] = "---";
  assert(len > 8);
  if ((input == NULL) || (input[0] == 0)) {
    if (NULL == str) {
      return (mkstring(defstr));
    } else {
      strcpy(str, defstr);
      return (str);
    }
  }
  ilen = strlen(input);
  if (ilen <= len) {
    if (NULL == str)
      return (mkstring(input));
    else {
      strcpy(str, input);
      return (str);
    }
  } else {
    if (NULL == str) {
      if (NULL == (str = (char *)malloc(len + 1)))
        return (NULL);
    }
    middle = (len / 2) - 3;
    i = 0;
    while (i < middle) {
      str[i] = input[i];
      i++;
    }
    str[i++] = '.';
    str[i++] = '.';
    str[i++] = '.';
    j = ilen - (len / 2);
    while (i < len) {
      str[i] = input[j];
      i++;
      j++;
    }
    str[i] = 0;
    return (str);
  }
}
```