#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*/ Show(double **, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ print(char *, int);
int CheckNaN(double **u, int is, int ie, int id) {
  int ii, nv, i, j;
  for (ii = is; ii <= ie; ii++) {
    for (nv = 0; nv < ((2 + (5 == 1 ? 2 : 1)) + (0 + 0 + 0)); nv++) {
      if (u[ii][nv] != u[ii][nv]) {
        print(" > NaN found (%d), |", id);
        Show(u, ii);
        exit(1);
        ;
      }
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<CheckNaN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11ee <CheckNaN+0xbe>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11db <CheckNaN+0xab>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jne    11a3 <CheckNaN+0x73>
jp     11a3 <CheckNaN+0x73>
jmp    11c8 <CheckNaN+0x98>
mov    -0x14(%rbp),%esi
lea    0xe53(%rip),%rdi
call   1040 <print@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <Show@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    11cd <CheckNaN+0x9d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115e <CheckNaN+0x2e>
jmp    11e0 <CheckNaN+0xb0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114b <CheckNaN+0x1b>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckNaN>:
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jg     117e <CheckNaN+0x4e>
mov    %esi,%ebx
mov    %rdi,%r14
movslq %esi,%rax
add    $0x1,%edx
lea    (%rdi,%rax,8),%rax
nopw   0x0(%rax,%rax,1)
mov    (%rax),%rsi
movsd  (%rsi),%xmm0
ucomisd %xmm0,%xmm0
jp     1188 <CheckNaN+0x58>
movsd  0x8(%rsi),%xmm0
ucomisd %xmm0,%xmm0
jp     1188 <CheckNaN+0x58>
movsd  0x10(%rsi),%xmm0
ucomisd %xmm0,%xmm0
jp     1188 <CheckNaN+0x58>
add    $0x1,%ebx
add    $0x8,%rax
cmp    %ebx,%edx
jne    1150 <CheckNaN+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe71(%rip),%rdi
mov    %ecx,%esi
call   1040 <print@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <Show@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c" > NaN found (%d), |\00"
define i32 @CheckNaN(double** %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca double**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store double** %0, double*** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%13 = load i32, i32* %6
store i32 %13, i32* %9
br label %14
14: ; preds = %54, %4
%15 = load i32, i32* %9
%16 = load i32, i32* %7
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %57
18: ; preds = %14
store i32 0, i32* %10
br label %19
19: ; preds = %50, %18
%20 = load i32, i32* %10
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %53
22: ; preds = %19
%23 = load double**, double*** %5
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double*, double** %23, i64 %25
%27 = load double*, double** %26
%28 = load i32, i32* %10
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load double, double* %30
%32 = load double**, double*** %5
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double*, double** %32, i64 %34
%36 = load double*, double** %35
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = fcmp une double %31, %40
br i1 %41, label %42, label %49
42: ; preds = %22
%43 = load i32, i32* %8
%44 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %43)
%45 = load double**, double*** %5
%46 = load i32, i32* %9
%47 = call i32 @Show(double** %45, i32 %46)
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %22
br label %50
50: ; preds = %49
%51 = load i32, i32* %10
%52 = add nsw i32 %51, 1
store i32 %52, i32* %10
br label %19
53: ; preds = %19
br label %54
54: ; preds = %53
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %14
57: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c" > NaN found (%d), |\00"
define i32 @CheckNaN(double** %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %1, %2
br i1 %5, label %32, label %6
6: ; preds = %4
%7 = sext i32 %1 to i64
%8 = add i32 %2, 1
br label %9
9: ; preds = %6, %23
%10 = phi i64 [ %7, %6 ], [ %24, %23 ]
%11 = getelementptr inbounds double*, double** %0, i64 %10
%12 = load double*, double** %11
%13 = load double, double* %12
%14 = fcmp uno double %13, 0.000000e+00
br i1 %14, label %27, label %15
15: ; preds = %9
%16 = getelementptr inbounds double, double* %12, i64 1
%17 = load double, double* %16
%18 = fcmp uno double %17, 0.000000e+00
br i1 %18, label %27, label %19
19: ; preds = %15
%20 = getelementptr inbounds double, double* %12, i64 2
%21 = load double, double* %20
%22 = fcmp uno double %21, 0.000000e+00
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = add nsw i64 %10, 1
%25 = trunc i64 %24 to i32
%26 = icmp eq i32 %8, %25
br i1 %26, label %32, label %9
27: ; preds = %19, %15, %9
%28 = trunc i64 %10 to i32
%29 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %3)
%30 = tail call i32 @Show(double** %0, i32 %28)
%31 = tail call i32 @exit(i32 1)
unreachable
32: ; preds = %23, %4
ret i32 0
}