user: Translate the below assembly code into C programming language:

```asm
<trim>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  call   <strlen@plt>
  lea    -0x1(%rax),%ebp
  jmp    L21
  nopl   0x0(%rax,%rax,1)
L162:
  add    $0x1,%rbx
  cmpb   $0x0,-0x1(%r12,%rbx,1)
  je     L37
L21:
  movsbl (%r12,%rbx,1),%edi
  mov    %ebx,%r14d
  mov    %ebx,%r13d
  call   <isspace@plt>
  test   %rax,%rax
  jne    L162
L37:
  movslq %ebp,%rbx
  nopl   0x0(%rax)
L191:
  movsbl (%r12,%rbx,1),%edi
  mov    %ebx,%ebp
  call   <isspace@plt>
  mov    %rax,%r8
  mov    %ebx,%eax
  not    %eax
  shr    $0x1f,%eax
  test   %r8,%r8
  setne  %dl
  sub    $0x1,%rbx
  test   %al,%dl
  jne    L191
  cmp    %ebp,%r13d
  jg     L147
  mov    %ebp,%edi
  movslq %r13d,%rdx
  sub    %r14d,%edi
  cmp    $0x6,%edi
  jbe    L189
  lea    0x1(%rdi),%esi
  cmp    $0xe,%edi
  jbe    L198
  mov    %esi,%ecx
  add    %r12,%rdx
  xor    %eax,%eax
  shr    $0x4,%ecx
  shl    $0x4,%rcx
L68:
  movdqu (%rdx,%rax,1),%xmm0
  movups %xmm0,(%r12,%rax,1)
  add    $0x10,%rax
  cmp    %rcx,%rax
  jne    L68
  mov    %esi,%eax
  and    $0xfffffff0,%eax
  mov    %eax,%ecx
  add    %eax,%r13d
  cmp    %eax,%esi
  je     L70
  sub    %eax,%edi
  lea    0x1(%rdi),%r8d
  cmp    $0x6,%edi
  jbe    L73
L20:
  mov    (%rdx,%rax,1),%rdx
  mov    %rdx,(%r12,%rax,1)
  mov    %r8d,%eax
  and    $0xfffffff8,%eax
  add    %eax,%r13d
  add    %eax,%ecx
  cmp    %eax,%r8d
  je     L70
L73:
  movslq %r13d,%rdx
  lea    0x1(%r13),%eax
  lea    0x1(%rcx),%edi
  movzbl (%r12,%rdx,1),%r8d
  movslq %ecx,%rdx
  mov    %r8b,(%r12,%rdx,1)
  cmp    %ebp,%eax
  jg     L70
  cltq
  lea    0x2(%r13),%edx
  lea    0x2(%rcx),%r8d
  movslq %edi,%rdi
  movzbl (%r12,%rax,1),%eax
  mov    %al,(%r12,%rdi,1)
  cmp    %edx,%ebp
  jl     L70
  movslq %edx,%rdx
  lea    0x3(%r13),%eax
  lea    0x3(%rcx),%edi
  movslq %r8d,%r8
  movzbl (%r12,%rdx,1),%edx
  mov    %dl,(%r12,%r8,1)
  cmp    %eax,%ebp
  jl     L70
  cltq
  lea    0x4(%r13),%edx
  lea    0x4(%rcx),%r8d
  movslq %edi,%rdi
  movzbl (%r12,%rax,1),%eax
  mov    %al,(%r12,%rdi,1)
  cmp    %edx,%ebp
  jl     L70
  movslq %edx,%rdx
  lea    0x5(%r13),%eax
  lea    0x5(%rcx),%edi
  movslq %r8d,%r8
  movzbl (%r12,%rdx,1),%edx
  mov    %dl,(%r12,%r8,1)
  cmp    %eax,%ebp
  jl     L70
  cltq
  movslq %edi,%rdi
  add    $0x6,%r13d
  add    $0x6,%ecx
  movzbl (%r12,%rax,1),%eax
  mov    %al,(%r12,%rdi,1)
  cmp    %r13d,%ebp
  jl     L70
  movslq %r13d,%r13
  movslq %ecx,%rcx
  movzbl (%r12,%r13,1),%eax
  mov    %al,(%r12,%rcx,1)
L70:
  movslq %esi,%rsi
  mov    %r12,%rax
  add    %r12,%rsi
  movb   $0x0,(%rsi)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L189:
  mov    %edi,%ecx
  mov    %r12,%rax
  lea    0x1(%r12,%rcx,1),%rsi
  nopw   0x0(%rax,%rax,1)
L177:
  movzbl (%rax,%rdx,1),%ecx
  add    $0x1,%rax
  mov    %cl,-0x1(%rax)
  cmp    %rsi,%rax
  jne    L177
  lea    0x1(%rdi),%esi
  jmp    L70
  nopl   (%rax)
L147:
  mov    %r12,%rsi
  mov    %r12,%rax
  movb   $0x0,(%rsi)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L198:
  mov    %esi,%r8d
  xor    %eax,%eax
  xor    %ecx,%ecx
  add    %r12,%rdx
  jmp    L20
```

assistant: ```c
char *trim(char *str) {
  int i = 0;
  int j = strlen(str) - 1;
  int k = 0;
  while (isspace(str[i]) && str[i] != '\0')
    i++;
  while (isspace(str[j]) && j >= 0)
    j--;
  while (i <= j)
    str[k++] = str[i++];
  str[k] = '\0';
  return str;
}
```