int ptm_pnm_filter_by_ath(float *ptm, float *pnm, float *psd_ath, int psd_len) {
  int k;
  for (k = 0; k < psd_len; k++) {
    if (ptm[k] < psd_ath[k])
      ptm[k] = 0.;
    if (pnm[k] < psd_ath[k])
      pnm[k] = 0.;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ptm_pnm_filter_by_ath>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    119f <ptm_pnm_filter_by_ath+0x9f>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
ucomiss %xmm1,%xmm0
jbe    1159 <ptm_pnm_filter_by_ath+0x59>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
ucomiss %xmm1,%xmm0
jbe    118c <ptm_pnm_filter_by_ath+0x8c>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    1191 <ptm_pnm_filter_by_ath+0x91>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    111a <ptm_pnm_filter_by_ath+0x1a>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptm_pnm_filter_by_ath>:
test   %ecx,%ecx
jle    113f <ptm_pnm_filter_by_ath+0x3f>
mov    %ecx,%eax
xor    %ecx,%ecx
jmp    1119 <ptm_pnm_filter_by_ath+0x19>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rcx
cmp    %rcx,%rax
je     113f <ptm_pnm_filter_by_ath+0x3f>
movss  (%rdx,%rcx,4),%xmm0
ucomiss (%rdi,%rcx,4),%xmm0
jbe    1130 <ptm_pnm_filter_by_ath+0x30>
movl   $0x0,(%rdi,%rcx,4)
movss  (%rdx,%rcx,4),%xmm0
ucomiss (%rsi,%rcx,4),%xmm0
jbe    1110 <ptm_pnm_filter_by_ath+0x10>
movl   $0x0,(%rsi,%rcx,4)
jmp    1110 <ptm_pnm_filter_by_ath+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ptm_pnm_filter_by_ath(float* nocapture %0, float* nocapture %1, float* nocapture %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %26
6: ; preds = %4
%7 = zext i32 %3 to i64
br label %8
8: ; preds = %6, %23
%9 = phi i64 [ 0, %6 ], [ %24, %23 ]
%10 = getelementptr inbounds float, float* %0, i64 %9
%11 = load float, float* %10
%12 = getelementptr inbounds float, float* %2, i64 %9
%13 = load float, float* %12
%14 = fcmp olt float %11, %13
br i1 %14, label %15, label %17
15: ; preds = %8
store float 0.000000e+00, float* %10
%16 = load float, float* %12
br label %17
17: ; preds = %15, %8
%18 = phi float [ %16, %15 ], [ %13, %8 ]
%19 = getelementptr inbounds float, float* %1, i64 %9
%20 = load float, float* %19
%21 = fcmp olt float %20, %18
br i1 %21, label %22, label %23
22: ; preds = %17
store float 0.000000e+00, float* %19
br label %23
23: ; preds = %17, %22
%24 = add nuw nsw i64 %9, 1
%25 = icmp eq i64 %24, %7
br i1 %25, label %26, label %8
26: ; preds = %23, %4
ret i32 0
}