user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0xc(%rbp)
  lea    -0x1c(%rbp),%rax
  mov    %rax,%rsi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  jmp    L28
L3:
  movl   $0x0,-0xc(%rbp)
  lea    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  movl   $0x0,-0x14(%rbp)
  jmp    L74
L63:
  movl   $0x0,-0x10(%rbp)
  jmp    L17
L55:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x14(%rbp),%eax
  cltq
  imul   $0x1f4,%rax,%rax
  add    %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  lea    D90(%rip),%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x14(%rbp),%eax
  cltq
  imul   $0x1f4,%rax,%rax
  add    %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  lea    D90(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  sub    $0x1,%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  lea    D33(%rip),%rdx
  mov    -0x14(%rbp),%eax
  mov    %eax,(%rcx,%rdx,1)
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x14(%rbp),%eax
  cltq
  imul   $0x1f4,%rax,%rax
  add    %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  lea    D90(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  add    %eax,%eax
  sub    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  lea    D33(%rip),%rdx
  mov    -0x10(%rbp),%eax
  mov    %eax,(%rcx,%rdx,1)
  addl   $0x1,-0x10(%rbp)
L17:
  mov    -0x18(%rbp),%eax
  cmp    %eax,-0x10(%rbp)
  jl     L55
  addl   $0x1,-0x14(%rbp)
L74:
  mov    -0x18(%rbp),%eax
  cmp    %eax,-0x14(%rbp)
  jl     L63
  movl   $0x0,-0x14(%rbp)
  jmp    L82
L56:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  lea    D33(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  mov    -0x14(%rbp),%edx
  add    $0x2,%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  lea    D33(%rip),%rdx
  mov    (%rcx,%rdx,1),%edx
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  addl   $0x1,-0x14(%rbp)
L82:
  mov    -0x18(%rbp),%edx
  mov    -0x18(%rbp),%eax
  imul   %edx,%eax
  sub    $0x1,%eax
  add    %eax,%eax
  cmp    %eax,-0x14(%rbp)
  jl     L56
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D104(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L28:
  mov    -0x1c(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  test   %eax,%eax
  jne    L3
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L52
  call   <__stack_chk_fail@plt>
L52:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D10
datatype: string
name: disassemble_data
arguments: tag: D104
datatype: string

tool: D10: %d

tool: D104: %d


assistant: ```c
int main(void) {
  int t, n, i, j, cnt = 0;
  static int ar[500][500];
  static int br[500000];
  scanf("%d", &t);
  while (t-- != 0) {
    cnt = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        scanf("%d", &ar[i][j]);
        br[ar[i][j] * 2 - 2] = i;
        br[ar[i][j] * 2 - 1] = j;
      }
    }
    for (i = 0; i < n * n * 2 - 2; i = i + 1) {
      cnt += abs(br[i] - br[i + 2]);
    }
    printf("%d\n", cnt);
  }
  return 0;
}
```