user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    D23(%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)
L149:
  xor    %eax,%eax
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r13,%rsi
  lea    D0(%rip),%rdi
  call   <scanf@plt>
  test   %eax,%eax
  je     L80
  mov    0x14(%rsp),%esi
  test   %esi,%esi
  je     L80
  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    L166
  mov    0x8(%rsp),%rbp
  xor    %r12d,%r12d
  nopl   0x0(%rax)
L180:
  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     L180
L166:
  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    L72
  nopl   (%rax)
L124:
  cmp    $0x4e,%al
  jne    L112
  sub    $0x1,%edi
  nopw   0x0(%rax,%rax,1)
L112:
  cmp    $0xffffffff,%edi
  sete   %al
  cmp    %esi,%edi
  sete   %r9b
  or     %r9b,%al
  jne    L58
  test   %ecx,%ecx
  js     L58
  cmp    %ecx,%edx
  je     L58
  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    L186
L72:
  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     L11
  jg     L29
  cmp    $0x45,%al
  jne    L124
  add    $0x1,%ecx
  jmp    L112
  nopl   0x0(%rax,%rax,1)
L29:
  cmp    $0x57,%al
  sete   %al
  movzbl %al,%eax
  sub    %eax,%ecx
  jmp    L112
  nop
L11:
  add    $0x1,%edi
  jmp    L112
  nopl   0x0(%rax,%rax,1)
L58:
  mov    %r8d,%esi
  lea    D24(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L149
  cs nopw 0x0(%rax,%rax,1)
L186:
  mov    %r8d,%edx
  mov    %r10d,%esi
  lea    D28(%rip),%rdi
  xor    %eax,%eax
  sub    %r10d,%edx
  call   <printf@plt>
  jmp    L149
  nopl   0x0(%rax)
L80:
  mov    0x7f8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L77
  add    $0x808,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L77:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D23
type_guessed: string
name: extract_symbolic_data
arguments: label: D0
type_guessed: string
name: extract_symbolic_data
arguments: label: D24
type_guessed: string
name: extract_symbolic_data
arguments: label: D28
type_guessed: string

tool: D23: %s

tool: D0: %d%d%d

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


tool: D28: %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;
}
```