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     L30
  test   %rcx,%rcx
  je     L30
  test   %r8,%r8
  je     L30
  mov    %r9,%r15
  test   %r9,%r9
  je     L30
  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     L257
  pxor   %xmm8,%xmm8
  cvtsi2sd %rax,%xmm8
L191:
  movsd  D26(%rip),%xmm1
  mov    0x70(%rsp),%rax
  mulsd  %xmm1,%xmm8
  sub    $0x1,%rax
  js     L190
  pxor   %xmm11,%xmm11
  cvtsi2sd %rax,%xmm11
L11:
  mulsd  %xmm1,%xmm11
  mov    0x80(%rsp),%rax
  movsd  %xmm11,0x10(%rsp)
  sub    $0x1,%rax
  js     L121
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
L214:
  mulsd  %xmm1,%xmm0
  movq   D7(%rip),%xmm2
  mov    %r15,%rax
  sub    $0x1,%rax
  mov    %rax,0x90(%rsp)
  xorpd  %xmm2,%xmm0
  movsd  %xmm0,0x58(%rsp)
  js     L145
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
L124:
  mulsd  %xmm1,%xmm0
  mov    %r15,%rax
  pxor   %xmm4,%xmm4
  mov    %r14,%r15
  movq   $0x0,0x60(%rsp)
  movsd  D23(%rip),%xmm5
  mov    %rax,%r14
  movq   $0x0,0x50(%rsp)
  xorpd  %xmm2,%xmm0
  movsd  %xmm0,0x98(%rsp)
  nopl   0x0(%rax)
L210:
  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    L200
  nopl   0x0(%rax)
L46:
  add    $0x1,%r13
  addsd  %xmm5,%xmm3
  cmp    %r13,%r14
  jbe    L207
L200:
  movapd %xmm6,%xmm1
  mulsd  %xmm3,%xmm1
  addsd  %xmm7,%xmm1
  addsd  %xmm8,%xmm1
  comisd %xmm4,%xmm1
  jb     L46
  movapd %xmm9,%xmm2
  mulsd  %xmm3,%xmm2
  subsd  %xmm10,%xmm2
  addsd  0x10(%rsp),%xmm2
  comisd %xmm4,%xmm2
  movsd  %xmm2,0x8(%rsp)
  jb     L46
  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    D23(%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    L46
  mov    0x70(%rsp),%rdi
  cmp    %rax,%rdi
  jbe    L46
  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     L40
  test   %rbx,%rbx
  movsd  0x18(%rsp),%xmm1
  js     L266
  pxor   %xmm0,%xmm0
  cvtsi2sd %rbx,%xmm0
L135:
  movapd %xmm1,%xmm13
  subsd  %xmm0,%xmm13
  test   %r12,%r12
  js     L279
  pxor   %xmm0,%xmm0
  cvtsi2sd %r12,%xmm0
L240:
  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
L40:
  cmp    %rax,%rbp
  je     L268
  test   %rax,%rax
  js     L57
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
L137:
  subsd  %xmm2,%xmm0
  mulsd  %xmm12,%xmm0
  test   %rbp,%rbp
  js     L215
  pxor   %xmm1,%xmm1
  cvtsi2sd %rbp,%xmm1
L208:
  subsd  %xmm1,%xmm2
  mulsd  %xmm11,%xmm2
  addsd  %xmm2,%xmm0
  movapd %xmm0,%xmm12
L268:
  mov    0x78(%rsp),%rax
  addsd  %xmm5,%xmm3
  movsd  %xmm12,(%rax,%r13,8)
  add    $0x1,%r13
  cmp    %r13,%r14
  ja     L200
  nopw   0x0(%rax,%rax,1)
L207:
  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     L210
L30:
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L257:
  mov    %rax,%rdx
  and    $0x1,%eax
  pxor   %xmm8,%xmm8
  shr    %rdx
  or     %rax,%rdx
  cvtsi2sd %rdx,%xmm8
  addsd  %xmm8,%xmm8
  jmp    L191
  nopl   0x0(%rax,%rax,1)
L279:
  mov    %r12,%rcx
  mov    %r12,%rdx
  pxor   %xmm0,%xmm0
  shr    %rcx
  and    $0x1,%edx
  or     %rdx,%rcx
  cvtsi2sd %rcx,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L240
  nopl   0x0(%rax)
L266:
  mov    %rbx,%rdx
  mov    %rbx,%rcx
  pxor   %xmm0,%xmm0
  shr    %rdx
  and    $0x1,%ecx
  or     %rcx,%rdx
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L135
  nopl   0x0(%rax)
L215:
  mov    %rbp,%rax
  and    $0x1,%ebp
  pxor   %xmm1,%xmm1
  shr    %rax
  or     %rbp,%rax
  cvtsi2sd %rax,%xmm1
  addsd  %xmm1,%xmm1
  jmp    L208
  xchg   %ax,%ax
L57:
  mov    %rax,%rdx
  and    $0x1,%eax
  pxor   %xmm0,%xmm0
  shr    %rdx
  or     %rax,%rdx
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L137
L145:
  mov    0x90(%rsp),%rbx
  pxor   %xmm0,%xmm0
  mov    %rbx,%rax
  and    $0x1,%ebx
  shr    %rax
  or     %rbx,%rax
  cvtsi2sd %rax,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L124
L121:
  mov    %rax,%rdx
  and    $0x1,%eax
  pxor   %xmm0,%xmm0
  shr    %rdx
  or     %rax,%rdx
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L214
L190:
  mov    %rax,%rdx
  and    $0x1,%eax
  pxor   %xmm11,%xmm11
  shr    %rdx
  or     %rax,%rdx
  cvtsi2sd %rdx,%xmm11
  addsd  %xmm11,%xmm11
  jmp    L11
```

tool_calls: name: read_data
arguments: tag: D26
datatype: byte[8]
name: read_data
arguments: tag: D7
datatype: byte[8]
name: read_data
arguments: tag: D23
datatype: f64

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

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

tool: D23: 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++;
    }
  }
}
```