user: 请从给定的汇编指令推导出C源代码：

```asm
<rotateByBilinear>:
  endbr64
  push   %r15
  mov    %r9,%r11
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  movsd  (%r8),%xmm0
  movsd  D4(%rip),%xmm1
  mov    %rsi,0x10(%rsp)
  mov    0xf0(%rsp),%r9
  mov    %rcx,%rsi
  mov    %rdi,0x50(%rsp)
  mov    0xf8(%rsp),%r13
  mov    %rdx,0x28(%rsp)
  mov    %r8,0x68(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xa8(%rsp)
  xor    %eax,%eax
  comisd %xmm1,%xmm0
  jb     L85
  nopl   (%rax)
L6:
  subsd  %xmm1,%xmm0
  comisd %xmm1,%xmm0
  jae    L6
  mov    0x68(%rsp),%rax
  movsd  %xmm0,(%rax)
L85:
  mov    0x10(%rsp),%rax
  mov    (%rax),%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  mov    %eax,0x1c(%rsp)
  mov    0x28(%rsp),%rax
  mov    (%rax),%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  mov    %eax,0x58(%rsp)
  mov    (%r9),%eax
  mov    %eax,%edi
  sub    %edx,%edi
  mov    %edi,%edx
  shr    $0x1f,%edx
  add    %edi,%edx
  mov    %edx,%ebx
  mov    0x0(%r13),%edx
  sar    %ebx
  mov    %edx,%edi
  mov    %ebx,0x38(%rsp)
  neg    %ebx
  sub    %ecx,%edi
  mov    %ebx,0x8c(%rsp)
  mov    %edi,%ecx
  shr    $0x1f,%ecx
  add    %edi,%ecx
  sar    %ecx
  mov    %ecx,%edi
  mov    %ecx,0x88(%rsp)
  neg    %ecx
  sub    %edi,%edx
  lea    0x90(%rsp),%rdi
  mov    %ecx,0x84(%rsp)
  mov    %rdi,0x78(%rsp)
  cmp    %edx,%ecx
  jge    L4
  mov    %r11,0x70(%rsp)
  mov    %rsi,%r14
  mov    %r9,%r15
  mov    %r13,%rcx
  nopw   0x0(%rax,%rax,1)
L98:
  mov    0x8c(%rsp),%esi
  sub    0x38(%rsp),%eax
  cmp    %esi,%eax
  jle    L4
  mov    0x84(%rsp),%eax
  mov    0x88(%rsp),%r11d
  mov    %esi,0x18(%rsp)
  mov    %rcx,0x60(%rsp)
  mov    %eax,%edi
  add    %eax,%r11d
  sub    0x58(%rsp),%edi
  mov    %edi,0x5c(%rsp)
  mov    %r11d,0x80(%rsp)
L106:
  mov    0x68(%rsp),%r12
  mov    0x18(%rsp),%ebx
  sub    0x1c(%rsp),%ebx
  movsd  (%r12),%xmm0
  call   <cos@plt>
  movsd  (%r12),%xmm0
  imul   %ebx,%eax
  mov    %eax,%ebp
  call   <sin@plt>
  mov    0x5c(%rsp),%r13d
  pxor   %xmm2,%xmm2
  movsd  (%r12),%xmm0
  imul   %r13d,%eax
  add    %ebp,%eax
  add    0x1c(%rsp),%eax
  cvtsi2sd %eax,%xmm2
  mov    %eax,0xc(%rsp)
  movsd  %xmm2,0x20(%rsp)
  call   <cos@plt>
  movsd  (%r12),%xmm0
  imul   %r13d,%eax
  mov    %eax,%ebp
  call   <sin@plt>
  pxor   %xmm1,%xmm1
  movsd  0x20(%rsp),%xmm2
  imul   %ebx,%eax
  subsd  %xmm2,%xmm2
  sub    %eax,%ebp
  add    0x58(%rsp),%ebp
  mov    (%r14),%eax
  cvtsi2sd %ebp,%xmm1
  subsd  %xmm1,%xmm1
  test   %eax,%eax
  jle    L104
  mov    0xc(%rsp),%r12d
  lea    0x1(%rbp),%eax
  mov    0x38(%rsp),%r13d
  mov    %ebp,%r8d
  mov    0x60(%rsp),%rcx
  add    0x18(%rsp),%r13d
  mov    %eax,0x4c(%rsp)
  xor    %ebx,%ebx
  or     %ebp,%r12d
  mov    0x80(%rsp),%r11d
  mov    0x70(%rsp),%rbp
  jmp    L28
  nopl   0x0(%rax)
L81:
  mov    (%rcx),%eax
  mov    (%r15),%edx
  imul   %eax,%edx
  imul   %r13d,%eax
  imul   %ebx,%edx
  add    $0x1,%ebx
  add    %r11d,%eax
  add    %edx,%eax
  cltq
  movl   $0x0,0x0(%rbp,%rax,4)
  cmp    %ebx,(%r14)
  jle    L104
L28:
  test   %r12d,%r12d
  js     L81
  mov    0x10(%rsp),%rax
  mov    (%rax),%edi
  cmp    %edi,0xc(%rsp)
  jge    L81
  mov    0x28(%rsp),%rax
  mov    (%rax),%eax
  cmp    %eax,%r8d
  jge    L81
  mov    %edi,%esi
  mov    0xc(%rsp),%r10d
  sub    $0x1,%edi
  imul   %eax,%esi
  mov    %r10d,%edx
  imul   %eax,%edx
  imul   %ebx,%esi
  lea    (%r8,%rdx,1),%r9d
  mov    %edx,0x20(%rsp)
  mov    0x50(%rsp),%rdx
  add    %esi,%r9d
  movslq %r9d,%r9
  mov    (%rdx,%r9,4),%r9d
  mov    %r9d,0x90(%rsp)
  cmp    %edi,%r10d
  je     L168
  mov    0x20(%rsp),%edi
  add    %eax,%edi
  sub    $0x1,%eax
  lea    (%rdi,%r8,1),%r10d
  add    %esi,%r10d
  movslq %r10d,%r10
  mov    (%rdx,%r10,4),%r10d
  mov    %r10d,0x94(%rsp)
  cmp    %eax,%r8d
  je     L94
  mov    %rdx,%r10
  mov    0x20(%rsp),%eax
  mov    0x4c(%rsp),%edx
  add    %edx,%eax
  add    %esi,%eax
  cltq
  mov    (%r10,%rax,4),%eax
  mov    %eax,0x98(%rsp)
  lea    (%rdi,%rdx,1),%eax
  add    %esi,%eax
  cltq
  mov    (%r10,%rax,4),%r9d
L47:
  mov    0x78(%rsp),%rdi
  movapd %xmm2,%xmm0
  mov    %r11d,0x48(%rsp)
  mov    %rcx,0x40(%rsp)
  mov    %r8d,0x3c(%rsp)
  mov    %r9d,0x9c(%rsp)
  movsd  %xmm1,0x30(%rsp)
  movsd  %xmm2,0x20(%rsp)
  call   <bilinear@plt>
  mov    0x40(%rsp),%rcx
  mov    (%r15),%edx
  mov    %rax,%r9
  mov    0x48(%rsp),%r11d
  mov    0x3c(%rsp),%r8d
  mov    (%rcx),%eax
  movsd  0x30(%rsp),%xmm1
  movsd  0x20(%rsp),%xmm2
  imul   %eax,%edx
  imul   %r13d,%eax
  imul   %ebx,%edx
  add    $0x1,%ebx
  add    %r11d,%eax
  add    %edx,%eax
  cltq
  mov    %r9d,0x0(%rbp,%rax,4)
  cmp    %ebx,(%r14)
  jg     L28
  nopl   0x0(%rax,%rax,1)
L104:
  mov    (%r15),%eax
  addl   $0x1,0x18(%rsp)
  mov    0x18(%rsp),%esi
  mov    %eax,%edx
  sub    0x38(%rsp),%edx
  cmp    %esi,%edx
  jg     L106
  mov    0x60(%rsp),%rcx
  addl   $0x1,0x84(%rsp)
  mov    0x84(%rsp),%edi
  mov    (%rcx),%edx
  sub    0x88(%rsp),%edx
  cmp    %edx,%edi
  jl     L98
L4:
  mov    0xa8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L22
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L94:
  mov    %r9d,0x98(%rsp)
  jmp    L47
  nopl   (%rax)
L168:
  sub    $0x1,%eax
  mov    %r9d,0x94(%rsp)
  cmp    %eax,%r8d
  je     L94
  mov    %rdx,%rax
  mov    0x20(%rsp),%edx
  add    0x4c(%rsp),%edx
  add    %esi,%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  mov    %eax,0x98(%rsp)
  jmp    L47
L22:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D4
datatype: byte[8]

tool: {"D4": [0x00,0x00,0x00,0x00,0x00,0x80,0x76,0x40]}

assistant: ```c
void rotateByBilinear(int *image, int *width, int *height, int *depth, double *angle, int *ret, int *new_width, int *new_height) {
  int x_center, y_center, x_diff, y_diff;
  int x, y, d;
  double x_src_d, y_src_d;
  int x_src, y_src;
  double x_weight, y_weight;
  while (*angle >= 360) {
    *angle = *angle - 360;
  }
  x_center = *width / 2;
  y_center = *height / 2;
  x_diff = (*new_width - *width) / 2;
  y_diff = (*new_height - *height) / 2;
  for (y = -1 * y_diff; y < (*new_height - y_diff); y++) {
    for (x = -1 * x_diff; x < (*new_width - x_diff); x++) {
      x_src_d = (x - x_center) * cos(*angle) + (y - y_center) * sin(*angle) + x_center;
      y_src_d = (y - y_center) * cos(*angle) - (x - x_center) * sin(*angle) + y_center;
      x_src = (int)x_src_d;
      y_src = (int)y_src_d;
      x_weight = x_src_d - x_src;
      y_weight = y_src_d - y_src;
      for (d = 0; d < *depth; d++) {
        if (x_src_d < 0 || y_src_d < 0 || x_src_d >= *width || y_src_d >= *height) {
          ret[((*new_height) * (x + x_diff) + (y + y_diff) + (*new_width) * (*new_height) * (d))] = 0;
        } else {
          int a[4];
          a[0] = image[((*height) * (x_src) + (y_src) + (*width) * (*height) * (d))];
          a[1] = (x_src == *width - 1) ? a[0] : image[((*height) * (x_src + 1) + (y_src) + (*width) * (*height) * (d))];
          a[2] = (y_src == *height - 1) ? a[0] : image[((*height) * (x_src) + (y_src + 1) + (*width) * (*height) * (d))];
          a[3] = ((x_src == *width - 1) || (y_src == *height - 1)) ? a[0] : image[((*height) * (x_src + 1) + (y_src + 1) + (*width) * (*height) * (d))];
          ret[((*new_height) * (x + x_diff) + (y + y_diff) + (*new_width) * (*new_height) * (d))] = (int)bilinear(a, x_weight, y_weight);
        }
      }
    }
  }
}
```