user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<pita1>:
  endbr64
  push   %r15
  mov    %edi,%esi
  mov    $0x1f4,%ecx
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  lea    0x3(%rsi),%ebp
  push   %rbx
  sub    $0xfd8,%rsp
  mov    %edi,0x10(%rsp)
  lea    0x20(%rsp),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0xfc8(%rsp)
  xor    %eax,%eax
  mov    %rdi,0x18(%rsp)
  test   %esi,%esi
  cmovns %esi,%ebp
  sar    $0x2,%ebp
  mov    %ebp,0x14(%rsp)
  mov    $0x3,%ebp
  rep stos %rax,%es:(%rdi)
  movl   $0x0,(%rdi)
  cmp    $0x7,%esi
  jle    L97
  nopl   0x0(%rax,%rax,1)
L22:
  mov    %ebp,%r13d
  pxor   %xmm0,%xmm0
  pxor   %xmm2,%xmm2
  mov    %ebp,%edi
  imul   %ebp,%r13d
  movsd  D1(%rip),%xmm1
  and    $0x1,%edi
  cvtsi2sd %ebp,%xmm2
  lea    0x1(%rdi),%ebx
  lea    -0x1(%r13),%eax
  sar    %eax
  cvtsi2sd %eax,%xmm0
  addsd  %xmm0,%xmm1
  addsd  %xmm0,%xmm2
  cvttsd2si %xmm1,%edx
  pxor   %xmm1,%xmm1
  cvtsi2sd %edx,%xmm1
  addsd  %xmm2,%xmm1
  cvttsd2si %xmm1,%r15d
  cmp    %ebp,%eax
  jle    L62
  cmp    %r15d,0x10(%rsp)
  jge    L54
  mov    $0x1,%ecx
  nopw   0x0(%rax,%rax,1)
L108:
  mov    %r13d,%eax
  add    %ebx,%ecx
  cltd
  idiv   %ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cmp    %ebp,%eax
  jg     L108
L62:
  lea    0x1(%rbp),%eax
  cmp    %ebp,0x14(%rsp)
  jl     L97
  mov    %eax,%ebp
  jmp    L22
  nop
L54:
  mov    $0x1,%r12d
  movslq %r15d,%r15
  jmp    L76
  nopl   0x0(%rax,%rax,1)
L31:
  mov    %r13d,%eax
  add    %ebx,%r12d
  pxor   %xmm0,%xmm0
  cltd
  idiv   %r12d
  sub    %r12d,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cvtsi2sd %eax,%xmm0
  cmp    %ebp,%eax
  jle    L62
L76:
  movsd  %xmm0,0x8(%rsp)
  call   <floor@plt>
  movsd  0x8(%rsp),%xmm0
  mov    %rax,%r14
  call   <ceil@plt>
  cmp    %rax,%r14
  jne    L31
  addl   $0x1,0x20(%rsp,%r15,4)
  jmp    L31
  nopl   0x0(%rax,%rax,1)
L97:
  mov    0x10(%rsp),%eax
  test   %eax,%eax
  jle    L3
  movslq 0x10(%rsp),%rbx
  xor    %eax,%eax
  xor    %esi,%esi
  xor    %ecx,%ecx
  nopl   0x0(%rax,%rax,1)
L141:
  mov    0x18(%rsp),%rdi
  mov    (%rdi,%rax,4),%edx
  cmp    %edx,%ecx
  jge    L144
  mov    %eax,%esi
  mov    %edx,%ecx
L144:
  add    $0x1,%rax
  cmp    %rax,%rbx
  jne    L141
  imul   $0x3e8,%esi,%eax
  add    %ecx,%eax
L40:
  mov    0xfc8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L132
  add    $0xfd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L3:
  xor    %eax,%eax
  jmp    L40
L132:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D1
type: byte[8]

tool: {"D1": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
int pita1(int lim) {
  int refs[1001] = {0};
  int c, d, asqr, peri, step;
  double b;
  for (int a = 3; a <= (lim / 4) + 1; a++) {
    if (0 == a % 2) {
      step = 1;
    } else {
      step = 2;
    }
    d = 1;
    asqr = a * a;
    b = ((asqr / d) - d) / 2;
    c = b + d;
    peri = a + b + c;
    while (a < b) {
      if ((peri <= lim) && (floor(b) == ceil(b))) {
        refs[peri] += 1;
      }
      d += step;
      b = ((asqr / d) - d) / 2;
    }
  }
  int res = 0;
  int ires = 0;
  for (int i = 0; i < lim; i++) {
    if (refs[i] > res) {
      res = refs[i];
      ires = i;
    }
  }
  return (ires * 1000) + res;
}
```