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

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x548,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x538(%rsp)
  xor    %eax,%eax
  lea    0x330(%rsp),%rdi
  mov    $0x64,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  lea    0x8(%rsp),%rsi
  lea    D24(%rip),%rdi
  call   <scanf@plt>
  lea    0x3a0(%rsp),%rbx
  mov    %rbx,%rdi
  call   <gets@plt>
  lea    D30(%rip),%rsi
  mov    %rbx,%rdi
  call   <strtok@plt>
  mov    %rax,%rbx
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,0x10(%rsp)
  test   %rbx,%rbx
  je     L24
  lea    0x14(%rsp),%rbx
  lea    D30(%rip),%rbp
L78:
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  test   %rax,%rax
  je     L24
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,(%rbx)
  add    $0x4,%rbx
  jmp    L78
L24:
  lea    0xc(%rsp),%rsi
  lea    D24(%rip),%rdi
  call   <scanf@plt>
  lea    0x3a0(%rsp),%rbx
  mov    %rbx,%rdi
  call   <gets@plt>
  lea    D30(%rip),%rsi
  mov    %rbx,%rdi
  call   <strtok@plt>
  mov    %rax,%rbx
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,0x1a0(%rsp)
  test   %rbx,%rbx
  je     L146
  lea    0x1a4(%rsp),%rbx
  lea    D30(%rip),%rbp
L30:
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  test   %rax,%rax
  je     L146
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,(%rbx)
  add    $0x4,%rbx
  jmp    L30
L146:
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  jle    L64
  mov    0x8(%rsp),%r9d
  lea    0x330(%rsp),%rsi
  lea    0x1a0(%rsp),%rdi
  lea    -0x1(%rax),%eax
  lea    0x331(%rsp,%rax,1),%r10
  lea    0x10(%rsp),%r11
  lea    -0x1(%r9),%eax
  lea    0x14(%rsp,%rax,4),%rcx
  mov    $0x0,%r8d
  jmp    L10
L59:
  add    $0x4,%rax
  cmp    %rax,%rcx
  je     L114
L35:
  cmp    (%rax),%edx
  jne    L59
  cmpb   $0x0,(%rsi)
  jne    L59
  add    $0x1,%r8d
  movb   $0x1,(%rsi)
  jmp    L59
L114:
  add    $0x1,%rsi
  add    $0x4,%rdi
  cmp    %rsi,%r10
  je     L84
L10:
  test   %r9d,%r9d
  jle    L114
  mov    (%rdi),%edx
  mov    %r11,%rax
  jmp    L35
L64:
  mov    $0x0,%r8d
L84:
  mov    %r8d,%esi
  lea    D24(%rip),%rdi
  call   <printf@plt>
  mov    0x538(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L67
  mov    $0x0,%eax
  add    $0x548,%rsp
  pop    %rbx
  pop    %rbp
  ret
L67:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D24
datatype: string
name: extract_symbolic_data
arguments: data_tag: D30
datatype: string

tool: D24: %d


tool: D30:  

assistant: ```c
int main() {
  int S[100], T[100];
  char checked[100];
  int n, q;
  int i = 0;
  int j;
  int c = 0;
  char input[400];
  char *p;
  memset(checked, 0, sizeof(checked));
  scanf("%d\n", &n);
  gets(input);
  p = strtok(input, " ");
  S[0] = atoi(p);
  while (p != NULL) {
    p = strtok(NULL, " ");
    if (p != NULL) {
      i++;
      S[i] = atoi(p);
    }
  }
  scanf("%d\n", &q);
  gets(input);
  i = 0;
  p = strtok(input, " ");
  T[0] = atoi(p);
  while (p != NULL) {
    p = strtok(NULL, " ");
    if (p != NULL) {
      i++;
      T[i] = atoi(p);
    }
  }
  for (i = 0; i < q; i++) {
    for (j = 0; j < n; j++) {
      if (T[i] == S[j] && checked[i] == 0) {
        c++;
        checked[i] = 1;
      }
    }
  }
  printf("%d\n", c);
  return 0;
}
```