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

```asm
<fitest_image_rotate>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %rsi,0x88(%rsp)
  mov    %rdx,0x68(%rsp)
  mov    %rcx,0x70(%rsp)
  mov    %r8,0x80(%rsp)
  test   %rdx,%rdx
  je     L182
  test   %rcx,%rcx
  je     L182
  test   %r8,%r8
  je     L182
  mov    %r9,%r15
  test   %r9,%r9
  je     L182
  mov    %rdx,%rbx
  mov    %rdi,%r14
  lea    0xa0(%rsp),%rsi
  lea    0xa8(%rsp),%rdi
  call   <sincos@plt>
  mov    %rbx,%rax
  movsd  0xa0(%rsp),%xmm9
  movsd  0xa8(%rsp),%xmm6
  sub    $0x1,%rax
  js     L273
  pxor   %xmm8,%xmm8
  cvtsi2sd %rax,%xmm8
L96:
  movsd  D5(%rip),%xmm1
  mov    0x70(%rsp),%rax
  mulsd  %xmm1,%xmm8
  sub    $0x1,%rax
  js     L203
  pxor   %xmm11,%xmm11
  cvtsi2sd %rax,%xmm11
L216:
  mulsd  %xmm1,%xmm11
  mov    0x80(%rsp),%rax
  movsd  %xmm11,0x10(%rsp)
  sub    $0x1,%rax
  js     L264
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
L214:
  mulsd  %xmm1,%xmm0
  movq   D11(%rip),%xmm2
  mov    %r15,%rax
  sub    $0x1,%rax
  mov    %rax,0x90(%rsp)
  xorpd  %xmm2,%xmm0
  movsd  %xmm0,0x58(%rsp)
  js     L28
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
L152:
  mulsd  %xmm1,%xmm0
  mov    %r15,%rax
  pxor   %xmm4,%xmm4
  mov    %r14,%r15
  movq   $0x0,0x60(%rsp)
  movsd  D7(%rip),%xmm5
  mov    %rax,%r14
  movq   $0x0,0x50(%rsp)
  xorpd  %xmm2,%xmm0
  movsd  %xmm0,0x98(%rsp)
  nopl   0x0(%rax)
L33:
  movsd  0x58(%rsp),%xmm3
  mov    0x88(%rsp),%rax
  xor    %r13d,%r13d
  mov    0x50(%rsp),%rbx
  movapd %xmm3,%xmm7
  mulsd  %xmm6,%xmm3
  lea    (%rax,%rbx,8),%rax
  mulsd  %xmm9,%xmm7
  mov    %rax,0x78(%rsp)
  movapd %xmm3,%xmm10
  movsd  0x98(%rsp),%xmm3
  jmp    L90
  nopl   0x0(%rax)
L145:
  add    $0x1,%r13
  addsd  %xmm5,%xmm3
  cmp    %r13,%r14
  jbe    L141
L90:
  movapd %xmm6,%xmm1
  mulsd  %xmm3,%xmm1
  addsd  %xmm7,%xmm1
  addsd  %xmm8,%xmm1
  comisd %xmm4,%xmm1
  jb     L145
  movapd %xmm9,%xmm2
  mulsd  %xmm3,%xmm2
  subsd  %xmm10,%xmm2
  addsd  0x10(%rsp),%xmm2
  comisd %xmm4,%xmm2
  movsd  %xmm2,0x8(%rsp)
  jb     L145
  movapd %xmm1,%xmm0
  movsd  %xmm6,0x48(%rsp)
  movsd  %xmm9,0x40(%rsp)
  movsd  %xmm3,0x38(%rsp)
  movsd  %xmm8,0x30(%rsp)
  movsd  %xmm10,0x28(%rsp)
  movsd  %xmm7,0x20(%rsp)
  movsd  %xmm1,0x18(%rsp)
  call   <floor@plt>
  movsd  0x18(%rsp),%xmm1
  mov    %rax,%rbx
  movapd %xmm1,%xmm0
  call   <ceil@plt>
  movsd  0x8(%rsp),%xmm2
  mov    %rax,%r12
  movapd %xmm2,%xmm0
  call   <floor@plt>
  movsd  0x8(%rsp),%xmm2
  mov    %rax,%rbp
  movapd %xmm2,%xmm0
  call   <ceil@plt>
  mov    D7(%rip),%rcx
  pxor   %xmm4,%xmm4
  cmp    %r12,0x68(%rsp)
  movsd  0x20(%rsp),%xmm7
  movsd  0x28(%rsp),%xmm10
  movsd  0x30(%rsp),%xmm8
  movsd  0x38(%rsp),%xmm3
  movq   %rcx,%xmm5
  movsd  0x40(%rsp),%xmm9
  movsd  0x48(%rsp),%xmm6
  jbe    L145
  mov    0x70(%rsp),%rdi
  cmp    %rax,%rdi
  jbe    L145
  mov    %rdi,%rsi
  imul   %r12,%rdi
  movsd  0x8(%rsp),%xmm2
  imul   %rbx,%rsi
  lea    (%rsi,%rbp,1),%rdx
  add    %rax,%rsi
  movsd  (%r15,%rsi,8),%xmm11
  mov    %rdi,%rsi
  movsd  (%r15,%rdx,8),%xmm12
  lea    (%rdi,%rbp,1),%rdx
  add    %rax,%rsi
  cmp    %r12,%rbx
  movsd  (%r15,%rdx,8),%xmm15
  movsd  (%r15,%rsi,8),%xmm14
  je     L92
  test   %rbx,%rbx
  movsd  0x18(%rsp),%xmm1
  js     L150
  pxor   %xmm0,%xmm0
  cvtsi2sd %rbx,%xmm0
L228:
  movapd %xmm1,%xmm13
  subsd  %xmm0,%xmm13
  test   %r12,%r12
  js     L125
  pxor   %xmm0,%xmm0
  cvtsi2sd %r12,%xmm0
L247:
  subsd  %xmm1,%xmm0
  mulsd  %xmm13,%xmm15
  movapd %xmm13,%xmm1
  mulsd  %xmm14,%xmm1
  mulsd  %xmm0,%xmm12
  mulsd  %xmm11,%xmm0
  addsd  %xmm15,%xmm12
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm11
L92:
  cmp    %rax,%rbp
  je     L53
  test   %rax,%rax
  js     L217
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
L116:
  subsd  %xmm2,%xmm0
  mulsd  %xmm12,%xmm0
  test   %rbp,%rbp
  js     L261
  pxor   %xmm1,%xmm1
  cvtsi2sd %rbp,%xmm1
L30:
  subsd  %xmm1,%xmm2
  mulsd  %xmm11,%xmm2
  addsd  %xmm2,%xmm0
  movapd %xmm0,%xmm12
L53:
  mov    0x78(%rsp),%rax
  addsd  %xmm5,%xmm3
  movsd  %xmm12,(%rax,%r13,8)
  add    $0x1,%r13
  cmp    %r13,%r14
  ja     L90
  nopw   0x0(%rax,%rax,1)
L141:
  movsd  0x58(%rsp),%xmm7
  mov    0x50(%rsp),%rbx
  xor    %eax,%eax
  test   %r14,%r14
  cmovne 0x90(%rsp),%rax
  addq   $0x1,0x60(%rsp)
  addsd  %xmm5,%xmm7
  lea    0x1(%rbx,%rax,1),%rax
  mov    %rax,0x50(%rsp)
  mov    0x60(%rsp),%rax
  movsd  %xmm7,0x58(%rsp)
  cmp    %rax,0x80(%rsp)
  ja     L33
L182:
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L273:
  mov    %rax,%rdx
  and    $0x1,%eax
  pxor   %xmm8,%xmm8
  shr    %rdx
  or     %rax,%rdx
  cvtsi2sd %rdx,%xmm8
  addsd  %xmm8,%xmm8
  jmp    L96
  nopl   0x0(%rax,%rax,1)
L125:
  mov    %r12,%rcx
  mov    %r12,%rdx
  pxor   %xmm0,%xmm0
  shr    %rcx
  and    $0x1,%edx
  or     %rdx,%rcx
  cvtsi2sd %rcx,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L247
  nopl   0x0(%rax)
L150:
  mov    %rbx,%rdx
  mov    %rbx,%rcx
  pxor   %xmm0,%xmm0
  shr    %rdx
  and    $0x1,%ecx
  or     %rcx,%rdx
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L228
  nopl   0x0(%rax)
L261:
  mov    %rbp,%rax
  and    $0x1,%ebp
  pxor   %xmm1,%xmm1
  shr    %rax
  or     %rbp,%rax
  cvtsi2sd %rax,%xmm1
  addsd  %xmm1,%xmm1
  jmp    L30
  xchg   %ax,%ax
L217:
  mov    %rax,%rdx
  and    $0x1,%eax
  pxor   %xmm0,%xmm0
  shr    %rdx
  or     %rax,%rdx
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L116
L28:
  mov    %rax,%rbx
  shr    %rax
  pxor   %xmm0,%xmm0
  and    $0x1,%ebx
  or     %rbx,%rax
  cvtsi2sd %rax,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L152
L264:
  mov    %rax,%rdx
  and    $0x1,%eax
  pxor   %xmm0,%xmm0
  shr    %rdx
  or     %rax,%rdx
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L214
L203:
  mov    %rax,%rdx
  and    $0x1,%eax
  pxor   %xmm11,%xmm11
  shr    %rdx
  or     %rax,%rdx
  cvtsi2sd %rdx,%xmm11
  addsd  %xmm11,%xmm11
  jmp    L216
```

tool_calls: name: unpack_data
arguments: tag: D5
data_type: byte[8]
name: unpack_data
arguments: tag: D11
data_type: byte[8]
name: unpack_data
arguments: tag: D7
data_type: f64

tool: {"D5": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: {"D11": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80]}

tool: D7: 1

assistant: ```c
void fitest_image_rotate(double *src, double *dst, unsigned long size_x_src, unsigned long size_y_src, unsigned long size_x_dst, unsigned long size_y_dst, double ori) {
  double *m_src = (double *)src;
  double *m_dst = (double *)dst;
  if ((size_x_src > 0) && (size_y_src > 0) && (size_x_dst > 0) && (size_y_dst > 0)) {
    const double cos_ori = cos(ori);
    const double sin_ori = sin(ori);
    const double origin_x_src = (double)((size_x_src - 1)) / 2;
    const double origin_y_src = (double)((size_y_src - 1)) / 2;
    double u = -((double)((size_x_dst - 1)) / 2);
    unsigned long n = 0;
    for (unsigned long dst_x = 0; dst_x < size_x_dst; dst_x++) {
      double v = -((double)((size_y_dst - 1)) / 2);
      for (unsigned long dst_y = 0; dst_y < size_y_dst; dst_y++) {
        double x = u * cos_ori + v * sin_ori + origin_x_src;
        double y = v * cos_ori - u * sin_ori + origin_y_src;
        if ((x >= 0) && (y >= 0)) {
          unsigned long x0 = (unsigned long)(floor(x));
          unsigned long x1 = (unsigned long)(ceil(x));
          unsigned long y0 = (unsigned long)(floor(y));
          unsigned long y1 = (unsigned long)(ceil(y));
          if ((0 <= x0) && (x1 < size_x_src) && (0 <= y0) && (y1 < size_y_src)) {
            double dist_x0 = x - x0;
            double dist_x1 = x1 - x;
            double dist_y0 = y - y0;
            double dist_y1 = y1 - y;
            const double m00 = m_src[x0 * size_y_src + y0];
            const double m01 = m_src[x0 * size_y_src + y1];
            const double m10 = m_src[x1 * size_y_src + y0];
            const double m11 = m_src[x1 * size_y_src + y1];
            const double t0 = (x0 != x1) ? (dist_x1 * m00 + dist_x0 * m10) : m00;
            const double t1 = (x0 != x1) ? (dist_x1 * m01 + dist_x0 * m11) : m01;
            m_dst[n] = (y0 != y1) ? (dist_y1 * t0 + dist_y0 * t1) : t0;
          }
        }
        n++;
        v++;
      }
      u++;
    }
  }
}
```