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

```asm
<main>:
  endbr64
  push   %r15
  lea    D57(%rip),%rsi
  lea    D30(%rip),%rdi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  movl   $0x1f,0x30(%rsp)
  movabs $0x1e0000001f,%rax
  mov    %rax,0x38(%rsp)
  mov    %rax,0x40(%rsp)
  movabs $0x1f0000001f,%rax
  mov    %rax,0x48(%rsp)
  sub    $0x1,%rax
  mov    %rax,0x50(%rsp)
  mov    %rax,0x58(%rsp)
  call   <fopen@plt>
  lea    D22(%rip),%rsi
  lea    D26(%rip),%rdi
  mov    %rax,%rbp
  call   <fopen@plt>
  lea    0xc(%rsp),%rdx
  lea    D34(%rip),%rsi
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <fscanf@plt>
  mov    0xc(%rsp),%eax
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  lea    0x76b(%rax),%r11d
  movl   $0x0,0x28(%rsp)
  movq   $0x0,0x20(%rsp)
  cmp    $0x76b,%r11d
  jle    L92
  mov    $0x76c,%edi
  xor    %r9d,%r9d
  mov    $0x1,%esi
  xor    %ecx,%ecx
  jmp    L30
  nopw   0x0(%rax,%rax,1)
L136:
  movslq %ecx,%r8
  add    $0x1,%ecx
L42:
  imul   $0xc28f5c29,%edi,%edx
  mov    $0x1d,%eax
  mov    %edx,%r10d
  ror    $0x4,%r10d
  cmp    $0xa3d70a,%r10d
  jbe    L59
  ror    $0x2,%edx
  mov    $0x1c,%eax
  cmp    $0x28f5c28,%edx
  jbe    L59
  mov    %edi,%eax
  and    $0x3,%eax
  cmp    $0x1,%eax
  mov    $0x1c,%eax
  adc    $0x0,%eax
L59:
  mov    %eax,0x34(%rsp)
  movslq %r9d,%rax
  cmp    %esi,0x30(%rsp,%rax,4)
  je     L68
  add    $0x1,%esi
  cmp    $0xd,%esi
  jne    L115
  addl   $0x1,0x10(%rsp,%r8,4)
L115:
  cmp    %r11d,%edi
  jg     L92
L30:
  cmp    $0x7,%ecx
  jne    L136
  mov    $0x1,%ecx
  xor    %r8d,%r8d
  jmp    L42
L68:
  add    $0x1,%r9d
  mov    $0x1,%esi
  cmp    $0xc,%r9d
  jne    L115
  add    $0x1,%edi
  xor    %r9d,%r9d
  cmp    %r11d,%edi
  jle    L30
  nopw   0x0(%rax,%rax,1)
L92:
  lea    0x10(%rsp),%rbx
  lea    0x1c(%rsp),%r15
  mov    %rbx,%r13
  lea    D64(%rip),%r14
L128:
  mov    0x10(%r13),%edx
  mov    %r14,%rsi
  mov    %r12,%rdi
  add    $0x4,%r13
  call   <fprintf@plt>
  cmp    %r13,%r15
  jne    L128
L3:
  mov    (%rbx),%edx
  mov    %r14,%rsi
  mov    %r12,%rdi
  add    $0x4,%rbx
  call   <fprintf@plt>
  cmp    %r15,%rbx
  jne    L3
  mov    0x1c(%rsp),%edx
  lea    D41(%rip),%rsi
  mov    %r12,%rdi
  call   <fprintf@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L107
  add    $0x78,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L107:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D57
data_type: string
name: unpack_data
arguments: data_label: D30
data_type: string
name: unpack_data
arguments: data_label: D22
data_type: string
name: unpack_data
arguments: data_label: D26
data_type: string
name: unpack_data
arguments: data_label: D34
data_type: string
name: unpack_data
arguments: data_label: D64
data_type: string
name: unpack_data
arguments: data_label: D41
data_type: string

tool: D57: r

tool: D30: friday.in

tool: D22: w

tool: D26: friday.out

tool: D34: %d

tool: D64: %d 

tool: D41: %d


assistant: ```c
int main(void) {
  int d = 0, date = 1, month = 0, year = 1900, np, i;
  int array[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int final[7];
  FILE *fin, *fout;
  fin = fopen("friday.in", "r");
  fout = fopen("friday.out", "w");
  fscanf(fin, "%d", &np);
  for (i = 0; i < 7; i++)
    final[i] = 0;
  while (year < 1900 + np) {
    if (d == 7)
      d = 0;
    if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)) {
      array[1] = 29;
    } else {
      array[1] = 28;
    }
    if (date == array[month]) {
      date = 1;
      month++;
      if (month == 12) {
        month = 0;
        year++;
      }
    } else {
      date++;
    }
    if (date == 13) {
      final[d] += 1;
    }
    d++;
  }
  for (i = 4; i < 7; i++) {
    fprintf(fout, "%d ", final[i]);
  }
  for (i = 0; i < 3; i++) {
    fprintf(fout, "%d ", final[i]);
  }
  fprintf(fout, "%d\n", final[3]);
  fclose(fin);
  fclose(fout);
}
```