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

```asm
<echelonform>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %esi,0x28(%rsp)
  test   %esi,%esi
  jle    L81
  mov    %edx,%r14d
  test   %edx,%edx
  jle    L15
  movslq %edx,%rax
  mov    0x18(%rsp),%rcx
  movl   $0x0,0x2c(%rsp)
  xor    %ebp,%ebp
  mov    %rax,0x38(%rsp)
  lea    -0x1(%rdx),%eax
  lea    0x1(%rcx,%rax,1),%rax
  movl   $0x0,0xc(%rsp)
  mov    %rax,0x20(%rsp)
  mov    %rax,0x30(%rsp)
  movl   $0x0,0x14(%rsp)
  nopw   0x0(%rax,%rax,1)
L31:
  movslq 0x14(%rsp),%rsi
  mov    0x38(%rsp),%rdi
  mov    0x28(%rsp),%r8d
  mov    %rsi,%r9
  add    %rbp,%rsi
  add    0x18(%rsp),%rsi
L72:
  mov    0x2c(%rsp),%eax
  mov    0xc(%rsp),%ecx
  mov    %rsi,%rdx
  jmp    L84
  nopw   0x0(%rax,%rax,1)
L131:
  add    $0x1,%ecx
  add    %r14d,%eax
  add    %rdi,%rdx
  cmp    %ecx,%r8d
  je     L85
L84:
  cmpb   $0x0,(%rdx)
  je     L131
  mov    0x18(%rsp),%rcx
  mov    0x30(%rsp),%r8
  mov    %r9d,0x14(%rsp)
  cltq
  lea    (%rcx,%rbp,1),%r12
  mov    %r12,%rdx
  nop
L45:
  mov    %rdx,%rcx
  movzbl (%rdx),%esi
  add    $0x1,%rdx
  sub    %rbp,%rcx
  movzbl (%rcx,%rax,1),%edi
  mov    %dil,-0x1(%rdx)
  mov    %sil,(%rcx,%rax,1)
  cmp    %r8,%rdx
  jne    L45
  mov    0x2c(%rsp),%eax
  mov    0x18(%rsp),%rcx
  add    0x14(%rsp),%eax
  cltq
  movzbl (%rcx,%rax,1),%ebx
  test   %bl,%bl
  jne    L1
L123:
  movl   $0x0,0x8(%rsp)
  xor    %eax,%eax
  mov    %r14d,0x10(%rsp)
  mov    %eax,%r14d
  nopl   0x0(%rax,%rax,1)
L115:
  mov    0x8(%rsp),%ebx
  cmp    %ebx,0xc(%rsp)
  je     L74
  mov    0x14(%rsp),%eax
  mov    0x18(%rsp),%rdx
  movslq %r14d,%rbx
  add    %r14d,%eax
  lea    (%rdx,%rbx,1),%r15
  cltq
  movzbl (%rdx,%rax,1),%r13d
  mov    0x20(%rsp),%rax
  lea    (%rbx,%rax,1),%r12
  nopl   (%rax)
L13:
  mov    %r15,%rax
  mov    %r13d,%edi
  add    $0x1,%r15
  sub    %rbx,%rax
  movzbl (%rax,%rbp,1),%esi
  call   <mul@plt>
  movzbl -0x1(%r15),%edi
  mov    %eax,%esi
  call   <sub@plt>
  mov    %al,-0x1(%r15)
  cmp    %r15,%r12
  jne    L13
L74:
  mov    0x8(%rsp),%eax
  add    0x10(%rsp),%r14d
  add    $0x1,%eax
  cmp    %eax,0x28(%rsp)
  je     L16
  mov    %eax,0x8(%rsp)
  jmp    L115
  nopl   0x0(%rax,%rax,1)
L85:
  add    $0x1,%r9d
  add    $0x1,%rsi
  cmp    %r9d,%r14d
  jne    L72
L15:
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L16:
  mov    0xc(%rsp),%ecx
  addl   $0x1,0x14(%rsp)
  mov    0x10(%rsp),%r14d
  lea    0x1(%rcx),%eax
  cmp    0x8(%rsp),%ecx
  je     L81
  mov    0x38(%rsp),%rbx
  add    %r14d,0x2c(%rsp)
  add    %rbx,0x30(%rsp)
  add    %rbx,%rbp
  cmp    0x14(%rsp),%r14d
  jle    L15
  mov    %eax,0xc(%rsp)
  jmp    L31
L1:
  mov    0x30(%rsp),%r13
  xchg   %ax,%ax
L44:
  movzbl (%r12),%edi
  mov    %ebx,%esi
  add    $0x1,%r12
  call   <divs@plt>
  mov    %al,-0x1(%r12)
  cmp    %r13,%r12
  jne    L44
  jmp    L123
L81:
  add    $0x48,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int echelonform(unsigned char M[], int nrows, int ncols) {
  int lead = 0, rix = 0, iix = 0, j, k;
  unsigned char temp, de, sb;
  for (rix = 0; rix < nrows; rix++) {
    if (lead >= ncols) {
      return 0;
    }
    iix = rix;
    while (M[iix * ncols + lead] == 0) {
      iix++;
      if (iix == nrows) {
        iix = rix;
        lead++;
        if (ncols == lead) {
          return 0;
        }
      }
    }
    for (j = 0; j < ncols; j++) {
      temp = M[rix * ncols + j];
      M[rix * ncols + j] = M[iix * ncols + j];
      M[iix * ncols + j] = temp;
    }
    de = M[rix * ncols + lead];
    if (de != 0) {
      for (j = 0; j < ncols; j++) {
        M[rix * ncols + j] = divs(M[rix * ncols + j], de);
      }
    }
    for (j = 0; j < nrows; j++) {
      if (j != rix) {
        sb = M[j * ncols + lead];
        for (k = 0; k < ncols; k++) {
          M[j * ncols + k] = sub(M[j * ncols + k], mul(sb, M[rix * ncols + k]));
        }
      }
    }
    lead++;
  }
  return 1;
}
```