#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 */
scalar_t__ isinf(double);
scalar_t__ isnan(double);
int anyNonNormal(double a[], int size) {
  int res = 0;
  int i;
  for (i = 0; i < size; i++) {
    if (isnan(a[i]) || isinf(a[i])) {
      res = 1;
      return res;
    }
  }
  return res;
}


x86 assembly (clang, -O0):
<anyNonNormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a6 <anyNonNormal+0x86>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
jne    1181 <anyNonNormal+0x61>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <isinf@plt>
cmp    $0x0,%rax
je     1193 <anyNonNormal+0x73>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11ac <anyNonNormal+0x8c>
jmp    1198 <anyNonNormal+0x78>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113d <anyNonNormal+0x1d>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<anyNonNormal>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    1169 <anyNonNormal+0x49>
mov    %rdi,%r15
mov    %esi,%r14d
xor    %ebx,%ebx
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
call   1030 <isnan@plt>
test   %rax,%rax
jne    116b <anyNonNormal+0x4b>
movsd  (%r15,%rbx,8),%xmm0
call   1040 <isinf@plt>
test   %rax,%rax
jne    116b <anyNonNormal+0x4b>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <anyNonNormal+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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