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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x140,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D47(%rip),%rax
  mov    %rax,%rsi
  lea    D82(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x120(%rbp)
  lea    D18(%rip),%rax
  mov    %rax,%rsi
  lea    D60(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x118(%rbp)
  movl   $0x0,-0x130(%rbp)
  lea    -0x138(%rbp),%rdx
  mov    -0x120(%rbp),%rax
  lea    D3(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  movl   $0x0,-0x134(%rbp)
  jmp    L118
L30:
  lea    -0x110(%rbp),%rcx
  mov    -0x134(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  lea    (%rcx,%rax,1),%rdx
  mov    -0x120(%rbp),%rax
  lea    D51(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  addl   $0x1,-0x134(%rbp)
L118:
  mov    -0x138(%rbp),%eax
  cmp    %eax,-0x134(%rbp)
  jl     L30
  movl   $0x0,-0x134(%rbp)
  jmp    L61
L73:
  lea    -0x90(%rbp),%rcx
  mov    -0x134(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  lea    (%rcx,%rax,1),%rdx
  mov    -0x120(%rbp),%rax
  lea    D51(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  addl   $0x1,-0x134(%rbp)
L61:
  mov    -0x138(%rbp),%eax
  cmp    %eax,-0x134(%rbp)
  jl     L73
  mov    -0x138(%rbp),%edx
  lea    -0x110(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <mat_copier@plt>
  mov    %rax,-0x128(%rbp)
  movl   $0x1,-0x134(%rbp)
  jmp    L43
L5:
  mov    -0x138(%rbp),%edx
  mov    -0x128(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <ninety_degree_conv@plt>
  mov    %rax,-0x128(%rbp)
  mov    -0x138(%rbp),%edx
  lea    -0x90(%rbp),%rcx
  mov    -0x128(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <checker@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  je     L60
  mov    -0x134(%rbp),%edx
  mov    -0x118(%rbp),%rax
  lea    D25(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L60:
  cmpl   $0x3,-0x134(%rbp)
  jne    L84
  addl   $0x2,-0x134(%rbp)
L84:
  addl   $0x1,-0x134(%rbp)
L43:
  cmpl   $0x6,-0x134(%rbp)
  jle    L5
  mov    -0x138(%rbp),%edx
  mov    -0x128(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <reflection_finder@plt>
  mov    %rax,-0x128(%rbp)
  mov    -0x138(%rbp),%edx
  lea    -0x90(%rbp),%rcx
  mov    -0x128(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <checker@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  je     L69
  mov    -0x118(%rbp),%rax
  mov    $0x4,%edx
  lea    D25(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L69:
  movl   $0x1,-0x134(%rbp)
  jmp    L66
L78:
  mov    -0x138(%rbp),%edx
  mov    -0x128(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <ninety_degree_conv@plt>
  mov    %rax,-0x128(%rbp)
  mov    -0x138(%rbp),%edx
  lea    -0x90(%rbp),%rcx
  mov    -0x128(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <checker@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  je     L28
  mov    -0x118(%rbp),%rax
  mov    $0x5,%edx
  lea    D25(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L28:
  addl   $0x1,-0x134(%rbp)
L66:
  cmpl   $0x3,-0x134(%rbp)
  jle    L78
  mov    -0x118(%rbp),%rax
  mov    $0x7,%edx
  lea    D25(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L57
  call   <__stack_chk_fail@plt>
L57:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: label: D47
type: string
name: retrieve_data
arguments: label: D82
type: string
name: retrieve_data
arguments: label: D18
type: string
name: retrieve_data
arguments: label: D60
type: string
name: retrieve_data
arguments: label: D3
type: string
name: retrieve_data
arguments: label: D51
type: string
name: retrieve_data
arguments: label: D25
type: string

tool: D47: r

tool: D82: transform.in

tool: D18: w

tool: D60: transform.out

tool: D3: %d

tool: D51: %s

tool: D25: %d


assistant: ```c
main() {
  FILE *fin = fopen("transform.in", "r");
  FILE *fout = fopen("transform.out", "w");
  int n, i, j, no, flag = 0;
  char grid_Before[11][11], grid_After[11][11];
  char **p;
  fscanf(fin, "%d", &n);
  for (i = 0; i < n; ++i) {
    fscanf(fin, "%s", grid_Before[i]);
  }
  for (i = 0; i < n; ++i) {
    fscanf(fin, "%s", grid_After[i]);
  }
  p = mat_copier(grid_Before, n);
  for (i = 1; i < 7; ++i) {
    p = ninety_degree_conv(p, n);
    no = checker(p, grid_After, n);
    if (no) {
      fprintf(fout, "%d\n", i);
      exit(0);
    }
    if (i == 3)
      i += 2;
  }
  p = reflection_finder(p, n);
  no = checker(p, grid_After, n);
  if (no) {
    fprintf(fout, "%d\n", 4);
    exit(0);
  }
  for (i = 1; i < 4; ++i) {
    p = ninety_degree_conv(p, n);
    no = checker(p, grid_After, n);
    if (no) {
      fprintf(fout, "%d\n", 5);
      exit(0);
    }
  }
  fprintf(fout, "%d\n", 7);
  exit(0);
}
```