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

```asm
<chk_3_err_only>:
  endbr64
  push   %r15
  mov    $0x1,%r15d
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  push   %rbx
  sub    $0x50,%rsp
  movzwl 0x6(%rdi),%ecx
  movzwl 0x4(%rdi),%edx
  movzwl 0xa(%r14),%r9d
  movzwl 0x8(%r14),%r8d
  mov    %rsi,0x20(%rsp)
  movzwl 0x2(%rdi),%esi
  movzwl (%rdi),%edi
  mov    %fs:0x28,%rax
  mov    %rax,0x40(%rsp)
  xor    %eax,%eax
  lea    0x30(%rsp),%rax
  push   %rax
  call   <find_3bit_err_coefs@plt>
  pop    %rsi
  pop    %rdi
  jmp    L69
  nopl   0x0(%rax,%rax,1)
L70:
  add    $0x1,%r15d
  cmp    $0xfff,%r15d
  je     L33
L69:
  mov    %r15d,%esi
  mov    %r15d,%edi
  mov    %r15d,%ebp
  call   <gf4096_mul@plt>
  mov    %r15d,%esi
  movzwl %ax,%edi
  call   <gf4096_mul@plt>
  movzwl 0x2c(%rsp),%edi
  movzwl %ax,%esi
  call   <gf4096_mul@plt>
  mov    %r15d,%esi
  mov    %r15d,%edi
  mov    %eax,%ebx
  call   <gf4096_mul@plt>
  movzwl 0x2a(%rsp),%edi
  movzwl %ax,%esi
  call   <gf4096_mul@plt>
  movzwl 0x28(%rsp),%edi
  mov    %r15d,%esi
  xor    %eax,%ebx
  call   <gf4096_mul@plt>
  xor    %eax,%ebx
  cmp    $0x1,%bx
  jne    L70
  test   %r12d,%r12d
  je     L41
  cmp    $0x1,%r12d
  je     L8
  cmp    $0x2,%r12d
  jne    L70
L68:
  movzwl %r13w,%edi
  call   <gf4096_inv@plt>
  movzwl 0xc(%rsp),%edi
  movzwl %ax,%ebx
  call   <gf4096_inv@plt>
  mov    %ebp,%edi
  movzwl %ax,%r13d
  call   <gf4096_inv@plt>
  sub    $0x8,%rsp
  movzwl 0x4(%r14),%edx
  mov    %ebx,%ecx
  movzwl %ax,%r15d
  lea    0x38(%rsp),%rax
  movzwl (%r14),%edi
  mov    %r13d,%r8d
  movzwl 0x2(%r14),%esi
  push   %rax
  mov    %r15d,%r9d
  call   <find_3bit_err_pats@plt>
  mov    %ebx,%esi
  mov    %ebx,%edi
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %edi,%esi
  call   <gf4096_mul@plt>
  mov    %ebx,%esi
  movzwl %ax,%edi
  call   <gf4096_mul@plt>
  mov    %ebx,%esi
  movzwl %ax,%edi
  call   <gf4096_mul@plt>
  mov    %ebx,%esi
  movzwl %ax,%r12d
  mov    %r12d,%edi
  call   <gf4096_mul@plt>
  mov    %r13d,%esi
  mov    %r13d,%edi
  mov    %ax,0x1e(%rsp)
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %edi,%esi
  call   <gf4096_mul@plt>
  mov    %r13d,%esi
  movzwl %ax,%edi
  call   <gf4096_mul@plt>
  mov    %r13d,%esi
  movzwl %ax,%edi
  call   <gf4096_mul@plt>
  mov    %r13d,%esi
  movzwl %ax,%r8d
  mov    %r8d,%edi
  mov    %r8d,0x24(%rsp)
  call   <gf4096_mul@plt>
  mov    %r15d,%esi
  mov    %r15d,%edi
  mov    %ax,0x20(%rsp)
  call   <gf4096_mul@plt>
  movzwl %ax,%edi
  mov    %edi,%esi
  call   <gf4096_mul@plt>
  mov    %r15d,%esi
  movzwl %ax,%edi
  call   <gf4096_mul@plt>
  mov    %r15d,%esi
  movzwl %ax,%edi
  call   <gf4096_mul@plt>
  mov    %r15d,%esi
  movzwl %ax,%ebp
  mov    %ebp,%edi
  call   <gf4096_mul@plt>
  movzwl 0xc(%r14),%ecx
  movzwl 0x40(%rsp),%edi
  mov    %r12d,%esi
  mov    %ax,0x22(%rsp)
  mov    %cx,0x1c(%rsp)
  call   <gf4096_mul@plt>
  movzwl 0x42(%rsp),%edi
  mov    0x24(%rsp),%esi
  mov    %eax,%r12d
  call   <gf4096_mul@plt>
  movzwl 0x44(%rsp),%edi
  mov    %ebp,%esi
  xor    %eax,%r12d
  call   <gf4096_mul@plt>
  pop    %rdx
  pop    %rcx
  movzwl 0xe(%rsp),%esi
  movzwl 0x30(%rsp),%edi
  xor    %eax,%r12d
  cmp    0xc(%rsp),%r12w
  movzwl 0xe(%r14),%r14d
  sete   %r12b
  call   <gf4096_mul@plt>
  movzwl 0x10(%rsp),%esi
  movzwl 0x32(%rsp),%edi
  mov    %eax,%ebp
  call   <gf4096_mul@plt>
  movzwl 0x12(%rsp),%esi
  movzwl 0x34(%rsp),%edi
  xor    %eax,%ebp
  call   <gf4096_mul@plt>
  xor    %eax,%ebp
  cmp    %r14w,%bp
  jne    L92
  test   %r12b,%r12b
  je     L92
  mov    %ebx,%edi
  call   <err_pos@plt>
  mov    %r13d,%edi
  mov    %eax,%ebp
  call   <err_pos@plt>
  cmp    $0xfff,%ebp
  mov    %r15d,%edi
  mov    %eax,%r11d
  sete   %al
  cmp    $0xfff,%r11d
  sete   %dl
  or     %edx,%eax
  mov    %eax,%ebp
  call   <err_pos@plt>
  cmp    $0xfff,%eax
  je     L92
  test   %bpl,%bpl
  je     L116
  nopw   0x0(%rax,%rax,1)
L92:
  mov    D1(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
L154:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L22
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L41:
  mov    %r15d,%r13d
  add    $0x1,%r15d
  mov    $0x1,%r12d
  cmp    $0xfff,%r15d
  jne    L69
  nopw   0x0(%rax,%rax,1)
L33:
  cmp    $0x3,%r12d
  jne    L92
  xor    %ebp,%ebp
  jmp    L68
  nopl   (%rax)
L8:
  mov    %r15w,0xc(%rsp)
  mov    $0x2,%r12d
  jmp    L70
L116:
  mov    0x18(%rsp),%r14
  mov    $0x3,%eax
  mov    %ebx,%edi
  mov    $0x55e,%ebx
  mov    %ax,(%r14)
  call   <err_pos@plt>
  mov    %r13d,%edi
  mov    %eax,%r10d
  mov    %ebx,%eax
  sub    %r10d,%eax
  mov    %ax,0x2(%r14)
  call   <err_pos@plt>
  mov    %r15d,%edi
  mov    %eax,%r8d
  mov    %ebx,%eax
  sub    %r8d,%eax
  mov    %ax,0x4(%r14)
  call   <err_pos@plt>
  sub    %eax,%ebx
  mov    0x30(%rsp),%eax
  mov    %bx,0x6(%r14)
  mov    %eax,0xa(%r14)
  movzwl 0x34(%rsp),%eax
  mov    %ax,0xe(%r14)
  xor    %eax,%eax
  jmp    L154
L22:
  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;
  }
}
```