user: Please show me the C implementation that matches the assembly code listed below:

```asm
<test>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%r13d
  lea    -0x2(%rdi),%eax
  mov    %eax,0xc(%rsp)
  cmp    $0x1,%eax
  jle    L78
  mov    %eax,%r15d
  mov    $0x1,%r14d
  jmp    L31
L66:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %r12d,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  mov    %ebp,%eax
  add    $0x1,%ebp
  cmp    %eax,%r12d
  jge    L66
L121:
  lea    0x2(%rbx),%ebp
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %r12d,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  mov    $0x2,%edi
  call   <hash@plt>
  mov    %r12d,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  add    $0x3,%ebx
  cmp    %r13d,%ebx
  jg     L21
L119:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %r12d,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  call   <hash@plt>
  add    $0x1,%ebx
  cmp    %ebx,%r13d
  jge    L119
L21:
  cmp    %r15d,%r14d
  je     L78
L31:
  mov    %r14d,%r12d
  mov    %r14d,%ebx
  add    $0x1,%r14d
  mov    $0x1,%ebp
  test   %r14d,%r14d
  jg     L66
  jmp    L121
L78:
  cmp    $0x2,%r13d
  jle    L114
  mov    $0x1,%ebx
L69:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    0xc(%rsp),%edi
  call   <hash@plt>
  mov    %ebx,%edi
  call   <hash@plt>
  add    $0x1,%ebx
  cmp    %ebx,%r13d
  jne    L69
  mov    $0x1,%edi
  call   <hash@plt>
  mov    0xc(%rsp),%r15d
  mov    %r15d,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  call   <hash@plt>
  mov    $0x2,%edi
  call   <hash@plt>
  mov    %r15d,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  call   <hash@plt>
L114:
  lea    -0x1(%r13),%ebp
  jmp    L101
L48:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  call   <hash@plt>
  add    $0x1,%ebx
  cmp    %ebx,%r13d
  jge    L48
L51:
  mov    $0x2,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  lea    0x2(%rbp),%edi
  call   <hash@plt>
  add    $0x1,%ebp
  cmp    %ebp,%r13d
  jl     L67
L101:
  mov    $0x1,%ebx
  test   %r13d,%r13d
  jg     L48
  jmp    L51
L67:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void test(int M) {
  int i, j;
  for (i = 1; i <= M - 3; i++) {
    for (j = 1; j <= i + 1; j++) {
      {
        hash(1);
        hash(i);
        hash(j);
      };
    }
    j = i + 2;
    {
      hash(1);
      hash(i);
      hash(i + 2);
    };
    {
      hash(2);
      hash(i);
      hash(i + 2);
    };
    for (j = i + 3; j <= M; j++) {
      {
        hash(1);
        hash(i);
        hash(j);
      };
    }
  }
  if (M >= 3) {
    i = M - 2;
    for (j = 1; j <= M - 1; j++) {
      {
        hash(1);
        hash(M - 2);
        hash(j);
      };
    }
    {
      hash(1);
      hash(M - 2);
      hash(M);
    };
    {
      hash(2);
      hash(M - 2);
      hash(M);
    };
  }
  for (i = M - 1; i <= M; i++) {
    for (j = 1; j <= M; j++) {
      {
        hash(1);
        hash(i);
        hash(j);
      };
    }
    j = i + 2;
    {
      hash(2);
      hash(i);
      hash(i + 2);
    };
  }
}
```