user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    -0x70(%rbp),%rax
  mov    %rax,%rsi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  jmp    L50
L162:
  mov    %rsp,%rax
  mov    %rax,%rbx
  movl   $0x0,-0x68(%rbp)
  lea    -0x6c(%rbp),%rax
  mov    %rax,%rsi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x6c(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x58(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  movslq %eax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L166:
  cmp    %rdx,%rsp
  je     L106
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L166
L106:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L146
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L146:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x50(%rbp)
  mov    -0x6c(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x48(%rbp)
  movslq %eax,%rdx
  mov    %rdx,-0x80(%rbp)
  movq   $0x0,-0x78(%rbp)
  movslq %eax,%rdx
  mov    %rdx,-0x90(%rbp)
  movq   $0x0,-0x88(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L116:
  cmp    %rdx,%rsp
  je     L147
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L116
L147:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L9
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L9:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x40(%rbp)
  movl   $0x0,-0x5c(%rbp)
  jmp    L111
L108:
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x40(%rbp),%rax
  mov    -0x5c(%rbp),%edx
  movslq %edx,%rdx
  movl   $0x0,(%rax,%rdx,4)
  addl   $0x1,-0x5c(%rbp)
L111:
  mov    -0x6c(%rbp),%eax
  cmp    %eax,-0x5c(%rbp)
  jl     L108
  movl   $0x0,-0x5c(%rbp)
  jmp    L1
L95:
  mov    -0x5c(%rbp),%eax
  mov    %eax,-0x60(%rbp)
  mov    -0x5c(%rbp),%eax
  mov    %eax,-0x64(%rbp)
  mov    -0x40(%rbp),%rax
  mov    -0x5c(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  cmp    $0x1,%eax
  je     L85
L54:
  mov    -0x40(%rbp),%rax
  mov    -0x5c(%rbp),%edx
  movslq %edx,%rdx
  movl   $0x1,(%rax,%rdx,4)
  mov    -0x50(%rbp),%rax
  mov    -0x60(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%edx
  mov    -0x60(%rbp),%eax
  add    %edx,%eax
  add    $0x1,%eax
  mov    -0x6c(%rbp),%ecx
  cltd
  idiv   %ecx
  mov    %edx,-0x60(%rbp)
  addl   $0x1,-0x68(%rbp)
  mov    -0x40(%rbp),%rax
  mov    -0x60(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  cmp    $0x1,%eax
  je     L48
  mov    -0x40(%rbp),%rax
  mov    -0x60(%rbp),%edx
  movslq %edx,%rdx
  movl   $0x1,(%rax,%rdx,4)
  jmp    L54
L48:
  nop
  jmp    L85
L42:
  mov    -0x50(%rbp),%rax
  mov    -0x64(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%edx
  mov    -0x64(%rbp),%eax
  add    %edx,%eax
  add    $0x1,%eax
  mov    -0x6c(%rbp),%ecx
  cltd
  idiv   %ecx
  mov    %edx,-0x64(%rbp)
  subl   $0x1,-0x68(%rbp)
L85:
  mov    -0x64(%rbp),%eax
  cmp    -0x60(%rbp),%eax
  jne    L42
  addl   $0x1,-0x5c(%rbp)
L1:
  mov    -0x6c(%rbp),%eax
  cmp    %eax,-0x5c(%rbp)
  jl     L95
  mov    -0x68(%rbp),%eax
  mov    %eax,%esi
  lea    D16(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    %rbx,%rsp
L50:
  mov    -0x70(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x70(%rbp)
  test   %eax,%eax
  jne    L162
  mov    $0x0,%eax
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L52
  call   <__stack_chk_fail@plt>
L52:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: data_label: D10
type_guessed: string
name: read_data
arguments: data_label: D16
type_guessed: string

tool: D10: %d

tool: D16: %d


assistant: ```c
int main(void) {
  int t, n, count, k, j, i;
  scanf("%d", &t);
  while (t--) {
    count = 0;
    scanf("%d", &n);
    int ar[n], visit[n];
    for (i = 0; i < n; i++) {
      scanf("%d", &ar[i]);
      visit[i] = 0;
    }
    for (i = 0; i < n; i++) {
      j = i;
      k = i;
      if (visit[i] != 1)
        while (1) {
          visit[i] = 1;
          j = (j + ar[j] + 1) % n;
          count++;
          if (visit[j] == 1)
            break;
          visit[j] = 1;
        }
      while (k != j) {
        k = (k + ar[k] + 1) % n;
        count--;
      }
    }
    printf("%d\n", count);
  }
  return 0;
}
```