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

```asm
<solve>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  mov    %esi,%ebp
  mov    %edx,%ebx
  mov    %esi,%r14d
  imul   %edx,%r14d
  shl    $0x2,%r14d
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    %r14d,%edi
  call   <malloc@plt>
  test   %ebp,%ebp
  jle    L7
  mov    %rax,%r11
  mov    %r12,%rdi
  mov    $0x0,%edx
  mov    $0xffffffff,%esi
  mov    %ebx,%r9d
  lea    -0x1(%rbp),%r10d
  lea    -0x1(%rbx),%r14d
  jmp    L100
L52:
  mov    (%rdi),%rcx
  cmpb   $0x4f,(%rcx,%rax,1)
  je     L106
L64:
  add    $0x1,%rax
  cmp    %r9,%rax
  je     L47
L207:
  mov    %eax,%r8d
  test   %edx,%edx
  je     L52
  test   %eax,%eax
  je     L52
  cmp    %edx,%r10d
  je     L52
  cmp    %eax,%r14d
  jne    L64
  jmp    L52
L106:
  add    $0x1,%esi
  movslq %esi,%rcx
  mov    %edx,0x0(%r13,%rcx,4)
  mov    %r8d,(%r11,%rcx,4)
  mov    (%rdi),%rcx
  movb   $0x61,(%rcx,%rax,1)
  jmp    L64
L47:
  lea    0x1(%rdx),%eax
  add    $0x8,%rdi
  cmp    %eax,%ebp
  je     L156
  mov    %eax,%edx
L100:
  mov    $0x0,%eax
  test   %ebx,%ebx
  jg     L207
  jmp    L47
L43:
  movb   $0x61,(%r10)
  mov    %r14d,(%r9)
  mov    %edi,(%rax)
  mov    %esi,%r8d
  jmp    L18
L154:
  test   %ecx,%ecx
  jle    L148
  movslq %ecx,%rsi
  movslq %edi,%rax
  add    -0x8(%r12,%rsi,8),%rax
  cmpb   $0x4f,(%rax)
  je     L104
L148:
  mov    %r8d,%esi
  test   %edi,%edi
  jle    L103
  movslq %ecx,%rsi
  movslq %edi,%rax
  mov    (%r12,%rsi,8),%rsi
  lea    -0x1(%rsi,%rax,1),%rax
  mov    %r8d,%esi
  cmpb   $0x4f,(%rax)
  je     L246
L103:
  test   %esi,%esi
  js     L271
L174:
  movslq %esi,%rax
  shl    $0x2,%rax
  lea    0x0(%r13,%rax,1),%r9
  mov    (%r9),%ecx
  lea    -0x1(%rsi),%r8d
  add    %r11,%rax
  mov    (%rax),%edi
  lea    0x1(%rcx),%r14d
  cmp    %edx,%ecx
  jge    L18
  movslq %ecx,%r15
  movslq %edi,%r10
  add    0x8(%r12,%r15,8),%r10
  cmpb   $0x4f,(%r10)
  je     L43
L18:
  lea    0x1(%rdi),%eax
  cmp    %ebx,%eax
  jge    L154
  movslq %ecx,%r9
  movslq %edi,%rsi
  mov    (%r12,%r9,8),%r9
  lea    0x1(%r9,%rsi,1),%rsi
  cmpb   $0x4f,(%rsi)
  jne    L154
  movb   $0x61,(%rsi)
  add    $0x1,%r8d
  movslq %r8d,%rsi
  mov    %ecx,0x0(%r13,%rsi,4)
  mov    %eax,(%r11,%rsi,4)
  jmp    L154
L104:
  movb   $0x61,(%rax)
  add    $0x1,%r8d
  movslq %r8d,%rax
  lea    -0x1(%rcx),%esi
  mov    %esi,0x0(%r13,%rax,4)
  mov    %edi,(%r11,%rax,4)
  jmp    L148
L246:
  movb   $0x61,(%rax)
  lea    0x1(%r8),%esi
  movslq %esi,%r8
  mov    %ecx,0x0(%r13,%r8,4)
  lea    -0x1(%rdi),%eax
  mov    %eax,(%r11,%r8,4)
  jmp    L103
L180:
  mov    %rdx,%rcx
  add    (%r12),%rcx
  cmpb   $0x61,(%rcx)
  setne  %al
  lea    0x4f(%rax,%rax,8),%eax
  mov    %al,(%rcx)
  add    $0x1,%rdx
  cmp    %rsi,%rdx
  jne    L180
L115:
  add    $0x1,%edi
  add    $0x8,%r12
  cmp    %edi,%ebp
  jle    L7
L274:
  mov    $0x0,%edx
  test   %ebx,%ebx
  jg     L180
  jmp    L115
L156:
  test   %esi,%esi
  jns    L174
L271:
  mov    $0x0,%edi
  mov    %ebx,%esi
  jmp    L274
L7:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

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';
    }
  }
}
```