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

```asm
<check_backup_name>:
  endbr64
  push   %r13
  push   %r12
  lea    D28(%rip),%r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  mov    %r12,%rdi
  sub    $0x268,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x258(%rsp)
  xor    %eax,%eax
  call   <DataManager_GetStrValue@plt>
  mov    %eax,%edi
  call   <strlen@plt>
  cmp    $0x40,%eax
  jg     L17
  mov    %r12,%rdi
  mov    %eax,%ebp
  lea    0x10(%rsp),%r12
  call   <DataManager_GetStrValue@plt>
  mov    %r12,%rdi
  mov    %ebp,%edx
  mov    %eax,%esi
  call   <strncpy@plt>
  lea    D10(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L27
  test   %ebp,%ebp
  jle    L164
  movabs $0x17ffffff5,%rdi
  lea    -0x1(%rbp),%eax
  mov    %r12,%rdx
  lea    0x11(%rsp,%rax,1),%rsi
  jmp    L170
  nopw   0x0(%rax,%rax,1)
L166:
  sub    $0x5d,%eax
  cmp    $0x20,%al
  ja     L178
  bt     %rax,%rdi
  jae    L178
L29:
  add    $0x1,%rdx
  cmp    %rdx,%rsi
  je     L164
L170:
  movsbl (%rdx),%r8d
  lea    -0x30(%r8),%ecx
  mov    %r8d,%eax
  cmp    $0x9,%ecx
  jbe    L29
  lea    -0x41(%r8),%ecx
  cmp    $0x1a,%ecx
  jbe    L29
  cmp    $0x2e,%r8b
  jg     L166
  cmp    $0x2c,%r8b
  jg     L29
L178:
  mov    $0xfffffffd,%r13d
  test   %ebx,%ebx
  jne    L127
  nopl   (%rax)
L199:
  mov    0x258(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L12
  add    $0x268,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L164:
  lea    D46(%rip),%rdi
  lea    0x50(%rsp),%r13
  call   <DataManager_GetStrValue@plt>
  lea    0x150(%rsp),%rbp
  mov    %r13,%rdi
  mov    %eax,%esi
  call   <strcpy@plt>
  mov    %rbp,%rdi
  mov    %r12,%rcx
  mov    %r13,%rdx
  lea    D24(%rip),%rsi
  call   <sprintf@plt>
  lea    0xc(%rsp),%rsi
  mov    %rbp,%rdi
  call   <statfs@plt>
  test   %rax,%rax
  je     L165
L27:
  xor    %r13d,%r13d
  jmp    L199
L127:
  mov    %r8d,%edx
  mov    %r12,%rsi
  lea    D5(%rip),%rdi
  xor    %eax,%eax
  call   <ui_print@plt>
  jmp    L199
L165:
  mov    $0xfffffffc,%r13d
  test   %ebx,%ebx
  je     L199
  lea    D12(%rip),%rdi
  call   <ui_print@plt>
  jmp    L199
  nopw   0x0(%rax,%rax,1)
L17:
  mov    $0xfffffffe,%r13d
  test   %ebx,%ebx
  je     L199
  lea    D66(%rip),%rdi
  xor    %eax,%eax
  call   <ui_print@plt>
  jmp    L199
L12:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D28
datatype: string
name: parse_data
arguments: data_tag: D10
datatype: string
name: parse_data
arguments: data_tag: D46
datatype: string
name: parse_data
arguments: data_tag: D24
datatype: string
name: parse_data
arguments: data_tag: D5
datatype: string
name: parse_data
arguments: data_tag: D12
datatype: string
name: parse_data
arguments: data_tag: D66
datatype: string

tool: D28: tw_backup_name

tool: D10: 0

tool: D46: tw_backups_folder

tool: D24: %s/%s/.

tool: D5: E:Backup name '%s' contains invalid character: '%c'


tool: D12: E:A backup with this name already exists.


tool: D66: E:Backup name is too long.


assistant: ```c
int check_backup_name(int show_error) {
  char backup_name[64];
  char backup_loc[255], tw_image_dir[255];
  int copy_size = strlen(DataManager_GetStrValue("tw_backup_name"));
  int index, cur_char;
  struct statfs st;
  if (copy_size > 64) {
    if (show_error)
      ui_print("E:"
               "Backup name is too long.\n");
    return -2;
  }
  strncpy(backup_name, DataManager_GetStrValue("tw_backup_name"), copy_size);
  if (strcmp(backup_name, "0") == 0)
    return 0;
  for (index = 0; index < copy_size; index++) {
    cur_char = (int)backup_name[index];
    if ((cur_char >= 48 && cur_char <= 57) || (cur_char >= 65 && cur_char <= 91) || cur_char == 93 || cur_char == 95 || (cur_char >= 97 && cur_char <= 123) || cur_char == 125 || cur_char == 45 || cur_char == 46) {
    } else {
      if (show_error)
        ui_print("E:"
                 "Backup name '%s' contains invalid character: '%c'\n",
                 backup_name, (char)cur_char);
      return -3;
    }
  }
  strcpy(backup_loc, DataManager_GetStrValue("tw_backups_folder"));
  sprintf(tw_image_dir, "%s/%s/.", backup_loc, backup_name);
  if (statfs(tw_image_dir, &st) == 0) {
    if (show_error)
      ui_print("E:"
               "A backup with this name already exists.\n");
    return -4;
  }
  return 0;
}
```