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

```asm
<main>:
  endbr64
  push   %r15
  mov    $0x32,%ecx
  lea    D41(%rip),%r15
  push   %r14
  push   %r13
  lea    D9(%rip),%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x518,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x508(%rsp)
  xor    %eax,%eax
  lea    0x50(%rsp),%rdi
  mov    %rdi,0x30(%rsp)
  rep stos %rax,%es:(%rdi)
  lea    0x1e0(%rsp),%rdi
  mov    $0x32,%ecx
  mov    %rdi,0x8(%rsp)
  rep stos %rax,%es:(%rdi)
  lea    0x370(%rsp),%rdi
  mov    $0x32,%ecx
  mov    %rdi,(%rsp)
  rep stos %rax,%es:(%rdi)
  lea    0x4c(%rsp),%rax
  mov    %rax,0x28(%rsp)
L169:
  mov    0x28(%rsp),%rsi
  lea    D35(%rip),%rdi
  call   <scanf@plt>
  test   %rax,%rax
  jle    L163
  mov    0x4c(%rsp),%eax
  test   %eax,%eax
  jle    L169
  lea    0x78(%rsp),%rax
  movl   $0x1,0x24(%rsp)
  lea    0x414(%rsp),%rbx
  mov    %rax,0x38(%rsp)
  lea    0x1ec(%rsp),%rax
  mov    %rax,0x18(%rsp)
  lea    0x378(%rsp),%rax
  mov    %rax,0x10(%rsp)
L155:
  mov    0x30(%rsp),%rbp
  mov    0x38(%rsp),%r12
L134:
  mov    %rbp,%rsi
  lea    D35(%rip),%rdi
  add    $0x4,%rbp
  call   <scanf@plt>
  cmp    %r12,%rbp
  jne    L134
  mov    (%rsp),%rdi
  mov    $0x190,%edx
  xor    %esi,%esi
  call   <memset@plt>
  movl   $0x32,0x20(%rsp)
  mov    0x374(%rsp),%eax
  movl   $0x1,0x3c0(%rsp)
  nopl   (%rax)
L33:
  mov    0x10(%rsp),%r12
  lea    D39(%rip),%rbp
  mov    %r12,%r14
  jmp    L20
  nopl   0x0(%rax)
L13:
  cmp    $0x1,%eax
  jne    L177
  mov    %rbp,%rdi
  call   <printf@plt>
L177:
  cmp    %rbx,%r12
  je     L70
L180:
  mov    (%r12),%eax
  add    $0x4,%r12
L20:
  cmp    $0x2,%eax
  je     L194
  jg     L8
  test   %eax,%eax
  jne    L13
  lea    D32(%rip),%rdi
  call   <printf@plt>
  cmp    %rbx,%r12
  jne    L180
  cs nopw 0x0(%rax,%rax,1)
L70:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    (%rsp),%rsi
  mov    0x8(%rsp),%rdi
  mov    $0x190,%edx
  call   <memcpy@plt>
  mov    0x1e8(%rsp),%edi
  mov    0x18(%rsp),%rdx
  mov    %edi,%esi
  nopl   0x0(%rax,%rax,1)
L101:
  mov    -0x8(%rdx),%eax
  add    $0x4,%r14
  add    $0x4,%rdx
  add    %esi,%eax
  mov    -0x4(%rdx),%esi
  add    %esi,%eax
  cltq
  mov    0x50(%rsp,%rax,4),%eax
  mov    %eax,-0x4(%r14)
  cmp    %rbx,%r14
  jne    L101
  add    0x1e4(%rsp),%edi
  subl   $0x1,0x20(%rsp)
  movslq %edi,%rdi
  mov    0x50(%rsp,%rdi,4),%eax
  mov    %eax,0x374(%rsp)
  jne    L33
  mov    0x4c(%rsp),%eax
  cmp    0x24(%rsp),%eax
  jg     L185
L14:
  addl   $0x1,0x24(%rsp)
  mov    0x24(%rsp),%ecx
  cmp    %eax,%ecx
  jle    L155
  jmp    L169
  nopl   0x0(%rax)
L8:
  cmp    $0x3,%eax
  jne    L177
  mov    %r15,%rdi
  call   <printf@plt>
  jmp    L177
  xchg   %ax,%ax
L194:
  mov    %r13,%rdi
  call   <printf@plt>
  jmp    L177
L185:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x4c(%rsp),%eax
  jmp    L14
L163:
  mov    0x508(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L153
  add    $0x518,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L153:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D41
datatype: string
name: retrieve_data
arguments: label: D9
datatype: string
name: retrieve_data
arguments: label: D35
datatype: string
name: retrieve_data
arguments: label: D39
datatype: string
name: retrieve_data
arguments: label: D32
datatype: string

tool: D41: W

tool: D9: x

tool: D35: %d

tool: D39: .

tool: D32:  

assistant: ```c
main() {
  int n, d[100] = {0}, y[100] = {0}, t[100] = {0}, i, j, k, l, m;
  while (scanf("%d", &n) > 0) {
    for (m = 1; m <= n; m++) {
      for (i = 0; i < 10; i++)
        scanf("%d", &d[i]);
      memset(t, 0, sizeof(t));
      t[20] = 1;
      for (l = 0; l < 50; l++) {
        for (j = 1; j <= 40; j++)
          switch (t[j]) {
          case 0:
            printf(" ");
            break;
          case 1:
            printf(".");
            break;
          case 2:
            printf("x");
            break;
          case 3:
            printf("W");
            break;
          default:
            break;
          }
        putchar('\n');
        memcpy(y, t, sizeof(y));
        for (j = 2; j <= 40; j++)
          t[j] = d[y[j] + y[j - 1] + y[j + 1]];
        t[1] = d[y[1] + y[2]];
      }
      if (m < n)
        putchar('\n');
    }
  }
  return 0;
}
```