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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  lea    D23(%rip),%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x18(%rsp),%rax
  mov    %rax,0x8(%rsp)
  nopl   0x0(%rax,%rax,1)
L30:
  mov    0x8(%rsp),%rsi
  lea    D15(%rip),%rdi
  call   <scanf@plt>
  test   %rax,%rax
  je     L26
  mov    0x18(%rsp),%eax
  test   %eax,%eax
  je     L26
  xor    %eax,%eax
  mov    $0x5,%r13d
  mov    $0x2,%r12d
  mov    $0x6,%ebx
  call   <getchar@plt>
  mov    $0x1,%ebp
  movl   $0x4,0x4(%rsp)
  movl   $0x3,(%rsp)
  jmp    L1
  nopl   0x0(%rax)
L17:
  lea    0x1e(%rsp),%r15
  mov    %r15,%rdi
  call   <gets@plt>
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L76
  mov    %ebp,%eax
  mov    %r13d,%ebp
  mov    %ebx,%r13d
  mov    %r12d,%ebx
  mov    %eax,%r12d
L1:
  mov    0x18(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0x18(%rsp)
  test   %eax,%eax
  jne    L17
  mov    %ebp,%esi
  lea    D1(%rip),%rdi
  call   <printf@plt>
  jmp    L30
  nopl   (%rax)
L76:
  lea    D27(%rip),%rsi
  mov    %r15,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L16
  mov    %ebp,%eax
  mov    (%rsp),%ebp
  mov    %ebx,(%rsp)
  mov    0x4(%rsp),%ebx
  mov    %eax,0x4(%rsp)
  jmp    L1
  cs nopw 0x0(%rax,%rax,1)
L16:
  lea    D2(%rip),%rsi
  mov    %r15,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L103
  mov    %ebp,%eax
  mov    %r12d,%ebp
  mov    %ebx,%r12d
  mov    %r13d,%ebx
  mov    %eax,%r13d
  jmp    L1
L26:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L94
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L103:
  lea    D38(%rip),%rsi
  mov    %r15,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L1
  mov    %ebp,%eax
  mov    0x4(%rsp),%ebp
  mov    %ebx,0x4(%rsp)
  mov    (%rsp),%ebx
  mov    %eax,(%rsp)
  jmp    L1
L94:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D23
data_type: string
name: extract_symbolic_data
arguments: data_label: D15
data_type: string
name: extract_symbolic_data
arguments: data_label: D1
data_type: string
name: extract_symbolic_data
arguments: data_label: D27
data_type: string
name: extract_symbolic_data
arguments: data_label: D2
data_type: string
name: extract_symbolic_data
arguments: data_label: D38
data_type: string

tool: D23: north

tool: D15: %d

tool: D1: %d


tool: D27: east

tool: D2: south

tool: D38: west

assistant: ```c
int main() {
  int n, temp;
  char str[10];
  while (scanf("%d", &n) && n) {
    getchar();
    int up = 1, down = 6, north = 2, south = 5, west = 3, east = 4;
    while (n--) {
      gets(str);
      if (strcasecmp(str, "north") == 0) {
        temp = up;
        up = south;
        south = down;
        down = north;
        north = temp;
      } else if (strcasecmp(str, "east") == 0) {
        temp = up;
        up = west;
        west = down;
        down = east;
        east = temp;
      } else if (strcasecmp(str, "south") == 0) {
        temp = up;
        up = north;
        north = down;
        down = south;
        south = temp;
      } else if (strcasecmp(str, "west") == 0) {
        temp = up;
        up = east;
        east = down;
        down = west;
        west = temp;
      }
    }
    printf("%d\n", up);
  }
  return 0;
}
```