user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<core_max_pool>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x158,%rsp
  mov    %edi,%r13d
  mov    %rsi,0x10(%rsp)
  mov    %rdx,0x20(%rsp)
  mov    %rcx,0x30(%rsp)
  mov    %r8,%rbp
  mov    %r9d,%r12d
  mov    0x190(%rsp),%ecx
  mov    %fs:0x28,%rax
  mov    %rax,0x148(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  jle    L37
  lea    0x100(%rsp),%rax
  lea    -0x1(%rdi),%edx
  lea    0x104(%rsp,%rdx,4),%rdx
L48:
  mov    %ecx,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L48
L37:
  lea    0x100(%rsp),%rsi
  mov    %r13d,%edi
  call   <size_from_shape2@plt>
  mov    %eax,%r15d
  mov    0x30(%rsp),%rsi
  mov    %r13d,%edi
  call   <size_from_shape2@plt>
  mov    %eax,%ebx
  lea    0x40(%rsp),%rsi
  mov    %r13d,%edi
  call   <indices_reset@plt>
  test   %ebx,%ebx
  jle    L105
  mov    %rbp,0x28(%rsp)
  lea    -0x1(%rbx),%eax
  lea    0x4(%rbp,%rax,4),%rax
  mov    %rax,0x38(%rsp)
  lea    0xc0(%rsp),%rbx
  lea    0x40(%rsp),%rbp
  lea    0x100(%rsp),%rax
  mov    %rax,0x18(%rsp)
  jmp    L55
L80:
  cltq
  mov    0x20(%rsp),%rdi
  pxor   %xmm0,%xmm0
  cvtss2sd (%rdi,%rax,4),%xmm0
  maxsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x8(%rsp)
L79:
  mov    %rbx,%rdx
  mov    0x18(%rsp),%rsi
  mov    %r13d,%edi
  call   <indices_inc@plt>
  add    $0x1,%r14d
  cmp    %r14d,%r15d
  je     L113
L89:
  mov    %r13d,%ecx
  mov    $0x0,%eax
  test   %r13d,%r13d
  jle    L62
L98:
  mov    %r12d,%edx
  imul   0x0(%rbp,%rax,4),%edx
  add    (%rbx,%rax,4),%edx
  mov    %edx,0x80(%rsp,%rax,4)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L98
L62:
  lea    0x80(%rsp),%rdx
  mov    0x10(%rsp),%rsi
  mov    %r13d,%edi
  call   <cnnc_inline_idxs_to_pos@plt>
  test   %eax,%eax
  jns    L80
  jmp    L79
L113:
  pxor   %xmm0,%xmm0
  cvtsd2ss 0x8(%rsp),%xmm0
  mov    0x28(%rsp),%r14
  movss  %xmm0,(%r14)
  mov    %rbp,%rdx
  mov    0x30(%rsp),%rsi
  mov    %r13d,%edi
  call   <indices_inc@plt>
  mov    %r14,%rax
  add    $0x4,%rax
  mov    %rax,0x28(%rsp)
  cmp    %rax,0x38(%rsp)
  je     L105
L55:
  mov    %rbx,%rsi
  mov    %r13d,%edi
  call   <indices_reset@plt>
  movsd  D4(%rip),%xmm2
  movsd  %xmm2,0x8(%rsp)
  mov    $0x0,%r14d
  test   %r15d,%r15d
  jg     L89
  jmp    L113
L105:
  mov    0x148(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L74
  add    $0x158,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L74:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D4
datatype: byte[8]

tool: {"D4": [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;
}
```