user: 请将以下的汇编代码转换成C语言代码:

```asm
<c_phansalkar>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  mov    $0x8,%edx
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  mov    %rcx,%rdi
  push   %rbx
  sub    $0x78,%rsp
  mov    %esi,0x40(%rsp)
  xor    %esi,%esi
  mov    %rcx,0x30(%rsp)
  call   <memset@plt>
  test   %r15d,%r15d
  jle    L158
  movslq %r15d,%rax
  mov    0x30(%rsp),%rdi
  mov    $0xfffffffffffffff8,%rdx
  movl   $0x0,0x18(%rsp)
  mov    %rax,0x38(%rsp)
  shl    $0x3,%rax
  movsd  D45(%rip),%xmm3
  mov    %rbp,%r13
  mov    %rax,0x28(%rsp)
  lea    -0x1(%r15),%eax
  movsd  D34(%rip),%xmm2
  shl    $0x3,%rax
  mov    %rdi,0x20(%rsp)
  sub    %rax,%rdx
  lea    0x8(%rbp,%rax,1),%rbx
  mov    %rdx,0x48(%rsp)
L144:
  mov    0x48(%rsp),%rax
  mov    0x20(%rsp),%r14
  lea    (%rax,%rbx,1),%r12
  nopl   0x0(%rax)
L46:
  movsd  (%r12),%xmm1
  movapd %xmm3,%xmm0
  add    $0x8,%r12
  add    $0x1,%r14
  movsd  %xmm2,0x10(%rsp)
  call   <min@plt>
  movsd  0x10(%rsp),%xmm2
  movsd  -0x8(%r12),%xmm1
  movsd  %xmm0,0x8(%rsp)
  movapd %xmm2,%xmm0
  call   <max@plt>
  movb   $0x0,-0x1(%r14)
  cmp    %rbx,%r12
  movsd  0x8(%rsp),%xmm3
  movapd %xmm0,%xmm2
  jne    L46
  mov    0x18(%rsp),%eax
  mov    0x38(%rsp),%rdi
  add    %rdi,0x20(%rsp)
  lea    0x1(%rax),%ecx
  mov    0x28(%rsp),%rax
  lea    (%r12,%rax,1),%rbx
  cmp    %ecx,%r15d
  je     L62
  mov    %ecx,0x18(%rsp)
  jmp    L144
L158:
  mov    0x40(%rsp),%r10d
  mov    %r15d,%edx
  sub    %r10d,%edx
  mov    %r10d,%edi
  cmp    %r10d,%edx
  jle    L109
  imul   %r15d,%edi
  lea    (%r10,%r10,1),%eax
  pxor   %xmm5,%xmm5
  movslq %r15d,%r11
  lea    0x1(%rax),%ebx
  mov    %eax,0x68(%rsp)
  movslq %r10d,%rax
  pxor   %xmm3,%xmm3
  mov    %ebx,%ecx
  mov    %r11,0x50(%rsp)
  mov    %ebx,%r14d
  movslq %edi,%rsi
  imul   %ebx,%ecx
  mov    %edi,0x5c(%rsp)
  add    %rsi,%rax
  mov    %rsi,%rdi
  mov    0x30(%rsp),%rsi
  mov    %edi,0x58(%rsp)
  add    %rax,%rsi
  cvtsi2sd %ecx,%xmm5
  lea    0x0(%rbp,%rax,8),%rax
  mov    %rsi,0x28(%rsp)
  lea    0x0(,%r11,8),%rsi
  mov    %rax,0x20(%rsp)
  lea    0x1(%rdx,%r10,1),%eax
  mov    %rsi,0x60(%rsp)
  mov    %eax,0x6c(%rsp)
  movsd  %xmm5,0x40(%rsp)
L250:
  mov    0x68(%rsp),%edi
  mov    %r14d,%eax
  xor    %ebx,%ebx
  sub    %edi,%eax
  sub    $0x1,%eax
  mov    %eax,0x38(%rsp)
  lea    -0x1(%r14),%eax
  mov    %eax,0x30(%rsp)
  mov    0x58(%rsp),%eax
  sub    0x5c(%rsp),%eax
  mov    %eax,0x48(%rsp)
  nopl   0x0(%rax,%rax,1)
L210:
  mov    0x20(%rsp),%rax
  mov    0x38(%rsp),%esi
  movsd  (%rax,%rbx,8),%xmm7
  movsd  %xmm7,0x8(%rsp)
  cmp    %esi,0x30(%rsp)
  jl     L16
  lea    0x1(%rdi),%r13d
  mov    %ebx,0x10(%rsp)
  mov    0x48(%rsp),%edx
  mov    %ebx,%r10d
  mov    %r13d,%r9d
  movapd %xmm3,%xmm1
  movapd %xmm3,%xmm4
  sub    %ebx,%r9d
  mov    %r9d,%eax
  mov    %r9d,%r11d
  shr    %eax
  and    $0xfffffffe,%r11d
  lea    -0x1(%rax),%r8d
  lea    (%r11,%rbx,1),%r12d
  add    $0x1,%r8
  shl    $0x4,%r8
  nopw   0x0(%rax,%rax,1)
L231:
  cmp    %edi,%r10d
  jg     L140
  je     L171
  movslq %edx,%rax
  add    %rbx,%rax
  lea    0x0(%rbp,%rax,8),%rax
  lea    (%r8,%rax,1),%rcx
  nopw   0x0(%rax,%rax,1)
L152:
  movupd (%rax),%xmm0
  add    $0x10,%rax
  addsd  %xmm0,%xmm4
  movapd %xmm0,%xmm6
  mulpd  %xmm0,%xmm0
  unpckhpd %xmm6,%xmm6
  addsd  %xmm6,%xmm4
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %rax,%rcx
  jne    L152
  mov    %r12d,%eax
  cmp    %r9d,%r11d
  je     L140
L122:
  add    %edx,%eax
  cltq
  movsd  0x0(%rbp,%rax,8),%xmm0
  addsd  %xmm0,%xmm4
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
L140:
  add    $0x1,%esi
  add    %r15d,%edx
  cmp    %r14d,%esi
  jne    L231
L243:
  movsd  0x40(%rsp),%xmm7
  movapd %xmm4,%xmm5
  divsd  %xmm7,%xmm5
  mulsd  %xmm5,%xmm4
  subsd  %xmm4,%xmm1
  divsd  %xmm7,%xmm1
  ucomisd %xmm1,%xmm3
  ja     L212
  sqrtsd %xmm1,%xmm1
L8:
  movsd  D29(%rip),%xmm0
  movsd  %xmm1,0x18(%rsp)
  movsd  %xmm5,0x10(%rsp)
  mulsd  %xmm5,%xmm0
  call   <exp@plt>
  movsd  0x18(%rsp),%xmm1
  movsd  0x10(%rsp),%xmm5
  pxor   %xmm3,%xmm3
  movapd %xmm0,%xmm2
  movsd  0x8(%rsp),%xmm7
  mov    0x28(%rsp),%rax
  addsd  %xmm1,%xmm1
  movsd  D38(%rip),%xmm0
  subsd  D17(%rip),%xmm1
  addsd  %xmm2,%xmm2
  addsd  D17(%rip),%xmm2
  mulsd  %xmm1,%xmm0
  addsd  %xmm2,%xmm0
  mulsd  %xmm5,%xmm0
  comisd %xmm0,%xmm7
  ja     L64
  movb   $0x0,(%rax,%rbx,1)
  mov    %r13d,%edi
  add    $0x1,%rbx
  cmp    %r13d,%r15d
  jne    L210
L30:
  mov    0x50(%rsp),%rdi
  add    %r15d,0x58(%rsp)
  add    $0x1,%r14d
  add    %rdi,0x28(%rsp)
  mov    0x60(%rsp),%rdi
  add    %rdi,0x20(%rsp)
  cmp    0x6c(%rsp),%r14d
  jne    L250
L109:
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L171:
  mov    0x10(%rsp),%eax
  jmp    L122
L64:
  movb   $0x1,(%rax,%rbx,1)
  mov    %r13d,%edi
  add    $0x1,%rbx
  cmp    %r15d,%r13d
  jne    L210
  jmp    L30
L16:
  movapd %xmm3,%xmm1
  movapd %xmm3,%xmm4
  lea    0x1(%rdi),%r13d
  jmp    L243
L62:
  subsd  %xmm3,%xmm2
  mov    %r15d,%eax
  mov    %r15d,%r8d
  xor    %edx,%edx
  shr    %eax
  movapd %xmm3,%xmm4
  and    $0xfffffffe,%r8d
  xor    %edi,%edi
  lea    -0x1(%rax),%esi
  unpcklpd %xmm4,%xmm4
  movapd %xmm2,%xmm1
  add    $0x1,%rsi
  unpcklpd %xmm1,%xmm1
  shl    $0x4,%rsi
  cmp    $0x1,%ecx
  je     L235
L101:
  lea    (%rsi,%r13,1),%r9
  mov    %r13,%rax
L15:
  movupd (%rax),%xmm0
  add    $0x10,%rax
  subpd  %xmm4,%xmm0
  divpd  %xmm1,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %r9,%rax
  jne    L15
  mov    %r8d,%eax
  cmp    %r15d,%r8d
  je     L5
L178:
  add    %edx,%eax
  cltq
  lea    0x0(%rbp,%rax,8),%rax
  movsd  (%rax),%xmm0
  subsd  %xmm3,%xmm0
  divsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax)
L5:
  lea    0x1(%rdi),%eax
  add    %r15d,%edx
  add    0x28(%rsp),%r13
  cmp    %edi,0x18(%rsp)
  je     L158
  mov    %eax,%edi
  cmp    $0x1,%ecx
  jne    L101
L235:
  xor    %eax,%eax
  jmp    L178
L212:
  movapd %xmm1,%xmm0
  movsd  %xmm5,0x10(%rsp)
  call   <sqrt@plt>
  movsd  0x10(%rsp),%xmm5
  movapd %xmm0,%xmm1
  jmp    L8
```

tool_calls: name: retrieve_data
arguments: data_label: D45
type_guessed: byte[8]
name: retrieve_data
arguments: data_label: D34
type_guessed: f64
name: retrieve_data
arguments: data_label: D29
type_guessed: byte[8]
name: retrieve_data
arguments: data_label: D38
type_guessed: f64
name: retrieve_data
arguments: data_label: D17
type_guessed: f64

tool: {"D45": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xbf]}

tool: D34: 65537

tool: {"D29": [0x00,0x00,0x00,0x00,0x00,0x00,0x24,0xc0]}

tool: D38: 0.25

tool: D17: 1

assistant: ```c
void c_phansalkar(double *frame, int wsize, int size, unsigned char *ret) {
  int i, j, m, n;
  double mean, sdv;
  double k = 0.25, r = 0.5, p = 2, q = 10;
  double pixel, th, sum, sum2, num;
  double Max = 65537, Min = -1;
  memset(ret, 0, sizeof(ret));
  for (i = 0; i < size; i++)
    for (j = 0; j < size; j++) {
      Min = min(Min, frame[i * size + j]);
      Max = max(Max, frame[i * size + j]);
      ret[i * size + j] = 0;
    }
  for (i = 0; i < size; i++)
    for (j = 0; j < size; j++)
      frame[i * size + j] = (frame[i * size + j] - Min) / (Max - Min);
  for (i = wsize; i < size - wsize; i++)
    for (j = wsize; j < size - wsize; j++) {
      pixel = frame[i * size + j];
      th = 0;
      sum = 0;
      sum2 = 0;
      for (m = i - wsize; m <= i + wsize; m++)
        for (n = j - wsize; n <= j + wsize; n++) {
          sum += frame[m * size + n];
          sum2 += frame[m * size + n] * frame[m * size + n];
        }
      num = (2 * wsize + 1) * (2 * wsize + 1);
      mean = sum / num;
      sdv = sqrt((sum2 - sum * mean) / num);
      th = mean * (1 + p * exp(-q * mean) + k * (sdv / r - 1));
      if (pixel > th)
        ret[i * size + j] = 1;
      else
        ret[i * size + j] = 0;
    }
}
```