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

```asm
<solve>:
  endbr64
  push   %r15
  push   %r14
  mov    %esi,%r14d
  imul   %edx,%r14d
  push   %r13
  mov    %edx,%r13d
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  shl    $0x2,%r14d
  mov    %esi,%ebx
  mov    %r14d,%edi
  sub    $0x18,%rsp
  call   <malloc@plt>
  mov    %r14d,%edi
  mov    %rax,%r12
  call   <malloc@plt>
  test   %ebx,%ebx
  jle    L259
  mov    %rax,%r15
  mov    %ebx,%eax
  mov    %rbp,(%rsp)
  mov    %rbp,%r9
  mov    %rbp,0x8(%rsp)
  lea    -0x1(%rbx),%r14d
  xor    %edi,%edi
  movslq %r13d,%r10
  mov    $0xffffffff,%r8d
  lea    -0x1(%r13),%ebx
  mov    %eax,%ebp
  cs nopw 0x0(%rax,%rax,1)
L58:
  test   %edi,%edi
  sete   %sil
  xor    %eax,%eax
  test   %r13d,%r13d
  jg     L14
  jmp    L167
  nop
L284:
  cmp    %edi,%r14d
  je     L246
  cmp    %eax,%ebx
  je     L246
L158:
  add    $0x1,%rax
  cmp    %rax,%r10
  je     L167
L14:
  mov    %eax,%ecx
  test   %eax,%eax
  je     L246
  test   %sil,%sil
  je     L284
L246:
  mov    (%r9),%rdx
  add    %rax,%rdx
  cmpb   $0x4f,(%rdx)
  jne    L158
  add    $0x1,%r8d
  add    $0x1,%rax
  movslq %r8d,%r11
  mov    %edi,(%r12,%r11,4)
  mov    %ecx,(%r15,%r11,4)
  movb   $0x61,(%rdx)
  cmp    %rax,%r10
  jne    L14
L167:
  lea    0x1(%rdi),%eax
  add    $0x8,%r9
  cmp    %eax,%ebp
  je     L141
  mov    %eax,%edi
  jmp    L58
  nopw   0x0(%rax,%rax,1)
L147:
  lea    0x8(%rbp,%rdi,8),%r8
  movslq %r13d,%rdi
L253:
  xor    %edx,%edx
  test   %r13d,%r13d
  jle    L70
  nopw   0x0(%rax,%rax,1)
L128:
  mov    (%rsi),%rcx
  add    %rdx,%rcx
  cmpb   $0x61,(%rcx)
  setne  %al
  add    $0x1,%rdx
  lea    0x4f(%rax,%rax,8),%eax
  mov    %al,(%rcx)
  cmp    %rdx,%rdi
  jne    L128
L70:
  add    $0x8,%rsi
  cmp    %rsi,%r8
  jne    L253
L259:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L141:
  mov    (%rsp),%rsi
  mov    0x8(%rsp),%rbp
  cmp    $0xffffffff,%r8d
  je     L147
  movslq %r8d,%rax
  nopw   0x0(%rax,%rax,1)
L26:
  shl    $0x2,%rax
  lea    -0x1(%r8),%r10d
  lea    (%r12,%rax,1),%rbx
  add    %r15,%rax
  mov    (%rbx),%ecx
  mov    (%rax),%edx
  lea    0x1(%rcx),%r14d
  cmp    %edi,%ecx
  jge    L207
  movslq %ecx,%r11
  movslq %edx,%r9
  add    0x8(%rbp,%r11,8),%r9
  cmpb   $0x4f,(%r9)
  jne    L207
  movb   $0x61,(%r9)
  mov    %r8d,%r10d
  mov    %r14d,(%rbx)
  mov    %edx,(%rax)
  nopl   0x0(%rax,%rax,1)
L207:
  lea    0x1(%rdx),%eax
  cmp    %r13d,%eax
  jge    L27
  movslq %ecx,%r11
  movslq %edx,%r9
  mov    0x0(%rbp,%r11,8),%r8
  lea    0x1(%r8,%r9,1),%r8
  cmpb   $0x4f,(%r8)
  jne    L27
  add    $0x1,%r10d
  movb   $0x61,(%r8)
  movslq %r10d,%r8
  mov    %ecx,(%r12,%r8,4)
  mov    %eax,(%r15,%r8,4)
  nopl   0x0(%rax)
L27:
  test   %ecx,%ecx
  jle    L36
  movslq %ecx,%r11
  movslq %edx,%r9
  mov    -0x8(%rbp,%r11,8),%rax
  add    %r9,%rax
  cmpb   $0x4f,(%rax)
  je     L179
L36:
  mov    %r10d,%r8d
  test   %edx,%edx
  jle    L107
  movslq %ecx,%r11
  movslq %edx,%r9
L39:
  mov    0x0(%rbp,%r11,8),%rax
  mov    %r10d,%r8d
  lea    -0x1(%rax,%r9,1),%rax
  cmpb   $0x4f,(%rax)
  je     L286
L107:
  cmp    $0xffffffff,%r10d
  je     L147
  movslq %r10d,%rax
  jmp    L26
L286:
  add    $0x1,%r8d
  movb   $0x61,(%rax)
  sub    $0x1,%edx
  movslq %r8d,%rax
  mov    %ecx,(%r12,%rax,4)
  mov    %edx,(%r15,%rax,4)
  jmp    L26
  nopw   0x0(%rax,%rax,1)
L179:
  add    $0x1,%r10d
  movb   $0x61,(%rax)
  lea    -0x1(%rcx),%r8d
  movslq %r10d,%rax
  mov    %r8d,(%r12,%rax,4)
  mov    %r10d,%r8d
  mov    %edx,(%r15,%rax,4)
  test   %edx,%edx
  jg     L39
  jmp    L26
```

assistant: ```c
void solve(char **board, int rSize, int cSize) {
  int *rStack = (int *)malloc(sizeof(int) * rSize * cSize);
  int *cStack = (int *)malloc(sizeof(int) * rSize * cSize);
  int top = -1;
  for (int i = 0; i < rSize; i++)
    for (int j = 0; j < cSize; j++) {
      if (i == 0 || j == 0 || i == rSize - 1 || j == cSize - 1) {
        if (board[i][j] == 'O') {
          rStack[++top] = i;
          cStack[top] = j;
          board[i][j] = 'a';
        }
      }
    }
  while (top > -1) {
    int r = rStack[top], c = cStack[top--];
    if (r + 1 < rSize && board[r + 1][c] == 'O') {
      board[r + 1][c] = 'a';
      rStack[++top] = r + 1;
      cStack[top] = c;
    }
    if (c + 1 < cSize && board[r][c + 1] == 'O') {
      board[r][c + 1] = 'a';
      rStack[++top] = r;
      cStack[top] = c + 1;
    }
    if (r - 1 > -1 && board[r - 1][c] == 'O') {
      board[r - 1][c] = 'a';
      rStack[++top] = r - 1;
      cStack[top] = c;
    }
    if (c - 1 > -1 && board[r][c - 1] == 'O') {
      board[r][c - 1] = 'a';
      rStack[++top] = r;
      cStack[top] = c - 1;
    }
  }
  for (int i = 0; i < rSize; i++) {
    for (int j = 0; j < cSize; j++) {
      if (board[i][j] == 'a')
        board[i][j] = 'O';
      else
        board[i][j] = 'X';
    }
  }
}
```