user: What would the C source look like for the assembly code provided here?

```asm
<pmesh_get_invariant_index>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r12
  push   %rbx
  sub    $0xc0,%rsp
  mov    %edi,-0x94(%rbp)
  mov    %rsi,-0xa0(%rbp)
  mov    %edx,-0x98(%rbp)
  mov    %ecx,-0xa4(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x28(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%r12
  mov    -0xa0(%rbp),%rdx
  mov    -0x94(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <absmax@plt>
  mov    %eax,-0x64(%rbp)
  cmpl   $0x0,-0x64(%rbp)
  jne    L301
  mov    $0x0,%eax
  jmp    L83
L301:
  mov    -0x64(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  mov    %eax,-0x60(%rbp)
  movl   $0x0,-0x84(%rbp)
  movl   $0x0,-0x80(%rbp)
  movl   $0x0,-0x7c(%rbp)
  movl   $0x0,-0x78(%rbp)
  movl   $0x0,-0x88(%rbp)
  jmp    L252
L261:
  mov    -0x88(%rbp),%eax
  mov    -0x98(%rbp),%edx
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L115
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jns    L115
  mov    $0xffffffff,%eax
  jmp    L83
L115:
  addl   $0x1,-0x88(%rbp)
L252:
  mov    -0x88(%rbp),%eax
  cmp    -0x94(%rbp),%eax
  jl     L261
  mov    -0x94(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x48(%rbp)
  movslq %eax,%rdx
  mov    %rdx,-0xc0(%rbp)
  movq   $0x0,-0xb8(%rbp)
  movslq %eax,%rdx
  mov    %rdx,-0xd0(%rbp)
  movq   $0x0,-0xc8(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L217:
  cmp    %rdx,%rsp
  je     L368
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L217
L368:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L148
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L148:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x40(%rbp)
  movl   $0x0,-0x74(%rbp)
  movl   $0x0,-0x70(%rbp)
  movl   $0x0,-0x88(%rbp)
  jmp    L259
L8:
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%edx
  neg    %edx
  cmovns %edx,%eax
  cmp    %eax,-0x64(%rbp)
  jne    L223
  mov    -0x88(%rbp),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  or     %eax,-0x7c(%rbp)
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  shr    $0x1f,%eax
  movzbl %al,%edx
  mov    -0x88(%rbp),%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  or     %eax,-0x78(%rbp)
  jmp    L40
L223:
  mov    -0x88(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  mov    -0x40(%rbp),%rax
  mov    -0x70(%rbp),%edx
  movslq %edx,%rdx
  mov    %ecx,(%rax,%rdx,4)
  mov    -0x88(%rbp),%eax
  mov    -0x98(%rbp),%edx
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  and    $0x1,%eax
  mov    %eax,%edx
  mov    -0x70(%rbp),%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  or     %eax,-0x74(%rbp)
  addl   $0x1,-0x70(%rbp)
L40:
  addl   $0x1,-0x88(%rbp)
L259:
  mov    -0x88(%rbp),%eax
  cmp    -0x94(%rbp),%eax
  jl     L8
  mov    -0x94(%rbp),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x5c(%rbp)
  mov    -0x94(%rbp),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x58(%rbp)
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x38(%rbp)
  movslq %eax,%rdx
  mov    %rdx,-0xe0(%rbp)
  movq   $0x0,-0xd8(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L126:
  cmp    %rdx,%rsp
  je     L310
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L126
L310:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L78
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L78:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x5c(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movl   $0x0,-0x6c(%rbp)
  jmp    L68
L345:
  movl   $0x0,-0x80(%rbp)
  jmp    L218
L271:
  mov    -0x80(%rbp),%eax
  not    %eax
  and    -0x6c(%rbp),%eax
  test   %eax,%eax
  jne    L137
  mov    -0x6c(%rbp),%eax
  and    -0x98(%rbp),%eax
  test   %eax,%eax
  jne    L263
  mov    -0x6c(%rbp),%eax
  cmp    -0x78(%rbp),%eax
  jne    L37
  mov    -0x80(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jne    L37
  movl   $0xffffffff,-0x68(%rbp)
  cmpl   $0x0,-0xa4(%rbp)
  js     L211
  mov    -0xa4(%rbp),%eax
  sub    -0x84(%rbp),%eax
  mov    %eax,-0x68(%rbp)
L211:
  mov    -0x68(%rbp),%ecx
  mov    -0x74(%rbp),%edx
  mov    -0x40(%rbp),%rsi
  mov    -0x70(%rbp),%eax
  mov    %eax,%edi
  call   <pmesh_get_invariant_index>
  mov    %eax,-0x54(%rbp)
  cmpl   $0xffffffff,-0x54(%rbp)
  jne    L280
  mov    $0xffffffff,%eax
  jmp    L83
L280:
  mov    -0x54(%rbp),%eax
  add    %eax,-0x84(%rbp)
  cmpl   $0x0,-0xa4(%rbp)
  js     L142
  mov    -0x84(%rbp),%eax
  cmp    -0xa4(%rbp),%eax
  jl     L142
  mov    $0xffffffff,%eax
  jmp    L83
L142:
  mov    -0x84(%rbp),%eax
  jmp    L83
L37:
  mov    -0x30(%rbp),%rax
  mov    -0x80(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  test   %eax,%eax
  jne    L346
  mov    -0x80(%rbp),%eax
  mov    %eax,%edi
  call   <get_nbits@plt>
  mov    %eax,-0x50(%rbp)
  mov    -0x80(%rbp),%eax
  not    %eax
  and    -0x98(%rbp),%eax
  mov    %eax,%edi
  call   <get_nbits@plt>
  mov    %eax,-0x4c(%rbp)
  mov    -0x94(%rbp),%eax
  sub    -0x50(%rbp),%eax
  sub    -0x4c(%rbp),%eax
  mov    -0x60(%rbp),%edx
  sub    $0x2,%edx
  mov    %eax,%esi
  mov    %edx,%edi
  call   <ipow@plt>
  mov    %eax,%ebx
  mov    -0x4c(%rbp),%edx
  mov    -0x64(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <ipow@plt>
  imul   %eax,%ebx
  mov    %ebx,%ecx
  mov    -0x30(%rbp),%rax
  mov    -0x80(%rbp),%edx
  movslq %edx,%rdx
  mov    %ecx,(%rax,%rdx,4)
L346:
  mov    -0x30(%rbp),%rax
  mov    -0x80(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  add    %eax,-0x84(%rbp)
  cmpl   $0x0,-0xa4(%rbp)
  js     L200
  mov    -0x84(%rbp),%eax
  cmp    -0xa4(%rbp),%eax
  jl     L200
  mov    $0xffffffff,%eax
  jmp    L83
L137:
  nop
  jmp    L200
L263:
  nop
L200:
  addl   $0x1,-0x80(%rbp)
L218:
  mov    -0x80(%rbp),%eax
  cmp    -0x5c(%rbp),%eax
  jl     L271
  addl   $0x1,-0x6c(%rbp)
L68:
  mov    -0x6c(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jl     L345
  mov    $0xffffffff,%eax
L83:
  mov    %r12,%rsp
  mov    -0x28(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L62
  call   <__stack_chk_fail@plt>
L62:
  lea    -0x20(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
ptrdiff_t pmesh_get_invariant_index(int ndim, const ptrdiff_t x[], const uint32_t cmask, ptrdiff_t max_length) {
  int d;
  ptrdiff_t shell = absmax(ndim, x);
  if (shell == 0)
    return 0;
  ptrdiff_t side = shell * 2 + 1;
  ptrdiff_t ind = 0;
  uint32_t icapset = 0;
  uint32_t icapset_x = 0;
  uint32_t icap_x = 0;
  for (d = 0; d < ndim; d++) {
    if ((cmask & (1 << d)) && x[d] < 0) {
      return -1;
    }
  }
  ptrdiff_t x1[ndim];
  uint32_t cmask1 = 0;
  int ndim1;
  for (ndim1 = 0, d = 0; d < ndim; d++) {
    if (abs(x[d]) == shell) {
      icapset_x |= (1 << d);
      icap_x |= (x[d] < 0) * (1 << d);
    } else {
      x1[ndim1] = x[d];
      cmask1 |= (1 << ndim1) * ((cmask >> d) & 1);
      ndim1++;
    }
  }
  int ncapsets = 1 << ndim;
  int ncapsmax = 1 << ndim;
  int icap;
  ptrdiff_t size[ncapsets];
  memset(size, 0, sizeof(size[0]) * ncapsets);
  for (icap = 0; icap < ncapsmax; icap++) {
    for (icapset = 0; icapset < ncapsets; icapset++) {
      if (icap & ~icapset)
        continue;
      if (icap & cmask)
        continue;
      if (icap == icap_x && icapset == icapset_x) {
        ptrdiff_t max_length1 = -1;
        if (max_length >= 0) {
          max_length1 = max_length - ind;
        }
        ptrdiff_t subind = pmesh_get_invariant_index(ndim1, x1, cmask1, max_length1);
        if (subind == -1) {
          return -1;
        }
        ind += subind;
        if (max_length >= 0 && ind >= max_length) {
          return -1;
        }
        return ind;
      }
      if (size[icapset] == 0) {
        int n = get_nbits(icapset);
        int nhalf = get_nbits(cmask & ~icapset);
        size[icapset] = ipow(side - 2, ndim - n - nhalf) * ipow(shell, nhalf);
      }
      ind += size[icapset];
      if (max_length >= 0 && ind >= max_length) {
        return -1;
      }
    }
  }
  return -1;
}
```