user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x7f8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x7e8(%rsp)
  xor    %eax,%eax
  lea    D18(%rip),%rbp
  lea    D28(%rip),%rbx
  lea    D8(%rip),%r12
  lea    D17(%rip),%r13
  jmp    L183
L50:
  cmp    $0x57,%cl
  sete   %cl
  movzbl %cl,%ecx
  sub    %ecx,%eax
L147:
  mov    %edi,%esi
  or     %eax,%esi
  js     L162
  cmp    %r8d,%edi
  je     L162
  cmp    %eax,%r10d
  je     L162
  movslq %eax,%rcx
  movslq %edi,%rsi
  lea    (%rsi,%rsi,4),%rsi
  lea    (%rcx,%rsi,4),%rcx
  mov    0x1a0(%rsp,%rcx,4),%esi
  cmp    $0xffffffff,%esi
  jne    L142
L86:
  mov    %edx,%r14d
  add    $0x1,%edx
  movslq %eax,%rcx
  movslq %edi,%r9
  lea    0x0(,%r9,4),%rsi
  lea    (%rsi,%r9,1),%r11
  lea    (%rcx,%r11,4),%r11
  mov    %r14d,0x1a0(%rsp,%r11,4)
  add    %r9,%rsi
  lea    0x7f0(%rsp,%rsi,4),%rsi
  movzbl -0x7e0(%rcx,%rsi,1),%ecx
  cmp    $0x53,%cl
  je     L0
  jg     L50
  cmp    $0x45,%cl
  je     L84
  cmp    $0x4e,%cl
  jne    L147
  sub    $0x1,%edi
  jmp    L147
L0:
  add    $0x1,%edi
  jmp    L147
L84:
  add    $0x1,%eax
  jmp    L147
L162:
  mov    %edx,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L183:
  lea    0xc(%rsp),%rcx
  lea    0x8(%rsp),%rdx
  lea    0x4(%rsp),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  test   %eax,%eax
  je     L11
  mov    0x4(%rsp),%r8d
  test   %r8d,%r8d
  je     L11
  lea    0x10(%rsp),%rdx
  mov    $0x32,%ecx
  mov    $0x0,%eax
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  lea    0x1a0(%rsp),%rdx
  mov    $0xc8,%ecx
  mov    $0xffffffffffffffff,%rax
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  jle    L152
  lea    0x10(%rsp),%r15
  mov    $0x0,%r14d
L32:
  mov    %r15,%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  add    $0x1,%r14d
  mov    0x4(%rsp),%r8d
  add    $0x14,%r15
  cmp    %r14d,%r8d
  jg     L32
L152:
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  mov    0x8(%rsp),%r10d
  mov    $0x0,%edx
  mov    $0x0,%edi
  jmp    L86
L142:
  sub    %esi,%edx
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L183
L11:
  mov    0x7e8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L148
  mov    $0x0,%eax
  add    $0x7f8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L148:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D18
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D28
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D8
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D17
type_infered: string

tool: D18: %d%d%d

tool: D28: %s

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


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