user: Converte this assembly snippet into its equivalent C code:

```asm
<core_max_pool>:
  endbr64
  push   %r15
  push   %r14
  mov    %edi,%r14d
  push   %r13
  push   %r12
  push   %rbp
  mov    %r9d,%ebp
  push   %rbx
  mov    %r8,%rbx
  sub    $0x188,%rsp
  mov    %rdx,0x48(%rsp)
  mov    0x1c0(%rsp),%edx
  mov    %rsi,0x10(%rsp)
  mov    %rcx,0x58(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x178(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  jle    L8
  lea    -0x1(%rdi),%eax
  cmp    $0x2,%eax
  jbe    L86
  mov    %edi,%eax
  movd   %edx,%xmm7
  pshufd $0x0,%xmm7,%xmm0
  shr    $0x2,%eax
  movaps %xmm0,0x130(%rsp)
  cmp    $0x1,%eax
  je     L161
  movaps %xmm0,0x140(%rsp)
  cmp    $0x2,%eax
  je     L161
  movaps %xmm0,0x150(%rsp)
  cmp    $0x3,%eax
  je     L161
  movaps %xmm0,0x160(%rsp)
L161:
  mov    %r14d,%eax
  and    $0xfffffffc,%eax
  test   $0x3,%r14b
  je     L8
L76:
  movslq %eax,%rcx
  mov    %edx,0x130(%rsp,%rcx,4)
  lea    0x1(%rax),%ecx
  cmp    %ecx,%r14d
  jle    L8
  movslq %ecx,%rcx
  add    $0x2,%eax
  mov    %edx,0x130(%rsp,%rcx,4)
  cmp    %eax,%r14d
  jle    L8
  cltq
  mov    %edx,0x130(%rsp,%rax,4)
L8:
  lea    0x130(%rsp),%r15
  mov    %r14d,%edi
  mov    %r15,%rsi
  call   <size_from_shape2@plt>
  mov    0x58(%rsp),%rsi
  mov    %r14d,%edi
  mov    %eax,0x18(%rsp)
  call   <size_from_shape2@plt>
  lea    0x70(%rsp),%rsi
  mov    %r14d,%edi
  mov    %eax,%r12d
  mov    %rsi,0x68(%rsp)
  call   <indices_reset@plt>
  test   %r12d,%r12d
  jle    L113
  lea    -0x1(%r12),%eax
  movd   %ebp,%xmm6
  mov    %rbx,0x50(%rsp)
  lea    0xf0(%rsp),%r12
  lea    0x4(%rbx,%rax,4),%rax
  pshufd $0x0,%xmm6,%xmm6
  mov    %rax,0x60(%rsp)
  lea    -0x1(%r14),%eax
  movdqa %xmm6,%xmm7
  mov    %eax,0x1c(%rsp)
  mov    %r14d,%eax
  psrlq  $0x20,%xmm7
  shr    $0x2,%eax
  movaps %xmm6,0x20(%rsp)
  mov    %eax,0x44(%rsp)
  mov    %r14d,%eax
  and    $0xfffffffc,%eax
  movaps %xmm7,0x30(%rsp)
  mov    %eax,0x40(%rsp)
  nopw   0x0(%rax,%rax,1)
L141:
  mov    %r12,%rsi
  mov    %r14d,%edi
  call   <indices_reset@plt>
  mov    0x18(%rsp),%eax
  movss  D10(%rip),%xmm0
  test   %eax,%eax
  jle    L180
  lea    0xb0(%rsp),%r13
  movsd  D7(%rip),%xmm5
  xor    %ebx,%ebx
  mov    %r13,%rax
  mov    %r14d,%r13d
  movsd  %xmm5,0x8(%rsp)
  mov    %rax,%r14
L198:
  test   %r13d,%r13d
  jle    L201
  cmpl   $0x2,0x1c(%rsp)
  jbe    L181
  movdqa 0x70(%rsp),%xmm1
  movdqa 0x30(%rsp),%xmm2
  movdqa 0x20(%rsp),%xmm3
  mov    0x44(%rsp),%eax
  psrlq  $0x20,%xmm1
  pmuludq %xmm2,%xmm1
  movdqa %xmm3,%xmm0
  pmuludq 0x70(%rsp),%xmm0
  pshufd $0x8,%xmm0,%xmm0
  pshufd $0x8,%xmm1,%xmm1
  punpckldq %xmm1,%xmm0
  paddd  0xf0(%rsp),%xmm0
  movaps %xmm0,0xb0(%rsp)
  cmp    $0x1,%eax
  jbe    L152
  movdqa 0x80(%rsp),%xmm1
  movdqa %xmm3,%xmm0
  pmuludq 0x80(%rsp),%xmm0
  pshufd $0x8,%xmm0,%xmm0
  psrlq  $0x20,%xmm1
  pmuludq %xmm2,%xmm1
  pshufd $0x8,%xmm1,%xmm1
  punpckldq %xmm1,%xmm0
  paddd  0x100(%rsp),%xmm0
  movaps %xmm0,0xc0(%rsp)
  cmp    $0x2,%eax
  je     L152
  movdqa 0x90(%rsp),%xmm1
  movdqa %xmm3,%xmm0
  pmuludq 0x90(%rsp),%xmm0
  pshufd $0x8,%xmm0,%xmm0
  psrlq  $0x20,%xmm1
  pmuludq %xmm2,%xmm1
  pshufd $0x8,%xmm1,%xmm1
  punpckldq %xmm1,%xmm0
  paddd  0x110(%rsp),%xmm0
  movaps %xmm0,0xd0(%rsp)
  cmp    $0x3,%eax
  je     L152
  movdqa 0xa0(%rsp),%xmm1
  movdqa %xmm3,%xmm0
  pmuludq 0xa0(%rsp),%xmm0
  pshufd $0x8,%xmm0,%xmm0
  psrlq  $0x20,%xmm1
  pmuludq %xmm2,%xmm1
  pshufd $0x8,%xmm1,%xmm1
  punpckldq %xmm1,%xmm0
  paddd  0x120(%rsp),%xmm0
  movaps %xmm0,0xe0(%rsp)
L152:
  mov    0x40(%rsp),%eax
  cmp    %r13d,%eax
  je     L201
L146:
  movslq %eax,%rdx
  mov    0x70(%rsp,%rdx,4),%esi
  imul   %ebp,%esi
  add    0xf0(%rsp,%rdx,4),%esi
  mov    %esi,0xb0(%rsp,%rdx,4)
  lea    0x1(%rax),%edx
  cmp    %r13d,%edx
  jge    L201
  movslq %edx,%rdx
  add    $0x2,%eax
  mov    0x70(%rsp,%rdx,4),%esi
  imul   %ebp,%esi
  add    0xf0(%rsp,%rdx,4),%esi
  mov    %esi,0xb0(%rsp,%rdx,4)
  cmp    %eax,%r13d
  jle    L201
  cltq
  mov    0x70(%rsp,%rax,4),%edx
  imul   %ebp,%edx
  add    0xf0(%rsp,%rax,4),%edx
  mov    %edx,0xb0(%rsp,%rax,4)
L201:
  mov    0x10(%rsp),%rsi
  mov    %r14,%rdx
  mov    %r13d,%edi
  call   <cnnc_inline_idxs_to_pos@plt>
  test   %eax,%eax
  js     L219
  mov    0x48(%rsp),%rcx
  cltq
  pxor   %xmm0,%xmm0
  cvtss2sd (%rcx,%rax,4),%xmm0
  maxsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x8(%rsp)
L219:
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %r13d,%edi
  add    $0x1,%ebx
  call   <indices_inc@plt>
  cmp    %ebx,0x18(%rsp)
  jne    L198
  pxor   %xmm0,%xmm0
  mov    %r13d,%r14d
  cvtsd2ss 0x8(%rsp),%xmm0
L180:
  mov    0x50(%rsp),%rbx
  mov    0x68(%rsp),%rdx
  mov    %r14d,%edi
  mov    0x58(%rsp),%rsi
  movss  %xmm0,(%rbx)
  call   <indices_inc@plt>
  mov    %rbx,%rax
  add    $0x4,%rax
  mov    %rax,0x50(%rsp)
  cmp    0x60(%rsp),%rax
  jne    L141
L113:
  mov    0x178(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L133
  add    $0x188,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L181:
  xor    %eax,%eax
  jmp    L146
L86:
  xor    %eax,%eax
  jmp    L76
L133:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D10
type: byte[4]
name: unpack_data
arguments: data_tag: D7
type: byte[8]

tool: {"D10": [0xca,0xf2,0x49,0xf1]}

tool: {"D7": [0xea,0x8c,0xa0,0x39,0x59,0x3e,0x29,0xc6]}

assistant: ```c
void core_max_pool(int rank, int *input_shape, float *input_ptr, int *output_shape, float *output_ptr, int tile_by, int pool_by) {
  int i, j, k, pool_size, output_size, pos;
  int output_idx[16], input_idx[16], pool_idx[16], pool_shape[16];
  double max;
  for (i = 0; i < rank; i++) {
    pool_shape[i] = pool_by;
  }
  pool_size = size_from_shape2(rank, pool_shape);
  output_size = size_from_shape2(rank, output_shape);
  indices_reset(rank, output_idx);
  for (i = 0; i < output_size; i++) {
    max = -1e30;
    indices_reset(rank, pool_idx);
    for (j = 0; j < pool_size; j++) {
      for (k = 0; k < rank; k++) {
        input_idx[k] = output_idx[k] * tile_by + pool_idx[k];
      }
      pos = cnnc_inline_idxs_to_pos(rank, input_shape, input_idx);
      if (pos >= 0 && input_ptr[pos] > max) {
        max = input_ptr[pos];
      }
      indices_inc(rank, pool_shape, pool_idx);
    }
    output_ptr[i] = max;
    indices_inc(rank, output_shape, output_idx);
  }
  return;
}
```