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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    -0x5000(%rsp),%r11
L257:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L257
  sub    $0x670,%rsp
  mov    %edi,-0x5664(%rbp)
  mov    %rsi,-0x5670(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x5658(%rbp),%rax
  mov    %rax,%rsi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  jmp    L102
L151:
  lea    -0x564c(%rbp),%rcx
  lea    -0x5650(%rbp),%rdx
  lea    -0x5654(%rbp),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  movl   $0x1,-0x5648(%rbp)
  jmp    L332
L28:
  lea    -0x5640(%rbp),%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rcx,%rax
  add    $0x1,%rax
  mov    %rax,%rsi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  addl   $0x1,-0x5648(%rbp)
L332:
  mov    -0x5654(%rbp),%eax
  cmp    %eax,-0x5648(%rbp)
  jle    L28
  jmp    L294
L198:
  movl   $0x1,-0x5648(%rbp)
  jmp    L129
L270:
  movl   $0x1,-0x5644(%rbp)
  jmp    L35
L117:
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x53,%eax
  je     L223
  cmp    $0x53,%eax
  jg     L333
  cmp    $0x50,%eax
  je     L112
  cmp    $0x52,%eax
  jne    L333
  mov    -0x5648(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  movslq %edx,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x50,%al
  je     L261
  mov    -0x5648(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  movslq %edx,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x50,%al
  je     L261
  mov    -0x5644(%rbp),%eax
  add    $0x1,%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x50,%al
  je     L261
  mov    -0x5644(%rbp),%eax
  sub    $0x1,%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x50,%al
  jne    L291
L261:
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x2b20,%rax
  movb   $0x50,(%rax)
  jmp    L333
L291:
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x2b20,%rax
  movb   $0x52,(%rax)
  jmp    L333
L223:
  mov    -0x5648(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  movslq %edx,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x52,%al
  je     L30
  mov    -0x5648(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  movslq %edx,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x52,%al
  je     L30
  mov    -0x5644(%rbp),%eax
  add    $0x1,%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x52,%al
  je     L30
  mov    -0x5644(%rbp),%eax
  sub    $0x1,%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x52,%al
  jne    L362
L30:
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x2b20,%rax
  movb   $0x52,(%rax)
  jmp    L333
L362:
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x2b20,%rax
  movb   $0x53,(%rax)
  jmp    L333
L112:
  mov    -0x5648(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  movslq %edx,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x53,%al
  je     L263
  mov    -0x5648(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  movslq %edx,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x53,%al
  je     L263
  mov    -0x5644(%rbp),%eax
  add    $0x1,%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x53,%al
  je     L263
  mov    -0x5644(%rbp),%eax
  sub    $0x1,%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x5640,%rax
  movzbl (%rax),%eax
  cmp    $0x53,%al
  jne    L323
L263:
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x2b20,%rax
  movb   $0x53,(%rax)
  jmp    L224
L323:
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x2b20,%rax
  movb   $0x50,(%rax)
L224:
  nop
L333:
  addl   $0x1,-0x5644(%rbp)
L35:
  mov    -0x5650(%rbp),%eax
  cmp    %eax,-0x5644(%rbp)
  jle    L117
  addl   $0x1,-0x5648(%rbp)
L129:
  mov    -0x5654(%rbp),%eax
  cmp    %eax,-0x5648(%rbp)
  jle    L270
  movl   $0x1,-0x5648(%rbp)
  jmp    L192
L173:
  movl   $0x1,-0x5644(%rbp)
  jmp    L47
L325:
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x2b20,%rax
  movzbl (%rax),%ecx
  mov    -0x5644(%rbp),%eax
  movslq %eax,%rsi
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rbp,%rax
  add    %rsi,%rax
  sub    $0x5640,%rax
  mov    %cl,(%rax)
  addl   $0x1,-0x5644(%rbp)
L47:
  mov    -0x5650(%rbp),%eax
  cmp    %eax,-0x5644(%rbp)
  jle    L325
  addl   $0x1,-0x5648(%rbp)
L192:
  mov    -0x5654(%rbp),%eax
  cmp    %eax,-0x5648(%rbp)
  jle    L173
L294:
  mov    -0x564c(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x564c(%rbp)
  test   %eax,%eax
  jne    L198
  movl   $0x1,-0x5648(%rbp)
  jmp    L119
L287:
  lea    -0x5640(%rbp),%rcx
  mov    -0x5648(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  add    %rcx,%rax
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <puts@plt>
  addl   $0x1,-0x5648(%rbp)
L119:
  mov    -0x5654(%rbp),%eax
  cmp    %eax,-0x5648(%rbp)
  jle    L287
  mov    $0xa,%edi
  call   <putchar@plt>
L102:
  mov    -0x5658(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x5658(%rbp)
  test   %eax,%eax
  jne    L151
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L349
  call   <__stack_chk_fail@plt>
L349:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D0
type_infered: string
name: read_data
arguments: data_tag: D13
type_infered: string
name: read_data
arguments: data_tag: D20
type_infered: string

tool: D0: %d

tool: D13: %d %d %d

tool: D20: %s

assistant: ```c
int main(int argc, char *argv[]) {
  int cnt, i, j, a, b, c;
  char m[105][105], m2[105][105];
  scanf("%d", &cnt);
  while (cnt--) {
    scanf("%d %d %d", &a, &b, &c);
    for (i = 1; i <= a; ++i)
      scanf("%s", m[i] + 1);
    while (c--) {
      for (i = 1; i <= a; ++i) {
        for (j = 1; j <= b; ++j) {
          switch (m[i][j]) {
          case 'R':
            if (m[i + 1][j] == 'P' || m[i - 1][j] == 'P' || m[i][j + 1] == 'P' || m[i][j - 1] == 'P')
              m2[i][j] = 'P';
            else
              m2[i][j] = 'R';
            break;
          case 'S':
            if (m[i + 1][j] == 'R' || m[i - 1][j] == 'R' || m[i][j + 1] == 'R' || m[i][j - 1] == 'R')
              m2[i][j] = 'R';
            else
              m2[i][j] = 'S';
            break;
          case 'P':
            if (m[i + 1][j] == 'S' || m[i - 1][j] == 'S' || m[i][j + 1] == 'S' || m[i][j - 1] == 'S')
              m2[i][j] = 'S';
            else
              m2[i][j] = 'P';
            break;
          }
        }
      }
      for (i = 1; i <= a; ++i)
        for (j = 1; j <= b; ++j)
          m[i][j] = m2[i][j];
    }
    for (i = 1; i <= a; ++i) {
      printf("%s\n", m[i] + 1);
    }
    printf("\n");
  }
  return 0;
}
```