user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<chk_3_err_only>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x50,%rsp
  mov    %rdi,%r14
  mov    %rsi,0x20(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x40(%rsp)
  xor    %eax,%eax
  movzwl 0x6(%rdi),%ecx
  movzwl 0x4(%rdi),%edx
  movzwl 0x2(%rdi),%esi
  movzwl (%rdi),%edi
  lea    0x30(%rsp),%rax
  push   %rax
  movzwl 0xa(%r14),%r9d
  movzwl 0x8(%r14),%r8d
  call   <find_3bit_err_coefs@plt>
  add    $0x10,%rsp
  mov    $0x1,%ebx
  mov    $0x0,%r13d
  mov    $0x1,%r15d
  jmp    L38
L156:
  mov    %bx,0xc(%rsp)
  mov    %r15d,%r13d
L100:
  add    $0x1,%ebx
  cmp    $0xfff,%ebx
  je     L130
L38:
  mov    %ebx,%r12d
  mov    %ebx,%esi
  mov    %ebx,%edi
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %ebx,%esi
  call   <gf4096_mul@plt>
  movzwl %ax,%esi
  movzwl 0x2c(%rsp),%edi
  call   <gf4096_mul@plt>
  mov    %eax,%ebp
  mov    %ebx,%esi
  mov    %ebx,%edi
  call   <gf4096_mul@plt>
  movzwl %ax,%esi
  movzwl 0x2a(%rsp),%edi
  call   <gf4096_mul@plt>
  xor    %eax,%ebp
  movzwl 0x28(%rsp),%edi
  mov    %ebx,%esi
  call   <gf4096_mul@plt>
  xor    %eax,%ebp
  cmp    $0x1,%bp
  jne    L100
  test   %r13d,%r13d
  je     L156
  cmp    $0x1,%r13d
  je     L60
  cmp    $0x2,%r13d
  jne    L100
L114:
  movzwl 0xc(%rsp),%edi
  call   <gf4096_inv@plt>
  mov    %eax,%ebp
  movzwl 0x10(%rsp),%edi
  call   <gf4096_inv@plt>
  mov    %eax,%ebx
  movzwl %r12w,%edi
  call   <gf4096_inv@plt>
  movzwl %ax,%r12d
  movzwl %bx,%ebx
  movzwl %bp,%ebp
  movzwl 0x4(%r14),%edx
  movzwl 0x2(%r14),%esi
  movzwl (%r14),%edi
  sub    $0x8,%rsp
  lea    0x38(%rsp),%rax
  push   %rax
  mov    %r12d,%r9d
  mov    %ebx,%r8d
  mov    %ebp,%ecx
  call   <find_3bit_err_pats@plt>
  mov    %ebp,%esi
  mov    %ebp,%edi
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %edi,%esi
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %ebp,%esi
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %ebp,%esi
  call   <gf4096_mul@plt>
  movzwl %ax,%r15d
  mov    %ebp,%esi
  mov    %r15d,%edi
  call   <gf4096_mul@plt>
  mov    %ax,0x22(%rsp)
  mov    %ebx,%esi
  mov    %ebx,%edi
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %edi,%esi
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %ebx,%esi
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %ebx,%esi
  call   <gf4096_mul@plt>
  movzwl %ax,%r13d
  mov    %ebx,%esi
  mov    %r13d,%edi
  call   <gf4096_mul@plt>
  mov    %ax,0x24(%rsp)
  mov    %r12d,%esi
  mov    %r12d,%edi
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %edi,%esi
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %r12d,%esi
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %r12d,%esi
  call   <gf4096_mul@plt>
  movzwl %ax,%ecx
  mov    %r12d,%esi
  mov    %ecx,0x1c(%rsp)
  mov    %ecx,%edi
  call   <gf4096_mul@plt>
  mov    %ax,0x26(%rsp)
  movzwl 0xc(%r14),%ecx
  mov    %cx,0x20(%rsp)
  movzwl 0x40(%rsp),%edi
  mov    %r15d,%esi
  call   <gf4096_mul@plt>
  mov    %eax,%r15d
  movzwl 0x42(%rsp),%edi
  mov    %r13d,%esi
  call   <gf4096_mul@plt>
  xor    %eax,%r15d
  mov    %r15d,%r13d
  movzwl 0x44(%rsp),%edi
  mov    0x1c(%rsp),%esi
  call   <gf4096_mul@plt>
  xor    %eax,%r13d
  add    $0x10,%rsp
  cmp    0x10(%rsp),%r13w
  sete   %r13b
  movzwl 0xe(%r14),%r14d
  movzwl 0x12(%rsp),%esi
  movzwl 0x30(%rsp),%edi
  call   <gf4096_mul@plt>
  mov    %eax,%r15d
  movzwl 0x14(%rsp),%esi
  movzwl 0x32(%rsp),%edi
  call   <gf4096_mul@plt>
  xor    %eax,%r15d
  movzwl 0x16(%rsp),%esi
  movzwl 0x34(%rsp),%edi
  call   <gf4096_mul@plt>
  xor    %eax,%r15d
  cmp    %r14w,%r15w
  jne    L138
  test   %r13b,%r13b
  je     L138
  mov    %ebp,%edi
  call   <err_pos@plt>
  mov    %eax,%r13d
  mov    %ebx,%edi
  call   <err_pos@plt>
  mov    %eax,%edx
  cmp    $0xfff,%r13d
  sete   %al
  cmp    $0xfff,%edx
  sete   %dl
  or     %edx,%eax
  mov    %eax,%r13d
  mov    %r12d,%edi
  call   <err_pos@plt>
  cmp    $0xfff,%eax
  je     L34
  test   %r13b,%r13b
  je     L22
L34:
  mov    D18(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L103
L60:
  mov    %bx,0x10(%rsp)
  mov    $0x2,%r13d
  jmp    L100
L130:
  cmp    $0x3,%r13d
  je     L114
  mov    D18(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L103
L22:
  mov    0x18(%rsp),%r14
  movw   $0x3,(%r14)
  mov    %ebp,%edi
  call   <err_pos@plt>
  mov    %eax,%edx
  mov    $0x55e,%ebp
  mov    %ebp,%eax
  sub    %edx,%eax
  mov    %ax,0x2(%r14)
  mov    %ebx,%edi
  call   <err_pos@plt>
  mov    %eax,%edx
  mov    %ebp,%eax
  sub    %edx,%eax
  mov    %ax,0x4(%r14)
  mov    %r12d,%edi
  call   <err_pos@plt>
  sub    %eax,%ebp
  mov    %bp,0x6(%r14)
  movzwl 0x30(%rsp),%eax
  mov    %ax,0xa(%r14)
  movzwl 0x32(%rsp),%eax
  mov    %ax,0xc(%r14)
  movzwl 0x34(%rsp),%eax
  mov    %ax,0xe(%r14)
  mov    $0x0,%eax
  jmp    L103
L138:
  mov    D18(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
L103:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L94
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L94:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int chk_3_err_only(unsigned short *chk_syndrome_list, unsigned short *err_info) {
  unsigned short tmp0, tmp1, tmp2, tmp3, tmp4, tmp5;
  unsigned short coefs[4];
  unsigned short err_pats[4];
  int found_num_root = 0;
  unsigned short bit3_root0, bit3_root1, bit3_root2;
  unsigned short bit3_root0_inv, bit3_root1_inv, bit3_root2_inv;
  unsigned short err_loc_eqn, test_root;
  find_3bit_err_coefs(chk_syndrome_list[0], chk_syndrome_list[1], chk_syndrome_list[2], chk_syndrome_list[3], chk_syndrome_list[4], chk_syndrome_list[5], coefs);
  for (test_root = 0x1; test_root < 0xfff; test_root++) {
    err_loc_eqn = gf4096_mul(coefs[2], gf4096_mul(gf4096_mul(test_root, test_root), test_root)) ^ gf4096_mul(coefs[1], gf4096_mul(test_root, test_root)) ^ gf4096_mul(coefs[0], test_root) ^ 0x1;
    if (err_loc_eqn == 0x0) {
      if (found_num_root == 0) {
        bit3_root0 = test_root;
        found_num_root = 1;
      } else if (found_num_root == 1) {
        bit3_root1 = test_root;
        found_num_root = 2;
      } else if (found_num_root == 2) {
        bit3_root2 = test_root;
        found_num_root = 3;
        break;
      }
    }
  }
  if (found_num_root != 3)
    return -EINVAL;
  else {
    bit3_root0_inv = gf4096_inv(bit3_root0);
    bit3_root1_inv = gf4096_inv(bit3_root1);
    bit3_root2_inv = gf4096_inv(bit3_root2);
    find_3bit_err_pats(chk_syndrome_list[0], chk_syndrome_list[1], chk_syndrome_list[2], bit3_root0_inv, bit3_root1_inv, bit3_root2_inv, err_pats);
    tmp0 = gf4096_mul(bit3_root0_inv, bit3_root0_inv);
    tmp0 = gf4096_mul(tmp0, tmp0);
    tmp0 = gf4096_mul(tmp0, bit3_root0_inv);
    tmp0 = gf4096_mul(tmp0, bit3_root0_inv);
    tmp1 = gf4096_mul(tmp0, bit3_root0_inv);
    tmp2 = gf4096_mul(bit3_root1_inv, bit3_root1_inv);
    tmp2 = gf4096_mul(tmp2, tmp2);
    tmp2 = gf4096_mul(tmp2, bit3_root1_inv);
    tmp2 = gf4096_mul(tmp2, bit3_root1_inv);
    tmp3 = gf4096_mul(tmp2, bit3_root1_inv);
    tmp4 = gf4096_mul(bit3_root2_inv, bit3_root2_inv);
    tmp4 = gf4096_mul(tmp4, tmp4);
    tmp4 = gf4096_mul(tmp4, bit3_root2_inv);
    tmp4 = gf4096_mul(tmp4, bit3_root2_inv);
    tmp5 = gf4096_mul(tmp4, bit3_root2_inv);
    if ((chk_syndrome_list[6] == (gf4096_mul(err_pats[0], tmp0) ^ gf4096_mul(err_pats[1], tmp2) ^ gf4096_mul(err_pats[2], tmp4))) & (chk_syndrome_list[7] == (gf4096_mul(err_pats[0], tmp1) ^ gf4096_mul(err_pats[1], tmp3) ^ gf4096_mul(err_pats[2], tmp5)))) {
      if ((err_pos(bit3_root0_inv) == 0xfff) | (err_pos(bit3_root1_inv) == 0xfff) | (err_pos(bit3_root2_inv) == 0xfff)) {
        return -EINVAL;
      } else {
        err_info[0] = 0x3;
        err_info[1] = (0x55e - err_pos(bit3_root0_inv));
        err_info[2] = (0x55e - err_pos(bit3_root1_inv));
        err_info[3] = (0x55e - err_pos(bit3_root2_inv));
        err_info[5] = err_pats[0];
        err_info[6] = err_pats[1];
        err_info[7] = err_pats[2];
        return 0;
      }
    } else
      return -EINVAL;
  }
}
```