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

```asm
<auto_recode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x430,%rsp
  mov    %rdi,-0x428(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x428(%rbp),%rax
  mov    %rax,%rdi
  call   <is_ascii_string@plt>
  test   %rax,%rax
  je     L7
  mov    -0x428(%rbp),%rax
  mov    %rax,-0x420(%rbp)
  jmp    L74
L7:
  mov    -0x428(%rbp),%rax
  mov    %rax,%rdi
  call   <utf8_validate@plt>
  test   %rax,%rax
  je     L68
  mov    -0x428(%rbp),%rax
  mov    %rax,-0x418(%rbp)
  lea    -0x410(%rbp),%rdx
  mov    -0x428(%rbp),%rax
  mov    %rdx,%rcx
  lea    D34(%rip),%rdx
  lea    D66(%rip),%rsi
  mov    %rax,%rdi
  call   <simple_recode@plt>
  test   %rax,%rax
  je     L90
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <utf8_validate@plt>
  test   %rax,%rax
  je     L90
  lea    -0x410(%rbp),%rax
  mov    %rax,-0x418(%rbp)
L90:
  mov    -0x418(%rbp),%rax
  mov    %rax,%rdi
  call   <is_cp1251@plt>
  test   %rax,%rax
  je     L103
  lea    -0x210(%rbp),%rdx
  mov    -0x418(%rbp),%rax
  mov    %rdx,%rcx
  lea    D34(%rip),%rdx
  lea    D66(%rip),%rsi
  mov    %rax,%rdi
  call   <simple_recode@plt>
  mov    %rax,-0x420(%rbp)
  cmpq   $0x0,-0x420(%rbp)
  je     L6
  mov    -0x420(%rbp),%rax
  lea    D40(%rip),%rdx
  mov    %rdx,%rcx
  lea    D66(%rip),%rdx
  lea    D103(%rip),%rsi
  mov    %rax,%rdi
  call   <simple_recode@plt>
  mov    %rax,-0x420(%rbp)
L6:
  cmpq   $0x0,-0x420(%rbp)
  jne    L74
  mov    -0x418(%rbp),%rax
  mov    %rax,-0x420(%rbp)
  jmp    L74
L103:
  mov    -0x418(%rbp),%rax
  mov    $0x200,%edx
  mov    %rax,%rsi
  lea    D40(%rip),%rax
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    %rax,-0x420(%rbp)
  jmp    L74
L68:
  mov    -0x428(%rbp),%rax
  lea    D40(%rip),%rdx
  mov    %rdx,%rcx
  lea    D66(%rip),%rdx
  lea    D103(%rip),%rsi
  mov    %rax,%rdi
  call   <simple_recode@plt>
  mov    %rax,-0x420(%rbp)
  cmpq   $0x0,-0x420(%rbp)
  jne    L74
  mov    -0x428(%rbp),%rax
  mov    %rax,-0x420(%rbp)
L74:
  mov    -0x420(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L50
  call   <__stack_chk_fail@plt>
L50:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D34
data_type: string
name: unpack_data
arguments: tag: D66
data_type: string
name: unpack_data
arguments: tag: D103
data_type: string

tool: D34: ISO8859-1

tool: D66: UTF-8

tool: D103: CP1251

assistant: ```c
const char *auto_recode(const char *utf_str) {
  char *res;
  static char result_buf[512];
  if (is_ascii_string(utf_str)) {
    res = (char *)utf_str;
  } else if (utf8_validate(utf_str)) {
    const char *utf_src = utf_str;
    char iso_8859_1[512];
    if (simple_recode(utf_str, "UTF-8", "ISO8859-1", iso_8859_1) && utf8_validate(iso_8859_1))
      utf_src = iso_8859_1;
    if (is_cp1251(utf_src)) {
      char tmp[512];
      res = simple_recode(utf_src, "UTF-8", "ISO8859-1", tmp);
      if (res)
        res = simple_recode(res, "CP1251", "UTF-8", result_buf);
      if (!res)
        res = (char *)utf_src;
    } else {
      res = strncpy(result_buf, utf_src, 512);
    }
  } else {
    res = simple_recode(utf_str, "CP1251", "UTF-8", result_buf);
    if (!res)
      res = (char *)utf_str;
  }
  return res;
}
```