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

```asm
<test>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,0x18(%rsp)
  cmp    $0x1,%edi
  jg     L103
L118:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L103:
  mov    %edi,%ebx
  mov    $0x1,%edi
  call   <hash@plt>
  mov    $0x1,%edi
  call   <hash@plt>
  mov    $0x0,%edi
  call   <hash@plt>
  mov    $0x0,%edi
  call   <hash@plt>
  lea    -0x1(%rbx),%eax
  mov    %eax,0x10(%rsp)
  add    %eax,%eax
  mov    %eax,0x1c(%rsp)
  mov    $0x2,%eax
  sub    %ebx,%eax
  mov    %eax,0xc(%rsp)
  movl   $0x2,0x8(%rsp)
  jmp    L22
L112:
  mov    $0x2,%edi
  call   <hash@plt>
  mov    %r15d,%edi
  sub    %ebx,%edi
  call   <hash@plt>
  mov    0x4(%rsp),%eax
  lea    (%rax,%rbx,1),%edi
  call   <hash@plt>
  mov    %ebx,%edi
  call   <hash@plt>
  add    $0x1,%ebx
L78:
  cmp    %r14d,%ebx
  jle    L112
  add    $0x1,%r12d
  sub    $0x1,%ebp
  addl   $0x1,0x4(%rsp)
  je     L48
L44:
  mov    0x14(%rsp),%eax
  lea    0x1(%rax),%ebx
  mov    0x10(%rsp),%eax
  cmp    %eax,%r12d
  mov    %eax,%r13d
  cmovle %r12d,%r13d
  cmp    %r13d,%ebx
  jg     L116
L66:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  call   <hash@plt>
  mov    %r12d,%edi
  sub    %ebx,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  add    $0x1,%ebx
  cmp    %r13d,%ebx
  jle    L66
L116:
  mov    0xc(%rsp),%eax
  lea    0x1(%rax),%ebx
  cmp    %ebp,%ebx
  cmovl  %ebp,%ebx
  jmp    L78
L48:
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  mov    $0x0,%ebx
  cmovns %eax,%ebx
  add    $0x1,%ebx
  mov    0x8(%rsp),%eax
  cmp    %eax,0x18(%rsp)
  mov    %eax,%ebp
  cmovle 0x10(%rsp),%ebp
  jmp    L50
L70:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  call   <hash@plt>
  mov    0x8(%rsp),%edi
  sub    %ebx,%edi
  call   <hash@plt>
  mov    $0x0,%edi
  call   <hash@plt>
  add    $0x1,%ebx
L50:
  cmp    %ebp,%ebx
  jle    L70
  addl   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%eax
  addl   $0x1,0xc(%rsp)
  cmp    %eax,0x1c(%rsp)
  jl     L118
L22:
  mov    0x18(%rsp),%ebx
  mov    0x8(%rsp),%ecx
  mov    $0x1,%eax
  sub    %ebx,%eax
  mov    $0x1,%edx
  sub    %ecx,%edx
  cmp    %ecx,%ebx
  cmovge %edx,%eax
  mov    %eax,%esi
  mov    %eax,0x4(%rsp)
  test   %eax,%eax
  jns    L48
  mov    %ecx,%r15d
  lea    -0x1(%rcx),%r14d
  cmp    %ecx,%ebx
  cmovle 0x10(%rsp),%r14d
  mov    %eax,%r12d
  add    %ecx,%r12d
  neg    %esi
  mov    %esi,%ebp
  mov    0xc(%rsp),%edx
  test   %edx,%edx
  mov    $0x0,%eax
  cmovns %edx,%eax
  mov    %eax,0x14(%rsp)
  jmp    L44
```

assistant: ```c
void test(int M) {
  int c2, c4, c6;
  int i, j, k;
  if (M >= 2) {
    {
      hash(1);
      hash(1);
      hash(0);
      hash(0);
    };
  }
  for (c2 = 2; c2 <= 2 * M - 2; c2++) {
    for (c4 = ((-M + 1) > (-c2 + 1) ? (-M + 1) : (-c2 + 1)); c4 <= -1; c4++) {
      for (i = ((1) > (c2 - M + 1) ? (1) : (c2 - M + 1)); i <= ((c2 + c4) < (M - 1) ? (c2 + c4) : (M - 1)); i++) {
        j = c2 + c4 - i;
        {
          hash(1);
          hash(i);
          hash(c2 + c4 - i);
          hash(-c4);
        };
      }
      for (c6 = ((-c4) > (c2 - M + 1) ? (-c4) : (c2 - M + 1)); c6 <= ((c2 - 1) < (M - 1) ? (c2 - 1) : (M - 1)); c6++) {
        i = c2 - c6;
        j = c4 + c6;
        {
          hash(2);
          hash(c2 - c6);
          hash(c4 + c6);
          hash(c6);
        };
      }
    }
    for (i = ((1) > (c2 - M + 1) ? (1) : (c2 - M + 1)); i <= ((M - 1) < (c2) ? (M - 1) : (c2)); i++) {
      j = c2 - i;
      {
        hash(1);
        hash(i);
        hash(c2 - i);
        hash(0);
      };
    }
  }
}
```