void qarn(double *r, double p[], int n) {
  int i, m;
  double s, u, v;
  s = 65536.0;
  u = 2053.0;
  v = 13849.0;
  for (i = 0; i <= n - 1; i++) {
    *r = u * (*r) + v;
    m = (int)(*r / s);
    *r = *r - m * s;
    p[i] = *r / s;
  }
  return;
}


x86 assembly (clang, -O0):
<qarn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  0xef9(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xee4(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xecf(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11e5 <qarn+0xe5>
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113d <qarn+0x3d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<qarn>:
test   %edx,%edx
jle    116a <qarn+0x6a>
mov    %edx,%eax
xor    %ecx,%ecx
movsd  0xef0(%rip),%xmm0
movsd  0xef0(%rip),%xmm1
movsd  0xef0(%rip),%xmm2
movsd  0xef0(%rip),%xmm3
nopl   0x0(%rax,%rax,1)
movsd  (%rdi),%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm1,%xmm4
movapd %xmm4,%xmm5
mulsd  %xmm2,%xmm5
cvttpd2dq %xmm5,%xmm5
cvtdq2pd %xmm5,%xmm5
mulsd  %xmm3,%xmm5
addsd  %xmm4,%xmm5
movsd  %xmm5,(%rdi)
mulsd  %xmm2,%xmm5
movsd  %xmm5,(%rsi,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1130 <qarn+0x30>
ret

LLVM IR (-O0):
define void @qarn(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
store double 6.553600e+04, double* %9
store double 2.053000e+03, double* %10
store double 1.384900e+04, double* %11
store i32 0, i32* %7
br label %12
12: ; preds = %45, %3
%13 = load i32, i32* %7
%14 = load i32, i32* %6
%15 = sub nsw i32 %14, 1
%16 = icmp sle i32 %13, %15
br i1 %16, label %17, label %48
17: ; preds = %12
%18 = load double, double* %10
%19 = load double*, double** %4
%20 = load double, double* %19
%21 = load double, double* %11
%22 = call double @llvm.fmuladd.f64(double %18, double %20, double %21)
%23 = load double*, double** %4
store double %22, double* %23
%24 = load double*, double** %4
%25 = load double, double* %24
%26 = load double, double* %9
%27 = fdiv double %25, %26
%28 = fptosi double %27 to i32
store i32 %28, i32* %8
%29 = load double*, double** %4
%30 = load double, double* %29
%31 = load i32, i32* %8
%32 = sitofp i32 %31 to double
%33 = load double, double* %9
%34 = fneg double %32
%35 = call double @llvm.fmuladd.f64(double %34, double %33, double %30)
%36 = load double*, double** %4
store double %35, double* %36
%37 = load double*, double** %4
%38 = load double, double* %37
%39 = load double, double* %9
%40 = fdiv double %38, %39
%41 = load double*, double** %5
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
store double %40, double* %44
br label %45
45: ; preds = %17
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
br label %12
48: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @qarn(double* nocapture %0, double* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %20
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %18, %7 ]
%9 = load double, double* %0
%10 = tail call double @llvm.fmuladd.f64(double %9, double 2.053000e+03, double 1.384900e+04)
%11 = fmul double %10, 0x3EF0000000000000
%12 = fptosi double %11 to i32
%13 = sitofp i32 %12 to double
%14 = fneg double %13
%15 = tail call double @llvm.fmuladd.f64(double %14, double 6.553600e+04, double %10)
store double %15, double* %0
%16 = fmul double %15, 0x3EF0000000000000
%17 = getelementptr inbounds double, double* %1, i64 %8
store double %16, double* %17
%18 = add nuw nsw i64 %8, 1
%19 = icmp eq i64 %18, %6
br i1 %19, label %20, label %7
20: ; preds = %7, %3
ret void
}