user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    D34(%rip),%rbx
  sub    $0x808,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x7f8(%rsp)
  xor    %eax,%eax
  lea    0x20(%rsp),%rax
  lea    0x1c(%rsp),%r15
  mov    %rax,0x8(%rsp)
  lea    0x18(%rsp),%r14
  lea    0x14(%rsp),%r13
  nopl   0x0(%rax,%rax,1)
L55:
  xor    %eax,%eax
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r13,%rsi
  lea    D16(%rip),%rdi
  call   <scanf@plt>
  test   %eax,%eax
  je     L79
  mov    0x14(%rsp),%esi
  test   %esi,%esi
  je     L79
  mov    0x8(%rsp),%rdi
  mov    $0x0,%eax
  mov    $0x32,%ecx
  lea    0x1b0(%rsp),%rdx
  rep stos %rax,%es:(%rdi)
  mov    $0xc8,%ecx
  mov    $0xffffffffffffffff,%rax
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  jle    L82
  mov    0x8(%rsp),%rbp
  xor    %r12d,%r12d
  nopl   0x0(%rax)
L65:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  add    $0x1,%r12d
  call   <scanf@plt>
  mov    0x14(%rsp),%esi
  add    $0x14,%rbp
  cmp    %r12d,%esi
  jg     L65
L82:
  mov    0x1c(%rsp),%eax
  mov    0x18(%rsp),%edx
  xor    %r8d,%r8d
  xor    %edi,%edi
  lea    -0x1(%rax),%ecx
  xor    %eax,%eax
  movslq %ecx,%r9
  jmp    L154
  nopl   (%rax)
L114:
  cmp    $0x4e,%al
  jne    L149
  sub    $0x1,%edi
  nopw   0x0(%rax,%rax,1)
L149:
  cmp    $0xffffffff,%edi
  sete   %al
  cmp    %esi,%edi
  sete   %r9b
  or     %r9b,%al
  jne    L60
  test   %ecx,%ecx
  js     L60
  cmp    %ecx,%edx
  je     L60
  movslq %edi,%rax
  movslq %ecx,%r9
  lea    (%rax,%rax,4),%r10
  lea    (%r9,%r10,4),%r10
  mov    0x1b0(%rsp,%r10,4),%r10d
  cmp    $0xffffffff,%r10d
  jne    L5
L154:
  lea    (%rax,%rax,4),%rax
  mov    %r8d,%r11d
  add    $0x1,%r8d
  shl    $0x2,%rax
  lea    (%rax,%r9,1),%r10
  add    $0x800,%rax
  add    %rsp,%rax
  mov    %r11d,0x1b0(%rsp,%r10,4)
  movzbl -0x7e0(%rax,%r9,1),%eax
  cmp    $0x53,%al
  je     L132
  jg     L147
  cmp    $0x45,%al
  jne    L114
  add    $0x1,%ecx
  jmp    L149
  nopl   0x0(%rax,%rax,1)
L147:
  cmp    $0x57,%al
  sete   %al
  movzbl %al,%eax
  sub    %eax,%ecx
  jmp    L149
  nop
L132:
  add    $0x1,%edi
  jmp    L149
  nopl   0x0(%rax,%rax,1)
L60:
  mov    %r8d,%esi
  lea    D1(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L55
  cs nopw 0x0(%rax,%rax,1)
L5:
  mov    %r8d,%edx
  mov    %r10d,%esi
  lea    D39(%rip),%rdi
  xor    %eax,%eax
  sub    %r10d,%edx
  call   <printf@plt>
  jmp    L55
  nopl   0x0(%rax)
L79:
  mov    0x7f8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L123
  add    $0x808,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L123:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D34
type: string
name: extract_symbolic_data
arguments: tag: D16
type: string
name: extract_symbolic_data
arguments: tag: D1
type: string
name: extract_symbolic_data
arguments: tag: D39
type: string

tool: D34: %s

tool: D16: %d%d%d

tool: D1: %d step(s) to exit


tool: D39: %d step(s) before a loop of %d step(s)


assistant: ```c
int main(int argc, char const *argv[]) {
  int r, c, p, graph[20][20];
  char grid[20][20];
  while (scanf("%d%d%d", &r, &c, &p) && r) {
    memset(grid, 0, sizeof(grid));
    memset(graph, -1, sizeof(graph));
    for (int i = 0; i < r; i++)
      scanf("%s", grid[i]);
    int x = 0, y = p - 1, cnt = 0;
    while (1) {
      graph[x][y] = cnt++;
      switch (grid[x][y]) {
      case 'N':
        x--;
        break;
      case 'S':
        x++;
        break;
      case 'E':
        y++;
        break;
      case 'W':
        y--;
        break;
      }
      if (x < 0 || x == r || y < 0 || y == c) {
        printf("%d step(s) to exit\n", cnt);
        break;
      }
      if (graph[x][y] != -1) {
        printf("%d step(s) before a loop of %d step(s)\n", graph[x][y], cnt - graph[x][y]);
        break;
      }
    }
  }
  return 0;
}
```