user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x88,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,-0xa8(%rbp)
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x70(%rbp),%rax
  mov    %rax,%rsi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x70(%rbp),%ecx
  mov    -0x70(%rbp),%esi
  movslq %ecx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x50(%rbp)
  movslq %ecx,%rax
  mov    %rax,-0xa0(%rbp)
  movq   $0x0,-0x98(%rbp)
  movslq %ecx,%rax
  lea    0x0(,%rax,4),%rbx
  movslq %esi,%rax
  sub    $0x1,%rax
  mov    %rax,-0x48(%rbp)
  movslq %ecx,%rax
  mov    %rax,-0x80(%rbp)
  movq   $0x0,-0x78(%rbp)
  movslq %esi,%rax
  mov    %rax,-0x90(%rbp)
  movq   $0x0,-0x88(%rbp)
  mov    -0x80(%rbp),%r10
  mov    -0x78(%rbp),%r11
  mov    %r11,%rdx
  mov    -0x90(%rbp),%r8
  mov    -0x88(%rbp),%r9
  imul   %r8,%rdx
  mov    %r9,%rax
  imul   %r10,%rax
  lea    (%rdx,%rax,1),%rdi
  mov    %r10,%rax
  mul    %r8
  add    %rdx,%rdi
  mov    %rdi,%rdx
  movslq %ecx,%rax
  mov    %rax,%r14
  mov    $0x0,%r15d
  movslq %esi,%rax
  mov    %rax,%r12
  mov    $0x0,%r13d
  mov    %r15,%rdx
  imul   %r12,%rdx
  mov    %r13,%rax
  imul   %r14,%rax
  lea    (%rdx,%rax,1),%rdi
  mov    %r14,%rax
  mul    %r12
  add    %rdx,%rdi
  mov    %rdi,%rdx
  movslq %ecx,%rdx
  movslq %esi,%rax
  imul   %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L61:
  cmp    %rdx,%rsp
  je     L122
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L61
L122:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L20
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L20:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x40(%rbp)
  movl   $0x0,-0x6c(%rbp)
  jmp    L8
L161:
  movl   $0x0,-0x68(%rbp)
  jmp    L29
L155:
  mov    -0x68(%rbp),%edx
  mov    -0x6c(%rbp),%eax
  mov    %eax,%esi
  lea    D41(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %rbx,%rdx
  shr    $0x2,%rdx
  mov    -0x68(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x6c(%rbp),%eax
  cltq
  imul   %rdx,%rax
  add    %rcx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  addl   $0x1,-0x68(%rbp)
L29:
  mov    -0x70(%rbp),%eax
  cmp    %eax,-0x68(%rbp)
  jl     L155
  addl   $0x1,-0x6c(%rbp)
L8:
  mov    -0x70(%rbp),%eax
  cmp    %eax,-0x6c(%rbp)
  jl     L161
  movl   $0x0,-0x64(%rbp)
  movl   $0x0,-0x6c(%rbp)
  movl   $0x0,-0x68(%rbp)
  movl   $0x0,-0x60(%rbp)
  movl   $0x0,-0x5c(%rbp)
  mov    -0x70(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x58(%rbp)
  movl   $0x0,-0x54(%rbp)
  jmp    L65
L85:
  mov    %rbx,%rcx
  shr    $0x2,%rcx
  mov    -0x40(%rbp),%rax
  mov    -0x68(%rbp),%edx
  movslq %edx,%rsi
  mov    -0x6c(%rbp),%edx
  movslq %edx,%rdx
  imul   %rcx,%rdx
  add    %rsi,%rdx
  mov    (%rax,%rdx,4),%edi
  mov    -0x70(%rbp),%edx
  mov    -0x70(%rbp),%eax
  mov    %edx,%esi
  imul   %eax,%esi
  mov    -0x64(%rbp),%ecx
  mov    -0x68(%rbp),%edx
  mov    -0x6c(%rbp),%eax
  mov    %edi,%r9d
  mov    %esi,%r8d
  mov    %eax,%esi
  lea    D36(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x60(%rbp),%eax
  and    $0x3,%eax
  test   %eax,%eax
  jne    L17
  addl   $0x1,-0x68(%rbp)
L17:
  mov    -0x60(%rbp),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cmp    $0x1,%eax
  jne    L135
  addl   $0x1,-0x6c(%rbp)
L135:
  mov    -0x60(%rbp),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cmp    $0x2,%eax
  jne    L92
  subl   $0x1,-0x68(%rbp)
L92:
  mov    -0x60(%rbp),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cmp    $0x3,%eax
  jne    L154
  subl   $0x1,-0x6c(%rbp)
L154:
  addl   $0x1,-0x5c(%rbp)
  mov    -0x5c(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jne    L27
  movl   $0xffffffff,-0x5c(%rbp)
  addl   $0x1,-0x60(%rbp)
  movl   $0x0,-0x54(%rbp)
L27:
  mov    -0x60(%rbp),%eax
  add    $0x1,%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L108
  cmpl   $0x0,-0x54(%rbp)
  jne    L108
  subl   $0x1,-0x58(%rbp)
  movl   $0x1,-0x54(%rbp)
L108:
  addl   $0x1,-0x64(%rbp)
L65:
  mov    -0x70(%rbp),%edx
  mov    -0x70(%rbp),%eax
  imul   %edx,%eax
  cmp    %eax,-0x64(%rbp)
  jl     L85
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0x0,%eax
  mov    -0xa8(%rbp),%rsp
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L136
  call   <__stack_chk_fail@plt>
L136:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: parse_data
arguments: data_label: D22
type_guessed: string
name: parse_data
arguments: data_label: D20
type_guessed: string
name: parse_data
arguments: data_label: D41
type_guessed: string
name: parse_data
arguments: data_label: D36
type_guessed: string

tool: D22: Inserisci dimensione della matrice: 

tool: D20: %d

tool: D41: Inserisci numero [%d:%d]: 

tool: D36: 
[i=%d, k=%d; %d/%d]: %d

assistant: ```c
int main() {
  int i, k, j;
  int size;
  int direction, step, max_step;
  bool changed;
  printf("Inserisci dimensione della matrice: ");
  scanf("%d", &size);
  int matrix[size][size];
  for (i = 0; i < size; i++) {
    for (k = 0; k < size; k++) {
      printf("Inserisci numero [%d:%d]: ", i, k);
      scanf("%d", &matrix[i][k]);
    }
  }
  for (j = 0, i = 0, k = 0, direction = 0, step = 0, max_step = size - 1, changed = false; j < size * size; j++) {
    printf("\n[i=%d, k=%d; %d/%d]: %d", i, k, j, size * size, matrix[i][k]);
    if (direction % 4 == 0)
      k++;
    if (direction % 4 == 1)
      i++;
    if (direction % 4 == 2)
      k--;
    if (direction % 4 == 3)
      i--;
    step++;
    if (step == max_step)
      step = -1, direction++, changed = false;
    if ((direction + 1) % 2 == 0 && !changed)
      max_step--, changed = true;
  }
  printf("\n");
  return 0;
}
```