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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0xc20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x2c20(%rbp),%rax
  mov    %rax,%rsi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  movl   $0x0,-0x2c1c(%rbp)
  jmp    L123
L12:
  lea    -0x2c10(%rbp),%rcx
  mov    -0x2c1c(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rcx,%rax
  mov    %rax,%rsi
  lea    D36(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  addl   $0x1,-0x2c1c(%rbp)
L123:
  mov    -0x2c20(%rbp),%eax
  cmp    %eax,-0x2c1c(%rbp)
  jl     L12
  lea    -0x2c20(%rbp),%rax
  mov    %rax,%rsi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  jmp    L150
L116:
  lea    -0x80(%rbp),%rdx
  lea    -0xf0(%rbp),%rax
  mov    %rax,%rsi
  lea    D37(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  movl   $0x0,-0x2c18(%rbp)
L70:
  lea    -0x2c10(%rbp),%rcx
  mov    -0x2c18(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  lea    (%rcx,%rax,1),%rdx
  lea    -0xf0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L42
  addl   $0x1,-0x2c18(%rbp)
  jmp    L70
L42:
  nop
  movl   $0x0,-0x2c14(%rbp)
L85:
  lea    -0x2c10(%rbp),%rcx
  mov    -0x2c14(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  lea    (%rcx,%rax,1),%rdx
  lea    -0x80(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L99
  addl   $0x1,-0x2c14(%rbp)
  jmp    L85
L99:
  nop
  mov    -0x2c18(%rbp),%eax
  cmp    -0x2c14(%rbp),%eax
  jle    L63
  mov    -0x2c18(%rbp),%eax
  mov    %eax,-0x2c1c(%rbp)
  jmp    L138
L64:
  lea    -0x2c10(%rbp),%rcx
  mov    -0x2c1c(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rcx,%rax
  mov    %rax,%rsi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  subl   $0x1,-0x2c1c(%rbp)
L138:
  mov    -0x2c1c(%rbp),%eax
  cmp    -0x2c14(%rbp),%eax
  jg     L64
  jmp    L21
L63:
  mov    -0x2c18(%rbp),%eax
  cmp    -0x2c14(%rbp),%eax
  jge    L21
  mov    -0x2c18(%rbp),%eax
  mov    %eax,-0x2c1c(%rbp)
  jmp    L54
L6:
  lea    -0x2c10(%rbp),%rcx
  mov    -0x2c1c(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rcx,%rax
  mov    %rax,%rsi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  addl   $0x1,-0x2c1c(%rbp)
L54:
  mov    -0x2c1c(%rbp),%eax
  cmp    -0x2c14(%rbp),%eax
  jl     L6
L21:
  lea    -0x80(%rbp),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L150:
  mov    -0x2c20(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x2c20(%rbp)
  test   %eax,%eax
  jne    L116
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L10
  call   <__stack_chk_fail@plt>
L10:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D4
type: string
name: retrieve_data
arguments: data_label: D36
type: string
name: retrieve_data
arguments: data_label: D37
type: string
name: retrieve_data
arguments: data_label: D9
type: string

tool: D4: %d

tool: D36: %s

tool: D37: %s%s

tool: D9: %s 

assistant: ```c
int main() {
  int n, i, p, q;
  char a[105][105], x[105], y[105];
  scanf("%d", &n);
  for (i = 0; i < n; i++)
    scanf("%s", a[i]);
  scanf("%d", &n);
  while (n--) {
    scanf("%s%s", x, y);
    for (p = 0;; p++)
      if (!strcmp(x, a[p]))
        break;
    for (q = 0;; q++)
      if (!strcmp(y, a[q]))
        break;
    if (p > q)
      for (i = p; i > q; i--)
        printf("%s ", a[i]);
    else if (p < q)
      for (i = p; i < q; i++)
        printf("%s ", a[i]);
    puts(y);
  }
  return 0;
}
```