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

```asm
<pregame_refresh>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %esi,-0x4c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    $0x0,%eax
  call   <io_clearscreen@plt>
  movl   $0x0,-0x3c(%rbp)
  movl   $0x1c,-0x34(%rbp)
  mov    -0x3c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x3c(%rbp)
  mov    -0x34(%rbp),%edx
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <io_printborder@plt>
  cmpl   $0x0,-0x4c(%rbp)
  jne    L18
  mov    $0x2a,%ecx
  jmp    L31
L18:
  mov    $0x20,%ecx
L31:
  mov    -0x48(%rbp),%rax
  add    $0x1c,%rax
  mov    (%rax),%eax
  movsbl %al,%edx
  lea    -0x30(%rbp),%rax
  lea    D12(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x30(%rbp),%rcx
  mov    -0x34(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <io_printtext@plt>
  mov    %eax,-0x3c(%rbp)
  movl   $0x0,-0x38(%rbp)
  jmp    L65
L3:
  mov    -0x38(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x4c(%rbp)
  jne    L103
  mov    $0x2a,%ecx
  jmp    L81
L103:
  mov    $0x20,%ecx
L81:
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  jne    L76
  lea    D42(%rip),%rax
  jmp    L88
L76:
  lea    D38(%rip),%rax
L88:
  mov    -0x38(%rbp),%edx
  add    $0x1,%edx
  movsbl %dl,%edx
  lea    -0x30(%rbp),%rdi
  mov    %ecx,%r8d
  mov    %rax,%rcx
  lea    D14(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x30(%rbp),%rcx
  mov    -0x34(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <io_printtext@plt>
  mov    %eax,-0x3c(%rbp)
  addl   $0x1,-0x38(%rbp)
L65:
  mov    -0x48(%rbp),%rax
  add    $0x1c,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x38(%rbp)
  jl     L3
  mov    -0x48(%rbp),%rax
  add    $0x1c,%rax
  mov    (%rax),%eax
  add    $0x1,%eax
  cmp    %eax,-0x4c(%rbp)
  jne    L94
  mov    $0x2a,%edx
  jmp    L96
L94:
  mov    $0x20,%edx
L96:
  lea    -0x30(%rbp),%rax
  lea    D29(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x30(%rbp),%rcx
  mov    -0x34(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <io_printtext@plt>
  mov    %eax,-0x3c(%rbp)
  mov    -0x3c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x3c(%rbp)
  mov    -0x34(%rbp),%edx
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <io_printborder@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L71
  call   <__stack_chk_fail@plt>
L71:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D12
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D42
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D38
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D14
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D29
type_guessed: string

tool: D12: Number of players: %d  %c

tool: D42: ai   

tool: D38: human

tool: D14: Player %d is: %s    %c

tool: D29: Play                  %c

assistant: ```c
void pregame_refresh(int *data, int cursor) {
  io_clearscreen();
  int y = 0;
  int width = 28;
  io_printborder(0, y++, width);
  char s[40];
  sprintf(s, "Number of players: %d  %c", data[7], (cursor == 0) ? '*' : ' ');
  y = io_printtext(0, y, width, s);
  int i;
  for (i = 0; i < data[7]; i++) {
    sprintf(s, "Player %d is: %s    %c", i + 1, (data[i] == 1) ? "ai   " : "human", (cursor == i + 1) ? '*' : ' ');
    y = io_printtext(0, y, width, s);
  }
  sprintf(s, "Play                  %c", (cursor == data[7] + 1) ? '*' : ' ');
  y = io_printtext(0, y, width, s);
  io_printborder(0, y++, width);
}
```