user: 请从给定的汇编指令推导出C源代码：

```asm
<test>:
  endbr64
  push   %r15
  lea    -0x1(%rdi),%ecx
  push   %r14
  lea    (%rcx,%rcx,1),%edx
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,0x14(%rsp)
  mov    %ecx,0x10(%rsp)
  mov    %edx,0x18(%rsp)
  cmp    $0x1,%edi
  jg     L119
  cmpl   $0x1,0x18(%rsp)
  jle    L69
L35:
  mov    0x14(%rsp),%esi
  mov    $0x1,%eax
  mov    $0x2,%r14d
  sub    %esi,%eax
  mov    %eax,0x1c(%rsp)
  mov    $0x3,%eax
  sub    %esi,%eax
  mov    %eax,0xc(%rsp)
  nopl   0x0(%rax,%rax,1)
L24:
  mov    0xc(%rsp),%eax
  mov    $0x0,%edx
  sub    $0x1,%eax
  cmovs  %edx,%eax
  add    $0x1,%eax
  mov    %eax,0x8(%rsp)
  cmp    %r14d,0x14(%rsp)
  jge    L107
  mov    0x1c(%rsp),%eax
  mov    %eax,%r12d
  test   %eax,%eax
  je     L66
L112:
  lea    -0x1(%r14),%eax
  cmp    %r14d,0x14(%rsp)
  cmovle 0x10(%rsp),%eax
  lea    (%r12,%r14,1),%r13d
  mov    %eax,0x4(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L120:
  mov    0x10(%rsp),%eax
  mov    %r12d,%ebx
  cmp    %eax,%r13d
  mov    %eax,%r15d
  mov    0x8(%rsp),%eax
  cmovle %r13d,%r15d
  neg    %ebx
  mov    %eax,%ebp
  cmp    %eax,%r15d
  jl     L1
  xchg   %ax,%ax
L117:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  mov    %r13d,%edi
  sub    %ebp,%edi
  add    $0x1,%ebp
  call   <hash@plt>
  mov    %ebx,%edi
  call   <hash@plt>
  cmp    %r15d,%ebp
  jle    L117
L1:
  mov    0xc(%rsp),%eax
  cmp    %ebx,%eax
  cmovge %eax,%ebx
  cmp    %ebx,0x4(%rsp)
  jl     L123
  nopl   0x0(%rax)
L31:
  mov    $0x2,%edi
  call   <hash@plt>
  mov    %r14d,%edi
  sub    %ebx,%edi
  call   <hash@plt>
  lea    (%r12,%rbx,1),%edi
  call   <hash@plt>
  mov    %ebx,%edi
  add    $0x1,%ebx
  call   <hash@plt>
  cmp    %ebx,0x4(%rsp)
  jge    L31
L123:
  add    $0x1,%r13d
  add    $0x1,%r12d
  jne    L120
L66:
  mov    0x10(%rsp),%ebx
  cmp    %r14d,0x14(%rsp)
  cmovg  %r14d,%ebx
  cmp    0x8(%rsp),%ebx
  jl     L77
  xchg   %ax,%ax
L111:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    0x8(%rsp),%r15d
  mov    %r15d,%edi
  call   <hash@plt>
  mov    %r14d,%edi
  sub    %r15d,%edi
  add    $0x1,%r15d
  call   <hash@plt>
  xor    %edi,%edi
  call   <hash@plt>
  mov    %r15d,0x8(%rsp)
  cmp    %r15d,%ebx
  jge    L111
L77:
  addl   $0x1,0xc(%rsp)
  add    $0x1,%r14d
  cmp    0x18(%rsp),%r14d
  jle    L24
L69:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L107:
  mov    $0x1,%r12d
  sub    %r14d,%r12d
  jmp    L112
L119:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    $0x1,%edi
  call   <hash@plt>
  xor    %edi,%edi
  call   <hash@plt>
  xor    %edi,%edi
  call   <hash@plt>
  jmp    L35
```

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);
      };
    }
  }
}
```