void coeffs(x, y, c, s, accuracy) double x, y, *c, *s;
double accuracy;
{
  double root;
  root = sqrt(x * x + y * y);
  if (root < accuracy) {
    *c = 1.0;
    *s = 0.0;
  } else {
    *c = x / root;
    *s = y / root;
  }
}


x86 assembly (clang, -O0):
<coeffs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1189 <coeffs+0x79>
mov    -0x18(%rbp),%rax
movsd  0xe8b(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    11ad <coeffs+0x9d>
movsd  -0x8(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coeffs>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movapd %xmm0,%xmm3
movapd %xmm1,%xmm4
mulsd  %xmm1,%xmm4
mulsd  %xmm0,%xmm0
addsd  %xmm4,%xmm0
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm0
jb     1153 <coeffs+0x43>
sqrtsd %xmm0,%xmm0
ucomisd %xmm0,%xmm2
ja     1180 <coeffs+0x70>
divsd  %xmm0,%xmm3
movsd  %xmm3,(%rbx)
divsd  %xmm0,%xmm1
jmp    1191 <coeffs+0x81>
movsd  %xmm1,0x10(%rsp)
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,(%rsp)
call   1030 <sqrt@plt>
movsd  (%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm2
jbe    1145 <coeffs+0x35>
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rbx)
xorpd  %xmm1,%xmm1
movsd  %xmm1,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @coeffs(double %0, double %1, double* %2, double* %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double*
%9 = alloca double*
%10 = alloca double
%11 = alloca double
store double %0, double* %6
store double %1, double* %7
store double* %2, double** %8
store double* %3, double** %9
store double %4, double* %10
%12 = load double, double* %6
%13 = load double, double* %6
%14 = load double, double* %7
%15 = load double, double* %7
%16 = fmul double %14, %15
%17 = call double @llvm.fmuladd.f64(double %12, double %13, double %16)
%18 = call double @sqrt(double %17)
store double %18, double* %11
%19 = load double, double* %11
%20 = load double, double* %10
%21 = fcmp olt double %19, %20
br i1 %21, label %22, label %25
22: ; preds = %5
%23 = load double*, double** %8
store double 1.000000e+00, double* %23
%24 = load double*, double** %9
store double 0.000000e+00, double* %24
br label %34
25: ; preds = %5
%26 = load double, double* %6
%27 = load double, double* %11
%28 = fdiv double %26, %27
%29 = load double*, double** %8
store double %28, double* %29
%30 = load double, double* %7
%31 = load double, double* %11
%32 = fdiv double %30, %31
%33 = load double*, double** %9
store double %32, double* %33
br label %34
34: ; preds = %25, %22
ret void
}

LLVM IR (-O2):
define void @coeffs(double %0, double %1, double* nocapture writeonly %2, double* nocapture writeonly %3, double %4) {
%6 = fmul double %1, %1
%7 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %6)
%8 = tail call double @sqrt(double %7)
%9 = fcmp olt double %8, %4
br i1 %9, label %10, label %11
10: ; preds = %5
store double 1.000000e+00, double* %2
br label %14
11: ; preds = %5
%12 = fdiv double %0, %8
store double %12, double* %2
%13 = fdiv double %1, %8
br label %14
14: ; preds = %11, %10
%15 = phi double [ %13, %11 ], [ 0.000000e+00, %10 ]
store double %15, double* %3
ret void
}