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

```asm
<test>:
  endbr64
  push   %r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  push   %rbx
  test   %edi,%edi
  jle    L147
  mov    $0x1,%ebx
  nop
L5:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  add    $0x1,%ebx
  call   <hash@plt>
  cmp    %ebx,%r12d
  jge    L5
  mov    $0x1,%ebx
  nopl   0x0(%rax,%rax,1)
L141:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    $0x2,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  add    $0x1,%ebx
  call   <hash@plt>
  cmp    %ebx,%r12d
  jge    L141
  cmp    $0x3,%r12d
  jle    L147
  mov    $0x3,%ebp
  nopw   0x0(%rax,%rax,1)
L108:
  mov    $0x1,%ebx
  nopl   (%rax)
L131:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  add    $0x1,%ebx
  call   <hash@plt>
  cmp    %ebp,%ebx
  jne    L131
  mov    $0x1,%edi
  lea    0x1(%rbp),%r14d
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  mov    $0x2,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  cmp    %r14d,%r12d
  jl     L16
  mov    %r14d,%ebx
  nopl   0x0(%rax,%rax,1)
L53:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  add    $0x1,%ebx
  call   <hash@plt>
  cmp    %ebx,%r12d
  jge    L53
  cmp    %r14d,%r12d
  je     L92
L16:
  mov    %r14d,%ebp
  jmp    L108
L147:
  cmp    $0x1,%r12d
  jle    L54
  nopl   0x0(%rax,%rax,1)
L92:
  mov    $0x1,%ebx
  nopl   (%rax)
L4:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %r12d,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  add    $0x1,%ebx
  call   <hash@plt>
  cmp    %ebx,%r12d
  jg     L4
L54:
  mov    $0x1,%edi
  lea    0x1(%r12),%ebp
  call   <hash@plt>
  mov    %r12d,%edi
  call   <hash@plt>
  mov    %r12d,%edi
  call   <hash@plt>
  mov    $0x2,%edi
  call   <hash@plt>
  mov    %r12d,%edi
  call   <hash@plt>
  mov    %r12d,%edi
  call   <hash@plt>
  cmp    %r13d,%ebp
  jg     L82
  nop
L27:
  mov    $0x1,%ebx
  test   %r12d,%r12d
  jle    L29
  nopw   0x0(%rax,%rax,1)
L98:
  mov    $0x1,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  mov    %ebx,%edi
  call   <hash@plt>
  mov    %ebx,%eax
  add    $0x1,%ebx
  cmp    %eax,%r12d
  jne    L98
L29:
  mov    $0x2,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  call   <hash@plt>
  mov    %ebp,%edi
  add    $0x1,%ebp
  call   <hash@plt>
  cmp    %ebp,%r13d
  jge    L27
L82:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

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