void count_array_threshold_(double *x, int *n, double *threshold, int *nlarge) {
  int i;
  *nlarge = 0;
  for (i = 0; i < *n; i++)
    if (*(x + i) > *threshold)
      (*nlarge)++;
}


x86 assembly (clang, -O0):
<count_array_threshold_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    116d <count_array_threshold_+0x6d>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    115a <count_array_threshold_+0x5a>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    115f <count_array_threshold_+0x5f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1125 <count_array_threshold_+0x25>
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_array_threshold_>:
movl   $0x0,(%rcx)
mov    (%rsi),%r9d
test   %r9d,%r9d
jle    1143 <count_array_threshold_+0x43>
movsd  (%rdx),%xmm0
xor    %r8d,%r8d
xor    %edx,%edx
jmp    112c <count_array_threshold_+0x2c>
nopl   0x0(%rax)
add    $0x1,%rdx
movslq %r9d,%rax
cmp    %rax,%rdx
jge    1143 <count_array_threshold_+0x43>
movsd  (%rdi,%rdx,8),%xmm1
ucomisd %xmm0,%xmm1
jbe    1120 <count_array_threshold_+0x20>
add    $0x1,%r8d
mov    %r8d,(%rcx)
mov    (%rsi),%r9d
jmp    1120 <count_array_threshold_+0x20>
ret

LLVM IR (-O0):
define void @count_array_threshold_(double* %0, i32* %1, double* %2, i32* %3) {
%5 = alloca double*
%6 = alloca i32*
%7 = alloca double*
%8 = alloca i32*
%9 = alloca i32
store double* %0, double** %5
store i32* %1, i32** %6
store double* %2, double** %7
store i32* %3, i32** %8
%10 = load i32*, i32** %8
store i32 0, i32* %10
store i32 0, i32* %9
br label %11
11: ; preds = %30, %4
%12 = load i32, i32* %9
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %33
16: ; preds = %11
%17 = load double*, double** %5
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = load double*, double** %7
%23 = load double, double* %22
%24 = fcmp ogt double %21, %23
br i1 %24, label %25, label %29
25: ; preds = %16
%26 = load i32*, i32** %8
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1
store i32 %28, i32* %26
br label %29
29: ; preds = %25, %16
br label %30
30: ; preds = %29
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
store i32 %32, i32* %9
br label %11
33: ; preds = %11
ret void
}

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