#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 */
float cos(float);
float sin(float);
void rotate(float r, float theta, float angle, float *x, float *y) {
  theta += angle;
  if (theta < 0.)
    theta += 6.28318530718f;
  else if (theta >= 6.28318530718f)
    theta -= 6.28318530718f;
  *x = r * cos(theta);
  *y = r * sin(theta);
}


x86 assembly (clang, -O0):
<rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    117b <rotate+0x5b>
movss  0xe94(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11ac <rotate+0x8c>
movss  -0x8(%rbp),%xmm0
movss  0xe78(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     11a7 <rotate+0x87>
movss  -0x8(%rbp),%xmm0
movss  0xe62(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11ac <rotate+0x8c>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movss  %xmm0,(%rsp)
addss  %xmm2,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    1145 <rotate+0x25>
addss  0xebd(%rip),%xmm1
jmp    1156 <rotate+0x36>
ucomiss 0xeb4(%rip),%xmm1
jb     1156 <rotate+0x36>
addss  0xeae(%rip),%xmm1
movss  %xmm1,0x4(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos@plt>
mulss  (%rsp),%xmm0
movss  %xmm0,(%rbx)
movss  0x4(%rsp),%xmm0
call   1030 <sin@plt>
mulss  (%rsp),%xmm0
movss  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @rotate(float %0, float %1, float %2, float* %3, float* %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float*
%10 = alloca float*
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float* %3, float** %9
store float* %4, float** %10
%11 = load float, float* %8
%12 = load float, float* %7
%13 = fadd float %12, %11
store float %13, float* %7
%14 = load float, float* %7
%15 = fpext float %14 to double
%16 = fcmp olt double %15, 0.000000e+00
br i1 %16, label %17, label %20
17: ; preds = %5
%18 = load float, float* %7
%19 = fadd float %18, 0x401921FB60000000
store float %19, float* %7
br label %27
20: ; preds = %5
%21 = load float, float* %7
%22 = fcmp oge float %21, 0x401921FB60000000
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load float, float* %7
%25 = fsub float %24, 0x401921FB60000000
store float %25, float* %7
br label %26
26: ; preds = %23, %20
br label %27
27: ; preds = %26, %17
%28 = load float, float* %6
%29 = load float, float* %7
%30 = call float @cos(float %29)
%31 = fmul float %28, %30
%32 = load float*, float** %9
store float %31, float* %32
%33 = load float, float* %6
%34 = load float, float* %7
%35 = call float @sin(float %34)
%36 = fmul float %33, %35
%37 = load float*, float** %10
store float %36, float* %37
ret void
}

LLVM IR (-O2):
define void @rotate(float %0, float %1, float %2, float* nocapture writeonly %3, float* nocapture writeonly %4) {
%6 = fadd float %1, %2
%7 = fcmp olt float %6, 0.000000e+00
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = fadd float %6, 0x401921FB60000000
br label %14
10: ; preds = %5
%11 = fcmp ult float %6, 0x401921FB60000000
br i1 %11, label %14, label %12
12: ; preds = %10
%13 = fadd float %6, 0xC01921FB60000000
br label %14
14: ; preds = %10, %12, %8
%15 = phi float [ %9, %8 ], [ %13, %12 ], [ %6, %10 ]
%16 = tail call float @cos(float %15)
%17 = fmul float %16, %0
store float %17, float* %3
%18 = tail call float @sin(float %15)
%19 = fmul float %18, %0
store float %19, float* %4
ret void
}