#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__ isnan(float);
int /*<<< orphan*/ printf(char *, int, int, int);
bool _assertNoNans(float *array, int length, int line) {
  int i;
  for (i = 0; i < length; i++) {
    if (isnan(array[i])) {
      printf("assertNoNans FAILED, line %i, index %i of %i\n", line, i, length);
      return false;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<_assertNoNans>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1195 <_assertNoNans+0x75>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1040 <isnan@plt>
cmp    $0x0,%rax
je     1182 <_assertNoNans+0x62>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    119c <_assertNoNans+0x7c>
jmp    1187 <_assertNoNans+0x67>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1139 <_assertNoNans+0x19>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_assertNoNans>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x1,%r15d
test   %esi,%esi
jle    1172 <_assertNoNans+0x52>
mov    %edx,%r14d
mov    %rdi,%rbp
mov    %esi,%r12d
xor    %ebx,%ebx
nopl   (%rax)
movss  0x0(%rbp,%rbx,4),%xmm0
call   1040 <isnan@plt>
test   %rax,%rax
jne    115b <_assertNoNans+0x3b>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <_assertNoNans+0x20>
jmp    1172 <_assertNoNans+0x52>
lea    0xe9e(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
call   1030 <printf@plt>
xor    %r15d,%r15d
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"assertNoNans FAILED, line %i, index %i of %i\0A\00"
define i32 @_assertNoNans(float* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca float*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store float* %0, float** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %27, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %30
13: ; preds = %9
%14 = load float*, float** %5
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds float, float* %14, i64 %16
%18 = load float, float* %17
%19 = call i64 @isnan(float %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %13
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = load i32, i32* %6
%25 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %23, i32 %24)
store i32 0, i32* %4
br label %31
26: ; preds = %13
br label %27
27: ; preds = %26
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %9
30: ; preds = %9
store i32 1, i32* %4
br label %31
31: ; preds = %30, %21
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
@.str = [46 x i8] c"assertNoNans FAILED, line %i, index %i of %i\0A\00"
define i32 @_assertNoNans(float* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %19
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %16
%8 = phi i64 [ 0, %5 ], [ %17, %16 ]
%9 = getelementptr inbounds float, float* %0, i64 %8
%10 = load float, float* %9
%11 = tail call i64 @isnan(float %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = trunc i64 %8 to i32
%15 = tail call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %14, i32 %1)
br label %19
16: ; preds = %7
%17 = add nuw nsw i64 %8, 1
%18 = icmp eq i64 %17, %6
br i1 %18, label %19, label %7
19: ; preds = %16, %3, %13
%20 = phi i32 [ 0, %13 ], [ 1, %3 ], [ 1, %16 ]
ret i32 %20
}