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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0xf6000(%rsp),%r11
L78:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L78
  sub    $0x1e8,%rsp
  lea    D13(%rip),%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0xf61d8(%rsp)
  xor    %eax,%eax
  lea    0x24(%rsp),%rax
  lea    0xff0(%rsp),%r14
  mov    %rax,0x18(%rsp)
  lea    0x20(%rsp),%rax
  lea    0xff4(%rsp),%r13
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax)
L155:
  mov    0x18(%rsp),%rdx
  mov    0x10(%rsp),%rsi
  mov    %rbx,%rdi
  call   <scanf@plt>
  movslq 0x20(%rsp),%rax
  mov    0x24(%rsp),%r8d
  test   %eax,%eax
  jne    L79
  test   %r8d,%r8d
  je     L92
L146:
  xor    %r15d,%r15d
  lea    0x2c(%rsp),%r12
  lea    0x28(%rsp),%rbp
  test   %r8d,%r8d
  jle    L86
  nop
L59:
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  add    $0x1,%r15d
  call   <scanf@plt>
  movslq 0x28(%rsp),%rsi
  movslq 0x2c(%rsp),%rax
  imul   $0x1f5,%rsi,%rdi
  movslq 0x30(%rsp,%rsi,4),%r9
  mov    %r9,%rdx
  add    %r9,%rdi
  movslq 0x30(%rsp,%rax,4),%r9
  add    $0x1,%edx
  mov    %eax,0xff0(%rsp,%rdi,4)
  imul   $0x1f5,%rax,%rdi
  mov    %edx,0x30(%rsp,%rsi,4)
  addl   $0x1,0x30(%rsp,%rax,4)
  add    %r9,%rdi
  mov    %esi,0xff0(%rsp,%rdi,4)
  cmp    %r15d,0x24(%rsp)
  jg     L59
L86:
  movl   $0x1,0x814(%rsp)
  mov    0x34(%rsp),%esi
  test   %esi,%esi
  jle    L23
  lea    -0x1(%rsi),%eax
  lea    0x17c4(%rsp),%rdi
  lea    0x17c8(%rsp,%rax,4),%r8
  mov    %rdi,%rax
  nopl   0x0(%rax,%rax,1)
L1:
  movslq (%rax),%rdx
  add    $0x4,%rax
  movl   $0x1,0x810(%rsp,%rdx,4)
  cmp    %r8,%rax
  jne    L1
  nopw   0x0(%rax,%rax,1)
L67:
  movslq (%rdi),%rdx
  mov    0x30(%rsp,%rdx,4),%ecx
  test   %ecx,%ecx
  jle    L105
  imul   $0x7d4,%rdx,%rax
  sub    $0x1,%ecx
  imul   $0x1f5,%rdx,%rdx
  add    %r14,%rax
  add    %rcx,%rdx
  lea    0x0(%r13,%rdx,4),%rcx
  nopw   0x0(%rax,%rax,1)
L71:
  movslq (%rax),%rdx
  mov    0x810(%rsp,%rdx,4),%r9d
  test   %r9d,%r9d
  jne    L73
  movl   $0x1,0x810(%rsp,%rdx,4)
  add    $0x1,%esi
L73:
  add    $0x4,%rax
  cmp    %rax,%rcx
  jne    L71
L105:
  add    $0x4,%rdi
  cmp    %r8,%rdi
  jne    L67
  lea    D8(%rip),%rdi
  call   <printf@plt>
  jmp    L155
L79:
  jle    L146
  lea    0x0(,%rax,4),%r12
  lea    0x34(%rsp),%rdi
  xor    %esi,%esi
  mov    %r8d,0xc(%rsp)
  mov    %r12,%rdx
  call   <memset@plt>
  lea    0x814(%rsp),%rdi
  mov    %r12,%rdx
  xor    %esi,%esi
  call   <memset@plt>
  mov    0xc(%rsp),%r8d
  jmp    L146
L23:
  xor    %esi,%esi
  lea    D8(%rip),%rdi
  call   <printf@plt>
  jmp    L155
L92:
  mov    0xf61d8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L85
  add    $0xf61e8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L85:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D13
type_guessed: string
name: read_data
arguments: label: D8
type_guessed: string

tool: D13: %d %d

tool: D8: %d


assistant: ```c
int main(void) {
  int n, m, student[501][501], i, j, t1, t2, lp[501], check[501], count;
  while (1) {
    scanf("%d %d", &n, &m);
    if (n == 0 && m == 0)
      break;
    count = 0;
    for (i = 1; i <= n; i++)
      lp[i] = 0, check[i] = 0;
    for (i = 0; i < m; i++) {
      scanf("%d %d", &t1, &t2);
      student[t1][lp[t1]] = t2;
      student[t2][lp[t2]] = t1;
      lp[t1]++;
      lp[t2]++;
    }
    check[1] = 1;
    for (i = 0; i < lp[1]; i++) {
      count++;
      check[student[1][i]] = 1;
    }
    for (i = 0; i < lp[1]; i++) {
      for (j = 0; j < lp[student[1][i]]; j++) {
        if (check[student[student[1][i]][j]] == 0) {
          check[student[student[1][i]][j]] = 1;
          count++;
        }
      }
    }
    printf("%d\n", count);
  }
  return 0;
}
```