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

```asm
<rbitrev>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    -0x40000(%rsp),%r11
L1:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L1
  sub    $0x790,%rsp
  mov    %rdi,-0x40788(%rbp)
  mov    %esi,-0x4078c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x4078c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x4077c(%rbp)
  mov    -0x4077c(%rbp),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x40760(%rbp)
  mov    -0x4077c(%rbp),%eax
  add    %eax,%eax
  cmp    %eax,-0x4078c(%rbp)
  je     L14
  addl   $0x1,-0x4077c(%rbp)
L14:
  movl   $0x0,-0x4074c(%rbp)
  movl   $0x1,-0x40748(%rbp)
  movl   $0x1,-0x40778(%rbp)
  movl   $0x2,-0x40774(%rbp)
  jmp    L2
L74:
  shll   -0x40778(%rbp)
  movl   $0x1,-0x40770(%rbp)
  jmp    L52
L89:
  mov    -0x40770(%rbp),%eax
  cltq
  mov    -0x40750(%rbp,%rax,4),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x40770(%rbp),%eax
  cltq
  mov    %edx,-0x40750(%rbp,%rax,4)
  mov    -0x40770(%rbp),%eax
  cltq
  mov    -0x40750(%rbp,%rax,4),%eax
  mov    -0x40770(%rbp),%ecx
  mov    -0x40778(%rbp),%edx
  add    %edx,%ecx
  lea    0x1(%rax),%edx
  movslq %ecx,%rax
  mov    %edx,-0x40750(%rbp,%rax,4)
  addl   $0x1,-0x40770(%rbp)
L52:
  mov    -0x40770(%rbp),%eax
  cmp    -0x40778(%rbp),%eax
  jle    L89
  addl   $0x1,-0x40774(%rbp)
L2:
  mov    -0x40774(%rbp),%eax
  cmp    -0x4077c(%rbp),%eax
  jle    L74
  movl   $0x2,-0x40768(%rbp)
  jmp    L49
L103:
  mov    -0x40768(%rbp),%eax
  cltq
  mov    -0x40750(%rbp,%rax,4),%eax
  imul   -0x40760(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x4075c(%rbp)
  mov    -0x40768(%rbp),%eax
  mov    %eax,-0x40770(%rbp)
  mov    -0x4075c(%rbp),%eax
  mov    %eax,-0x4076c(%rbp)
  movl   $0x2,-0x40764(%rbp)
  jmp    L94
L3:
  mov    -0x40770(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40788(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x40758(%rbp)
  mov    -0x4076c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40788(%rbp),%rax
  add    %rax,%rdx
  mov    -0x40770(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x40788(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x4076c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40788(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x40758(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x40760(%rbp),%eax
  add    %eax,-0x40770(%rbp)
  mov    -0x40764(%rbp),%eax
  cltq
  mov    -0x40750(%rbp,%rax,4),%edx
  mov    -0x4075c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x4076c(%rbp)
  addl   $0x1,-0x40764(%rbp)
L94:
  mov    -0x40768(%rbp),%eax
  cltq
  mov    -0x40750(%rbp,%rax,4),%eax
  add    $0x1,%eax
  cmp    %eax,-0x40764(%rbp)
  jle    L3
  addl   $0x1,-0x40768(%rbp)
L49:
  mov    -0x40768(%rbp),%eax
  cmp    -0x40760(%rbp),%eax
  jle    L103
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L58
  call   <__stack_chk_fail@plt>
L58:
  leave
  ret
```

assistant: ```c
void rbitrev(x, m) double *x;
int m;
{
  int itab[66000];
  int m2, nbit, imax, lbss, i, j, k, l, j0;
  double t1;
  m2 = m / 2;
  nbit = 1 << m2;
  if (2 * m2 != m)
    m2 = m2 + 1;
  itab[1] = 0;
  itab[2] = 1;
  imax = 1;
  for (lbss = 2; lbss <= m2; lbss++) {
    imax = 2 * imax;
    for (i = 1; i <= imax; i++) {
      itab[i] = 2 * itab[i];
      itab[i + imax] = 1 + itab[i];
    }
  }
  for (k = 2; k <= nbit; k++) {
    j0 = nbit * itab[k] + 1;
    i = k;
    j = j0;
    for (l = 2; l <= itab[k] + 1; l++) {
      t1 = x[i];
      x[i] = x[j];
      x[j] = t1;
      i = i + nbit;
      j = j0 + itab[l];
    }
  }
  return;
}
```