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

```asm
<utf8_to_latin1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L161
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L151
L136:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x1f,%al
  jbe    L21
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jns    L29
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xbf,%al
  ja     L29
L21:
  mov    -0x10(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x10(%rbp)
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2e,(%rax)
  jmp    L144
L29:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xdf,%al
  jbe    L20
  mov    -0x10(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x10(%rbp)
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L70
L20:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xe0,%eax
  cmp    $0xc0,%eax
  jne    L50
  mov    -0x14(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0xc(%rbp)
  jne    L184
  mov    -0x10(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x10(%rbp)
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L70
L184:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xfc,%eax
  cmp    $0xc0,%eax
  je     L51
  mov    -0x10(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x10(%rbp)
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2e,(%rax)
  addl   $0x1,-0x14(%rbp)
  jmp    L144
L51:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  je     L27
  mov    -0x10(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x10(%rbp)
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L70
L27:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x10(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  shl    $0x6,%edx
  mov    %dl,(%rax)
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x1(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  and    $0x3f,%eax
  mov    %eax,%esi
  mov    -0x10(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  add    %esi,%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x14(%rbp)
  addl   $0x1,-0x10(%rbp)
  jmp    L144
L50:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x10(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x10(%rbp)
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  movzbl (%rcx),%eax
  mov    %al,(%rdx)
L144:
  addl   $0x1,-0x14(%rbp)
L151:
  mov    -0x14(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jl     L136
  mov    -0x10(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jge    L70
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L70
L161:
  nop
L70:
  leave
  ret
```

assistant: ```c
void utf8_to_latin1(char *utf8_str) {
  int i, j, len;
  unsigned char *str;
  str = (unsigned char *)utf8_str;
  len = strlen(utf8_str);
  if (!len) {
    return;
  }
  j = 0;
  for (i = 0; i < len; i++) {
    if ((str[i] < 32) || ((str[i] > 127) && (str[i] < 192))) {
      str[j++] = '.';
      continue;
    }
    if (str[i] > 223) {
      str[j++] = 0;
      return;
    }
    if ((str[i] & 224) == 192) {
      if ((i + 1) == len) {
        str[j++] = 0;
        return;
      }
      if ((str[i] & 252) != 192) {
        str[j++] = '.';
        i++;
        continue;
      }
      if ((str[i + 1] & 192) != 128) {
        str[j++] = 0;
        return;
      }
      str[j] = str[i] << 6;
      str[j] += (str[i + 1] & 63);
      i++;
      j++;
      continue;
    }
    str[j++] = str[i];
  }
  if (j < len) {
    str[j] = 0;
  }
}
```