user: 请从给定的汇编指令推导出C源代码:

```asm
<chkval>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %edx,-0x1c(%rbp)
  mov    %rcx,-0x28(%rbp)
  mov    %r8,-0x30(%rbp)
  mov    %r9d,-0x20(%rbp)
  movl   $0x0,-0x4(%rbp)
  mov    -0x18(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  je     L7
  addl   $0x1,-0x4(%rbp)
  mov    -0x1c(%rbp),%r8d
  mov    -0x18(%rbp),%edi
  mov    -0x18(%rbp),%ecx
  mov    0x18(%rbp),%rdx
  mov    -0x14(%rbp),%eax
  sub    $0x8,%rsp
  mov    -0x1c(%rbp),%esi
  push   %rsi
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %eax,%esi
  lea    D33(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rsp
L7:
  mov    -0x28(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  je     L32
  cmpq   $0x0,-0x28(%rbp)
  je     L56
  cmpq   $0x0,-0x30(%rbp)
  je     L56
  mov    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L32
L56:
  addl   $0x1,-0x4(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %eax,%ecx
  cmpq   $0x0,-0x30(%rbp)
  je     L18
  mov    -0x30(%rbp),%rdx
  jmp    L13
L18:
  lea    D22(%rip),%rdx
L13:
  mov    -0x28(%rbp),%rax
  mov    %eax,%r8d
  cmpq   $0x0,-0x28(%rbp)
  je     L91
  mov    -0x28(%rbp),%rax
  jmp    L16
L91:
  lea    D22(%rip),%rax
L16:
  mov    0x18(%rbp),%rdi
  mov    -0x14(%rbp),%esi
  sub    $0x8,%rsp
  push   %rcx
  mov    %rdx,%r9
  mov    %rax,%rcx
  mov    %rdi,%rdx
  lea    D21(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rsp
L32:
  mov    -0x20(%rbp),%eax
  cmp    0x10(%rbp),%eax
  je     L62
  addl   $0x1,-0x4(%rbp)
  mov    -0x20(%rbp),%edi
  mov    -0x20(%rbp),%ecx
  mov    0x18(%rbp),%rdx
  mov    -0x14(%rbp),%eax
  sub    $0x8,%rsp
  mov    0x10(%rbp),%esi
  push   %rsi
  mov    0x10(%rbp),%r9d
  mov    %edi,%r8d
  mov    %eax,%esi
  lea    D46(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rsp
L62:
  cmpl   $0x0,-0x4(%rbp)
  jle    L8
  mov    0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D32(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L8:
  nop
  leave
  ret
```

tool_calls: name: read_data
arguments: label: D33
data_type: string
name: read_data
arguments: label: D22
data_type: string
name: read_data
arguments: label: D21
data_type: string
name: read_data
arguments: label: D46
data_type: string
name: read_data
arguments: label: D32
data_type: string

tool: D33: Mismatch %d %s: got char %c 0x%x exp char %c 0x%x


tool: 

tool: D21: Mismatch %d %s: got optarg %s 0x%x exp optarg %s 0x%x


tool: D46: Mismatch %d %s: got optind %d 0x%x exp optind %d 0x%x


tool: D32: FAIL getopttest %s


assistant: ```c
void chkval(int ct, int c, int expchar, char *extra, char *expextra, int optnum, int expnum, const char *testid) {
  int err = 0;
  if (c != expchar) {
    err++;
    printf("Mismatch %d %s: got char %c 0x%x exp char %c 0x%x\n", ct, testid, c, c, expchar, expchar);
  }
  if (extra != expextra) {
    if (extra && expextra && (!strcmp(extra, expextra))) {
    } else {
      err++;
      printf("Mismatch %d %s: got optarg %s 0x%x exp optarg %s 0x%x\n", ct, testid, extra ? extra : "", (unsigned)extra, expextra ? expextra : "", (unsigned)expextra);
    }
  }
  if (optnum != expnum) {
    err++;
    printf("Mismatch %d %s: got optind %d 0x%x exp optind %d 0x%x\n", ct, testid, optnum, optnum, expnum, expnum);
  }
  if (err > 0) {
    printf("FAIL getopttest %s\n", testid);
    exit(1);
  }
}
```