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

```asm
<redupe_correct_errata>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %r9d,%ebp
  push   %rbx
  sub    $0x668,%rsp
  mov    %rdi,0x30(%rsp)
  mov    %esi,0x2c(%rsp)
  mov    %r8,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x658(%rsp)
  xor    %eax,%eax
  test   %r9d,%r9d
  je     L55
  movzbl 0x2c(%rsp),%eax
  lea    -0x1(%rax),%ecx
  lea    -0x1(%r9),%eax
  cmp    $0xe,%eax
  jbe    L187
  movd   %ecx,%xmm0
  movdqu (%r8),%xmm3
  mov    %r9d,%eax
  punpcklbw %xmm0,%xmm0
  shr    $0x4,%eax
  punpcklwd %xmm0,%xmm0
  movaps %xmm3,(%rsp)
  pshufd $0x0,%xmm0,%xmm0
  movdqa %xmm0,%xmm1
  psubb  %xmm3,%xmm1
  movaps %xmm1,0x50(%rsp)
  cmp    $0x1,%eax
  je     L314
  movdqu 0x10(%r8),%xmm5
  movdqa %xmm0,%xmm1
  psubb  %xmm5,%xmm1
  movaps %xmm5,(%rsp)
  movaps %xmm1,0x60(%rsp)
  cmp    $0x2,%eax
  je     L314
  movdqu 0x20(%r8),%xmm7
  movdqa %xmm0,%xmm1
  psubb  %xmm7,%xmm1
  movaps %xmm7,(%rsp)
  movaps %xmm1,0x70(%rsp)
  cmp    $0x3,%eax
  je     L314
  movdqu 0x30(%r8),%xmm5
  movdqa %xmm0,%xmm1
  psubb  %xmm5,%xmm1
  movaps %xmm5,(%rsp)
  movaps %xmm1,0x80(%rsp)
  cmp    $0x4,%eax
  je     L314
  movdqu 0x40(%r8),%xmm3
  movdqa %xmm0,%xmm1
  psubb  %xmm3,%xmm1
  movaps %xmm3,(%rsp)
  movaps %xmm1,0x90(%rsp)
  cmp    $0x5,%eax
  je     L314
  movdqu 0x50(%r8),%xmm7
  movdqa %xmm0,%xmm1
  psubb  %xmm7,%xmm1
  movaps %xmm7,(%rsp)
  movaps %xmm1,0xa0(%rsp)
  cmp    $0x6,%eax
  je     L314
  movdqu 0x60(%r8),%xmm4
  movdqa %xmm0,%xmm1
  psubb  %xmm4,%xmm1
  movaps %xmm4,(%rsp)
  movaps %xmm1,0xb0(%rsp)
  cmp    $0x7,%eax
  je     L314
  movdqu 0x70(%r8),%xmm6
  movdqa %xmm0,%xmm1
  psubb  %xmm6,%xmm1
  movaps %xmm6,(%rsp)
  movaps %xmm1,0xc0(%rsp)
  cmp    $0x8,%eax
  je     L314
  movdqu 0x80(%r8),%xmm5
  movdqa %xmm0,%xmm1
  psubb  %xmm5,%xmm1
  movaps %xmm5,(%rsp)
  movaps %xmm1,0xd0(%rsp)
  cmp    $0x9,%eax
  je     L314
  movdqu 0x90(%r8),%xmm7
  movdqa %xmm0,%xmm1
  psubb  %xmm7,%xmm1
  movaps %xmm7,(%rsp)
  movaps %xmm1,0xe0(%rsp)
  cmp    $0xa,%eax
  je     L314
  movdqu 0xa0(%r8),%xmm2
  movdqa %xmm0,%xmm1
  psubb  %xmm2,%xmm1
  movaps %xmm2,(%rsp)
  movaps %xmm1,0xf0(%rsp)
  cmp    $0xb,%eax
  je     L314
  movdqu 0xb0(%r8),%xmm6
  movdqa %xmm0,%xmm1
  psubb  %xmm6,%xmm1
  movaps %xmm6,(%rsp)
  movaps %xmm1,0x100(%rsp)
  cmp    $0xc,%eax
  je     L314
  movdqu 0xc0(%r8),%xmm2
  movdqa %xmm0,%xmm1
  psubb  %xmm2,%xmm1
  movaps %xmm2,(%rsp)
  movaps %xmm1,0x110(%rsp)
  cmp    $0xd,%eax
  je     L314
  movdqu 0xd0(%r8),%xmm4
  movdqa %xmm0,%xmm1
  psubb  %xmm4,%xmm1
  movaps %xmm4,(%rsp)
  movaps %xmm1,0x120(%rsp)
  cmp    $0xe,%eax
  je     L314
  movdqu 0xe0(%r8),%xmm6
  movdqa %xmm0,%xmm1
  psubb  %xmm6,%xmm1
  movaps %xmm6,(%rsp)
  movaps %xmm1,0x130(%rsp)
  cmp    $0xf,%eax
  je     L314
  movdqu 0xf0(%r8),%xmm2
  psubb  %xmm2,%xmm0
  movaps %xmm2,(%rsp)
  movaps %xmm0,0x140(%rsp)
  nopl   0x0(%rax)
L314:
  mov    %ebp,%eax
  and    $0xfffffff0,%eax
  test   $0xf,%bpl
  je     L55
L362:
  mov    %ebp,%edi
  sub    %eax,%edi
  lea    -0x1(%rdi),%edx
  cmp    $0x6,%edx
  jbe    L272
  mov    %ecx,%edx
  mov    0x10(%rsp),%rbx
  movzbl %cl,%esi
  mov    %eax,%r8d
  shl    $0x8,%edx
  or     %esi,%edx
  movq   (%rbx,%r8,1),%xmm1
  movd   %edx,%xmm2
  mov    %edi,%edx
  pshuflw $0x0,%xmm2,%xmm0
  and    $0xfffffff8,%edx
  psubb  %xmm1,%xmm0
  add    %edx,%eax
  movq   %xmm0,0x50(%rsp,%r8,1)
  cmp    %edx,%edi
  je     L55
L272:
  mov    0x10(%rsp),%rbx
  mov    %eax,%edx
  mov    %ecx,%esi
  sub    (%rbx,%rdx,1),%sil
  mov    %sil,0x50(%rsp,%rdx,1)
  lea    0x1(%rax),%edx
  cmp    %edx,%ebp
  jbe    L55
  mov    %ecx,%esi
  sub    (%rbx,%rdx,1),%sil
  mov    %sil,0x50(%rsp,%rdx,1)
  lea    0x2(%rax),%edx
  cmp    %edx,%ebp
  jbe    L55
  mov    %ecx,%esi
  sub    (%rbx,%rdx,1),%sil
  mov    %sil,0x50(%rsp,%rdx,1)
  lea    0x3(%rax),%edx
  cmp    %edx,%ebp
  jbe    L55
  mov    %ecx,%esi
  sub    (%rbx,%rdx,1),%sil
  mov    %sil,0x50(%rsp,%rdx,1)
  lea    0x4(%rax),%edx
  cmp    %edx,%ebp
  jbe    L55
  mov    %ecx,%esi
  sub    (%rbx,%rdx,1),%sil
  mov    %sil,0x50(%rsp,%rdx,1)
  lea    0x5(%rax),%edx
  cmp    %edx,%ebp
  jbe    L55
  mov    %ecx,%esi
  add    $0x6,%eax
  sub    (%rbx,%rdx,1),%sil
  mov    %sil,0x50(%rsp,%rdx,1)
  cmp    %eax,%ebp
  jbe    L55
  sub    (%rbx,%rax,1),%cl
  mov    %cl,0x50(%rsp,%rax,1)
L55:
  lea    0x150(%rsp),%r13
  lea    0x50(%rsp),%rbx
  mov    %ebp,%esi
  movl   $0x0,0x44(%rsp)
  lea    0x44(%rsp),%rcx
  mov    %r13,%rdx
  mov    %rbx,%rdi
  call   <redupe_find_errata_locator@plt>
  mov    %r12d,0x48(%rsp)
  test   %r12d,%r12d
  je     L139
  lea    -0x1(%r12),%eax
  lea    -0x1(%r12,%r14,1),%esi
  lea    0x1(%r14,%rax,1),%rdi
  mov    %r14,%rax
  nop
L146:
  movzbl (%rax),%ecx
  mov    %esi,%edx
  sub    %eax,%edx
  add    $0x1,%rax
  mov    %cl,0x250(%rsp,%rdx,1)
  cmp    %rdi,%rax
  jne    L146
L139:
  lea    0x250(%rsp),%rax
  mov    0x44(%rsp),%ecx
  mov    %r13,%rdx
  lea    0x350(%rsp),%r9
  mov    %r9,0x20(%rsp)
  sub    $0x8,%rsp
  mov    %rax,%rdi
  mov    %r12d,%esi
  movl   $0x0,0x54(%rsp)
  lea    -0x1(%rcx),%r8d
  mov    %rax,0x20(%rsp)
  lea    0x54(%rsp),%rax
  push   %rax
  call   <redupe_find_error_evaluator@plt>
  mov    0x5c(%rsp),%edx
  pop    %rax
  pop    %rcx
  mov    %edx,%eax
  shr    %eax
  je     L315
  mov    0x20(%rsp),%rcx
  sub    $0x1,%eax
  lea    0x351(%rsp,%rax,1),%r8
  lea    -0x1(%rdx,%rcx,1),%edi
  mov    %rcx,%rax
  nopl   0x0(%rax)
L3:
  mov    %edi,%edx
  movzbl (%rax),%ecx
  sub    %eax,%edx
  add    $0x1,%rax
  movzbl 0x350(%rsp,%rdx,1),%esi
  mov    %sil,-0x1(%rax)
  mov    %cl,0x350(%rsp,%rdx,1)
  cmp    %r8,%rax
  jne    L3
L315:
  mov    %ebp,%r12d
  xor    %r14d,%r14d
  lea    0x450(%rsp),%r13
  test   %ebp,%ebp
  je     L308
  nopl   0x0(%rax)
L12:
  movzbl (%rbx,%r14,1),%esi
  mov    $0x2,%edi
  sub    $0xff,%esi
  call   <redupe_gf_pow@plt>
  mov    %al,0x0(%r13,%r14,1)
  add    $0x1,%r14
  cmp    %r12,%r14
  jne    L12
  lea    0x550(%rsp),%rax
  mov    $0x100,%edx
  xor    %esi,%esi
  xor    %ebp,%ebp
  mov    %rax,%rdi
  mov    %rax,0x38(%rsp)
  call   <memset@plt>
  nopl   0x0(%rax)
L2:
  movzbl 0x0(%r13,%rbp,1),%eax
  xor    %r14d,%r14d
  mov    $0x1,%ebx
  mov    %eax,%edi
  mov    %eax,(%rsp)
  call   <redupe_gf_inv@plt>
  movzbl %al,%r15d
  nopl   0x0(%rax)
L202:
  cmp    %ebp,%r14d
  je     L264
  movzbl 0x0(%r13,%r14,1),%esi
  mov    %r15d,%edi
  call   <redupe_gf_mul@plt>
  mov    $0x1,%edi
  movzbl %al,%esi
  call   <redupe_gf_sub@plt>
  movzbl %bl,%edi
  movzbl %al,%esi
  call   <redupe_gf_mul@plt>
  mov    %eax,%ebx
L264:
  add    $0x1,%r14
  cmp    %r12,%r14
  jne    L202
  mov    0x4c(%rsp),%esi
  mov    0x20(%rsp),%rdx
  mov    %esi,0x48(%rsp)
  lea    -0x1(%rsi),%eax
  test   %esi,%esi
  je     L100
  nopw   0x0(%rax,%rax,1)
L329:
  movzbl (%rdx),%edi
  mov    %eax,%ecx
  add    $0x1,%rdx
  mov    %dil,0x250(%rsp,%rcx,1)
  sub    $0x1,%eax
  jae    L329
L100:
  mov    0x18(%rsp),%rdi
  mov    %r15d,%edx
  call   <redupe_gf_poly_eval@plt>
  mov    (%rsp),%edi
  mov    $0x1,%esi
  movzbl %al,%r15d
  call   <redupe_gf_pow@plt>
  mov    %r15d,%esi
  movzbl %al,%edi
  call   <redupe_gf_mul@plt>
  mov    0x10(%rsp),%rcx
  movzbl %bl,%esi
  movzbl %al,%edi
  movzbl (%rcx,%rbp,1),%r14d
  add    $0x1,%rbp
  call   <redupe_gf_div@plt>
  mov    %al,0x550(%rsp,%r14,1)
  cmp    %r12,%rbp
  jne    L2
L144:
  mov    0x2c(%rsp),%ebx
  mov    0x30(%rsp),%r14
  mov    0x18(%rsp),%r15
  mov    %ebx,%edx
  mov    %r14,%rsi
  mov    %ebx,0x48(%rsp)
  mov    %r15,%rdi
  call   <memmove@plt>
  mov    0x38(%rsp),%rdx
  mov    0x48(%rsp),%esi
  mov    %ebx,%ecx
  lea    0x48(%rsp),%r9
  mov    %r14,%r8
  mov    %r15,%rdi
  call   <redupe_gf_poly_add@plt>
  mov    0x658(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L128
  add    $0x668,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L308:
  lea    0x550(%rsp),%rax
  mov    $0x100,%edx
  xor    %esi,%esi
  mov    %rax,%rdi
  mov    %rax,0x38(%rsp)
  call   <memset@plt>
  jmp    L144
L187:
  xor    %eax,%eax
  jmp    L362
L128:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void redupe_correct_errata(unsigned char *msg, unsigned msg_sz, const unsigned char *synd, unsigned synd_sz, const unsigned char *err_pos, unsigned err_pos_sz) {
  unsigned char coef_pos[256];
  unsigned coef_pos_sz = err_pos_sz;
  for (unsigned i = 0; i < coef_pos_sz; ++i) {
    coef_pos[i] = msg_sz - 1 - err_pos[i];
  }
  unsigned char err_loc[256];
  unsigned err_loc_sz = 0;
  redupe_find_errata_locator(coef_pos, coef_pos_sz, err_loc, &err_loc_sz);
  unsigned char tmp[256];
  unsigned tmp_sz = synd_sz;
  for (unsigned i = 0; i < synd_sz; ++i) {
    tmp[synd_sz - i - 1] = synd[i];
  }
  unsigned char err_eval[256];
  unsigned err_eval_sz = 0;
  redupe_find_error_evaluator(tmp, tmp_sz, err_loc, err_loc_sz, err_loc_sz - 1, err_eval, &err_eval_sz);
  for (unsigned i = 0; i < err_eval_sz / 2; ++i) {
    unsigned char t = err_eval[i];
    err_eval[i] = err_eval[err_eval_sz - i - 1];
    err_eval[err_eval_sz - i - 1] = t;
  }
  unsigned char X[256];
  unsigned X_sz = coef_pos_sz;
  for (unsigned i = 0; i < coef_pos_sz; ++i) {
    int l = 255 - coef_pos[i];
    X[i] = redupe_gf_pow(2, -l);
  }
  unsigned char E[256];
  unsigned E_sz = msg_sz;
  memset(E, 0, sizeof(E));
  for (unsigned i = 0; i < X_sz; ++i) {
    unsigned char xinv = redupe_gf_inv(X[i]);
    unsigned char err_loc_prime = 1;
    for (unsigned j = 0; j < X_sz; ++j) {
      if (j == i) {
        continue;
      }
      unsigned char t = redupe_gf_mul(xinv, X[j]);
      t = redupe_gf_sub(1, t);
      err_loc_prime = redupe_gf_mul(err_loc_prime, t);
    }
    tmp_sz = err_eval_sz;
    for (unsigned j = 0; j < err_eval_sz; ++j) {
      tmp[tmp_sz - j - 1] = err_eval[j];
    }
    unsigned char y = redupe_gf_poly_eval(tmp, tmp_sz, xinv);
    y = redupe_gf_mul(redupe_gf_pow(X[i], 1), y);
    E[err_pos[i]] = redupe_gf_div(y, err_loc_prime);
  }
  tmp_sz = msg_sz;
  memmove(tmp, msg, msg_sz);
  redupe_gf_poly_add(tmp, tmp_sz, E, E_sz, msg, &tmp_sz);
}
```