user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
L36:
  lea    -0x38(%rbp),%rax
  mov    %rax,%rsi
  lea    D29(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x38(%rbp),%eax
  test   %eax,%eax
  je     L33
  movl   $0x1,-0x34(%rbp)
  movl   $0x2,-0x30(%rbp)
  movl   $0x3,-0x2c(%rbp)
  movl   $0x4,-0x28(%rbp)
  movl   $0x5,-0x24(%rbp)
  movl   $0x6,-0x20(%rbp)
  movl   $0x1,-0x18(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L118
L139:
  lea    -0xd(%rbp),%rax
  mov    %rax,%rsi
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  movzbl -0xd(%rbp),%eax
  cmp    $0x4e,%al
  jne    L71
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  jmp    L51
L71:
  movzbl -0xd(%rbp),%eax
  cmp    $0x45,%al
  jne    L86
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x2c(%rbp)
  jmp    L51
L86:
  movzbl -0xd(%rbp),%eax
  cmp    $0x57,%al
  jne    L137
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  jmp    L51
L137:
  movzbl -0xd(%rbp),%eax
  cmp    $0x53,%al
  jne    L58
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x30(%rbp)
  jmp    L51
L58:
  movzbl -0xd(%rbp),%eax
  cmp    $0x52,%al
  jne    L54
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x2c(%rbp)
  jmp    L51
L54:
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x28(%rbp)
L51:
  mov    -0x34(%rbp),%eax
  add    %eax,-0x18(%rbp)
  addl   $0x1,-0x1c(%rbp)
L118:
  mov    -0x38(%rbp),%eax
  cmp    %eax,-0x1c(%rbp)
  jl     L139
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  lea    D29(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L36
L33:
  nop
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L1
  call   <__stack_chk_fail@plt>
L1:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D29
datatype: string
name: unpack_data
arguments: data_label: D12
datatype: string

tool: D29: %d


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