user: Converte this assembly snippet into its equivalent C code:

```asm
<string_thirdword>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    %r12,%rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  jmp    L204
  nopl   0x0(%rax)
L222:
  movsbl (%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  je     L76
  add    $0x1,%ebp
L204:
  movsbl (%rbx),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L222
  movsbl (%rbx),%edi
  test   %dil,%dil
  je     L76
  movslq %ebp,%rax
  lea    0x1(%r12,%rax,1),%rbx
  jmp    L144
  cs nopw 0x0(%rax,%rax,1)
L57:
  movsbl (%rbx),%edi
  add    $0x1,%rbx
  add    $0x1,%ebp
  test   %dil,%dil
  je     L76
L144:
  call   <isspace@plt>
  test   %rax,%rax
  je     L57
  movslq %ebp,%r13
  movsbl (%r12,%r13,1),%edi
  jmp    L78
  nopl   0x0(%rax,%rax,1)
L76:
  movslq %ebp,%r13
L78:
  add    %r12,%r13
  sub    %r13d,%ebp
  jmp    L140
  nopl   0x0(%rax,%rax,1)
L271:
  movsbl 0x0(%r13),%edi
  add    $0x1,%r13
  test   %dil,%dil
  je     L21
  movsbl 0x0(%r13),%edi
L140:
  lea    0x0(%rbp,%r13,1),%ebx
  call   <isspace@plt>
  test   %rax,%rax
  jne    L271
  movsbl 0x0(%r13),%edi
  test   %dil,%dil
  je     L21
  movslq %ebx,%rax
  lea    0x1(%r12,%rax,1),%rbp
  jmp    L167
  xchg   %ax,%ax
L171:
  movsbl 0x0(%rbp),%edi
  add    $0x1,%rbp
  add    $0x1,%ebx
  test   %dil,%dil
  je     L21
L167:
  call   <isspace@plt>
  test   %rax,%rax
  je     L171
  movslq %ebx,%r13
  movsbl (%r12,%r13,1),%edi
  jmp    L169
  nopl   0x0(%rax)
L21:
  movslq %ebx,%r13
L169:
  add    %r12,%r13
  sub    %r13d,%ebx
  jmp    L90
  nopl   0x0(%rax,%rax,1)
L221:
  movzbl 0x0(%r13),%edi
  add    $0x1,%r13
  test   %dil,%dil
  je     L232
  movsbl 0x0(%r13),%edi
L90:
  lea    (%rbx,%r13,1),%ebp
  call   <isspace@plt>
  test   %rax,%rax
  jne    L221
  movsbl 0x0(%r13),%edi
  test   %dil,%dil
  je     L232
  movslq %ebp,%rbx
  mov    %ebp,%r14d
  lea    0x1(%r12,%rbx,1),%r15
  jmp    L22
  nopl   0x0(%rax,%rax,1)
L194:
  movsbl (%r15),%edi
  add    $0x1,%r15
  add    $0x1,%r14d
  test   %dil,%dil
  je     L17
L22:
  call   <isspace@plt>
  test   %rax,%rax
  je     L194
  sub    $0x1,%r14d
L17:
  cmp    %ebp,%r14d
  jl     L257
  movzbl 0x0(%r13),%edi
L33:
  mov    %r12,%rdx
  mov    %rbx,%rax
  sub    %rbx,%rdx
  jmp    L95
  nopl   0x0(%rax)
L69:
  movzbl (%r12,%rax,1),%edi
L95:
  mov    %dil,(%rdx,%rax,1)
  add    $0x1,%rax
  cmp    %eax,%r14d
  jge    L69
  mov    %r14d,%eax
  mov    $0x1,%edx
  sub    %ebp,%eax
  add    $0x1,%eax
  cmp    %ebp,%r14d
  cmovl  %edx,%eax
  cltq
  add    %r12,%rax
L247:
  movb   $0x0,(%rax)
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L232:
  mov    %ebp,%r14d
  movslq %ebp,%rbx
  jmp    L33
  nopl   0x0(%rax,%rax,1)
L257:
  mov    %r12,%rax
  jmp    L247
```

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