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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x100,%rsp
  mov    %edi,-0xf4(%rbp)
  mov    %rsi,-0x100(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0xe4(%rbp),%rax
  mov    %rax,%rdi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    -0x100(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0xc4(%rbp)
  mov    -0x100(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0xc0(%rbp)
  lea    -0x90(%rbp),%rcx
  mov    -0xc0(%rbp),%eax
  mov    $0x40,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  lea    -0xe0(%rbp),%rdx
  lea    -0x90(%rbp),%rax
  lea    D29(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  mov    -0xe0(%rbp),%edx
  lea    -0x50(%rbp),%rax
  mov    %edx,%ecx
  lea    D58(%rip),%rdx
  lea    D66(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x50(%rbp),%rax
  lea    D9(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    %eax,%edx
  lea    D17(%rip),%rax
  mov    %rax,%rsi
  mov    %edx,%edi
  call   <fopen@plt>
  mov    %rax,-0xb8(%rbp)
  lea    -0xb0(%rbp),%rax
  lea    0xc(%rax),%r8
  lea    -0xb0(%rbp),%rax
  lea    0x8(%rax),%rdi
  lea    -0xb0(%rbp),%rax
  lea    0x4(%rax),%rcx
  lea    -0xb0(%rbp),%rdx
  mov    -0xb8(%rbp),%rax
  sub    $0x8,%rsp
  lea    -0xb0(%rbp),%rsi
  add    $0x10,%rsi
  push   %rsi
  mov    %r8,%r9
  mov    %rdi,%r8
  lea    D97(%rip),%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  add    $0x10,%rsp
  mov    -0x100(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0xbc(%rbp)
  lea    -0x90(%rbp),%rax
  mov    $0x40,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    -0x90(%rbp),%rax
  mov    $0xde,%edx
  lea    D29(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x90(%rbp),%rcx
  mov    -0xbc(%rbp),%eax
  mov    $0x40,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  movl   $0x0,-0xd0(%rbp)
  movl   $0x0,-0xcc(%rbp)
L231:
  lea    -0x90(%rbp),%rax
  mov    $0x40,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    -0x90(%rbp),%rcx
  mov    -0xc0(%rbp),%eax
  mov    $0x40,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  lea    -0xe8(%rbp),%rdx
  lea    -0x90(%rbp),%rax
  lea    D29(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  mov    -0xe8(%rbp),%eax
  cmp    $0x6f,%eax
  jne    L15
  movl   $0x0,-0xcc(%rbp)
  movl   $0x0,-0xd4(%rbp)
  jmp    L160
L190:
  mov    -0xd4(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%eax
  test   %eax,%eax
  jle    L174
  addl   $0x1,-0xcc(%rbp)
L174:
  addl   $0x1,-0xd4(%rbp)
L160:
  cmpl   $0x4,-0xd4(%rbp)
  jle    L190
  cmpl   $0x0,-0xcc(%rbp)
  jne    L137
  lea    -0x90(%rbp),%rax
  mov    $0xffffffff,%edx
  lea    D29(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x90(%rbp),%rcx
  mov    -0xbc(%rbp),%eax
  mov    $0x40,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  jmp    L231
L137:
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  idivl  -0xcc(%rbp)
  mov    %edx,-0xc8(%rbp)
  movl   $0x0,-0xd4(%rbp)
  jmp    L150
L58:
  mov    -0xd4(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%eax
  test   %eax,%eax
  jle    L170
  cmpl   $0x0,-0xc8(%rbp)
  jne    L170
  mov    -0xd4(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%edx
  lea    -0x90(%rbp),%rax
  lea    D29(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x90(%rbp),%rcx
  mov    -0xbc(%rbp),%eax
  mov    $0x40,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  jmp    L144
L170:
  mov    -0xd4(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%eax
  test   %eax,%eax
  jle    L171
  subl   $0x1,-0xc8(%rbp)
L171:
  addl   $0x1,-0xd4(%rbp)
L150:
  cmpl   $0x4,-0xd4(%rbp)
  jle    L58
  jmp    L231
L15:
  mov    -0xe8(%rbp),%eax
  cmp    $0x29a,%eax
  jne    L231
  lea    -0x90(%rbp),%rcx
  mov    -0xc0(%rbp),%eax
  mov    $0x40,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  lea    -0xdc(%rbp),%rdx
  lea    -0x90(%rbp),%rax
  lea    D29(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  movl   $0x0,-0xd0(%rbp)
  movl   $0x0,-0xd4(%rbp)
  jmp    L89
L226:
  mov    -0xd4(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%edx
  mov    -0xdc(%rbp),%eax
  cmp    %eax,%edx
  jle    L202
  addl   $0x1,-0xd0(%rbp)
L202:
  addl   $0x1,-0xd4(%rbp)
L89:
  cmpl   $0x4,-0xd4(%rbp)
  jle    L226
  lea    -0x90(%rbp),%rax
  mov    $0x40,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0xd0(%rbp),%edx
  lea    -0x90(%rbp),%rax
  lea    D29(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x90(%rbp),%rcx
  mov    -0xbc(%rbp),%eax
  mov    $0x40,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  lea    -0x90(%rbp),%rcx
  mov    -0xc0(%rbp),%eax
  mov    $0x40,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  lea    -0xd8(%rbp),%rdx
  lea    -0x90(%rbp),%rax
  lea    D29(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  mov    -0xd8(%rbp),%eax
  cmp    $0x14d,%eax
  jne    L126
  movl   $0x0,-0xd4(%rbp)
  jmp    L223
L75:
  mov    -0xd4(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%edx
  mov    -0xdc(%rbp),%eax
  cmp    %eax,%edx
  jge    L18
  mov    -0xd4(%rbp),%eax
  cltq
  movl   $0xffffffff,-0xb0(%rbp,%rax,4)
L18:
  addl   $0x1,-0xd4(%rbp)
L223:
  cmpl   $0x4,-0xd4(%rbp)
  jle    L75
L126:
  mov    -0xd8(%rbp),%eax
  cmp    $0x1bc,%eax
  jne    L51
  movl   $0x0,-0xd4(%rbp)
  jmp    L16
L237:
  mov    -0xd4(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%edx
  mov    -0xdc(%rbp),%eax
  cmp    %eax,%edx
  jle    L159
  mov    -0xd4(%rbp),%eax
  cltq
  movl   $0xffffffff,-0xb0(%rbp,%rax,4)
L159:
  addl   $0x1,-0xd4(%rbp)
L16:
  cmpl   $0x4,-0xd4(%rbp)
  jle    L237
L51:
  mov    -0xd8(%rbp),%eax
  cmp    $0x22b,%eax
  je     L117
L144:
  jmp    L231
L117:
  nop
  mov    -0xb8(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L74
  call   <__stack_chk_fail@plt>
L74:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D29
type_guessed: string
name: parse_data
arguments: data_label: D58
type_guessed: string
name: parse_data
arguments: data_label: D66
type_guessed: string
name: parse_data
arguments: data_label: D9
type_guessed: string
name: parse_data
arguments: data_label: D17
type_guessed: string
name: parse_data
arguments: data_label: D97
type_guessed: string

tool: D29: %d

tool: D58: data

tool: D66: %s%d

tool: D9: .txt

tool: D17: r

tool: D97: %d %d %d %d %d

assistant: ```c
int main(int argc, char *argv[]) {
  char msg[64];
  int n, i;
  time_t t;
  srand((unsigned)time(&t));
  int temp = atoi(argv[1]);
  int fd = atoi(argv[2]);
  int n3;
  read(fd, msg, 64);
  sscanf(msg, "%d", &n3);
  char txt_file[64];
  sprintf(txt_file, "%s%d", "data", n3);
  FILE *in = fopen(strcat(txt_file, ".txt"), "r");
  int input_num[5];
  fscanf(in, "%d %d %d %d %d", &input_num[0], &input_num[1], &input_num[2], &input_num[3], &input_num[4]);
  int fd1 = atoi(argv[3]);
  memset(&msg[0], 0, sizeof(msg));
  sprintf(msg, "%d", 222);
  write(fd1, msg, 64);
  int n1, n2;
  int count = 0, num_n = 0;
  while (1) {
    memset(&msg[0], 0, sizeof(msg));
    read(fd, msg, 64);
    sscanf(msg, "%d", &n);
    if (n == 111) {
      num_n = 0;
      for (i = 0; i < 5; i++) {
        if (input_num[i] > 0)
          num_n++;
      }
      if (num_n == 0) {
        sprintf(msg, "%d", -1);
        write(fd1, msg, 64);
      } else {
        int rnd_n = rand() % num_n;
        for (i = 0; i < 5; i++) {
          if (input_num[i] > 0 && rnd_n == 0) {
            sprintf(msg, "%d", input_num[i]);
            write(fd1, msg, 64);
            break;
          } else if (input_num[i] > 0)
            rnd_n--;
        }
      }
    } else if (n == 666) {
      read(fd, msg, 64);
      sscanf(msg, "%d", &n1);
      count = 0;
      for (i = 0; i < 5; i++) {
        if (input_num[i] > n1)
          count++;
      }
      memset(&msg[0], 0, sizeof(msg));
      sprintf(msg, "%d", count);
      write(fd1, msg, 64);
      read(fd, msg, 64);
      sscanf(msg, "%d", &n2);
      if (n2 == 333) {
        for (i = 0; i < 5; i++) {
          if (input_num[i] < n1)
            input_num[i] = -1;
        }
      }
      if (n2 == 444) {
        for (i = 0; i < 5; i++) {
          if (input_num[i] > n1)
            input_num[i] = -1;
        }
      }
      if (n2 == 555) {
        break;
      }
    }
  }
  fclose(in);
}
```