user: Translate the below assembly code into C programming language:

```asm
<chkval>:
  endbr64
  push   %r15
  push   %r14
  mov    %edi,%r14d
  push   %r13
  mov    %r9d,%r13d
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  push   %rbx
  mov    %r8,%rbx
  sub    $0x18,%rsp
  mov    0x50(%rsp),%r15d
  mov    0x58(%rsp),%rbp
  cmp    %edx,%esi
  jne    L88
  xor    %edx,%edx
  cmp    %r8,%rcx
  je     L167
L158:
  mov    %edx,0xc(%rsp)
  test   %r12,%r12
  je     L24
  test   %rbx,%rbx
  je     L24
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  mov    0xc(%rsp),%edx
  test   %eax,%eax
  jne    L109
  cmp    %r15d,%r13d
  jne    L65
  test   %edx,%edx
  jne    L54
L124:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L24:
  mov    %ebx,%eax
  mov    %r12d,%r8d
  test   %rbx,%rbx
  je     L91
  lea    D58(%rip),%r12
L116:
  sub    $0x8,%rsp
  mov    %rbp,%rdx
  mov    %rbx,%r9
  mov    %r12,%rcx
  push   %rax
  mov    %r14d,%esi
  lea    D44(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  pop    %rax
  pop    %rdx
  cmp    %r15d,%r13d
  je     L54
L65:
  sub    $0x8,%rsp
  mov    %r13d,%r8d
  lea    D0(%rip),%rdi
  xor    %eax,%eax
  push   %r15
  mov    %r15d,%r9d
  mov    %r13d,%ecx
  mov    %rbp,%rdx
  mov    %r14d,%esi
  call   <printf@plt>
  pop    %rdi
  pop    %r8
L54:
  mov    %rbp,%rsi
  lea    D55(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  add    $0x18,%rsp
  mov    $0x1,%edi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1090 <exit@plt>
  nopw   0x0(%rax,%rax,1)
L88:
  sub    $0x8,%rsp
  mov    %esi,%ecx
  mov    %edx,%r9d
  mov    %esi,%r8d
  push   %rdx
  mov    %edi,%esi
  mov    %rbp,%rdx
  lea    D59(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  pop    %rcx
  mov    $0x1,%edx
  pop    %rsi
  cmp    %rbx,%r12
  jne    L158
  cmp    %r15d,%r13d
  je     L54
  jmp    L65
  nopw   0x0(%rax,%rax,1)
L109:
  mov    %ebx,%eax
  mov    %r12d,%r8d
  jmp    L116
  nopw   0x0(%rax,%rax,1)
L91:
  lea    D58(%rip),%rbx
  test   %r12,%r12
  jne    L116
  mov    %rbx,%r12
  jmp    L116
  nopl   0x0(%rax,%rax,1)
L167:
  cmp    %r15d,%r9d
  je     L124
  jmp    L65
```

tool_calls: name: parse_data
arguments: data_label: D58
type_guessed: string
name: parse_data
arguments: data_label: D44
type_guessed: string
name: parse_data
arguments: data_label: D0
type_guessed: string
name: parse_data
arguments: data_label: D55
type_guessed: string
name: parse_data
arguments: data_label: D59
type_guessed: string

tool: 

tool: D44: 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: D55: FAIL getopttest %s


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


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