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

```asm
<pet_filename_to_host>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0xf,-0xc(%rbp)
  jmp    L83
L157:
  addl   $0x1,-0x10(%rbp)
L83:
  cmpl   $0xf,-0x10(%rbp)
  jg     L125
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x20,%eax
  je     L157
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0xa0,%eax
  je     L157
  jmp    L125
L72:
  subl   $0x1,-0xc(%rbp)
L125:
  cmpl   $0x0,-0xc(%rbp)
  js     L110
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x20,%eax
  je     L72
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0xa0,%eax
  je     L72
L110:
  addl   $0x1,-0xc(%rbp)
  mov    -0x10(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jge    L151
  movl   $0x0,-0x8(%rbp)
  jmp    L164
L134:
  mov    -0x10(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <pet_to_asc@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <isprint@plt>
  test   %rax,%rax
  je     L75
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <is_host_allowed_char@plt>
  test   %rax,%rax
  je     L75
  mov    -0x4(%rbp),%eax
  mov    %eax,%edx
  jmp    L155
L75:
  mov    $0x5f,%edx
L155:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    %dl,(%rax)
  addl   $0x1,-0x8(%rbp)
L164:
  mov    -0xc(%rbp),%eax
  sub    -0x10(%rbp),%eax
  cmp    %eax,-0x8(%rbp)
  jl     L134
  mov    -0xc(%rbp),%eax
  sub    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L31
L151:
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
L31:
  cmpq   $0x0,-0x28(%rbp)
  je     L55
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L55
  mov    -0xc(%rbp),%eax
  sub    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2e,(%rax)
  mov    -0xc(%rbp),%eax
  cltq
  mov    -0x10(%rbp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x28(%rbp),%rax
  mov    $0x3,%edx
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0xc(%rbp),%eax
  sub    -0x10(%rbp),%eax
  cltq
  lea    0x4(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L55:
  nop
  leave
  ret
```

assistant: ```c
void pet_filename_to_host(char *asc, const uint8_t *pet, const char *ext) {
  int lead = 0;
  int trail = 16 - 1;
  while (lead < 16 && (pet[lead] == 0x20 || pet[lead] == 0xa0)) {
    lead++;
  }
  while (trail >= 0 && (pet[trail] == 0x20 || pet[trail] == 0xa0)) {
    trail--;
  }
  trail++;
  if (lead < trail) {
    int i;
    for (i = 0; i < trail - lead; i++) {
      int b = pet_to_asc(pet[lead + i]);
      asc[i] = isprint(b) && is_host_allowed_char(b) ? (char)b : '_';
    }
    asc[trail - lead] = '\0';
  } else {
    lead = trail;
    asc[0] = '\0';
  }
  if (ext != NULL && *ext != '\0') {
    asc[trail - lead] = '.';
    memcpy(asc + trail - lead + 1, ext, 3);
    asc[trail - lead + 4] = '\0';
  }
}
```