user: Converte this assembly snippet into its equivalent C code:

```asm
<rechac>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %ecx,-0x38(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L16
L9:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    0x4(%rax),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%ecx
  mov    -0x18(%rbp),%eax
  add    %ecx,%eax
  add    $0x1,%eax
  sar    %eax
  add    %edx,%eax
  add    $0x1,%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x10(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    0x8(%rax),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%ecx
  mov    -0x14(%rbp),%eax
  add    %ecx,%eax
  add    $0x1,%eax
  sar    %eax
  add    %edx,%eax
  lea    0x1(%rax),%edx
  mov    -0x10(%rbp),%rax
  add    $0x4,%rax
  sar    %edx
  mov    %edx,(%rax)
  mov    -0x10(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    0xc(%rax),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%ecx
  mov    -0x18(%rbp),%eax
  add    %ecx,%eax
  add    $0x1,%eax
  sar    %eax
  add    %edx,%eax
  lea    0x1(%rax),%edx
  mov    -0x10(%rbp),%rax
  add    $0x8,%rax
  sar    %edx
  mov    %edx,(%rax)
  mov    -0x10(%rbp),%rax
  add    $0xc,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    0x10(%rax),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%ecx
  mov    -0x14(%rbp),%eax
  add    %ecx,%eax
  add    $0x1,%eax
  sar    %eax
  add    %edx,%eax
  lea    0x1(%rax),%edx
  mov    -0x10(%rbp),%rax
  add    $0xc,%rax
  sar    %edx
  mov    %edx,(%rax)
  mov    -0x10(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    0x14(%rax),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%ecx
  mov    -0x18(%rbp),%eax
  add    %ecx,%eax
  add    $0x1,%eax
  sar    %eax
  add    %edx,%eax
  lea    0x1(%rax),%edx
  mov    -0x10(%rbp),%rax
  add    $0x10,%rax
  sar    %edx
  mov    %edx,(%rax)
  mov    -0x10(%rbp),%rax
  add    $0x14,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    0x18(%rax),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%ecx
  mov    -0x14(%rbp),%eax
  add    %ecx,%eax
  add    $0x1,%eax
  sar    %eax
  add    %edx,%eax
  lea    0x1(%rax),%edx
  mov    -0x10(%rbp),%rax
  add    $0x14,%rax
  sar    %edx
  mov    %edx,(%rax)
  mov    -0x10(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    0x1c(%rax),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%ecx
  mov    -0x18(%rbp),%eax
  add    %ecx,%eax
  add    $0x1,%eax
  sar    %eax
  add    %edx,%eax
  lea    0x1(%rax),%edx
  mov    -0x10(%rbp),%rax
  add    $0x18,%rax
  sar    %edx
  mov    %edx,(%rax)
  mov    -0x10(%rbp),%rax
  add    $0x1c,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%ecx
  mov    -0x14(%rbp),%eax
  add    %ecx,%eax
  add    $0x1,%eax
  sar    %eax
  add    %edx,%eax
  lea    0x1(%rax),%edx
  mov    -0x10(%rbp),%rax
  add    $0x1c,%rax
  sar    %edx
  mov    %edx,(%rax)
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x8(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x10(%rbp)
  addl   $0x1,-0x1c(%rbp)
L16:
  mov    -0x1c(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jl     L9
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void rechac(uint8_t *s, uint8_t *d, int lx2, int h) {
  uint8_t *dp = d, *sp = s;
  uint32_t s1, s2;
  int j;
  for (j = 0; j < h; ++j) {
    s1 = sp[0];
    dp[0] = (dp[0] + ((uint32_t)(s1 + (s2 = sp[1]) + 1) >> 1) + 1) >> 1;
    dp[1] = (dp[1] + ((uint32_t)(s2 + (s1 = sp[2]) + 1) >> 1) + 1) >> 1;
    dp[2] = (dp[2] + ((uint32_t)(s1 + (s2 = sp[3]) + 1) >> 1) + 1) >> 1;
    dp[3] = (dp[3] + ((uint32_t)(s2 + (s1 = sp[4]) + 1) >> 1) + 1) >> 1;
    dp[4] = (dp[4] + ((uint32_t)(s1 + (s2 = sp[5]) + 1) >> 1) + 1) >> 1;
    dp[5] = (dp[5] + ((uint32_t)(s2 + (s1 = sp[6]) + 1) >> 1) + 1) >> 1;
    dp[6] = (dp[6] + ((uint32_t)(s1 + (s2 = sp[7]) + 1) >> 1) + 1) >> 1;
    dp[7] = (dp[7] + ((uint32_t)(s2 + sp[8] + 1) >> 1) + 1) >> 1;
    sp += lx2;
    dp += lx2;
  }
}
```