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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  lea    -0x186000(%rsp),%r11
L46:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L46
  sub    $0xa78,%rsp
  lea    D20(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    -0x186a70(%rbp),%rdx
  lea    -0x186a78(%rbp),%rsi
  call   <scanf@plt>
  mov    -0x186a78(%rbp),%rcx
  mov    %rsp,%rsi
  lea    0xf(,%rcx,8),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rsi
  and    $0xfffffffffffffff0,%rdx
  cmp    %rsi,%rsp
  je     L111
L129:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L129
L111:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L102
L24:
  mov    %rsp,%r12
  test   %rcx,%rcx
  jle    L93
  xor    %ebx,%ebx
  nopw   0x0(%rax,%rax,1)
L138:
  mov    $0x8,%edi
  call   <malloc@plt>
  mov    %rax,(%r12,%rbx,8)
  add    $0x1,%rbx
  cmp    %rbx,-0x186a78(%rbp)
  jg     L138
L93:
  xor    %esi,%esi
  lea    -0x186a50(%rbp),%rdi
  mov    $0x186a1,%edx
  call   <memset@plt>
  lea    -0xc3540(%rbp),%r13
  xor    %esi,%esi
  mov    $0x186a1,%edx
  mov    %r13,%rdi
  call   <memset@plt>
  cmpq   $0x0,-0x186a70(%rbp)
  jle    L127
  lea    -0x186a58(%rbp),%rax
  xor    %r15d,%r15d
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  mov    %rax,-0x186a98(%rbp)
  lea    -0x186a60(%rbp),%rax
  mov    %rax,-0x186a90(%rbp)
  lea    -0x186a68(%rbp),%rax
  mov    %rax,-0x186a88(%rbp)
  jmp    L67
  xchg   %ax,%ax
L86:
  mov    -0x186a58(%rbp),%rax
  add    $0x1,%r14
  cqto
  idivq  -0x186a50(%rbp,%rcx,8)
  mov    (%r12,%rcx,8),%rax
  mov    (%rax,%rdx,8),%r15
  mov    %r15,-0xc3540(%rbp,%rbx,8)
  add    $0x1,%rbx
  cmp    %r14,-0x186a70(%rbp)
  jle    L1
L67:
  mov    -0x186a98(%rbp),%rcx
  mov    -0x186a90(%rbp),%rdx
  xor    %eax,%eax
  lea    D7(%rip),%rdi
  mov    -0x186a88(%rbp),%rsi
  call   <scanf@plt>
  mov    -0x186a60(%rbp),%rax
  xor    %r15,%rax
  cqto
  idivq  -0x186a78(%rbp)
  cmpq   $0x1,-0x186a68(%rbp)
  mov    %rdx,%rcx
  jne    L86
  mov    -0x186a50(%rbp,%rdx,8),%rax
  mov    (%r12,%rdx,8),%rdi
  mov    %rdx,-0x186aa0(%rbp)
  add    $0x1,%r14
  lea    0x8(,%rax,8),%rsi
  call   <realloc@plt>
  mov    -0x186aa0(%rbp),%rcx
  mov    -0x186a58(%rbp),%rsi
  mov    -0x186a50(%rbp,%rcx,8),%rdx
  mov    %rax,(%r12,%rcx,8)
  mov    %rsi,(%rax,%rdx,8)
  addq   $0x1,-0x186a50(%rbp,%rcx,8)
  cmp    %r14,-0x186a70(%rbp)
  jg     L67
L1:
  test   %rbx,%rbx
  je     L127
  xor    %r12d,%r12d
  lea    D16(%rip),%r14
L79:
  mov    0x0(%r13,%r12,8),%rsi
  mov    %r14,%rdi
  add    $0x1,%r12
  call   <printf@plt>
  cmp    %r12,%rbx
  jne    L79
L127:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L13
  lea    -0x28(%rbp),%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L102:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L24
L13:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D20
datatype: string
name: extract_symbolic_data
arguments: data_tag: D7
datatype: string
name: extract_symbolic_data
arguments: data_tag: D16
datatype: string

tool: D20: %lld %lld

tool: D7: %lld %lld %lld

tool: D16: %lld


assistant: ```c
int main() {
  long long n, q, i, l;
  long long idx[100001];
  long long out[100001];
  long long qn, x, y;
  long long lastAns;
  lastAns = 0;
  l = 0;
  scanf("%lld %lld", &n, &q);
  long long *arr[n];
  for (i = 0; i < n; i++)
    arr[i] = (long long *)malloc(sizeof(long long));
  memset(idx, 0, 100001);
  memset(out, 0, 100001);
  for (i = 0; i < q; i++) {
    scanf("%lld %lld %lld", &qn, &x, &y);
    long long seq = (x ^ lastAns) % n;
    if (qn == 1) {
      arr[seq] = realloc(arr[seq], (idx[seq] + 1) * sizeof(long long));
      arr[seq][idx[seq]] = y;
      idx[seq]++;
    } else {
      lastAns = arr[seq][y % idx[seq]];
      out[l] = lastAns;
      l++;
    }
  }
  for (i = 0; i < l; i++) {
    printf("%lld\n", out[i]);
  }
  return 0;
}
```