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

```asm
<main>:
  endbr64
  push   %r15
  xor    %edi,%edi
  push   %r14
  lea    D1(%rip),%r14
  push   %r13
  lea    D3(%rip),%r13
  push   %r12
  lea    D24(%rip),%r12
  push   %rbp
  push   %rbx
  mov    $0x186a0,%ebx
  sub    $0x898,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x888(%rsp)
  xor    %eax,%eax
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  xchg   %ax,%ax
L1:
  xor    %eax,%eax
  call   <rand@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  movslq %eax,%rcx
  cltd
  imul   $0x7fc01ff1,%rcx,%rcx
  sar    $0x28,%rcx
  sub    %edx,%ecx
  mov    %ecx,%edx
  shl    $0x9,%edx
  add    %edx,%ecx
  mov    %eax,%edx
  sub    %ecx,%edx
  call   <fprintf@plt>
  sub    $0x1,%ebx
  jne    L1
  mov    %rbp,%rdi
  lea    0x820(%rsp),%rbx
  call   <fclose@plt>
  mov    %r14,%rdi
  lea    D10(%rip),%rsi
  call   <fopen@plt>
  lea    0x10(%rsp),%rdi
  mov    $0x100,%ecx
  mov    %rax,%rbp
  xor    %eax,%eax
  mov    %rdi,0x8(%rsp)
  rep stos %rax,%es:(%rdi)
  movl   $0x0,(%rdi)
L49:
  mov    %rbp,%rdi
  call   <feof@plt>
  test   %eax,%eax
  jne    L61
L60:
  pxor   %xmm0,%xmm0
  mov    %rbp,%rdx
  mov    $0x64,%esi
  mov    %rbx,%rdi
  movl   $0x0,0x880(%rsp)
  movaps %xmm0,0x820(%rsp)
  movaps %xmm0,0x830(%rsp)
  movaps %xmm0,0x840(%rsp)
  movaps %xmm0,0x850(%rsp)
  movaps %xmm0,0x860(%rsp)
  movaps %xmm0,0x870(%rsp)
  call   <fgets@plt>
  cmpb   $0x0,0x820(%rsp)
  je     L49
  mov    %rbx,%rdi
  call   <atoi@plt>
  mov    %rbp,%rdi
  cltq
  addl   $0x1,0x10(%rsp,%rax,4)
  call   <feof@plt>
  test   %eax,%eax
  je     L60
L61:
  mov    %rbp,%rdi
  xor    %r15d,%r15d
  call   <fclose@plt>
  mov    %r13,%rsi
  lea    D32(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r14
  nopl   0x0(%rax)
L10:
  mov    0x8(%rsp),%rax
  mov    %r15d,%r13d
  xor    %ebx,%ebx
  mov    (%rax,%r15,4),%ebp
  test   %ebp,%ebp
  jle    L35
  nopw   0x0(%rax,%rax,1)
L2:
  mov    %r13d,%edx
  mov    %r12,%rsi
  mov    %r14,%rdi
  add    $0x1,%ebx
  call   <fprintf@plt>
  cmp    %ebx,%ebp
  jne    L2
L35:
  add    $0x1,%r15
  cmp    $0x201,%r15
  jne    L10
  mov    %r14,%rdi
  call   <fclose@plt>
  lea    D34(%rip),%rdi
  call   <printf@plt>
  mov    0x888(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  add    $0x898,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D1
type_infered: string
name: extract_symbolic_data
arguments: data_label: D3
type_infered: string
name: extract_symbolic_data
arguments: data_label: D24
type_infered: string
name: extract_symbolic_data
arguments: data_label: D10
type_infered: string
name: extract_symbolic_data
arguments: data_label: D32
type_infered: string
name: extract_symbolic_data
arguments: data_label: D34
type_infered: string

tool: D1: D:\temp\a.txt

tool: D3: w

tool: D24: %d


tool: D10: r

tool: D32: D:\temp\b.txt

tool: D34: end


assistant: ```c
int main(void) {
  srand((unsigned int)time(NULL));
  int i;
  FILE *p = fopen("D:\\temp\\a.txt", "w");
  for (i = 0; i < 100000; i++) {
    fprintf(p, "%d\n", (int)rand() % 513);
  }
  fclose(p);
  p = fopen("D:\\temp\\a.txt", "r");
  int array[513] = {0};
  while (!feof(p)) {
    char buf[100] = {0};
    fgets(buf, sizeof(buf), p);
    if (buf[0] != 0) {
      int value = atoi(buf);
      array[value]++;
    }
  }
  fclose(p);
  p = fopen("D:\\temp\\b.txt", "w");
  int j;
  for (i = 0; i < 513; i++) {
    for (j = 0; j < array[i]; j++) {
      fprintf(p, "%d\n", i);
    }
  }
  fclose(p);
  printf("end\n");
  return 0;
}
```