#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ r_set_na_real(double const *);
bool pcapack_anyna(const int n, const double *x) {
  int i;
  const double NA;
  r_set_na_real(&NA);
  for (i = 0; i < n; i++) {
    if (x[i] == NA)
      return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<pcapack_anyna>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <r_set_na_real@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1178 <pcapack_anyna+0x68>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x20(%rbp),%xmm0
jne    1165 <pcapack_anyna+0x55>
jp     1165 <pcapack_anyna+0x55>
movl   $0x1,-0x4(%rbp)
jmp    117f <pcapack_anyna+0x6f>
jmp    116a <pcapack_anyna+0x5a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112f <pcapack_anyna+0x1f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcapack_anyna>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsp,%rdi
call   1030 <r_set_na_real@plt>
test   %ebp,%ebp
jle    1146 <pcapack_anyna+0x36>
movsd  (%rsp),%xmm0
mov    %ebp,%eax
xor    %ecx,%ecx
nopl   (%rax)
movsd  (%rbx,%rcx,8),%xmm1
ucomisd %xmm0,%xmm1
jne    113d <pcapack_anyna+0x2d>
jnp    114a <pcapack_anyna+0x3a>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1130 <pcapack_anyna+0x20>
xor    %eax,%eax
jmp    114f <pcapack_anyna+0x3f>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @pcapack_anyna(i32 %0, double* nocapture %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = call i32 @r_set_na_real(double* %3)
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %18
7: ; preds = %2
%8 = load double, double* %3
%9 = zext i32 %0 to i64
br label %12
10: ; preds = %12
%11 = icmp eq i64 %17, %9
br i1 %11, label %18, label %12
12: ; preds = %7, %10
%13 = phi i64 [ 0, %7 ], [ %17, %10 ]
%14 = getelementptr inbounds double, double* %1, i64 %13
%15 = load double, double* %14
%16 = fcmp oeq double %15, %8
%17 = add nuw nsw i64 %13, 1
br i1 %16, label %18, label %10
18: ; preds = %12, %10, %2
%19 = phi i32 [ 0, %2 ], [ 0, %10 ], [ 1, %12 ]
ret i32 %19
}