user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<predictor_decompress_fir_adapt>:
  endbr64
  push   %r15
  mov    %rsi,%rax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    (%rdi),%edi
  mov    0x38(%rsp),%ebp
  mov    %edi,(%rsi)
  test   %r9d,%r9d
  jne    L12
  cmp    $0x1,%edx
  jg     L161
L4:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L12:
  mov    %ecx,%esi
  cmp    $0x1f,%r9d
  je     L59
  test   %r9d,%r9d
  jle    L4
  mov    $0x20,%r14d
  lea    -0x1(%r9),%esi
  mov    %r9d,%r11d
  mov    $0x1,%r10d
  sub    %ecx,%r14d
  mov    %rsi,%r13
  mov    %r14d,%ecx
  jmp    L132
  nopw   0x0(%rax,%rax,1)
L116:
  add    $0x1,%r10
L132:
  add    (%rbx,%r10,4),%edi
  shl    %cl,%edi
  sar    %cl,%edi
  mov    %edi,(%rax,%r10,4)
  cmp    %r10,%r11
  jne    L116
  mov    %ecx,%r14d
  lea    0x1(%r9),%ecx
  cmp    %edx,%ecx
  jge    L4
  lea    -0x1(%rbp),%ecx
  mov    $0x1,%edi
  lea    0x4(%rax),%r10
  sub    $0x2,%edx
  shl    %cl,%edi
  sub    %r9d,%edx
  lea    0x4(%r8,%rsi,4),%r11
  movslq %r9d,%rcx
  lea    0x4(,%rcx,4),%r15
  lea    0x8(%rax,%rdx,4),%rax
  mov    %edi,-0x10(%rsp)
  mov    %rax,-0x20(%rsp)
  lea    -0x8(%r15),%rax
  add    %r15,%rbx
  mov    %rax,-0x18(%rsp)
  lea    -0x2(%r9),%eax
  mov    %eax,-0xc(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L143:
  mov    -0x18(%rsp),%rax
  mov    (%rbx),%esi
  mov    %r8,%rdx
  xor    %ecx,%ecx
  mov    -0x4(%r10),%edi
  lea    (%rax,%r10,1),%r9
  nopl   0x0(%rax)
L174:
  mov    (%r9),%eax
  add    $0x4,%rdx
  sub    $0x4,%r9
  sub    %edi,%eax
  imul   -0x4(%rdx),%eax
  add    %eax,%ecx
  cmp    %rdx,%r11
  jne    L174
  mov    -0x10(%rsp),%eax
  add    %ecx,%eax
  mov    %ebp,%ecx
  sar    %cl,%eax
  mov    %r14d,%ecx
  add    %edi,%eax
  add    %esi,%eax
  shl    %cl,%eax
  sar    %cl,%eax
  mov    %eax,-0x4(%r10,%r15,1)
  test   %esi,%esi
  jg     L90
  jne    L13
L171:
  add    $0x4,%r10
  add    $0x4,%rbx
  cmp    %r10,-0x20(%rsp)
  jne    L143
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L161:
  lea    0x4(%rbx),%rsi
  lea    -0x4(,%rdx,4),%edx
  pop    %rbx
  pop    %rbp
  lea    0x4(%rax),%rdi
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1050 <memcpy@plt>
  cs nopw 0x0(%rax,%rax,1)
L59:
  cmp    $0x1,%edx
  jle    L4
  mov    $0x20,%ecx
  sub    %esi,%ecx
  lea    -0x1(%rdx),%esi
  mov    $0x1,%edx
  jmp    L184
  nopw   0x0(%rax,%rax,1)
L7:
  add    $0x1,%rdx
L184:
  add    (%rbx,%rdx,4),%edi
  shl    %cl,%edi
  sar    %cl,%edi
  mov    %edi,(%rax,%rdx,4)
  cmp    %rsi,%rdx
  jne    L7
  jmp    L4
  nopl   0x0(%rax,%rax,1)
L90:
  movslq -0xc(%rsp),%rdx
  mov    %r10,%rdi
  mov    %ebp,%ecx
  nopw   0x0(%rax,%rax,1)
L88:
  mov    -0x4(%r10),%ebp
  mov    %r13d,%r9d
  sub    (%rdi),%ebp
  xor    %eax,%eax
  sub    %edx,%r9d
  test   %ebp,%ebp
  mov    $0xffffffff,%r12d
  setg   %al
  cmovs  %r12d,%eax
  sub    %eax,0x4(%r8,%rdx,4)
  imul   %ebp,%eax
  sar    %cl,%eax
  imul   %r9d,%eax
  sub    %eax,%esi
  mov    %edx,%eax
  not    %eax
  shr    $0x1f,%eax
  test   %esi,%esi
  setg   %r9b
  sub    $0x1,%rdx
  add    $0x4,%rdi
  test   %al,%r9b
  jne    L88
  mov    %ecx,%ebp
  jmp    L171
  xchg   %ax,%ax
L13:
  movslq -0xc(%rsp),%rdx
  mov    %r10,%rdi
  mov    %ebp,%ecx
  nopw   0x0(%rax,%rax,1)
L73:
  mov    -0x4(%r10),%eax
  mov    %r13d,%r9d
  sub    (%rdi),%eax
  mov    $0x1,%ebp
  sub    %edx,%r9d
  test   %eax,%eax
  js     L68
  setg   %bpl
  movzbl %bpl,%ebp
  neg    %ebp
  imul   %ebp,%eax
L68:
  sar    %cl,%eax
  sub    %ebp,0x4(%r8,%rdx,4)
  add    $0x4,%rdi
  imul   %r9d,%eax
  sub    %eax,%esi
  mov    %esi,%eax
  not    %eax
  or     %edx,%eax
  sub    $0x1,%rdx
  test   %eax,%eax
  jns    L73
  mov    %ecx,%ebp
  jmp    L171
```

assistant: ```c
void predictor_decompress_fir_adapt(int32_t *error_buffer, int32_t *buffer_out, int output_size, int readsamplesize, int16_t *predictor_coef_table, int predictor_coef_num, int predictor_quantitization) {
  int i;
  *buffer_out = *error_buffer;
  if (!predictor_coef_num) {
    if (output_size <= 1)
      return;
    memcpy(buffer_out + 1, error_buffer + 1, (output_size - 1) * 4);
    return;
  }
  if (predictor_coef_num == 0x1f) {
    if (output_size <= 1)
      return;
    for (i = 0; i < output_size - 1; i++) {
      int32_t prev_value;
      int32_t error_value;
      prev_value = buffer_out[i];
      error_value = error_buffer[i + 1];
      buffer_out[i + 1] = (((prev_value + error_value) << (32 - readsamplesize)) >> (32 - readsamplesize));
    }
    return;
  }
  if (predictor_coef_num > 0) {
    int i;
    for (i = 0; i < predictor_coef_num; i++) {
      int32_t val;
      val = buffer_out[i] + error_buffer[i + 1];
      val = ((val << (32 - readsamplesize)) >> (32 - readsamplesize));
      buffer_out[i + 1] = val;
    }
  }
  if (predictor_coef_num > 0) {
    for (i = predictor_coef_num + 1; i < output_size; i++) {
      int j;
      int sum = 0;
      int outval;
      int error_val = error_buffer[i];
      for (j = 0; j < predictor_coef_num; j++) {
        sum += (buffer_out[predictor_coef_num - j] - buffer_out[0]) * predictor_coef_table[j];
      }
      outval = (1 << (predictor_quantitization - 1)) + sum;
      outval = outval >> predictor_quantitization;
      outval = outval + buffer_out[0] + error_val;
      outval = ((outval << (32 - readsamplesize)) >> (32 - readsamplesize));
      buffer_out[predictor_coef_num + 1] = outval;
      if (error_val > 0) {
        int predictor_num = predictor_coef_num - 1;
        while (predictor_num >= 0 && error_val > 0) {
          int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
          int sign = ((val < 0) ? (-1) : ((val > 0) ? (1) : (0)));
          predictor_coef_table[predictor_num] -= sign;
          val *= sign;
          error_val -= ((val >> predictor_quantitization) * (predictor_coef_num - predictor_num));
          predictor_num--;
        }
      } else if (error_val < 0) {
        int predictor_num = predictor_coef_num - 1;
        while (predictor_num >= 0 && error_val < 0) {
          int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
          int sign = -((val < 0) ? (-1) : ((val > 0) ? (1) : (0)));
          predictor_coef_table[predictor_num] -= sign;
          val *= sign;
          error_val -= ((val >> predictor_quantitization) * (predictor_coef_num - predictor_num));
          predictor_num--;
        }
      }
      buffer_out++;
    }
  }
}
```