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

```asm
<orangesRotting>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    (%rdx),%r15d
  test   %esi,%esi
  jle    L190
  lea    -0x1(%r15),%ebx
  mov    %esi,%r13d
  lea    -0x1(%rsi),%esi
  mov    %rdi,%rbp
  lea    0x0(,%rbx,4),%rax
  shl    $0x3,%rsi
  xor    %r12d,%r12d
  mov    %rax,0x8(%rsp)
  lea    0x8(%rdi,%rsi,1),%r8
  lea    0x4(%rax),%r9
  nopw   0x0(%rax,%rax,1)
L274:
  test   %r15d,%r15d
  jle    L260
  mov    (%rdi),%rax
  lea    (%r9,%rax,1),%rcx
  nopl   0x0(%rax)
L246:
  xor    %edx,%edx
  cmpl   $0x1,(%rax)
  sete   %dl
  add    $0x4,%rax
  add    %edx,%r12d
  cmp    %rcx,%rax
  jne    L246
L260:
  add    $0x8,%rdi
  cmp    %r8,%rdi
  jne    L274
  mov    %rsi,(%rsp)
  test   %r12d,%r12d
  je     L132
  lea    0x0(,%r13,8),%r14d
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %r14d,%edi
  lea    0x0(,%r15,4),%r14d
  mov    %rax,0x20(%rsp)
  call   <malloc@plt>
  mov    (%rsp),%rsi
  mov    %r12d,0x28(%rsp)
  mov    %rax,0x10(%rsp)
  mov    0x20(%rsp),%rax
  mov    %rbx,0x18(%rsp)
  lea    0x8(%rax,%rsi,1),%rdi
  mov    %r13d,0x2c(%rsp)
  mov    %rax,%rbx
  mov    %rdi,(%rsp)
  mov    %rbp,%rdi
  mov    %rax,%rbp
  sub    %rax,%rdi
  mov    %rdi,%r13
  nopl   0x0(%rax)
L168:
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %r14d,%edi
  mov    %rax,%r12
  call   <malloc@plt>
  test   %r15d,%r15d
  jle    L104
  mov    0x8(%rsp),%rdi
  mov    0x0(%r13,%rbp,1),%rsi
  mov    %rax,%rdx
  lea    0x4(%rax,%rdi,1),%r9
  mov    %r12,%rdi
  sub    %rax,%rsi
  sub    %rax,%rdi
  nopl   0x0(%rax,%rax,1)
L105:
  mov    (%rsi,%rdx,1),%ecx
  mov    %ecx,(%rdx)
  mov    %ecx,(%rdi,%rdx,1)
  add    $0x4,%rdx
  cmp    %r9,%rdx
  jne    L105
L104:
  mov    0x10(%rsp),%rdx
  mov    %r12,0x0(%rbp)
  sub    %rbx,%rdx
  mov    %rax,(%rdx,%rbp,1)
  add    $0x8,%rbp
  cmp    (%rsp),%rbp
  jne    L168
  mov    0x28(%rsp),%r12d
  mov    0x18(%rsp),%rbx
  movl   $0x0,0x18(%rsp)
  mov    0x10(%rsp),%rax
  mov    0x2c(%rsp),%r13d
  mov    %r12d,0x8(%rsp)
  mov    0x20(%rsp),%r11
  mov    %rax,%rbp
  nopl   0x0(%rax)
L76:
  addl   $0x1,0x18(%rsp)
  mov    %rbp,%r12
  xor    %r9d,%r9d
  xor    %r10d,%r10d
  xor    %r14d,%r14d
  nopl   0x0(%rax)
L167:
  add    $0x1,%r10d
  test   %r15d,%r15d
  jle    L259
  mov    (%r11,%r9,8),%rdi
  mov    (%r12),%r8
  mov    %rbp,(%rsp)
  xor    %eax,%eax
  jmp    L232
  nopl   (%rax)
L230:
  mov    %edx,(%rsi)
  lea    0x1(%rax),%rdx
  cmp    %rbx,%rax
  je     L92
L279:
  mov    %rdx,%rax
L232:
  mov    (%rdi,%rax,4),%edx
  lea    0x0(,%rax,4),%rcx
  lea    (%r8,%rcx,1),%rsi
  cmp    $0x1,%edx
  jne    L230
  test   %r9,%r9
  je     L271
  mov    -0x8(%r11,%r9,8),%rbp
  cmpl   $0x2,0x0(%rbp,%rcx,1)
  je     L207
L271:
  cmp    %r10d,%r13d
  jle    L130
  mov    0x8(%r11,%r9,8),%rbp
  cmpl   $0x2,0x0(%rbp,%rcx,1)
  je     L207
L130:
  test   %rax,%rax
  je     L181
  cmpl   $0x2,-0x4(%rdi,%rax,4)
  je     L207
L181:
  lea    0x1(%rax),%ecx
  cmp    %r15d,%ecx
  jge    L47
  cmpl   $0x2,0x4(%rdi,%rax,4)
  je     L207
L47:
  mov    %edx,(%rsi)
  add    $0x1,%r14d
  lea    0x1(%rax),%rdx
  cmp    %rbx,%rax
  jne    L279
  nopw   0x0(%rax,%rax,1)
L92:
  mov    (%rsp),%rbp
L259:
  add    $0x1,%r9
  add    $0x8,%r12
  cmp    %r10d,%r13d
  jne    L167
  cmp    0x8(%rsp),%r14d
  je     L63
  mov    %rbp,%rax
  mov    %r11,%rbp
  test   %r14d,%r14d
  jle    L187
  mov    %r14d,0x8(%rsp)
  mov    %rax,%r11
  jmp    L76
L187:
  mov    0x10(%rsp),%rsi
  mov    0x20(%rsp),%rdi
  mov    %r13d,%edx
  call   <freeSpace@plt>
  mov    0x18(%rsp),%r12d
L132:
  add    $0x38,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L207:
  mov    $0x2,%edx
  jmp    L230
L63:
  mov    0x10(%rsp),%rsi
  mov    0x20(%rsp),%rdi
  mov    %r13d,%edx
  mov    $0xffffffff,%r12d
  call   <freeSpace@plt>
  jmp    L132
L190:
  xor    %r12d,%r12d
  jmp    L132
```

assistant: ```c
int orangesRotting(int **grid, int gridSize, int *gridColSize) {
  int colSize = *gridColSize;
  int firstFresh = 0;
  for (int i = 0; i < gridSize; i++) {
    for (int j = 0; j < colSize; j++) {
      if (grid[i][j] == 1) {
        firstFresh++;
      }
    }
  }
  if (firstFresh == 0) {
    return 0;
  }
  int **gridA, **gridB, **cur, **next, **temp;
  gridA = (int **)malloc(sizeof(int *) * gridSize);
  gridB = (int **)malloc(sizeof(int *) * gridSize);
  for (int i = 0; i < gridSize; i++) {
    int *rowA = (int *)malloc(sizeof(int) * colSize);
    int *rowB = (int *)malloc(sizeof(int) * colSize);
    for (int j = 0; j < colSize; j++) {
      rowA[j] = rowB[j] = grid[i][j];
    }
    gridA[i] = rowA;
    gridB[i] = rowB;
  }
  cur = gridA, next = gridB;
  int prevFresh = firstFresh, fresh = 0;
  int minute = 0;
  while (prevFresh > 0) {
    fresh = 0;
    minute++;
    for (int i = 0; i < gridSize; i++) {
      for (int j = 0; j < colSize; j++) {
        if (cur[i][j] == 1) {
          if ((i - 1 >= 0 && cur[i - 1][j] == 2) || (i + 1 < gridSize && cur[i + 1][j] == 2) || (j - 1 >= 0 && cur[i][j - 1] == 2) || (j + 1 < colSize && cur[i][j + 1] == 2)) {
            next[i][j] = 2;
          } else {
            next[i][j] = cur[i][j];
            fresh++;
          }
        } else {
          next[i][j] = cur[i][j];
        }
      }
    }
    if (fresh == prevFresh) {
      freeSpace(gridA, gridB, gridSize);
      return -1;
    } else {
      prevFresh = fresh;
      temp = cur;
      cur = next;
      next = temp;
    }
  }
  freeSpace(gridA, gridB, gridSize);
  return minute;
}
```