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

```asm
<isMagic>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  movslq %esi,%r12
  push   %rbp
  lea    -0x1(%r12),%r15d
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,0x8(%rsp)
  test   %r12d,%r12d
  jle    L154
  mov    %r15d,%eax
  mov    %rdi,0x10(%rsp)
  mov    $0xfffffffffffffffc,%r14
  lea    D13(%rip),%rbp
  lea    0x0(,%rax,4),%rdx
  mov    %r12d,0x1c(%rsp)
  imul   $0xfa0,%rax,%rax
  lea    0x4(%rdi,%rdx,1),%rbx
  sub    %rdx,%r14
  lea    0xfa0(%rdi,%rax,1),%rax
  mov    %rax,%r13
  nopl   (%rax)
L89:
  lea    (%r14,%rbx,1),%r12
  nopl   0x0(%rax)
L211:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  add    $0x4,%r12
  call   <scanf@plt>
  cmp    %rbx,%r12
  jne    L211
  lea    0xf9c(%r12),%rbx
  cmp    %r13,%rbx
  jne    L89
  movslq 0x1c(%rsp),%r12
  mov    0x10(%rsp),%r13
  xor    %ebx,%ebx
  xor    %r11d,%r11d
  movl   $0x1,0x10(%rsp)
  mov    0x8(%rsp),%r10
  xor    %edi,%edi
  mov    %r12d,%eax
  mov    %r12d,%ebp
  shr    $0x2,%eax
  and    $0xfffffffc,%ebp
  sub    $0x1,%eax
  add    $0x1,%rax
  shl    $0x4,%rax
  mov    %rax,%r14
  nopl   0x0(%rax)
L227:
  cmp    $0x3,%r15d
  jbe    L202
L91:
  pxor   %xmm3,%xmm3
  lea    (%r14,%r13,1),%rcx
  mov    %r13,%rdx
  mov    %r10,%rax
  movdqa %xmm3,%xmm1
  nopl   0x0(%rax)
L6:
  movd   0x1f38(%rax),%xmm2
  movd   (%rax),%xmm0
  add    $0x10,%rdx
  add    $0x3e70,%rax
  movd   -0xf9c(%rax),%xmm5
  movd   -0x2ed4(%rax),%xmm6
  movdqu -0x10(%rdx),%xmm4
  punpckldq %xmm5,%xmm2
  punpckldq %xmm6,%xmm0
  punpcklqdq %xmm2,%xmm0
  paddd  %xmm4,%xmm1
  paddd  %xmm0,%xmm3
  cmp    %rdx,%rcx
  jne    L6
  movdqa %xmm3,%xmm0
  mov    %ebp,%ecx
  psrldq $0x8,%xmm0
  paddd  %xmm0,%xmm3
  movdqa %xmm3,%xmm0
  psrldq $0x4,%xmm0
  paddd  %xmm0,%xmm3
  movdqa %xmm1,%xmm0
  psrldq $0x8,%xmm0
  movd   %xmm3,%edx
  paddd  %xmm0,%xmm1
  movdqa %xmm1,%xmm0
  psrldq $0x4,%xmm0
  paddd  %xmm0,%xmm1
  movd   %xmm1,%eax
  cmp    %r12d,%ebp
  je     L85
L169:
  movslq %ecx,%rsi
  movslq %edi,%r9
  lea    0x0(%r13,%rsi,4),%r8
  imul   $0xf9c,%rsi,%rsi
  add    0x8(%rsp),%rsi
  add    (%r8),%eax
  lea    (%rsi,%r9,4),%rsi
  lea    0x1(%rcx),%r9d
  add    (%rsi),%edx
  cmp    %r9d,%r12d
  jle    L82
  lea    0x2(%rcx),%r9d
  add    0x4(%r8),%eax
  add    0xf9c(%rsi),%edx
  cmp    %r9d,%r12d
  jle    L85
  add    $0x3,%ecx
  add    0x8(%r8),%eax
  add    0x1f38(%rsi),%edx
  cmp    %r12d,%ecx
  jge    L85
  add    0xc(%r8),%eax
  add    0x2ed4(%rsi),%edx
L85:
  test   %edi,%edi
  je     L39
L135:
  cmp    %r11d,%eax
  mov    %eax,%r11d
  jne    L206
  cmp    %edx,%ebx
  je     L132
L206:
  movl   $0x0,0x10(%rsp)
  mov    %edx,%ebx
L75:
  add    $0x1,%edi
  add    $0xf9c,%r13
  add    $0x4,%r10
  cmp    %edi,%r12d
  jne    L227
L78:
  imul   $0xf9c,%r12,%rax
  mov    0x8(%rsp),%rcx
  xor    %esi,%esi
  imul   $0xfa0,%r12,%r12
  lea    -0xf9c(%rcx,%rax,1),%rdx
  lea    -0xfa0(%rcx,%r12,1),%rax
  xor    %ecx,%ecx
  nopl   0x0(%rax,%rax,1)
L232:
  sub    $0x1,%r15d
  add    (%rdx),%esi
  add    (%rax),%ecx
  sub    $0xf98,%rdx
  sub    $0xfa0,%rax
  cmp    $0xffffffff,%r15d
  jne    L232
  cmp    %esi,%ebx
  setne  %al
  cmp    %ecx,%ebx
  setne  %dl
  or     %dl,%al
  jne    L144
  mov    0x10(%rsp),%eax
  test   %eax,%eax
  jne    L16
L144:
  lea    D5(%rip),%rdi
L14:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <printf@plt>
  nopl   0x0(%rax,%rax,1)
L39:
  add    $0xf9c,%r13
  add    $0x4,%r10
  mov    %eax,%r11d
  mov    %edx,%ebx
  mov    $0x1,%edi
  cmp    $0x3,%r15d
  ja     L91
L202:
  xor    %edx,%edx
  xor    %eax,%eax
  xor    %ecx,%ecx
  jmp    L169
  nopw   0x0(%rax,%rax,1)
L132:
  mov    %edx,%ebx
  jmp    L75
L82:
  test   %edi,%edi
  jne    L135
  mov    %eax,%r11d
  mov    %edx,%ebx
  jmp    L75
L154:
  test   %r15d,%r15d
  jns    L99
L16:
  lea    D10(%rip),%rdi
  jmp    L14
L99:
  movl   $0x1,0x10(%rsp)
  xor    %ebx,%ebx
  jmp    L78
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D13
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D5
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D10
type_infered: string

tool: D13: %d

tool: D5: NO MAGIC


tool: D10: MAGIC


assistant: ```c
void isMagic(int square[999][999], int n) {
  int magical = 1;
  int i;
  int j;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      scanf("%d", &square[i][j]);
  int curr_sumrows = 0;
  int prev_sumrows = 0;
  int curr_sumcols = 0;
  int prev_sumcols = 0;
  for (i = 0; i < n; i++) {
    prev_sumrows = curr_sumrows;
    curr_sumrows = 0;
    prev_sumcols = curr_sumcols;
    curr_sumcols = 0;
    for (j = 0; j < n; j++) {
      curr_sumrows = curr_sumrows + square[i][j];
      curr_sumcols = curr_sumcols + square[j][i];
    }
    if (i == 0) {
      prev_sumrows = curr_sumrows;
      prev_sumcols = curr_sumcols;
    }
    if (curr_sumrows != prev_sumrows || curr_sumcols != prev_sumcols)
      magical = 0;
  }
  j = 0;
  int curr_sumdiag1 = 0;
  int curr_sumdiag2 = 0;
  for (i = n - 1; i >= 0; i--) {
    curr_sumdiag1 = curr_sumdiag1 + square[i][j];
    curr_sumdiag2 = curr_sumdiag2 + square[i][i];
    j++;
  }
  if (curr_sumdiag1 != curr_sumcols || curr_sumdiag2 != curr_sumcols)
    magical = 0;
  if (magical == 1)
    printf("MAGIC\n");
  else
    printf("NO MAGIC\n");
}
```