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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0xce8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xcd8(%rsp)
  xor    %eax,%eax
  lea    0x30(%rsp),%rax
  lea    0xc8d(%rsp),%rbp
  mov    %rax,0x8(%rsp)
  mov    %rax,0x10(%rsp)
  lea    0x2c(%rsp),%rax
  mov    %rax,0x18(%rsp)
  nopl   0x0(%rax,%rax,1)
L13:
  lea    D3(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x18(%rsp),%rsi
  lea    D33(%rip),%rdi
  call   <scanf@plt>
  mov    0x2c(%rsp),%edx
  test   %edx,%edx
  je     L120
  lea    D33(%rip),%rsi
  mov    %rbp,%rdi
  lea    0xc90(%rsp),%r14
  call   <sprintf@plt>
  mov    $0x3c,%esi
  mov    %r14,%rdi
  call   <readline@plt>
  test   %ebx,%ebx
  je     L39
  mov    0x8(%rsp),%r8
  xor    %r12d,%r12d
  jmp    L117
  nopl   0x0(%rax)
L23:
  add    $0x1,%r12d
  lea    0x3f(%r13),%r8
  cmp    %ebx,%r12d
  je     L33
L117:
  mov    %r8,%rsi
  mov    %rbp,%rdi
  mov    %r8,%r13
  call   <strcmp@plt>
  test   %rax,%rax
  jns    L23
  cmp    %ebx,%r12d
  jge    L127
  lea    -0x1(%rbx),%eax
  mov    0x10(%rsp),%r15
  sub    %r12d,%eax
  mov    %rax,%rdx
  lea    -0x3f(%r15),%rcx
  shl    $0x6,%rdx
  sub    %rax,%rdx
  sub    %rdx,%rcx
  mov    %rcx,%r12
L87:
  mov    %r15,%rdi
  sub    $0x3f,%r15
  mov    %r15,%rsi
  call   <strcpy@plt>
  cmp    %r12,%r15
  jne    L87
L127:
  mov    %rbp,%rsi
  mov    %r13,%rdi
  add    $0x1,%ebx
  call   <strcpy@plt>
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <strcat@plt>
  addq   $0x3f,0x10(%rsp)
  cmp    $0x32,%ebx
  jne    L13
  lea    D9(%rip),%rdi
  call   <puts@plt>
  lea    D63(%rip),%rdi
  call   <puts@plt>
  jmp    L104
  cs nopw 0x0(%rax,%rax,1)
L33:
  movslq %ebx,%rax
  mov    %rax,%r8
  shl    $0x6,%r8
  sub    %rax,%r8
  mov    0x8(%rsp),%rax
  lea    (%rax,%r8,1),%r13
  jmp    L127
L120:
  lea    D63(%rip),%rdi
  call   <puts@plt>
  test   %ebx,%ebx
  je     L31
L104:
  xor    %r12d,%r12d
  lea    D8(%rip),%rbp
  nopw   0x0(%rax,%rax,1)
L78:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  shl    $0x6,%rsi
  sub    %r12,%rsi
  add    $0x1,%r12
  add    0x8(%rsp),%rsi
  call   <printf@plt>
  cmp    %r12d,%ebx
  jg     L78
L31:
  mov    0xcd8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L26
  add    $0xce8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L39:
  mov    0x8(%rsp),%r13
  jmp    L127
L26:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D3
type: string
name: retrieve_data
arguments: label: D33
type: string
name: retrieve_data
arguments: label: D9
type: string
name: retrieve_data
arguments: label: D63
type: string
name: retrieve_data
arguments: label: D8
type: string

tool: D3: Enter day and reminder: 

tool: D33: %2d

tool: D9: -- No space left --

tool: D63: 
Day reminder

tool: D8:  %s


assistant: ```c
int main(void) {
  char reminders[50][60 + 3];
  char day_str[3], msg_str[60 + 1];
  int day, i, j, num_remind = 0;
  for (;;) {
    if (num_remind == 50) {
      printf("-- No space left --\n");
      break;
    }
    printf("Enter day and reminder: ");
    scanf("%2d", &day);
    if (day == 0)
      break;
    sprintf(day_str, "%2d", day);
    readline(msg_str, 60);
    for (i = 0; i < num_remind; i++)
      if (strcmp(day_str, reminders[i]) < 0)
        break;
    for (j = num_remind; j > i; j--)
      strcpy(reminders[j], reminders[j - 1]);
    strcpy(reminders[i], day_str);
    strcat(reminders[i], msg_str);
    num_remind++;
  }
  printf("\nDay reminder\n");
  for (i = 0; i < num_remind; i++) {
    printf(" %s\n", reminders[i]);
  }
  return 0;
}
```