int velofreq(restfrq, nvelo, svelo, sfreq, velo, freq, stat)
double restfrq;
int nvelo, svelo, sfreq;
const double velo[];
double freq[];
int stat[];
{
  int status = 0;
  double s;
  register int ivelo, *statp;
  register const double *velop;
  register double *freqp;
  velop = velo;
  freqp = freq;
  statp = stat;
  for (ivelo = 0; ivelo < nvelo; ivelo++) {
    s = 2.99792458e8 + *velop;
    if (s != 0.0) {
      *freqp = restfrq * sqrt((2.99792458e8 - *velop) / s);
      *(statp++) = 0;
    } else {
      *(statp++) = 1;
      status = 4;
    }
    velop += svelo;
    freqp += sfreq;
  }
  return status;
}


x86 assembly (clang, -O0):
<velofreq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    123c <velofreq+0x12c>
mov    -0x58(%rbp),%rax
movsd  0xe90(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1196 <velofreq+0x86>
jp     1196 <velofreq+0x86>
jmp    11e8 <velofreq+0xd8>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x58(%rbp),%rax
movsd  0xe54(%rip),%xmm0
subsd  (%rax),%xmm0
divsd  -0x40(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x60(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x50(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x50(%rbp)
movl   $0x0,(%rax)
jmp    1204 <velofreq+0xf4>
mov    -0x50(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x50(%rbp)
movl   $0x1,(%rax)
movl   $0x4,-0x34(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x60(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1158 <velofreq+0x48>
mov    -0x34(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<velofreq>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %edi,%edi
jle    11e9 <velofreq+0xd9>
mov    %r9,%r13
mov    %r8,%r15
mov    %rcx,%rbx
movapd %xmm0,%xmm3
movslq %esi,%r12
movslq %edx,%rsi
shl    $0x3,%rsi
shl    $0x3,%r12
mov    %edi,%ebp
xor    %r14d,%r14d
movsd  0xeb2(%rip),%xmm4
xorpd  %xmm5,%xmm5
movl   $0x0,0x4(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %rsi,0x8(%rsp)
jmp    1191 <velofreq+0x81>
nopw   0x0(%rax,%rax,1)
movl   $0x4,0x4(%rsp)
mov    $0x1,%eax
mov    %eax,0x0(%r13,%r14,4)
add    %rsi,%r15
add    %r12,%rbx
add    $0x1,%r14
cmp    %r14d,%ebp
je     11f1 <velofreq+0xe1>
movsd  (%rbx),%xmm2
movapd %xmm2,%xmm1
addsd  %xmm4,%xmm1
ucomisd %xmm5,%xmm1
jne    11a5 <velofreq+0x95>
jnp    1170 <velofreq+0x60>
movapd %xmm4,%xmm0
subsd  %xmm2,%xmm0
divsd  %xmm1,%xmm0
ucomisd %xmm5,%xmm0
jb     11c0 <velofreq+0xb0>
sqrtsd %xmm0,%xmm0
jmp    11dc <velofreq+0xcc>
nopl   (%rax)
call   1030 <sqrt@plt>
xorpd  %xmm5,%xmm5
movsd  0xe2f(%rip),%xmm4
mov    0x8(%rsp),%rsi
movsd  0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm0
movsd  %xmm0,(%r15)
xor    %eax,%eax
jmp    117d <velofreq+0x6d>
movl   $0x0,0x4(%rsp)
mov    0x4(%rsp),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @velofreq(double %0, i32 %1, i32 %2, i32 %3, double* %4, double* %5, i32* %6) {
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca double
%17 = alloca i32
%18 = alloca i32*
%19 = alloca double*
%20 = alloca double*
store double %0, double* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
store i32* %6, i32** %14
store i32 0, i32* %15
%21 = load double*, double** %12
store double* %21, double** %19
%22 = load double*, double** %13
store double* %22, double** %20
%23 = load i32*, i32** %14
store i32* %23, i32** %18
store i32 0, i32* %17
br label %24
24: ; preds = %58, %7
%25 = load i32, i32* %17
%26 = load i32, i32* %9
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %61
28: ; preds = %24
%29 = load double*, double** %19
%30 = load double, double* %29
%31 = fadd double 0x41B1DE784A000000, %30
store double %31, double* %16
%32 = load double, double* %16
%33 = fcmp une double %32, 0.000000e+00
br i1 %33, label %34, label %46
34: ; preds = %28
%35 = load double, double* %8
%36 = load double*, double** %19
%37 = load double, double* %36
%38 = fsub double 0x41B1DE784A000000, %37
%39 = load double, double* %16
%40 = fdiv double %38, %39
%41 = call double @sqrt(double %40)
%42 = fmul double %35, %41
%43 = load double*, double** %20
store double %42, double* %43
%44 = load i32*, i32** %18
%45 = getelementptr inbounds i32, i32* %44, i32 1
store i32* %45, i32** %18
store i32 0, i32* %44
br label %49
46: ; preds = %28
%47 = load i32*, i32** %18
%48 = getelementptr inbounds i32, i32* %47, i32 1
store i32* %48, i32** %18
store i32 1, i32* %47
store i32 4, i32* %15
br label %49
49: ; preds = %46, %34
%50 = load i32, i32* %10
%51 = load double*, double** %19
%52 = sext i32 %50 to i64
%53 = getelementptr inbounds double, double* %51, i64 %52
store double* %53, double** %19
%54 = load i32, i32* %11
%55 = load double*, double** %20
%56 = sext i32 %54 to i64
%57 = getelementptr inbounds double, double* %55, i64 %56
store double* %57, double** %20
br label %58
58: ; preds = %49
%59 = load i32, i32* %17
%60 = add nsw i32 %59, 1
store i32 %60, i32* %17
br label %24
61: ; preds = %24
%62 = load i32, i32* %15
ret i32 %62
}

LLVM IR (-O2):
define i32 @velofreq(double %0, i32 %1, i32 %2, i32 %3, double* nocapture %4, double* nocapture writeonly %5, i32* nocapture writeonly %6) {
%8 = icmp sgt i32 %1, 0
br i1 %8, label %9, label %34
9: ; preds = %7
%10 = sext i32 %2 to i64
%11 = sext i32 %3 to i64
br label %12
12: ; preds = %9, %26
%13 = phi double* [ %5, %9 ], [ %31, %26 ]
%14 = phi double* [ %4, %9 ], [ %30, %26 ]
%15 = phi i32* [ %6, %9 ], [ %29, %26 ]
%16 = phi i32 [ 0, %9 ], [ %32, %26 ]
%17 = phi i32 [ 0, %9 ], [ %28, %26 ]
%18 = load double, double* %14
%19 = fadd double %18, 0x41B1DE784A000000
%20 = fcmp une double %19, 0.000000e+00
br i1 %20, label %21, label %26
21: ; preds = %12
%22 = fsub double 0x41B1DE784A000000, %18
%23 = fdiv double %22, %19
%24 = tail call double @sqrt(double %23)
%25 = fmul double %24, %0
store double %25, double* %13
br label %26
26: ; preds = %12, %21
%27 = phi i32 [ 0, %21 ], [ 1, %12 ]
%28 = phi i32 [ %17, %21 ], [ 4, %12 ]
%29 = getelementptr inbounds i32, i32* %15, i64 1
store i32 %27, i32* %15
%30 = getelementptr inbounds double, double* %14, i64 %10
%31 = getelementptr inbounds double, double* %13, i64 %11
%32 = add nuw nsw i32 %16, 1
%33 = icmp eq i32 %32, %1
br i1 %33, label %34, label %12
34: ; preds = %26, %7
%35 = phi i32 [ 0, %7 ], [ %28, %26 ]
ret i32 %35
}