user: 请将以下的汇编代码转换成C语言代码:

```asm
<gauss>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %edx,-0x54(%rbp)
  mov    %ecx,-0x58(%rbp)
  mov    %r8d,-0x5c(%rbp)
  movl   $0x0,-0x34(%rbp)
  mov    -0x58(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L121
L243:
  movl   $0xffffffff,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  jmp    L240
L196:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L180
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x20(%rbp)
L180:
  addl   $0x1,-0x28(%rbp)
L240:
  cmpl   $0x0,-0x20(%rbp)
  jns    L277
  mov    -0x28(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L196
L277:
  cmpl   $0xffffffff,-0x20(%rbp)
  je     L139
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  jmp    L46
L35:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    -0x30(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x48(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rcx
  mov    -0x28(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,%rdx
  mov    -0x1c(%rbp),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x28(%rbp)
L46:
  mov    -0x28(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jl     L35
  mov    -0x30(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x28(%rbp)
  jmp    L259
L276:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  neg    %eax
  mov    %eax,%ebx
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x5c(%rbp),%edx
  mov    %edx,%esi
  mov    %eax,%edi
  call   <invMod@plt>
  imul   %ebx,%eax
  cltd
  idivl  -0x5c(%rbp)
  mov    %edx,-0x1c(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  jmp    L280
L245:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x48(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  imul   -0x1c(%rbp),%eax
  add    %edx,%eax
  mov    -0x28(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x48(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rcx
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  add    %rdx,%rcx
  cltd
  idivl  -0x5c(%rbp)
  mov    %edx,%eax
  mov    %eax,(%rcx)
  addl   $0x1,-0x24(%rbp)
L280:
  mov    -0x24(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jl     L245
  addl   $0x1,-0x28(%rbp)
L259:
  mov    -0x28(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L276
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x5c(%rbp),%edx
  mov    %edx,%esi
  mov    %eax,%edi
  call   <invMod@plt>
  mov    %eax,-0x1c(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  jmp    L172
L163:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  imul   -0x1c(%rbp),%eax
  mov    -0x30(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x48(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rcx
  mov    -0x28(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  add    %rdx,%rcx
  cltd
  idivl  -0x5c(%rbp)
  mov    %edx,%eax
  mov    %eax,(%rcx)
  addl   $0x1,-0x28(%rbp)
L172:
  mov    -0x28(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jl     L163
  mov    -0x30(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x30(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x34(%rbp)
  jmp    L208
L139:
  nop
L208:
  addl   $0x1,-0x2c(%rbp)
L121:
  mov    -0x30(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jge    L238
  mov    -0x58(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x2c(%rbp)
  jl     L243
L238:
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x30(%rbp)
  jmp    L143
L16:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x58(%rbp),%eax
  cltq
  shl    $0x2,%rax
  sub    $0x4,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L89
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  jmp    L24
L89:
  addl   $0x1,-0x30(%rbp)
L143:
  mov    -0x30(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L16
  movl   $0x0,-0x30(%rbp)
  jmp    L144
L190:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x58(%rbp),%eax
  cltq
  shl    $0x2,%rax
  sub    $0x4,%rax
  add    %rdx,%rax
  mov    -0x30(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x50(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x30(%rbp)
L144:
  mov    -0x30(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L190
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x30(%rbp)
  jmp    L182
L17:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movl   $0x0,(%rax)
  addl   $0x1,-0x30(%rbp)
L182:
  mov    -0x58(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x30(%rbp)
  jl     L17
  mov    -0x34(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x30(%rbp)
  jmp    L197
L241:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    $0x1,%eax
  mov    %eax,-0x2c(%rbp)
  jmp    L131
L146:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x48(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rcx,%rax
  mov    (%rax),%ecx
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x50(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%eax
  imul   %eax,%ecx
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x50(%rbp),%rax
  add    %rsi,%rax
  sub    %ecx,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x2c(%rbp)
L131:
  mov    -0x58(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x2c(%rbp)
  jl     L146
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x30(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x50(%rbp),%rdx
  add    %rdx,%rcx
  cltd
  idivl  -0x5c(%rbp)
  mov    %edx,%eax
  mov    %eax,(%rcx)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x5c(%rbp),%eax
  add    %edx,%eax
  mov    -0x30(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x50(%rbp),%rdx
  add    %rdx,%rcx
  cltd
  idivl  -0x5c(%rbp)
  mov    %edx,%eax
  mov    %eax,(%rcx)
  subl   $0x1,-0x30(%rbp)
L197:
  cmpl   $0x0,-0x30(%rbp)
  jns    L241
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x1,%eax
L24:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int gauss(int **a, int *x, int m, int n, int q) {
  int rank = 0, i, j, k, l, *pivot = (int *)malloc(sizeof(int) * n);
  for (i = 0, j = 0; i < m && j < n - 1; ++j) {
    int p = -1, tmp = 0;
    for (k = i; p < 0 && k < m; ++k) {
      if (a[k][j] != 0)
        p = k;
    }
    if (p == -1)
      continue;
    for (k = j; k < n; ++k)
      tmp = a[i][k], a[i][k] = a[p][k], a[p][k] = tmp;
    for (k = i + 1; k < m; ++k) {
      tmp = -a[k][j] * invMod(a[i][j], q) % q;
      for (l = j; l < n; ++l)
        a[k][l] = (a[k][l] + tmp * a[i][l]) % q;
    }
    tmp = invMod(a[i][j], q);
    for (k = j; k < n; ++k)
      a[i][k] = a[i][k] * tmp % q;
    pivot[i++] = j, rank++;
  }
  for (i = rank; i < m; ++i)
    if (a[i][n - 1] != 0) {
      free(pivot);
      return 0;
    }
  for (i = 0; i < rank; ++i)
    x[i] = a[i][n - 1];
  for (i = rank; i < n - 1; ++i)
    x[i] = 0;
  for (i = rank - 1; i >= 0; --i) {
    for (j = pivot[i] + 1; j < n - 1; ++j)
      x[i] -= a[i][j] * x[j];
    x[i] -= x[i] / q * q, x[i] = (x[i] + q) % q;
  }
  free(pivot);
  return 1;
}
```