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

```asm
<redupe_correct_msg>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x448,%rsp
  mov    %rdi,%rbp
  mov    %esi,%r12d
  mov    %edx,%r13d
  mov    %rcx,%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x438(%rsp)
  xor    %eax,%eax
  lea    (%rsi,%rdx,1),%r15d
  cmp    $0xff,%r15d
  setbe  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  movl   $0x0,0x24(%rsp)
  movl   $0x0,0x28(%rsp)
  movl   $0x0,0x2c(%rsp)
  test   %r12d,%r12d
  je     L66
  mov    %r12d,%ecx
  mov    $0x0,%eax
L76:
  movzbl 0x0(%rbp,%rax,1),%edx
  mov    %dl,0x30(%rsp,%rax,1)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L76
L66:
  test   %r13d,%r13d
  je     L17
  lea    -0x1(%r13),%eax
  lea    0x1(%r14,%rax,1),%rdi
  mov    %r14,%rax
  mov    %r12d,%esi
  sub    %r14d,%esi
L5:
  lea    (%rsi,%rax,1),%edx
  movzbl (%rax),%ecx
  mov    %cl,0x30(%rsp,%rdx,1)
  add    $0x1,%rax
  cmp    %rdi,%rax
  jne    L5
L17:
  lea    0x130(%rsp),%rcx
  lea    0x30(%rsp),%rdi
  lea    0x24(%rsp),%r8
  mov    %r13d,%edx
  mov    %r15d,%esi
  call   <redupe_calc_syndromes@plt>
  mov    0x24(%rsp),%edi
  test   %edi,%edi
  je     L22
  lea    0x130(%rsp),%rbx
  lea    0x131(%rsp),%rax
  mov    %rax,0x8(%rsp)
  lea    -0x1(%rdi),%esi
  add    %rax,%rsi
  mov    %rbx,%rax
  mov    $0x0,%edx
L71:
  movzbl (%rax),%ecx
  add    %ecx,%edx
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L71
  mov    $0x0,%eax
  test   %edx,%edx
  je     L169
  lea    0x230(%rsp),%rcx
  lea    0x130(%rsp),%rax
  lea    0x28(%rsp),%r8
  mov    %r13d,%edx
  mov    %edi,%esi
  mov    %rax,%rdi
  call   <redupe_find_error_locator@plt>
  test   %rax,%rax
  js     L162
  mov    0x28(%rsp),%r9d
  mov    %r9d,%r8d
  shr    %r8d
  cmp    $0x1,%r9d
  jbe    L184
  lea    0x230(%rsp),%rdx
  mov    $0x0,%eax
  lea    -0x1(%r9),%r10d
L46:
  movzbl (%rdx),%esi
  mov    %r10d,%ecx
  sub    %eax,%ecx
  movzbl 0x230(%rsp,%rcx,1),%edi
  mov    %dil,(%rdx)
  mov    %sil,0x230(%rsp,%rcx,1)
  add    $0x1,%eax
  add    $0x1,%rdx
  cmp    %r8d,%eax
  jb     L46
L184:
  lea    0x330(%rsp),%rcx
  lea    0x230(%rsp),%rdi
  lea    0x2c(%rsp),%r8
  mov    %r15d,%edx
  mov    %r9d,%esi
  call   <redupe_find_errors@plt>
  test   %rax,%rax
  js     L87
  lea    0x130(%rsp),%rax
  lea    0x30(%rsp),%rdi
  mov    0x2c(%rsp),%r9d
  lea    0x330(%rsp),%r8
  mov    0x24(%rsp),%ecx
  mov    %rax,0x10(%rsp)
  mov    %rax,%rdx
  mov    %r15d,%esi
  mov    %rdi,0x18(%rsp)
  call   <redupe_correct_errata@plt>
  lea    0x24(%rsp),%r8
  mov    0x10(%rsp),%rcx
  mov    %r13d,%edx
  mov    %r15d,%esi
  mov    0x18(%rsp),%rdi
  call   <redupe_calc_syndromes@plt>
  mov    0x24(%rsp),%eax
  test   %eax,%eax
  je     L178
  lea    -0x1(%rax),%ecx
  add    0x8(%rsp),%rcx
  mov    $0x0,%eax
L51:
  movzbl (%rbx),%edx
  add    %edx,%eax
  add    $0x1,%rbx
  cmp    %rbx,%rcx
  jne    L51
  test   %eax,%eax
  jne    L84
L178:
  lea    0x30(%rsp),%rbx
  mov    %r12d,%edx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <memmove@plt>
  mov    %r12d,%r12d
  lea    (%rbx,%r12,1),%rsi
  mov    %r13d,%edx
  mov    %r14,%rdi
  call   <memmove@plt>
  mov    $0x0,%eax
L169:
  mov    0x438(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L120
  add    $0x448,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L22:
  mov    $0x0,%eax
  jmp    L169
L162:
  mov    $0xffffffff,%eax
  jmp    L169
L87:
  mov    $0xffffffff,%eax
  jmp    L169
L84:
  mov    $0xffffffff,%eax
  jmp    L169
L120:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
__attribute__((visibility("default"))) int redupe_correct_msg(unsigned char *msg, unsigned msg_sz, unsigned nsym, unsigned char *code) {
  assert(msg_sz + nsym < 256);
  unsigned char buf[256];
  const unsigned buf_sz = msg_sz + nsym;
  unsigned char synd[256];
  unsigned synd_sz = 0;
  unsigned synd_sum = 0;
  unsigned char err_loc[256];
  unsigned err_loc_sz = 0;
  unsigned char err_pos[256];
  unsigned err_pos_sz = 0;
  for (unsigned i = 0; i < msg_sz; ++i) {
    buf[i] = msg[i];
  }
  for (unsigned i = 0; i < nsym; ++i) {
    buf[msg_sz + i] = code[i];
  }
  redupe_calc_syndromes(buf, buf_sz, nsym, synd, &synd_sz);
  for (unsigned i = 0; i < synd_sz; ++i) {
    synd_sum += synd[i];
  }
  if (synd_sum == 0) {
    return 0;
  }
  if (redupe_find_error_locator(synd, synd_sz, nsym, err_loc, &err_loc_sz) < 0) {
    return -1;
  }
  for (unsigned i = 0; i < err_loc_sz / 2; ++i) {
    unsigned char tmp = err_loc[i];
    err_loc[i] = err_loc[err_loc_sz - i - 1];
    err_loc[err_loc_sz - i - 1] = tmp;
  }
  if (redupe_find_errors(err_loc, err_loc_sz, buf_sz, err_pos, &err_pos_sz) < 0) {
    return -1;
  }
  redupe_correct_errata(buf, buf_sz, synd, synd_sz, err_pos, err_pos_sz);
  redupe_calc_syndromes(buf, buf_sz, nsym, synd, &synd_sz);
  synd_sum = 0;
  for (unsigned i = 0; i < synd_sz; ++i) {
    synd_sum += synd[i];
  }
  if (synd_sum != 0) {
    return -1;
  }
  memmove(msg, buf, msg_sz);
  memmove(code, buf + msg_sz, nsym);
  return 0;
}
```