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

```asm
<convert_statistics>:
  endbr64
  push   %r13
  mov    %rdi,%rsi
  mov    %rdi,%r13
  lea    D23(%rip),%rdi
  push   %r12
  push   %rbp
  call   <printf@plt>
  mov    %r13,%rdi
  call   <open_file@plt>
  test   %rax,%rax
  je     L4
  mov    %r13,%rdi
  mov    %rax,%rbp
  call   <create_file@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L14
  mov    %rbp,%rdi
  lea    D99(%rip),%rdx
  mov    %rax,%rsi
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D164(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D201(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D31(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D132(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D75(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D117(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D114(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D80(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D177(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D103(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D101(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D61(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D84(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D189(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D71(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D14(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D148(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D5(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D124(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D102(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D145(%rip),%rdx
  call   <save_str@plt>
  mov    %r12,%rsi
  lea    D67(%rip),%rdx
  mov    %rbp,%rdi
  call   <save_str@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  pop    %rbp
  mov    %r13,%rdi
  pop    %r12
  pop    %r13
  jmp    10e0 <rename_file@plt>
  xchg   %ax,%ax
L4:
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L14:
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    10b0 <fclose@plt>
```

tool_calls: name: retrieve_data
arguments: label: D23
data_type: string
name: retrieve_data
arguments: label: D99
data_type: string
name: retrieve_data
arguments: label: D164
data_type: string
name: retrieve_data
arguments: label: D201
data_type: string
name: retrieve_data
arguments: label: D31
data_type: string
name: retrieve_data
arguments: label: D132
data_type: string
name: retrieve_data
arguments: label: D75
data_type: string
name: retrieve_data
arguments: label: D117
data_type: string
name: retrieve_data
arguments: label: D114
data_type: string
name: retrieve_data
arguments: label: D80
data_type: string
name: retrieve_data
arguments: label: D177
data_type: string
name: retrieve_data
arguments: label: D103
data_type: string
name: retrieve_data
arguments: label: D101
data_type: string
name: retrieve_data
arguments: label: D61
data_type: string
name: retrieve_data
arguments: label: D84
data_type: string
name: retrieve_data
arguments: label: D189
data_type: string
name: retrieve_data
arguments: label: D71
data_type: string
name: retrieve_data
arguments: label: D14
data_type: string
name: retrieve_data
arguments: label: D148
data_type: string
name: retrieve_data
arguments: label: D5
data_type: string
name: retrieve_data
arguments: label: D124
data_type: string
name: retrieve_data
arguments: label: D102
data_type: string
name: retrieve_data
arguments: label: D145
data_type: string
name: retrieve_data
arguments: label: D67
data_type: string

tool: D23: converting statistics %s


tool: D99: oldest

tool: D164: youngest

tool: D201: most_logins

tool: D31: most_xsent

tool: D132: most_xrecv

tool: D75: most_esent

tool: D117: most_erecv

tool: D114: most_posted

tool: D80: most_read

tool: D177: oldest_birth

tool: D103: youngest_birth

tool: D101: logins

tool: D61: xsent

tool: D84: xrecv

tool: D189: esent

tool: D71: erecv

tool: D14: posted

tool: D148: read

tool: D5: oldest_age

tool: D124: most_fsent

tool: D102: most_frecv

tool: D145: fsent

tool: D67: frecv

assistant: ```c
void convert_statistics(char *filename) {
  FILE *f, *f2;
  printf("converting statistics %s\n", filename);
  if ((f = open_file(filename)) == NULL)
    return;
  if ((f2 = create_file(filename)) == NULL) {
    fclose(f);
    return;
  }
  save_str(f, f2, "oldest");
  save_str(f, f2, "youngest");
  save_str(f, f2, "most_logins");
  save_str(f, f2, "most_xsent");
  save_str(f, f2, "most_xrecv");
  save_str(f, f2, "most_esent");
  save_str(f, f2, "most_erecv");
  save_str(f, f2, "most_posted");
  save_str(f, f2, "most_read");
  save_str(f, f2, "oldest_birth");
  save_str(f, f2, "youngest_birth");
  save_str(f, f2, "logins");
  save_str(f, f2, "xsent");
  save_str(f, f2, "xrecv");
  save_str(f, f2, "esent");
  save_str(f, f2, "erecv");
  save_str(f, f2, "posted");
  save_str(f, f2, "read");
  save_str(f, f2, "oldest_age");
  save_str(f, f2, "most_fsent");
  save_str(f, f2, "most_frecv");
  save_str(f, f2, "fsent");
  save_str(f, f2, "frecv");
  fclose(f);
  fclose(f2);
  rename_file(filename);
}
```