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

```asm
<bpsconv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  mov    %r9d,%ebx
  mov    0x38(%rsp),%rdx
  sub    $0x1,%ebx
  mov    0x40(%rsp),%rax
  mov    %rcx,-0x20(%rsp)
  mov    %r8d,-0x14(%rsp)
  mov    %ebx,-0x18(%rsp)
  js     L50
  movslq %esi,%r8
  mov    %r8,%rcx
  neg    %rcx
  lea    0x0(,%rcx,8),%r14
  movslq %r9d,%rcx
  lea    0x0(,%rcx,8),%rbp
  add    %r8,%rcx
  mov    %r14,-0x10(%rsp)
  lea    0x0(,%rcx,8),%r8
  lea    -0x10(%rbp),%r10
  lea    -0x10(%r8),%rcx
  lea    -0x8(%rax,%rbp,1),%r15
  lea    (%rdx,%rcx,1),%rbx
  add    %rax,%rcx
  lea    (%rdx,%r10,1),%r11
  cmpl   $0x1,-0x18(%rsp)
  seta   %r13b
  cmp    $0xfffffffffffffff8,%r14
  setne  %r14b
  and    %r13d,%r14d
  cmp    %r15,%r11
  setne  %r13b
  and    %r14d,%r13d
  cmp    %r15,%rbx
  setne  %r14b
  test   %r14b,%r13b
  je     L49
  add    %rax,%r8
  cmp    %r8,%r11
  setae  %r8b
  add    %rdx,%rbp
  cmp    %rbp,%rcx
  setae  %bpl
  or     %r8b,%bpl
  je     L49
  mov    %r9d,%ebp
  add    %rax,%r10
  xor    %r8d,%r8d
  shr    %ebp
  neg    %rbp
  shl    $0x4,%rbp
  cs nopw 0x0(%rax,%rax,1)
L7:
  movupd (%rbx,%r8,1),%xmm4
  movups %xmm4,(%r11,%r8,1)
  movupd (%rcx,%r8,1),%xmm5
  movups %xmm5,(%r10,%r8,1)
  sub    $0x10,%r8
  cmp    %rbp,%r8
  jne    L7
  mov    -0x18(%rsp),%ecx
  mov    %r9d,%r8d
  and    $0xfffffffe,%r8d
  sub    %r8d,%ecx
  cmp    %r9d,%r8d
  je     L50
  lea    (%rsi,%rcx,1),%r8d
  movslq %ecx,%rcx
  movslq %r8d,%r8
  movsd  (%rdx,%r8,8),%xmm0
  movsd  %xmm0,(%rdx,%rcx,8)
  movsd  (%rax,%r8,8),%xmm0
  movsd  %xmm0,(%rax,%rcx,8)
L50:
  test   %esi,%esi
  jle    L40
  movslq -0x14(%rsp),%rcx
  mov    -0x20(%rsp),%r14
  xor    %ebx,%ebx
  xor    %ebp,%ebp
  shl    $0x3,%rcx
  lea    -0x10(%r12,%rcx,1),%r11
  lea    (%r12,%rcx,1),%r13
  add    %rcx,%r14
  mov    %r9d,%ecx
  shl    $0x4,%rcx
  sub    %rcx,%r11
  nopw   0x0(%rax,%rax,1)
L34:
  pxor   %xmm0,%xmm0
  test   %r9d,%r9d
  js     L36
  mov    %rbx,%r8
  mov    %r14,%r10
  pxor   %xmm0,%xmm0
  mov    %r13,%rcx
  xchg   %ax,%ax
L97:
  movsd  (%rdx,%r8,1),%xmm1
  movupd -0x8(%rcx),%xmm2
  sub    $0x10,%rcx
  sub    $0x10,%r10
  movupd 0x8(%r10),%xmm3
  unpcklpd %xmm1,%xmm1
  mulpd  %xmm2,%xmm1
  addpd  %xmm1,%xmm0
  movsd  (%rax,%r8,1),%xmm1
  add    $0x8,%r8
  unpcklpd %xmm1,%xmm1
  mulpd  %xmm3,%xmm1
  addpd  %xmm1,%xmm0
  cmp    %r11,%rcx
  jne    L97
L36:
  add    $0x1,%ebp
  movups %xmm0,(%rdi,%rbx,2)
  add    $0x8,%rbx
  cmp    %ebp,%esi
  jne    L34
L40:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L49:
  mov    -0x10(%rsp),%rbx
  mov    %rdx,%r10
  mov    %rax,%r8
  movslq -0x18(%rsp),%rcx
  sub    %rbx,%r10
  sub    %rbx,%r8
L71:
  movsd  (%r10,%rcx,8),%xmm0
  movsd  %xmm0,(%rdx,%rcx,8)
  movsd  (%r8,%rcx,8),%xmm0
  movsd  %xmm0,(%rax,%rcx,8)
  sub    $0x1,%rcx
  test   %ecx,%ecx
  jns    L71
  jmp    L50
```

assistant: ```c
void bpsconv(double *x_out, int lx, double *g0, double *g1, int lhm1, int lhhm1, double *x_inl, double *x_inh) {
  int i, j, ind, tj;
  double x0, x1;
  for (i = lhhm1 - 1; i > -1; i--) {
    x_inl[i] = x_inl[lx + i];
    x_inh[i] = x_inh[lx + i];
  }
  ind = 0;
  for (i = 0; i < (lx); i++) {
    x0 = 0;
    x1 = 0;
    tj = -2;
    for (j = 0; j <= lhhm1; j++) {
      tj += 2;
      x0 = x0 + x_inl[i + j] * g0[lhm1 - 1 - tj] + x_inh[i + j] * g1[lhm1 - 1 - tj];
      x1 = x1 + x_inl[i + j] * g0[lhm1 - tj] + x_inh[i + j] * g1[lhm1 - tj];
    }
    x_out[ind++] = x0;
    x_out[ind++] = x1;
  }
}
```