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

```asm
<makecomat3D>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,-0x8(%rsp)
  test   %edx,%edx
  jle    L4
  mov    %ecx,%ebx
  test   %ecx,%ecx
  jle    L4
  mov    %r8d,%ecx
  test   %r8d,%r8d
  jle    L4
  cmpl   $0x1,0x38(%rsp)
  mov    %rsi,%rdi
  mov    %edx,%r11d
  mov    %r9,%r8
  jne    L48
  movslq %ecx,%r14
  xor    %r15d,%r15d
  xor    %r12d,%r12d
  shl    $0x2,%r14
L142:
  mov    %r15d,%ebp
  xor    %r9d,%r9d
  imul   %ecx,%ebp
  movslq %ebp,%rbp
  shl    $0x2,%rbp
  nopw   0x0(%rax,%rax,1)
L326:
  mov    %rbp,%rdx
  xor    %eax,%eax
  jmp    L212
  nop
L87:
  add    $0x1,%eax
  add    $0x4,%rdx
  cmp    %eax,%ecx
  je     L6
L212:
  cmpl   $0x1,(%rdi,%rdx,1)
  jne    L87
  mov    (%r8),%esi
  add    %r12d,%esi
  cmp    %esi,%r11d
  jle    L87
  test   %esi,%esi
  js     L87
  mov    0x4(%r8),%r13d
  add    %r9d,%r13d
  cmp    %r13d,%ebx
  jle    L87
  test   %r13d,%r13d
  js     L87
  mov    0x8(%r8),%r10d
  add    %eax,%r10d
  cmp    %r10d,%ecx
  jle    L87
  test   %r10d,%r10d
  js     L87
  imul   %ebx,%esi
  add    %r13d,%esi
  imul   %ecx,%esi
  add    %r10d,%esi
  movslq %esi,%rsi
  cmpl   $0x1,(%rdi,%rsi,4)
  jne    L87
  mov    -0x8(%rsp),%r10
  mov    (%r10,%rdx,1),%r13d
  test   %r13d,%r13d
  jne    L87
  mov    (%r10,%rsi,4),%esi
  test   %esi,%esi
  jne    L87
  mov    0x40(%rsp),%rsi
  add    $0x1,%eax
  add    $0x4,%rdx
  addl   $0x1,(%rsi)
  cmp    %eax,%ecx
  jne    L212
L6:
  add    $0x1,%r9d
  add    %r14,%rbp
  cmp    %r9d,%ebx
  jne    L326
  add    $0x1,%r12d
  add    %ebx,%r15d
  cmp    %r12d,%r11d
  jne    L142
L4:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L48:
  movslq %ecx,%r14
  xor    %r15d,%r15d
  xor    %r9d,%r9d
  shl    $0x2,%r14
L202:
  mov    %r15d,%ebp
  xor    %r10d,%r10d
  imul   %ecx,%ebp
  movslq %ebp,%rbp
  shl    $0x2,%rbp
  nopl   0x0(%rax,%rax,1)
L13:
  mov    %rbp,%rdx
  xor    %eax,%eax
  jmp    L312
  nopw   0x0(%rax,%rax,1)
L167:
  add    $0x1,%eax
  add    $0x4,%rdx
  cmp    %eax,%ecx
  je     L221
L312:
  cmpl   $0x1,(%rdi,%rdx,1)
  jne    L167
  mov    %r9d,%esi
  add    (%r8),%esi
  js     L167
  cmp    %esi,%r11d
  jle    L167
  mov    %r10d,%r13d
  add    0x4(%r8),%r13d
  js     L167
  cmp    %r13d,%ebx
  jle    L167
  mov    %eax,%r12d
  add    0x8(%r8),%r12d
  js     L167
  cmp    %r12d,%ecx
  jle    L167
  imul   %ebx,%esi
  add    %r13d,%esi
  imul   %ecx,%esi
  add    %r12d,%esi
  movslq %esi,%rsi
  cmpl   $0x1,(%rdi,%rsi,4)
  jne    L167
  mov    -0x8(%rsp),%r13
  mov    0x0(%r13,%rdx,1),%r12d
  test   %r12d,%r12d
  js     L167
  cmp    0x38(%rsp),%r12d
  jge    L167
  mov    0x0(%r13,%rsi,4),%r13d
  test   %r13d,%r13d
  js     L167
  cmp    0x38(%rsp),%r13d
  jge    L167
  mov    0x38(%rsp),%esi
  add    $0x1,%eax
  add    $0x4,%rdx
  imul   %r12d,%esi
  mov    0x40(%rsp),%r12
  add    %r13d,%esi
  movslq %esi,%rsi
  addl   $0x1,(%r12,%rsi,4)
  cmp    %eax,%ecx
  jne    L312
  nopl   0x0(%rax)
L221:
  add    $0x1,%r10d
  add    %r14,%rbp
  cmp    %r10d,%ebx
  jne    L13
  add    $0x1,%r9d
  add    %ebx,%r15d
  cmp    %r9d,%r11d
  jne    L202
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void makecomat3D(int *input, int *mask, int xi, int yi, int zi, int *coords, int levels, int *output) {
  int x, y, z, xval, yval, zval, i, j;
  for (x = 0; x < xi; x++) {
    for (y = 0; y < yi; y++) {
      for (z = 0; z < zi; z++) {
        if (mask[(x * yi + y) * zi + z] == 1) {
          i = input[(x * yi + y) * zi + z];
          xval = x + coords[0];
          yval = y + coords[1];
          zval = z + coords[2];
          if ((xval >= 0) && (xval < xi) && (yval >= 0) && (yval < yi) && (zval >= 0) && (zval < zi)) {
            if (mask[(xval * yi + yval) * zi + zval] == 1) {
              j = input[(xval * yi + yval) * zi + zval];
              if (i >= 0 && i < levels && j >= 0 && j < levels) {
                output[i * levels + j]++;
              }
            }
          }
        }
      }
    }
  }
}
```