#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ ceil(double);
double cos(double);
scalar_t__ floor(double);
double sin(double);
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++;
    }
  }
}


x86 assembly (clang, -O0):
<fitest_image_rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x18(%rbp)
jbe    172f <fitest_image_rotate+0x5ef>
cmpq   $0x0,-0x20(%rbp)
jbe    172f <fitest_image_rotate+0x5ef>
cmpq   $0x0,-0x28(%rbp)
jbe    172f <fitest_image_rotate+0x5ef>
cmpq   $0x0,-0x30(%rbp)
jbe    172f <fitest_image_rotate+0x5ef>
movsd  -0x38(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
movq   %rax,%xmm0
movaps 0xe3a(%rip),%xmm2
punpckldq %xmm2,%xmm0
movapd 0xe3e(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
movsd  0xe07(%rip),%xmm3
divsd  %xmm3,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
movq   %rax,%xmm0
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm4
unpckhpd %xmm0,%xmm0
addsd  %xmm4,%xmm0
divsd  %xmm3,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
movq   %rax,%xmm0
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdad(%rip),%xmm1
divsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x70(%rbp)
movq   $0x0,-0x78(%rbp)
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    172a <fitest_image_rotate+0x5ea>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
movq   %rax,%xmm0
movaps 0xd6b(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xd6f(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd38(%rip),%xmm1
divsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movq   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    1707 <fitest_image_rotate+0x5c7>
movsd  -0x70(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x88(%rbp),%xmm1
ff
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     16cc <fitest_image_rotate+0x58c>
movsd  -0xa0(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     16cc <fitest_image_rotate+0x58c>
movsd  -0x98(%rbp),%xmm0
ff
call   1060 <floor@plt>
mov    %rax,-0xa8(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
call   1030 <ceil@plt>
mov    %rax,-0xb0(%rbp)
movsd  -0xa0(%rbp),%xmm0
ff
call   1060 <floor@plt>
mov    %rax,-0xb8(%rbp)
movsd  -0xa0(%rbp),%xmm0
ff
call   1030 <ceil@plt>
mov    %rax,-0xc0(%rbp)
xor    %eax,%eax
cmp    -0xa8(%rbp),%rax
ja     16c7 <fitest_image_rotate+0x587>
mov    -0xb0(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    16c7 <fitest_image_rotate+0x587>
xor    %eax,%eax
cmp    -0xb8(%rbp),%rax
ja     16c7 <fitest_image_rotate+0x587>
mov    -0xc0(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    16c7 <fitest_image_rotate+0x587>
movsd  -0x98(%rbp),%xmm0
ff
movq   -0xa8(%rbp),%xmm3
ff
movaps 0xbc9(%rip),%xmm2
punpckldq %xmm2,%xmm3
movapd 0xbcd(%rip),%xmm1
subpd  %xmm1,%xmm3
movaps %xmm3,%xmm4
unpckhpd %xmm3,%xmm3
addsd  %xmm4,%xmm3
subsd  %xmm3,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movq   -0xb0(%rbp),%xmm0
ff
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
movsd  -0x98(%rbp),%xmm3
ff
subsd  %xmm3,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movq   -0xb8(%rbp),%xmm3
ff
punpckldq %xmm2,%xmm3
subpd  %xmm1,%xmm3
movaps %xmm3,%xmm4
unpckhpd %xmm3,%xmm3
addsd  %xmm4,%xmm3
subsd  %xmm3,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movq   -0xc0(%rbp),%xmm0
ff
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
subsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xe0(%rbp)
ff
mov    -0x40(%rbp),%rax
mov    -0xa8(%rbp),%rcx
imul   -0x20(%rbp),%rcx
add    -0xb8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
mov    -0x40(%rbp),%rax
mov    -0xa8(%rbp),%rcx
imul   -0x20(%rbp),%rcx
add    -0xc0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
mov    -0x40(%rbp),%rax
mov    -0xb0(%rbp),%rcx
imul   -0x20(%rbp),%rcx
add    -0xb8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
mov    -0x40(%rbp),%rax
mov    -0xb0(%rbp),%rcx
imul   -0x20(%rbp),%rcx
add    -0xc0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
mov    -0xa8(%rbp),%rax
cmp    -0xb0(%rbp),%rax
je     15d0 <fitest_image_rotate+0x490>
movsd  -0xd0(%rbp),%xmm0
ff
movsd  -0xe8(%rbp),%xmm2
ff
movsd  -0xc8(%rbp),%xmm1
ff
mulsd  -0xf8(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
jmp    15e0 <fitest_image_rotate+0x4a0>
movsd  -0xe8(%rbp),%xmm0
ff
movsd  %xmm0,-0x118(%rbp)
ff
movsd  -0x118(%rbp),%xmm0
ff
movsd  %xmm0,-0x108(%rbp)
ff
mov    -0xa8(%rbp),%rax
cmp    -0xb0(%rbp),%rax
je     1639 <fitest_image_rotate+0x4f9>
movsd  -0xd0(%rbp),%xmm0
ff
movsd  -0xf0(%rbp),%xmm2
ff
movsd  -0xc8(%rbp),%xmm1
ff
mulsd  -0x100(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
jmp    1649 <fitest_image_rotate+0x509>
movsd  -0xf0(%rbp),%xmm0
ff
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0x120(%rbp),%xmm0
ff
movsd  %xmm0,-0x110(%rbp)
ff
mov    -0xb8(%rbp),%rax
cmp    -0xc0(%rbp),%rax
je     16a2 <fitest_image_rotate+0x562>
movsd  -0xe0(%rbp),%xmm0
ff
movsd  -0x108(%rbp),%xmm2
ff
movsd  -0xd8(%rbp),%xmm1
ff
mulsd  -0x110(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
jmp    16b2 <fitest_image_rotate+0x572>
movsd  -0x108(%rbp),%xmm0
ff
movsd  %xmm0,-0x128(%rbp)
ff
movsd  -0x128(%rbp),%xmm0
ff
mov    -0x48(%rbp),%rax
mov    -0x78(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    16cc <fitest_image_rotate+0x58c>
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
movsd  0x928(%rip),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x90(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x90(%rbp)
jmp    12f6 <fitest_image_rotate+0x1b6>
movsd  0x8f9(%rip),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    1283 <fitest_image_rotate+0x143>
jmp    172f <fitest_image_rotate+0x5ef>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fitest_image_rotate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %r8,0x8(%rsp)
mov    %rsi,0x20(%rsp)
mov    %rdx,0x28(%rsp)
test   %rdx,%rdx
je     152e <fitest_image_rotate+0x3ee>
mov    %rcx,%r15
test   %rcx,%rcx
je     152e <fitest_image_rotate+0x3ee>
cmpq   $0x0,0x8(%rsp)
je     152e <fitest_image_rotate+0x3ee>
mov    %r9,%rbx
test   %r9,%r9
je     152e <fitest_image_rotate+0x3ee>
movsd  %xmm0,0x10(%rsp)
mov    %rdi,0x58(%rsp)
call   1050 <cos@plt>
movaps %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
movapd 0x30(%rsp),%xmm10
movq   0x28(%rsp),%xmm1
movq   %r15,%xmm2
punpcklqdq %xmm1,%xmm2
pcmpeqd %xmm11,%xmm11
paddq  %xmm2,%xmm11
movdqa 0xe2b(%rip),%xmm1
pand   %xmm11,%xmm1
por    0xe2e(%rip),%xmm1
psrlq  $0x20,%xmm11
por    0xe2f(%rip),%xmm11
movapd %xmm0,%xmm12
subpd  0xe31(%rip),%xmm11
addpd  %xmm1,%xmm11
mulpd  0xe33(%rip),%xmm11
lea    -0x1(%rbx),%rax
movq   %rax,%xmm0
movdqa 0xe32(%rip),%xmm2
punpckldq %xmm2,%xmm0
movapd 0xe36(%rip),%xmm3
subpd  %xmm3,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe3e(%rip),%xmm0
mulsd  %xmm0,%xmm1
movapd %xmm1,0x70(%rsp)
mov    0x8(%rsp),%rax
lea    -0x1(%rax),%rax
movq   %rax,%xmm1
punpckldq %xmm2,%xmm1
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
unpcklpd %xmm10,%xmm10
lea    0x0(,%rbx,8),%rax
mov    %rax,0x40(%rsp)
xor    %ecx,%ecx
movsd  0xdfa(%rip),%xmm7
movapd %xmm10,0x30(%rsp)
movapd %xmm11,0x90(%rsp)
movsd  %xmm12,0x50(%rsp)
jmp    12db <fitest_image_rotate+0x19b>
nopl   0x0(%rax,%rax,1)
movapd 0x80(%rsp),%xmm2
addsd  %xmm7,%xmm2
mov    0x48(%rsp),%rcx
add    $0x1,%rcx
mov    0x40(%rsp),%rax
add    %rax,0x20(%rsp)
cmp    0x8(%rsp),%rcx
je     152e <fitest_image_rotate+0x3ee>
mov    %rcx,0x48(%rsp)
movapd %xmm2,%xmm4
xorpd  0xd84(%rip),%xmm4
mulsd  %xmm12,%xmm4
movapd %xmm2,0x80(%rsp)
unpcklpd %xmm2,%xmm5
xor    %ebp,%ebp
movapd 0x70(%rsp),%xmm6
movapd %xmm4,0xb0(%rsp)
movapd %xmm5,0xa0(%rsp)
jmp    133b <fitest_image_rotate+0x1fb>
nopw   0x0(%rax,%rax,1)
mov    0x20(%rsp),%rax
movsd  %xmm0,(%rax,%rbp,8)
addsd  %xmm7,%xmm6
add    $0x1,%rbp
cmp    %rbp,%rbx
je     12b0 <fitest_image_rotate+0x170>
movapd %xmm12,%xmm0
mulsd  %xmm6,%xmm0
movapd %xmm5,%xmm1
movsd  %xmm6,%xmm1
mulpd  %xmm10,%xmm1
movapd %xmm4,%xmm2
unpcklpd %xmm0,%xmm2
addpd  %xmm1,%xmm2
addpd  %xmm11,%xmm2
xorpd  %xmm0,%xmm0
cmplepd %xmm2,%xmm0
movmskpd %xmm0,%eax
cmp    $0x3,%al
jne    132a <fitest_image_rotate+0x1ea>
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
movapd %xmm0,0x60(%rsp)
movapd %xmm6,0xc0(%rsp)
movapd %xmm2,0x10(%rsp)
call   1060 <floor@plt>
mov    %rax,%r13
movaps 0x60(%rsp),%xmm0
call   1030 <ceil@plt>
mov    %rax,%r12
movaps 0x10(%rsp),%xmm0
call   1060 <floor@plt>
mov    %rax,%r14
movapd 0x10(%rsp),%xmm0
call   1030 <ceil@plt>
movapd 0x10(%rsp),%xmm13
movapd 0xc0(%rsp),%xmm6
movapd 0xa0(%rsp),%xmm5
movapd 0xb0(%rsp),%xmm4
movsd  0xca1(%rip),%xmm7
movsd  0x50(%rsp),%xmm12
movapd 0x90(%rsp),%xmm11
movapd 0x30(%rsp),%xmm10
mov    0x58(%rsp),%rdi
cmp    0x28(%rsp),%r12
jae    132a <fitest_image_rotate+0x1ea>
cmp    %r15,%rax
jae    132a <fitest_image_rotate+0x1ea>
movq   %r13,%xmm0
movdqa 0xc2b(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xc2f(%rip),%xmm3
subpd  %xmm3,%xmm0
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
addsd  %xmm0,%xmm2
movq   %r12,%xmm0
punpckldq %xmm1,%xmm0
subpd  %xmm3,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movapd 0x60(%rsp),%xmm3
subsd  %xmm3,%xmm1
subsd  %xmm2,%xmm3
mov    %r13,%rdx
imul   %r15,%rdx
lea    (%r14,%rdx,1),%rcx
movsd  (%rdi,%rcx,8),%xmm0
add    %rax,%rdx
mov    %r12,%rcx
imul   %r15,%rcx
cmp    %r12,%r13
je     149c <fitest_image_rotate+0x35c>
lea    (%rcx,%r14,1),%rsi
movsd  (%rdi,%rsi,8),%xmm2
mulsd  %xmm3,%xmm2
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
movsd  (%rdi,%rdx,8),%xmm2
cmp    %r12,%r13
je     14ba <fitest_image_rotate+0x37a>
add    %rax,%rcx
mulsd  (%rdi,%rcx,8),%xmm3
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
movapd %xmm1,%xmm2
cmp    %rax,%r14
je     1320 <fitest_image_rotate+0x1e0>
movq   %r14,%xmm1
movdqa 0xb7f(%rip),%xmm9
punpckldq %xmm9,%xmm1
movapd 0xb81(%rip),%xmm8
subpd  %xmm8,%xmm1
movapd %xmm1,%xmm3
unpckhpd %xmm1,%xmm3
addsd  %xmm1,%xmm3
movapd %xmm13,%xmm1
subsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm1
movq   %rax,%xmm2
punpckldq %xmm9,%xmm2
subpd  %xmm8,%xmm2
movapd %xmm2,%xmm3
unpckhpd %xmm2,%xmm3
addsd  %xmm2,%xmm3
subsd  %xmm13,%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
movapd %xmm3,%xmm0
jmp    1320 <fitest_image_rotate+0x1e0>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fitest_image_rotate(double* %0, double* %1, i64 %2, i64 %3, i64 %4, i64 %5, double %6) {
%8 = alloca double*
%9 = alloca double*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca double
%15 = alloca double*
%16 = alloca double*
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca i64
%23 = alloca i64
%24 = alloca double
%25 = alloca i64
%26 = alloca double
%27 = alloca double
%28 = alloca i64
%29 = alloca i64
%30 = alloca i64
%31 = alloca i64
%32 = alloca double
%33 = alloca double
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = alloca double
%39 = alloca double
%40 = alloca double
%41 = alloca double
store double* %0, double** %8
store double* %1, double** %9
store i64 %2, i64* %10
store i64 %3, i64* %11
store i64 %4, i64* %12
store i64 %5, i64* %13
store double %6, double* %14
%42 = load double*, double** %8
store double* %42, double** %15
%43 = load double*, double** %9
store double* %43, double** %16
%44 = load i64, i64* %10
%45 = icmp ugt i64 %44, 0
br i1 %45, label %46, label %242
46: ; preds = %7
%47 = load i64, i64* %11
%48 = icmp ugt i64 %47, 0
br i1 %48, label %49, label %242
49: ; preds = %46
%50 = load i64, i64* %12
%51 = icmp ugt i64 %50, 0
br i1 %51, label %52, label %242
52: ; preds = %49
%53 = load i64, i64* %13
%54 = icmp ugt i64 %53, 0
br i1 %54, label %55, label %242
55: ; preds = %52
%56 = load double, double* %14
%57 = call double @cos(double %56)
store double %57, double* %17
%58 = load double, double* %14
%59 = call double @sin(double %58)
store double %59, double* %18
%60 = load i64, i64* %10
%61 = sub i64 %60, 1
%62 = uitofp i64 %61 to double
%63 = fdiv double %62, 2.000000e+00
store double %63, double* %19
%64 = load i64, i64* %11
%65 = sub i64 %64, 1
%66 = uitofp i64 %65 to double
%67 = fdiv double %66, 2.000000e+00
store double %67, double* %20
%68 = load i64, i64* %12
%69 = sub i64 %68, 1
%70 = uitofp i64 %69 to double
%71 = fdiv double %70, 2.000000e+00
%72 = fneg double %71
store double %72, double* %21
store i64 0, i64* %22
store i64 0, i64* %23
br label %73
73: ; preds = %238, %55
%74 = load i64, i64* %23
%75 = load i64, i64* %12
%76 = icmp ult i64 %74, %75
br i1 %76, label %77, label %241
77: ; preds = %73
%78 = load i64, i64* %13
%79 = sub i64 %78, 1
%80 = uitofp i64 %79 to double
%81 = fdiv double %80, 2.000000e+00
%82 = fneg double %81
store double %82, double* %24
store i64 0, i64* %25
br label %83
83: ; preds = %232, %77
%84 = load i64, i64* %25
%85 = load i64, i64* %13
%86 = icmp ult i64 %84, %85
br i1 %86, label %87, label %235
87: ; preds = %83
%88 = load double, double* %21
%89 = load double, double* %17
%90 = load double, double* %24
%91 = load double, double* %18
%92 = fmul double %90, %91
%93 = call double @llvm.fmuladd.f64(double %88, double %89, double %92)
%94 = load double, double* %19
%95 = fadd double %93, %94
store double %95, double* %26
%96 = load double, double* %24
%97 = load double, double* %17
%98 = load double, double* %21
%99 = load double, double* %18
%100 = fmul double %98, %99
%101 = fneg double %100
%102 = call double @llvm.fmuladd.f64(double %96, double %97, double %101)
%103 = load double, double* %20
%104 = fadd double %102, %103
store double %104, double* %27
%105 = load double, double* %26
%106 = fcmp oge double %105, 0.000000e+00
br i1 %106, label %107, label %227
107: ; preds = %87
%108 = load double, double* %27
%109 = fcmp oge double %108, 0.000000e+00
br i1 %109, label %110, label %227
110: ; preds = %107
%111 = load double, double* %26
%112 = call i64 @floor(double %111)
store i64 %112, i64* %28
%113 = load double, double* %26
%114 = call i64 @ceil(double %113)
store i64 %114, i64* %29
%115 = load double, double* %27
%116 = call i64 @floor(double %115)
store i64 %116, i64* %30
%117 = load double, double* %27
%118 = call i64 @ceil(double %117)
store i64 %118, i64* %31
%119 = load i64, i64* %28
%120 = icmp ule i64 0, %119
br i1 %120, label %121, label %226
121: ; preds = %110
%122 = load i64, i64* %29
%123 = load i64, i64* %10
%124 = icmp ult i64 %122, %123
br i1 %124, label %125, label %226
125: ; preds = %121
%126 = load i64, i64* %30
%127 = icmp ule i64 0, %126
br i1 %127, label %128, label %226
128: ; preds = %125
%129 = load i64, i64* %31
%130 = load i64, i64* %11
%131 = icmp ult i64 %129, %130
br i1 %131, label %132, label %226
132: ; preds = %128
%133 = load double, double* %26
%134 = load i64, i64* %28
%135 = uitofp i64 %134 to double
%136 = fsub double %133, %135
store double %136, double* %32
%137 = load i64, i64* %29
%138 = uitofp i64 %137 to double
%139 = load double, double* %26
%140 = fsub double %138, %139
store double %140, double* %33
%141 = load double, double* %27
%142 = load i64, i64* %30
%143 = uitofp i64 %142 to double
%144 = fsub double %141, %143
store double %144, double* %34
%145 = load i64, i64* %31
%146 = uitofp i64 %145 to double
%147 = load double, double* %27
%148 = fsub double %146, %147
store double %148, double* %35
%149 = load double*, double** %15
%150 = load i64, i64* %28
%151 = load i64, i64* %11
%152 = mul i64 %150, %151
%153 = load i64, i64* %30
%154 = add i64 %152, %153
%155 = getelementptr inbounds double, double* %149, i64 %154
%156 = load double, double* %155
store double %156, double* %36
%157 = load double*, double** %15
%158 = load i64, i64* %28
%159 = load i64, i64* %11
%160 = mul i64 %158, %159
%161 = load i64, i64* %31
%162 = add i64 %160, %161
%163 = getelementptr inbounds double, double* %157, i64 %162
%164 = load double, double* %163
store double %164, double* %37
%165 = load double*, double** %15
%166 = load i64, i64* %29
%167 = load i64, i64* %11
%168 = mul i64 %166, %167
%169 = load i64, i64* %30
%170 = add i64 %168, %169
%171 = getelementptr inbounds double, double* %165, i64 %170
%172 = load double, double* %171
store double %172, double* %38
%173 = load double*, double** %15
%174 = load i64, i64* %29
%175 = load i64, i64* %11
%176 = mul i64 %174, %175
%177 = load i64, i64* %31
%178 = add i64 %176, %177
%179 = getelementptr inbounds double, double* %173, i64 %178
%180 = load double, double* %179
store double %180, double* %39
%181 = load i64, i64* %28
%182 = load i64, i64* %29
%183 = icmp ne i64 %181, %182
br i1 %183, label %184, label %191
184: ; preds = %132
%185 = load double, double* %33
%186 = load double, double* %36
%187 = load double, double* %32
%188 = load double, double* %38
%189 = fmul double %187, %188
%190 = call double @llvm.fmuladd.f64(double %185, double %186, double %189)
br label %193
191: ; preds = %132
%192 = load double, double* %36
br label %193
193: ; preds = %191, %184
%194 = phi double [ %190, %184 ], [ %192, %191 ]
store double %194, double* %40
%195 = load i64, i64* %28
%196 = load i64, i64* %29
%197 = icmp ne i64 %195, %196
br i1 %197, label %198, label %205
198: ; preds = %193
%199 = load double, double* %33
%200 = load double, double* %37
%201 = load double, double* %32
%202 = load double, double* %39
%203 = fmul double %201, %202
%204 = call double @llvm.fmuladd.f64(double %199, double %200, double %203)
br label %207
205: ; preds = %193
%206 = load double, double* %37
br label %207
207: ; preds = %205, %198
%208 = phi double [ %204, %198 ], [ %206, %205 ]
store double %208, double* %41
%209 = load i64, i64* %30
%210 = load i64, i64* %31
%211 = icmp ne i64 %209, %210
br i1 %211, label %212, label %219
212: ; preds = %207
%213 = load double, double* %35
%214 = load double, double* %40
%215 = load double, double* %34
%216 = load double, double* %41
%217 = fmul double %215, %216
%218 = call double @llvm.fmuladd.f64(double %213, double %214, double %217)
br label %221
219: ; preds = %207
%220 = load double, double* %40
br label %221
221: ; preds = %219, %212
%222 = phi double [ %218, %212 ], [ %220, %219 ]
%223 = load double*, double** %16
%224 = load i64, i64* %22
%225 = getelementptr inbounds double, double* %223, i64 %224
store double %222, double* %225
br label %226
226: ; preds = %221, %128, %125, %121, %110
br label %227
227: ; preds = %226, %107, %87
%228 = load i64, i64* %22
%229 = add i64 %228, 1
store i64 %229, i64* %22
%230 = load double, double* %24
%231 = fadd double %230, 1.000000e+00
store double %231, double* %24
br label %232
232: ; preds = %227
%233 = load i64, i64* %25
%234 = add i64 %233, 1
store i64 %234, i64* %25
br label %83
235: ; preds = %83
%236 = load double, double* %21
%237 = fadd double %236, 1.000000e+00
store double %237, double* %21
br label %238
238: ; preds = %235
%239 = load i64, i64* %23
%240 = add i64 %239, 1
store i64 %240, i64* %23
br label %73
241: ; preds = %73
br label %242
242: ; preds = %241, %52, %49, %46, %7
ret void
}

LLVM IR (-O2):
define void @fitest_image_rotate(double* nocapture %0, double* nocapture writeonly %1, i64 %2, i64 %3, i64 %4, i64 %5, double %6) {
%8 = icmp ne i64 %2, 0
%9 = icmp ne i64 %3, 0
%10 = and i1 %8, %9
%11 = icmp ne i64 %4, 0
%12 = and i1 %10, %11
%13 = icmp ne i64 %5, 0
%14 = and i1 %12, %13
br i1 %14, label %15, label %107
15: ; preds = %7
%16 = tail call double @cos(double %6)
%17 = tail call double @sin(double %6)
%18 = insertelement <2 x i64> poison, i64 %3, i64 0
%19 = insertelement <2 x i64> %18, i64 %2, i64 1
%20 = add <2 x i64> %19, <i64 -1, i64 -1>
%21 = uitofp <2 x i64> %20 to <2 x double>
%22 = fmul <2 x double> %21, <double 5.000000e-01, double 5.000000e-01>
%23 = add i64 %5, -1
%24 = uitofp i64 %23 to double
%25 = fmul double %24, -5.000000e-01
%26 = add i64 %4, -1
%27 = uitofp i64 %26 to double
%28 = fmul double %27, -5.000000e-01
%29 = insertelement <2 x double> poison, double %16, i64 0
%30 = shufflevector <2 x double> %29, <2 x double> poison, <2 x i32> zeroinitializer
br label %31
31: ; preds = %15, %40
%32 = phi double [ %41, %40 ], [ %28, %15 ]
%33 = phi i64 [ %37, %40 ], [ 0, %15 ]
%34 = phi i64 [ %42, %40 ], [ 0, %15 ]
%35 = fneg double %32
%36 = fmul double %17, %35
%37 = add i64 %33, %5
%38 = insertelement <2 x double> poison, double %32, i64 1
%39 = insertelement <2 x double> poison, double %36, i64 0
br label %44
40: ; preds = %103
%41 = fadd double %32, 1.000000e+00
%42 = add nuw i64 %34, 1
%43 = icmp eq i64 %42, %4
br i1 %43, label %107, label %31
44: ; preds = %31, %103
%45 = phi i64 [ %33, %31 ], [ %104, %103 ]
%46 = phi double [ %25, %31 ], [ %105, %103 ]
%47 = fmul double %17, %46
%48 = insertelement <2 x double> %38, double %46, i64 0
%49 = insertelement <2 x double> %39, double %47, i64 1
%50 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> %30, <2 x double> %49)
%51 = fadd <2 x double> %22, %50
%52 = fcmp oge <2 x double> %51, zeroinitializer
%53 = extractelement <2 x i1> %52, i64 0
%54 = extractelement <2 x i1> %52, i64 1
%55 = select i1 %54, i1 %53, i1 false
br i1 %55, label %56, label %103
56: ; preds = %44
%57 = extractelement <2 x double> %51, i64 1
%58 = tail call i64 @floor(double %57)
%59 = tail call i64 @ceil(double %57)
%60 = extractelement <2 x double> %51, i64 0
%61 = tail call i64 @floor(double %60)
%62 = tail call i64 @ceil(double %60)
%63 = icmp ult i64 %59, %2
%64 = icmp ult i64 %62, %3
%65 = select i1 %63, i1 %64, i1 false
br i1 %65, label %66, label %103
66: ; preds = %56
%67 = uitofp i64 %58 to double
%68 = fsub double %57, %67
%69 = uitofp i64 %59 to double
%70 = fsub double %69, %57
%71 = uitofp i64 %61 to double
%72 = fsub double %60, %71
%73 = uitofp i64 %62 to double
%74 = fsub double %73, %60
%75 = mul i64 %58, %3
%76 = add i64 %61, %75
%77 = getelementptr inbounds double, double* %0, i64 %76
%78 = load double, double* %77
%79 = add i64 %62, %75
%80 = getelementptr inbounds double, double* %0, i64 %79
%81 = load double, double* %80
%82 = mul i64 %59, %3
%83 = add i64 %62, %82
%84 = getelementptr inbounds double, double* %0, i64 %83
%85 = load double, double* %84
%86 = icmp eq i64 %58, %59
br i1 %86, label %93, label %87
87: ; preds = %66
%88 = add i64 %82, %61
%89 = getelementptr inbounds double, double* %0, i64 %88
%90 = load double, double* %89
%91 = fmul double %68, %90
%92 = tail call double @llvm.fmuladd.f64(double %70, double %78, double %91)
br label %93
93: ; preds = %66, %87
%94 = phi double [ %92, %87 ], [ %78, %66 ]
%95 = fmul double %68, %85
%96 = tail call double @llvm.fmuladd.f64(double %70, double %81, double %95)
%97 = select i1 %86, double %81, double %96
%98 = icmp eq i64 %61, %62
%99 = fmul double %72, %97
%100 = tail call double @llvm.fmuladd.f64(double %74, double %94, double %99)
%101 = select i1 %98, double %94, double %100
%102 = getelementptr inbounds double, double* %1, i64 %45
store double %101, double* %102
br label %103
103: ; preds = %56, %93, %44
%104 = add i64 %45, 1
%105 = fadd double %46, 1.000000e+00
%106 = icmp eq i64 %104, %37
br i1 %106, label %40, label %44
107: ; preds = %40, %7
ret void
}