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

```asm
<goodv>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %edx,-0x54(%rbp)
  mov    %ecx,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x34(%rbp)
  jmp    L34
L62:
  movl   $0x0,-0x30(%rbp)
  jmp    L53
L22:
  mov    -0x54(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x58(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x4,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%eax
  cltq
  mov    (%rdx,%rax,4),%ecx
  mov    -0x34(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x4,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%eax
  add    $0x1,%eax
  cltq
  mov    (%rdx,%rax,4),%eax
  cmp    %eax,%ecx
  jne    L179
  mov    -0x34(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x54(%rbp)
  jle    L179
  mov    -0x30(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x58(%rbp)
  jle    L179
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L29
L112:
  movl   $0x1,-0x2c(%rbp)
  jmp    L141
L8:
  addl   $0x1,-0x2c(%rbp)
L141:
  mov    -0x28(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x54(%rbp)
  jle    L193
  mov    -0x24(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x58(%rbp)
  jle    L193
  mov    -0x28(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x4,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%eax
  cltq
  mov    (%rdx,%rax,4),%ecx
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x4,%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%esi
  mov    -0x2c(%rbp),%eax
  add    %esi,%eax
  cltq
  mov    (%rdx,%rax,4),%eax
  cmp    %eax,%ecx
  je     L8
L193:
  mov    -0x28(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  sub    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x24(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  sub    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  addl   $0x1,-0x28(%rbp)
  addl   $0x1,-0x24(%rbp)
L29:
  mov    -0x18(%rbp),%eax
  cmp    %eax,-0x28(%rbp)
  jge    L170
  mov    -0x14(%rbp),%eax
  cmp    %eax,-0x24(%rbp)
  jl     L112
L170:
  mov    -0x18(%rbp),%eax
  sub    -0x34(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jle    L85
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x10(%rbp),%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x50(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    -0xc(%rbp),%eax
  mov    %eax,(%rdx)
  jmp    L179
L85:
  mov    -0x1c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jne    L179
  mov    -0x10(%rbp),%edx
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jl     L106
  mov    -0x10(%rbp),%edx
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L179
L106:
  mov    -0xc(%rbp),%edx
  mov    -0x50(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L179
  mov    -0x10(%rbp),%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x50(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    -0xc(%rbp),%eax
  mov    %eax,(%rdx)
L179:
  addl   $0x1,-0x30(%rbp)
L53:
  mov    -0x30(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L22
  addl   $0x1,-0x34(%rbp)
L34:
  mov    -0x34(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jl     L62
  mov    -0x20(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L190
  call   <__stack_chk_fail@plt>
L190:
  leave
  ret
```

assistant: ```c
int goodv(int m[][20], int ind[], int r, int c) {
  int endi[2], i, j, k, k1, k2, maxg = 0, tmpg;
  int tmpi[2];
  for (i = 0; i < c; ++i)
    for (j = 0; j < r; ++j) {
      endi[0] = r - 1;
      endi[1] = c - 1;
      if (m[i + 1][j] == m[i][j + 1] && (i + 1) < r && (j + 1) < c) {
        tmpi[0] = k1 = i;
        tmpi[1] = k2 = j;
        tmpg = 0;
        while (k1 < endi[0] && k2 < endi[1]) {
          k = 1;
          while ((((k1 + k) < r) && ((k2 + k) < c)) && (m[k1 + k][k2] == m[k1][k2 + k]))
            k++;
          endi[0] = k1 + k - 1;
          endi[1] = k2 + k - 1;
          k1++;
          k2++;
        }
        tmpg = endi[0] - i + 1;
        if (tmpg > maxg) {
          maxg = tmpg;
          ind[0] = tmpi[0];
          ind[1] = tmpi[1];
        } else if (tmpg == maxg) {
          if (((tmpi[0] < ind[0]) || (tmpi[0] == ind[0])) && (tmpi[1] < ind[1])) {
            ind[0] = tmpi[0];
            ind[1] = tmpi[1];
          }
        }
      }
    }
  return maxg;
}
```