user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r15
  lea    D34(%rip),%rsi
  lea    D46(%rip),%rdi
  push   %r14
  lea    D1(%rip),%r14
  push   %r13
  push   %r12
  push   %rbp
  mov    $0x76c,%ebp
  push   %rbx
  sub    $0x58,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  lea    0x20(%rsp),%r13
  call   <fopen@plt>
  lea    D38(%rip),%rsi
  lea    D32(%rip),%rdi
  mov    %rax,%rbx
  mov    %rax,0x8(%rsp)
  call   <fopen@plt>
  test   %rbx,%rbx
  mov    %rax,%r12
  setne  %al
  xor    %edi,%edi
  test   %r12,%r12
  setne  %dil
  and    %eax,%edi
  call   <assert@plt>
  mov    %rbx,%rdi
  lea    0x1c(%rsp),%rdx
  mov    %r14,%rsi
  call   <fscanf@plt>
  mov    $0x1c,%edx
  xor    %esi,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  mov    0x1c(%rsp),%eax
  xor    %ebx,%ebx
  test   %eax,%eax
  jle    L30
  nopl   0x0(%rax,%rax,1)
L36:
  xor    %r15d,%r15d
  nopl   0x0(%rax,%rax,1)
L60:
  movslq %ebx,%rax
  mov    %r15d,%esi
  mov    %ebp,%edi
  add    $0x1,%r15d
  addl   $0x1,0x20(%rsp,%rax,4)
  call   <month_len@plt>
  add    %ebx,%eax
  movslq %eax,%rbx
  mov    %eax,%ecx
  imul   $0xffffffff92492493,%rbx,%rbx
  sar    $0x1f,%ecx
  shr    $0x20,%rbx
  add    %eax,%ebx
  sar    $0x2,%ebx
  sub    %ecx,%ebx
  lea    0x0(,%rbx,8),%ecx
  sub    %ebx,%ecx
  sub    %ecx,%eax
  mov    %eax,%ebx
  cmp    $0xc,%r15d
  jne    L60
  mov    0x1c(%rsp),%eax
  add    $0x1,%ebp
  add    $0x76b,%eax
  cmp    %ebp,%eax
  jge    L36
L30:
  xor    %ebx,%ebx
  jmp    L33
  nopl   0x0(%rax)
L52:
  mov    0x0(%r13),%edx
  mov    %r14,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
L37:
  add    $0x1,%rbx
L33:
  test   %rbx,%rbx
  je     L52
  mov    %r12,%rsi
  mov    $0x20,%edi
  call   <fputc@plt>
  mov    0x0(%r13,%rbx,4),%edx
  xor    %eax,%eax
  mov    %r14,%rsi
  mov    %r12,%rdi
  call   <fprintf@plt>
  cmp    $0x6,%rbx
  jne    L37
  mov    %r12,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  mov    0x8(%rsp),%rdi
  call   <fclose@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L54
  add    $0x58,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L54:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D34
type: string
name: retrieve_data
arguments: data_tag: D46
type: string
name: retrieve_data
arguments: data_tag: D1
type: string
name: retrieve_data
arguments: data_tag: D38
type: string
name: retrieve_data
arguments: data_tag: D32
type: string

tool: D34: r

tool: D46: friday.in

tool: D1: %d

tool: D38: w

tool: D32: friday.out

assistant: ```c
int main(void) {
  FILE *fin;
  FILE *fout;
  int i;
  int m;
  int day_of_week;
  int N;
  int y;
  int day_of_week_numbers[7];
  fin = fopen("friday.in", "r");
  fout = fopen("friday.out", "w");
  assert(fin != NULL && fout != NULL);
  fscanf(fin, "%d", &N);
  memset(day_of_week_numbers, 0, sizeof(day_of_week_numbers));
  day_of_week = 0;
  for (y = 1900; y < 1900 + N; ++y) {
    for (m = 0; m < 12; ++m) {
      ++day_of_week_numbers[day_of_week];
      day_of_week = (day_of_week + month_len(y, m)) % 7;
    }
  }
  for (i = 0; i < 7; ++i) {
    if (i) {
      fprintf(fout, " ");
    }
    fprintf(fout, "%d", day_of_week_numbers[i]);
  }
  fprintf(fout, "\n");
  fclose(fin);
  fclose(fout);
  return 0;
}
```