user: Please show me the C implementation that matches the assembly code listed below:

```asm
<spiralPrint>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edi,0xc(%rsp)
  mov    %rdx,0x10(%rsp)
  test   %esi,%esi
  jle    L146
  test   %edi,%edi
  jle    L146
  movslq %esi,%rax
  movl   $0x0,(%rsp)
  mov    %esi,%r12d
  xor    %r15d,%r15d
  lea    0x14(%rdx,%rax,4),%rdx
  sub    $0x1,%rax
  movl   $0x0,0x8(%rsp)
  mov    0x8(%rsp),%r13d
  mov    %rdx,0x18(%rsp)
  lea    D4(%rip),%rbx
  mov    %rax,0x28(%rsp)
  nopw   0x0(%rax,%rax,1)
L61:
  mov    0x10(%rsp),%rdx
  lea    (%r15,%r15,2),%rax
  mov    %rbx,%rdi
  lea    (%rdx,%rax,8),%rbp
  movslq %r13d,%rax
  lea    0x0(%rbp,%rax,4),%r14
  mov    %rax,0x20(%rsp)
  mov    (%r14),%esi
  call   <printf@plt>
  mov    %r13d,%eax
  add    $0x1,%eax
  mov    %eax,0x8(%rsp)
  cmp    %eax,%r12d
  jle    L55
  mov    0x4(%r14),%esi
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    0x2(%r13),%eax
  cmp    %eax,%r12d
  jle    L55
  mov    0x8(%r14),%esi
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    0x3(%r13),%eax
  cmp    %eax,%r12d
  jle    L55
  mov    0xc(%r14),%esi
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    0x4(%r13),%eax
  cmp    %eax,%r12d
  jle    L55
  mov    0x10(%r14),%esi
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    0x5(%r13),%eax
  cmp    %eax,%r12d
  jle    L55
  mov    0x14(%r14),%esi
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    0x6(%r13),%eax
  cmp    %eax,%r12d
  jle    L55
  mov    0x18(%r14),%esi
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    0x7(%r13),%edx
  cmp    %edx,%r12d
  jle    L55
  movslq %edx,%r14
L178:
  mov    0x0(%rbp,%r14,4),%esi
  mov    %rbx,%rdi
  add    $0x1,%r14
  call   <printf@plt>
  cmp    %r14d,%r12d
  jg     L178
  nopl   0x0(%rax,%rax,1)
L55:
  addl   $0x1,(%rsp)
  mov    0xc(%rsp),%ecx
  lea    -0x1(%r12),%edx
  mov    (%rsp),%eax
  mov    %edx,0x4(%rsp)
  cmp    %ecx,%eax
  jge    L261
  lea    -0x2(%rcx),%eax
  mov    0x10(%rsp),%rcx
  mov    0x18(%rsp),%r14
  sub    %r15d,%eax
  add    %r15,%rax
  lea    (%rax,%rax,2),%rdx
  mov    0x28(%rsp),%rax
  sub    %r15,%rax
  lea    (%rax,%rdx,2),%rax
  lea    0x30(%rcx,%rax,4),%rbp
  nopl   0x0(%rax)
L82:
  mov    (%r14),%esi
  mov    %rbx,%rdi
  add    $0x18,%r14
  call   <printf@plt>
  cmp    %rbp,%r14
  jne    L82
  lea    -0x2(%r12),%eax
  cmp    %eax,%r13d
  jg     L16
  movslq 0xc(%rsp),%rdx
  mov    0x10(%rsp),%rcx
  cltq
  mov    %rbx,%rdi
  lea    (%rdx,%rdx,2),%rdx
  lea    -0x18(%rcx,%rdx,8),%rbp
  mov    0x0(%rbp,%rax,4),%esi
  call   <printf@plt>
  lea    -0x3(%r12),%eax
  cmp    %eax,%r13d
  jg     L16
  cltq
  mov    %rbx,%rdi
  mov    0x0(%rbp,%rax,4),%esi
  call   <printf@plt>
  lea    -0x4(%r12),%eax
  cmp    %eax,%r13d
  jg     L16
  cltq
  mov    %rbx,%rdi
  mov    0x0(%rbp,%rax,4),%esi
  call   <printf@plt>
  lea    -0x5(%r12),%eax
  cmp    %eax,%r13d
  jg     L16
  cltq
  mov    %rbx,%rdi
  mov    0x0(%rbp,%rax,4),%esi
  call   <printf@plt>
  lea    -0x6(%r12),%eax
  cmp    %eax,%r13d
  jg     L16
  cltq
  mov    %rbx,%rdi
  mov    0x0(%rbp,%rax,4),%esi
  call   <printf@plt>
  lea    -0x7(%r12),%eax
  cmp    %eax,%r13d
  jg     L16
  cltq
  mov    %rbx,%rdi
  mov    0x0(%rbp,%rax,4),%esi
  call   <printf@plt>
  lea    -0x8(%r12),%eax
  cmp    %eax,%r13d
  jg     L16
  cltq
  mov    %rbx,%rdi
  sub    $0x9,%r12d
  mov    0x0(%rbp,%rax,4),%esi
  call   <printf@plt>
  cmp    %r12d,%r13d
  jg     L16
  movslq %r12d,%r12
L35:
  mov    0x0(%rbp,%r12,4),%esi
  mov    %rbx,%rdi
  sub    $0x1,%r12
  call   <printf@plt>
  cmp    %r12d,%r13d
  jle    L35
  nopl   (%rax)
L16:
  subl   $0x1,0xc(%rsp)
L261:
  cmp    0x4(%rsp),%r13d
  jl     L101
L146:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L101:
  mov    (%rsp),%edx
  cmp    %edx,0xc(%rsp)
  jle    L210
  movslq 0xc(%rsp),%rax
  mov    0x20(%rsp),%rcx
  mov    %rax,%rdx
  lea    (%rax,%rax,2),%rax
  lea    (%rcx,%rax,2),%rax
  mov    0x10(%rsp),%rcx
  shl    $0x2,%rax
  lea    -0x30(%rcx,%rax,1),%rbp
  lea    -0x18(%rcx,%rax,1),%r12
  mov    %edx,%eax
  sub    %r15d,%eax
  sub    $0x2,%eax
  lea    (%rax,%rax,2),%rax
  shl    $0x3,%rax
  sub    %rax,%rbp
  nopl   0x0(%rax)
L159:
  mov    (%r12),%esi
  mov    %rbx,%rdi
  sub    $0x18,%r12
  call   <printf@plt>
  cmp    %rbp,%r12
  jne    L159
L210:
  addq   $0x14,0x18(%rsp)
  mov    (%rsp),%edx
  add    $0x1,%r15
  cmp    %edx,0xc(%rsp)
  jle    L146
  mov    0x8(%rsp),%ecx
  cmp    %ecx,0x4(%rsp)
  jle    L146
  mov    0x4(%rsp),%r12d
  mov    %ecx,%r13d
  jmp    L61
```

tool_calls: name: disassemble_data
arguments: label: D4
type_infered: string

tool: D4: %d 

assistant: ```c
void spiralPrint(int m, int n, int a[3][6]) {
  int i, k = 0, l = 0;
  while (k < m && l < n) {
    for (i = l; i < n; ++i) {
      printf("%d ", a[k][i]);
    }
    k++;
    for (i = k; i < m; ++i) {
      printf("%d ", a[i][n - 1]);
    }
    n--;
    if (k < m) {
      for (i = n - 1; i >= l; --i) {
        printf("%d ", a[m - 1][i]);
      }
      m--;
    }
    if (l < n) {
      for (i = m - 1; i >= k; --i) {
        printf("%d ", a[i][l]);
      }
      l++;
    }
  }
}
```