int freqwavn(dummy, nfreq, sfreq, swavn, freq, wavn, stat)
double dummy;
int nfreq, sfreq, swavn;
const double freq[];
double wavn[];
int stat[];
{
  register int ifreq, *statp;
  register const double *freqp;
  register double *wavnp;
  freqp = freq;
  wavnp = wavn;
  statp = stat;
  for (ifreq = 0; ifreq < nfreq; ifreq++) {
    *wavnp = (*freqp) / 2.99792458e8;
    *(statp++) = 0;
    freqp += sfreq;
    wavnp += swavn;
  }
  return 0;
}


x86 assembly (clang, -O0):
<freqwavn>:
push   %rbp
mov    %rsp,%rbp
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)
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b2 <freqwavn+0xb2>
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xea7(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x40(%rbp)
movl   $0x0,(%rax)
mov    -0x10(%rbp),%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    113d <freqwavn+0x3d>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<freqwavn>:
test   %edi,%edi
jle    1189 <freqwavn+0x89>
cmp    $0x1,%edi
je     116b <freqwavn+0x6b>
movslq %esi,%r10
movslq %edx,%r11
mov    %edi,%esi
and    $0xfffffffe,%esi
mov    %r11,%rdx
shl    $0x4,%rdx
mov    %r10,%rax
shl    $0x4,%rax
movsd  0xed2(%rip),%xmm0
xchg   %ax,%ax
movsd  (%rcx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r8)
movl   $0x0,(%r9)
movsd  (%rcx,%r10,8),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r8,%r11,8)
movl   $0x0,0x4(%r9)
add    $0x8,%r9
add    %rdx,%r8
add    %rax,%rcx
add    $0xfffffffe,%esi
jne    1130 <freqwavn+0x30>
test   $0x1,%dil
je     1189 <freqwavn+0x89>
movsd  (%rcx),%xmm0
divsd  0xe83(%rip),%xmm0
movsd  %xmm0,(%r8)
movl   $0x0,(%r9)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @freqwavn(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 i32*
%17 = alloca double*
%18 = 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
%19 = load double*, double** %12
store double* %19, double** %17
%20 = load double*, double** %13
store double* %20, double** %18
%21 = load i32*, i32** %14
store i32* %21, i32** %16
store i32 0, i32* %15
br label %22
22: ; preds = %41, %7
%23 = load i32, i32* %15
%24 = load i32, i32* %9
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %44
26: ; preds = %22
%27 = load double*, double** %17
%28 = load double, double* %27
%29 = fdiv double %28, 0x41B1DE784A000000
%30 = load double*, double** %18
store double %29, double* %30
%31 = load i32*, i32** %16
%32 = getelementptr inbounds i32, i32* %31, i32 1
store i32* %32, i32** %16
store i32 0, i32* %31
%33 = load i32, i32* %10
%34 = load double*, double** %17
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds double, double* %34, i64 %35
store double* %36, double** %17
%37 = load i32, i32* %11
%38 = load double*, double** %18
%39 = sext i32 %37 to i64
%40 = getelementptr inbounds double, double* %38, i64 %39
store double* %40, double** %18
br label %41
41: ; preds = %26
%42 = load i32, i32* %15
%43 = add nsw i32 %42, 1
store i32 %43, i32* %15
br label %22
44: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
define i32 @freqwavn(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 %41
9: ; preds = %7
%10 = sext i32 %2 to i64
%11 = sext i32 %3 to i64
%12 = and i32 %1, 1
%13 = icmp eq i32 %1, 1
br i1 %13, label %33, label %14
14: ; preds = %9
%15 = and i32 %1, -2
br label %16
16: ; preds = %16, %14
%17 = phi double* [ %5, %14 ], [ %30, %16 ]
%18 = phi double* [ %4, %14 ], [ %29, %16 ]
%19 = phi i32* [ %6, %14 ], [ %28, %16 ]
%20 = phi i32 [ 0, %14 ], [ %31, %16 ]
%21 = load double, double* %18
%22 = fdiv double %21, 0x41B1DE784A000000
store double %22, double* %17
%23 = getelementptr inbounds i32, i32* %19, i64 1
store i32 0, i32* %19
%24 = getelementptr inbounds double, double* %18, i64 %10
%25 = getelementptr inbounds double, double* %17, i64 %11
%26 = load double, double* %24
%27 = fdiv double %26, 0x41B1DE784A000000
store double %27, double* %25
%28 = getelementptr inbounds i32, i32* %19, i64 2
store i32 0, i32* %23
%29 = getelementptr inbounds double, double* %24, i64 %10
%30 = getelementptr inbounds double, double* %25, i64 %11
%31 = add i32 %20, 2
%32 = icmp eq i32 %31, %15
br i1 %32, label %33, label %16
33: ; preds = %16, %9
%34 = phi double* [ %5, %9 ], [ %30, %16 ]
%35 = phi double* [ %4, %9 ], [ %29, %16 ]
%36 = phi i32* [ %6, %9 ], [ %28, %16 ]
%37 = icmp eq i32 %12, 0
br i1 %37, label %41, label %38
38: ; preds = %33
%39 = load double, double* %35
%40 = fdiv double %39, 0x41B1DE784A000000
store double %40, double* %34
store i32 0, i32* %36
br label %41
41: ; preds = %38, %33, %7
ret i32 0
}