user: What is the c source code of the assembly code below?

```asm
<is_magic>:
  endbr64
  test   %rsi,%rsi
  je     L92
  push   %r15
  push   %r14
  mov    %edi,%r14d
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  test   %edi,%edi
  jle    L21
  lea    0x2(%rdi,%rdi,1),%eax
  mov    %rsi,%rbx
  mov    $0x4,%esi
  xor    %r15d,%r15d
  mov    %eax,%edi
  mov    %eax,0x34(%rsp)
  call   <calloc@plt>
  mov    %rax,%rbp
  mov    %rax,0x28(%rsp)
  lea    (%r14,%r14,1),%eax
  cltq
  mov    %rbp,0x38(%rsp)
  shl    $0x2,%rax
  lea    0x0(%rbp,%rax,1),%rsi
  lea    0x4(%rbp,%rax,1),%rax
  mov    %rax,0x20(%rsp)
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,4),%rax
  mov    %rsi,0x18(%rsp)
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax,%rax,1)
L30:
  lea    0x1(%r15),%eax
  xor    %r13d,%r13d
  mov    %eax,0xc(%rsp)
  mov    %r14d,%eax
  mov    %r13,%r14
  mov    %eax,%r13d
  jmp    L16
  cs nopw 0x0(%rax,%rax,1)
L28:
  mov    0xc(%rsp),%eax
  lea    (%rax,%r12,1),%r8d
  cmp    %r8d,%r13d
  je     L75
L68:
  add    $0x1,%r14
  cmp    %r14d,%r13d
  jle    L6
L16:
  mov    %r14d,%ecx
  mov    %r15d,%edx
  mov    %r13d,%esi
  mov    %rbx,%rdi
  mov    %r14d,0x30(%rsp)
  mov    %r14d,%r12d
  call   <mat_elem@plt>
  add    %eax,0x0(%rbp)
  mov    %r14d,%ecx
  mov    %r15d,%edx
  mov    %r13d,%esi
  mov    %rbx,%rdi
  call   <mat_elem@plt>
  mov    0x10(%rsp),%rcx
  add    %eax,(%rcx,%r14,4)
  cmp    %r14d,%r15d
  jne    L28
  mov    %rbx,%rdi
  mov    %r15d,%ecx
  mov    %r15d,%edx
  mov    %r13d,%esi
  call   <mat_elem@plt>
  mov    0x18(%rsp),%rdi
  add    %eax,(%rdi)
  mov    0xc(%rsp),%eax
  lea    (%rax,%r12,1),%r8d
  cmp    %r8d,%r13d
  jne    L68
  nopw   0x0(%rax,%rax,1)
L75:
  mov    0x30(%rsp),%ecx
  mov    %rbx,%rdi
  mov    %r15d,%edx
  mov    %r13d,%esi
  add    $0x1,%r14
  call   <mat_elem@plt>
  mov    0x20(%rsp),%rdi
  add    %eax,(%rdi)
  cmp    %r14d,%r13d
  jg     L16
  cs nopw 0x0(%rax,%rax,1)
L6:
  mov    0xc(%rsp),%r15d
  mov    %r13d,%r14d
  add    $0x4,%rbp
  cmp    %r15d,%r13d
  jg     L30
  mov    0x34(%rsp),%eax
  mov    0x28(%rsp),%rsi
  mov    0x38(%rsp),%rdx
  sub    $0x1,%eax
  lea    (%rsi,%rax,4),%rax
  nopw   0x0(%rax,%rax,1)
L72:
  mov    (%rdx),%esi
  cmp    %esi,0x4(%rdx)
  jne    L21
  add    $0x4,%rdx
  cmp    %rdx,%rax
  jne    L72
  mov    0x28(%rsp),%rdi
  call   <free@plt>
  add    $0x48,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L21:
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L92:
  xor    %eax,%eax
  ret
```

assistant: ```c
int is_magic(int N, int *m[]) {
  int i, j;
  int *sum;
  if (m == NULL || N <= 0)
    return 0;
  sum = calloc(N + N + 2, sizeof(int));
  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++) {
      sum[i] += mat_elem(m, N, i, j);
      sum[N + j] += mat_elem(m, N, i, j);
      if (i == j)
        sum[N + N] += mat_elem(m, N, i, j);
      if ((i + j + 1) == N)
        sum[N + N + 1] += mat_elem(m, N, i, j);
    }
  for (i = 1; i < N + N + 2; i++)
    if (sum[i] != sum[i - 1])
      return 0;
  free(sum);
  return 1;
}
```