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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0xd8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  xor    %eax,%eax
  movq   $0x0,0xc0(%rsp)
  call   <init_pt6312@plt>
  lea    D118(%rip),%rdi
  call   <printf@plt>
  cmp    $0x2,%ebx
  je     L7
  lea    0x10(%rsp),%rbx
  lea    D25(%rip),%r13
  lea    0x8(%rsp),%r12
  lea    D55(%rip),%rbp
  lea    D99(%rip),%r15
  nopw   0x0(%rax,%rax,1)
L100:
  mov    $0x16,%edx
  xor    %esi,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    %r13,%rdi
  call   <printf@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    0x8(%rsp),%eax
  cmp    $0x16,%eax
  ja     L100
  test   %eax,%eax
  je     L55
  sub    $0x1,%eax
  mov    %r15,%rdi
  lea    0xc0(%rsp),%r14
  mov    %eax,0x8(%rsp)
  call   <printf@plt>
  mov    %r14,%rsi
  lea    D91(%rip),%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    $0x2,%edx
  lea    D83(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L45
  lea    0xc(%rsp),%rdx
  lea    0xc2(%rsp),%rdi
  lea    D50(%rip),%rsi
  call   <sscanf@plt>
  mov    0xc(%rsp),%eax
L81:
  mov    0x8(%rsp),%ecx
  xor    %esi,%esi
  mov    %rbx,%rdi
  lea    (%rcx,%rcx,1),%edx
  movzbl %al,%ecx
  movzbl %ah,%eax
  cltq
  movq   %rcx,%xmm0
  movslq %edx,%rdx
  movq   %rax,%xmm1
  punpcklqdq %xmm1,%xmm0
  movaps %xmm0,(%rbx,%rdx,8)
  mov    $0x16,%edx
  call   <updateDisplay@plt>
  jmp    L100
  nopw   0x0(%rax,%rax,1)
L45:
  mov    %r14,%rdi
  call   <atoi@plt>
  mov    %eax,0xc(%rsp)
  jmp    L81
L7:
  mov    0x8(%rbp),%rbp
  lea    D23(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L99
  lea    D44(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L9
  lea    0x10(%rsp),%rbp
  mov    $0x16,%edx
  xor    %esi,%esi
L128:
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    $0x16,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <updateDisplay@plt>
  nopw   0x0(%rax,%rax,1)
L55:
  xor    %eax,%eax
  call   <close_pt6312@plt>
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L121
  add    $0xd8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L9:
  lea    D85(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L110
  lea    D2(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L55
L110:
  lea    D4(%rip),%rdi
  call   <printf@plt>
  jmp    L55
L99:
  lea    0x10(%rsp),%rbp
  mov    $0x16,%edx
  mov    $0xff,%esi
  jmp    L128
L121:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D118
type_guessed: string
name: unpack_data
arguments: label: D25
type_guessed: string
name: unpack_data
arguments: label: D55
type_guessed: string
name: unpack_data
arguments: label: D99
type_guessed: string
name: unpack_data
arguments: label: D91
type_guessed: string
name: unpack_data
arguments: label: D83
type_guessed: string
name: unpack_data
arguments: label: D50
type_guessed: string
name: unpack_data
arguments: label: D23
type_guessed: string
name: unpack_data
arguments: label: D44
type_guessed: string
name: unpack_data
arguments: label: D85
type_guessed: string
name: unpack_data
arguments: label: D2
type_guessed: string
name: unpack_data
arguments: label: D4
type_guessed: string

tool: D118: === DISPLAY TEST ===



tool: D25: Grid? [1-22, 0:end] 

tool: D55: %d

tool: D99: Value (16bit) ? 

tool: D91: %6s

tool: D83: 0x

tool: D50: %X

tool: D23: --all-grids

tool: D44: --clear

tool: D85: --help

tool: D2: -h

tool: D4: Usage:
   --all-grids: show all grids activated
   --clear: deactivate all grids
   --help: show this text

   No parameters: test individual grids interactively



assistant: ```c
int main(int argc, char *argv[]) {
  uint8_t data[22];
  int grid;
  char val[8] = {0};
  init_pt6312();
  printf("=== DISPLAY TEST ===\n\n");
  if (argc == 2) {
    if (!strcmp(argv[1], "--all-grids")) {
      memset(data, 255, 22);
      updateDisplay(data, 0, 22);
    } else if (!strcmp(argv[1], "--clear")) {
      memset(data, 0, 22);
      updateDisplay(data, 0, 22);
    } else if (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) {
      printf("Usage:\n   --all-grids: show all grids activated\n"
             "   --clear: deactivate all grids\n"
             "   --help: show this text\n\n"
             "   No parameters: test individual grids interactively\n\n");
    }
  } else
    while (1) {
      memset(data, 0, 22);
      printf("Grid? [1-22, 0:end] ");
      scanf("%d", &grid);
      if (grid < 0 || grid > 22)
        continue;
      else if (!grid)
        break;
      grid--;
      printf("Value (16bit) ? ");
      scanf("%6s", &val);
      uint16_t num;
      if (!strncmp(val, "0x", 2))
        sscanf(&val[2], "%X", &num);
      else
        num = atoi(val);
      data[grid * 2 + 1] = (uint8_t)((num & 0xFF00) >> 8);
      data[grid * 2] = (uint8_t)(num & 0xFF);
      updateDisplay(data, 0, 22);
    }
  close_pt6312();
  return 0;
}
```