user: What would the C source look like for the assembly code provided here:

```asm
<checksq>:
  endbr64
  test   %rsi,%rsi
  je     L148
  push   %rbp
  mov    %rdi,%r8
  mov    %rsi,%rdi
  push   %rbx
  cmp    $0x1,%rsi
  je     L93
  mov    %rsi,%rdx
  mov    %r8,%rax
  pxor   %xmm0,%xmm0
  shr    %rdx
  shl    $0x4,%rdx
  add    %r8,%rdx
  nopl   0x0(%rax,%rax,1)
L71:
  movdqu (%rax),%xmm3
  add    $0x10,%rax
  paddq  %xmm3,%xmm0
  cmp    %rdx,%rax
  jne    L71
  movdqa %xmm0,%xmm1
  mov    %rdi,%rax
  psrldq $0x8,%xmm1
  and    $0xfffffffffffffffe,%rax
  paddq  %xmm1,%xmm0
  movq   %xmm0,%r10
  test   $0x1,%dil
  je     L143
L101:
  add    (%r8,%rax,8),%r10
  cmp    $0x1,%rdi
  je     L6
L143:
  mov    %rdi,%rbx
  mov    %rdi,%rsi
  mov    %rdi,%rcx
  mov    $0x1,%r11d
  lea    0x0(,%rdi,8),%rbp
  shr    %rbx
  and    $0xfffffffffffffffe,%rsi
  lea    (%r8,%rbp,1),%r9
  shl    $0x4,%rbx
  nopl   0x0(%rax)
L123:
  lea    (%r9,%rbx,1),%rdx
  mov    %r9,%rax
  pxor   %xmm0,%xmm0
  nopl   0x0(%rax,%rax,1)
L74:
  movdqu (%rax),%xmm2
  add    $0x10,%rax
  paddq  %xmm2,%xmm0
  cmp    %rax,%rdx
  jne    L74
  movdqa %xmm0,%xmm1
  psrldq $0x8,%xmm1
  paddq  %xmm1,%xmm0
  movq   %xmm0,%rax
  cmp    %rsi,%rdi
  je     L46
  lea    (%rcx,%rsi,1),%rdx
  add    (%r8,%rdx,8),%rax
L46:
  cmp    %rax,%r10
  jne    L118
  add    $0x1,%r11
  add    %rbp,%r9
  add    %rdi,%rcx
  cmp    %r11,%rdi
  jne    L123
L6:
  mov    %r8,%rbp
  lea    0x0(,%rdi,8),%r9
  mov    %r8,%r11
  xor    %ebx,%ebx
  nopl   0x0(%rax)
L106:
  mov    %r11,%rdx
  xor    %ecx,%ecx
  xor    %eax,%eax
  nop
L22:
  mov    %rax,%rsi
  lea    0x1(%rax),%rax
  add    (%rdx),%rcx
  add    %r9,%rdx
  cmp    %rax,%rdi
  jne    L22
  cmp    %rcx,%r10
  jne    L118
  lea    0x1(%rbx),%rax
  add    $0x8,%r11
  cmp    %rbx,%rsi
  je     L68
  mov    %rax,%rbx
  jmp    L106
L118:
  xor    %eax,%eax
L56:
  pop    %rbx
  pop    %rbp
  ret
L68:
  add    $0x8,%r9
  xor    %edx,%edx
  xor    %eax,%eax
  cs nopw 0x0(%rax,%rax,1)
L81:
  mov    %rax,%rcx
  add    0x0(%rbp),%rdx
  add    $0x1,%rax
  add    %r9,%rbp
  cmp    %rcx,%rsi
  jne    L81
  xor    %eax,%eax
  cmp    %rdx,%r10
  jne    L56
  lea    0x0(,%rsi,8),%rdi
  xor    %edx,%edx
  add    %rdi,%r8
  nopw   0x0(%rax,%rax,1)
L21:
  mov    %rdx,%rcx
  add    (%r8),%rax
  add    $0x1,%rdx
  add    %rdi,%r8
  cmp    %rcx,%rsi
  jne    L21
  xor    %edx,%edx
  cmp    %rax,%r10
  cmovne %rdx,%rax
  jmp    L56
L148:
  xor    %eax,%eax
  ret
L93:
  xor    %r10d,%r10d
  xor    %eax,%eax
  jmp    L101
```

assistant: ```c
unsigned long int checksq(const unsigned long int *magicsq, unsigned long int d) {
  unsigned long int i, j;
  unsigned long int mc = 0;
  for (j = 0; j < d; j++) {
    mc += magicsq[j];
  }
  for (i = 1; i < d; i++) {
    unsigned long int ms = 0;
    for (j = 0; j < d; j++) {
      ms += magicsq[d * i + j];
    }
    if (mc != ms)
      return 0;
  }
  for (j = 0; j < d; j++) {
    unsigned long int ms = 0;
    for (i = 0; i < d; i++) {
      ms += magicsq[d * i + j];
    }
    if (mc != ms)
      return 0;
  }
  unsigned long int ms = 0;
  for (i = 0; i < d; i++) {
    ms += magicsq[d * i + i];
  }
  if (mc != ms)
    return 0;
  ms = 0;
  for (i = 0; i < d; i++) {
    ms += magicsq[d * i + (d - i - 1)];
  }
  if (mc != ms)
    return 0;
  return mc;
}
```