user: Translate the below assembly code into C programming language:

```asm
<magic_square>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x3cf000(%rsp),%r11
L26:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L26
  sub    $0x988,%rsp
  mov    %edi,%r15d
  mov    %fs:0x28,%rax
  mov    %rax,0x3cf978(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  jle    L21
  lea    0xfb0(%rsp),%r14
  lea    -0x1(%rdi),%eax
  lea    0xfb4(%rsp,%rax,4),%rbp
  mov    $0x0,%r13d
  mov    %edi,%eax
  neg    %rax
  shl    $0x2,%rax
  lea    D19(%rip),%r12
  mov    %r14,0x8(%rsp)
  mov    %rax,%r14
L142:
  add    $0x1,%r13d
  mov    %r13d,%esi
  lea    D13(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    (%r14,%rbp,1),%rbx
L114:
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  add    $0x4,%rbx
  cmp    %rbp,%rbx
  jne    L114
  add    $0xf9c,%rbp
  cmp    %r15d,%r13d
  jne    L142
  mov    0x8(%rsp),%r14
  mov    %r15d,%eax
  imul   %r15d,%eax
  add    $0x1,%eax
  imul   %r15d,%eax
  mov    %eax,%r12d
  shr    $0x1f,%r12d
  add    %eax,%r12d
  sar    %r12d
  lea    (%r15,%r15,1),%r11d
  movslq %r11d,%rax
  movl   $0x0,0x10(%rsp,%rax,4)
  lea    0x1(%r11),%r13d
  movslq %r13d,%rax
  movl   $0x0,0x10(%rsp,%rax,4)
  lea    0x10(%rsp),%r10
  movslq %r15d,%rbp
  lea    (%r10,%rbp,4),%rbx
  mov    %r14,%r8
  mov    $0x0,%edi
  mov    %r15d,%r9d
  movslq %r11d,%r11
  jmp    L43
L57:
  add    $0x1,%rax
  add    $0xf9c,%rdx
  cmp    %r9,%rax
  je     L159
L89:
  mov    (%r8,%rax,4),%r10d
  add    %r10d,(%rsi)
  mov    (%rdx),%r10d
  add    %r10d,(%rcx)
  cmp    %eax,%edi
  jne    L57
  mov    (%r8,%rbp,4),%r10d
  add    %r10d,0x10(%rsp,%r11,4)
  jmp    L57
L159:
  mov    0x8(%rsp),%r10
  lea    0x1(%rdi),%eax
  add    $0x4,%r10
  add    $0x4,%rbx
  add    $0x4,%r14
  add    $0xf9c,%r8
  cmp    %eax,%r15d
  je     L51
  mov    %eax,%edi
L43:
  mov    %r10,%rsi
  movl   $0x0,(%r10)
  mov    %rbx,%rcx
  movl   $0x0,(%rbx)
  mov    %r14,%rdx
  mov    $0x0,%eax
  mov    %r10,0x8(%rsp)
  jmp    L89
L69:
  lea    D38(%rip),%rdi
  call   <puts@plt>
L128:
  cmp    %ebx,%r15d
  je     L110
L72:
  mov    0x3cf978(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L39
  add    $0x3cf988,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L88:
  mov    $0x0,%ebx
  jmp    L128
L110:
  lea    D9(%rip),%rdi
  call   <puts@plt>
  jmp    L72
L51:
  test   %edi,%edi
  jg     L106
L46:
  movslq %r13d,%rax
  mov    0x10(%rsp,%rax,4),%edx
  movslq %edi,%rax
  imul   $0xf9c,%rax,%rax
  lea    0xfb0(%rsp,%rax,1),%rax
L101:
  add    (%rax),%edx
  sub    $0x1,%edi
  sub    $0xf98,%rax
  test   %edi,%edi
  jle    L101
  movslq %r13d,%r13
  mov    %edx,0x10(%rsp,%r13,4)
  test   %r15d,%r15d
  jle    L88
L106:
  lea    0x10(%rsp),%rax
  mov    $0x0,%ebx
L150:
  cmp    %r12d,(%rax)
  jne    L69
  add    $0x1,%ebx
  add    $0x4,%rax
  cmp    %ebx,%r15d
  jg     L150
  jmp    L128
L21:
  mov    %edi,%eax
  imul   %edi,%eax
  add    $0x1,%eax
  imul   %edi,%eax
  mov    %eax,%r12d
  shr    $0x1f,%r12d
  add    %eax,%r12d
  sar    %r12d
  lea    (%rdi,%rdi,1),%r13d
  movslq %r13d,%rax
  movl   $0x0,0x10(%rsp,%rax,4)
  add    $0x1,%r13d
  movslq %r13d,%rax
  movl   $0x0,0x10(%rsp,%rax,4)
  lea    -0x1(%rdi),%edi
  jmp    L46
L39:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D19
data_type: string
name: extract_symbolic_data
arguments: label: D13
data_type: string
name: extract_symbolic_data
arguments: label: D38
data_type: string
name: extract_symbolic_data
arguments: label: D9
data_type: string

tool: D19:  %d

tool: D13: Enter %d line: 

tool: D38: NO MAGIC

tool: D9: MAGIC

assistant: ```c
void magic_square(int a) {
  int i, b, c;
  int ar[999][999];
  int ar1[999];
  for (i = 0; i < a; i++) {
    printf("Enter %d line: ", i + 1);
    for (b = 0; b < a; b++) {
      scanf(" %d", &ar[i][b]);
    }
  }
  c = (a * (a * a + 1)) / 2;
  ar1[a + a] = 0;
  ar1[a + a + 1] = 0;
  for (i = 0; i < a; i++) {
    ar1[i] = 0;
    ar1[i + a] = 0;
    for (b = 0; b < a; b++) {
      ar1[i] = ar1[i] + ar[i][b];
      ar1[i + a] = ar1[i + a] + ar[b][i];
      if (b == i) {
        ar1[a + a] = ar1[a + a] + ar[i][a];
      }
    }
  }
  b = 0;
  for (i = a - 1; i <= 0; i--) {
    ar1[a + a + 1] = ar1[a + a + 1] + ar[i][b];
    b++;
  }
  b = 0;
  for (i = 0; i < a; i++) {
    if (ar1[i] == c)
      b++;
    else {
      printf("NO MAGIC\n");
      break;
    }
  }
  if (b == a)
    printf("MAGIC\n");
}
```