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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x2c(%rsp),%rax
  mov    %rax,0x18(%rsp)
  nopl   0x0(%rax)
L48:
  mov    0x18(%rsp),%rsi
  lea    D1(%rip),%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    0x2c(%rsp),%eax
  test   %eax,%eax
  je     L7
  movl   $0x1,0xc(%rsp)
  jle    L30
  lea    0x33(%rsp),%rax
  xor    %r8d,%r8d
  mov    $0x6,%ebp
  mov    $0x5,%r12d
  mov    %rax,0x10(%rsp)
  mov    $0x4,%r13d
  mov    $0x1,%ebx
  mov    $0x3,%r14d
  mov    $0x2,%r15d
  jmp    L32
  xchg   %ax,%ax
L120:
  cmp    $0x53,%al
  je     L88
  jg     L14
  cmp    $0x45,%al
  je     L59
  cmp    $0x52,%al
  mov    %r15d,%eax
  jne    L85
  mov    %r14d,%r15d
  mov    %r12d,%r14d
  mov    %r13d,%r12d
  mov    %eax,%r13d
L145:
  add    %ebx,0xc(%rsp)
  add    $0x1,%r8d
  cmp    %r8d,0x2c(%rsp)
  jle    L30
L32:
  mov    0x10(%rsp),%rsi
  xor    %eax,%eax
  mov    %r8d,0x8(%rsp)
  lea    D9(%rip),%rdi
  call   <scanf@plt>
  movzbl 0x33(%rsp),%eax
  mov    0x8(%rsp),%r8d
  cmp    $0x4e,%al
  jne    L120
  mov    %ebx,%eax
  add    $0x1,%r8d
  mov    %r15d,%ebx
  mov    %ebp,%r15d
  add    %ebx,0xc(%rsp)
  mov    %r12d,%ebp
  mov    %eax,%r12d
  cmp    %r8d,0x2c(%rsp)
  jg     L32
L30:
  mov    0xc(%rsp),%esi
  lea    D1(%rip),%rdi
  call   <printf@plt>
  jmp    L48
  nopl   0x0(%rax)
L14:
  cmp    $0x57,%al
  jne    L165
  mov    %ebx,%eax
  mov    %r14d,%ebx
  mov    %ebp,%r14d
  mov    %r13d,%ebp
  mov    %eax,%r13d
  jmp    L145
  nopl   0x0(%rax)
L59:
  mov    %ebx,%eax
  mov    %r13d,%ebx
  mov    %ebp,%r13d
  mov    %r14d,%ebp
  mov    %eax,%r14d
  jmp    L145
  nopl   0x0(%rax,%rax,1)
L165:
  mov    %r15d,%eax
L85:
  mov    %r13d,%r15d
  mov    %r12d,%r13d
  mov    %r14d,%r12d
  mov    %eax,%r14d
  jmp    L145
  nopl   0x0(%rax)
L88:
  mov    %ebx,%eax
  mov    %r12d,%ebx
  mov    %ebp,%r12d
  mov    %r15d,%ebp
  mov    %eax,%r15d
  jmp    L145
  nopl   0x0(%rax,%rax,1)
L7:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D1
type_guessed: string
name: disassemble_data
arguments: data_label: D9
type_guessed: string

tool: D1: %d


tool: D9: %s


assistant: ```c
int main(void) {
  int o, s, e, w, n, u, c, temp, i, sum;
  char inst[5];
  while (1) {
    scanf("%d\n", &c);
    if (c == 0)
      break;
    o = 1, s = 2, e = 3, w = 4, n = 5, u = 6, sum = 1;
    for (i = 0; i < c; i++) {
      scanf("%s\n", inst);
      if (inst[0] == 'N') {
        temp = o;
        o = s;
        s = u;
        u = n;
        n = temp;
      } else if (inst[0] == 'E') {
        temp = o;
        o = w;
        w = u;
        u = e;
        e = temp;
      } else if (inst[0] == 'W') {
        temp = o;
        o = e;
        e = u;
        u = w;
        w = temp;
      } else if (inst[0] == 'S') {
        temp = o;
        o = n;
        n = u;
        u = s;
        s = temp;
      } else if (inst[0] == 'R') {
        temp = n;
        n = w;
        w = s;
        s = e;
        e = temp;
      } else {
        temp = n;
        n = e;
        e = s;
        s = w;
        w = temp;
      }
      sum += o;
    }
    printf("%d\n", sum);
  }
  return 0;
}
```