user: 请将以下的汇编代码转换成C语言代码：

```asm
<chkval>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%r13d
  mov    %rcx,%rbp
  mov    %r8,%rbx
  mov    %r9d,%r12d
  mov    0x40(%rsp),%r14d
  mov    $0x0,%r15d
  cmp    %edx,%esi
  jne    L12
L4:
  cmp    %rbx,%rbp
  je     L128
  test   %rbp,%rbp
  je     L127
  test   %rbx,%rbx
  je     L127
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L128
  mov    %ebx,%eax
  mov    %ebp,%r8d
  jmp    L137
L12:
  sub    $0x8,%rsp
  push   %rdx
  mov    %edx,%r9d
  mov    %esi,%r8d
  mov    %esi,%ecx
  mov    0x58(%rsp),%rdx
  mov    %edi,%esi
  lea    D35(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rsp
  mov    $0x1,%r15d
  jmp    L4
L15:
  lea    D16(%rip),%rbx
  mov    %rbx,%rbp
  jmp    L137
L128:
  cmp    %r14d,%r12d
  jne    L10
  test   %r15d,%r15d
  jg     L54
L67:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L140:
  mov    %ebp,%r8d
  lea    D16(%rip),%rbp
  jmp    L137
L127:
  mov    %ebx,%eax
  test   %rbx,%rbx
  jne    L140
  mov    %ebp,%r8d
  test   %rbp,%rbp
  je     L15
  lea    D16(%rip),%rbx
L137:
  sub    $0x8,%rsp
  push   %rax
  mov    %rbx,%r9
  mov    %rbp,%rcx
  mov    0x58(%rsp),%rdx
  mov    %r13d,%esi
  lea    D64(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rsp
  cmp    %r14d,%r12d
  je     L54
L10:
  sub    $0x8,%rsp
  push   %r14
  mov    %r14d,%r9d
  mov    %r12d,%r8d
  mov    %r12d,%ecx
  mov    0x58(%rsp),%rdx
  mov    %r13d,%esi
  lea    D0(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rsp
L54:
  mov    0x48(%rsp),%rsi
  lea    D1(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L67
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D35
data_type: string
name: extract_symbolic_data
arguments: data_tag: D16
data_type: string
name: extract_symbolic_data
arguments: data_tag: D64
data_type: string
name: extract_symbolic_data
arguments: data_tag: D0
data_type: string
name: extract_symbolic_data
arguments: data_tag: D1
data_type: string

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


tool: 

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


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


tool: D1: 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);
  }
}
```