#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__ any_NaN(double *, int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ write_data_double(char *, int, int, double *);
void print_debug_NaN(double *A, int n, int L, char *name) {
  printf("%s\n", name);
  write_data_double(name, n, L, A);
  if (any_NaN(A, n, L))
    exit(1);
}


x86 assembly (clang, -O0):
<print_debug_NaN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rcx
call   1040 <write_data_double@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1060 <any_NaN@plt>
cmp    $0x0,%rax
je     119c <print_debug_NaN+0x5c>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_debug_NaN>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%rbp
lea    0xea6(%rip),%rdi
mov    %rcx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %rbp,%rcx
call   1040 <write_data_double@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
call   1060 <any_NaN@plt>
test   %rax,%rax
jne    1191 <print_debug_NaN+0x51>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @print_debug_NaN(double* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store double* %0, double** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i8*, i8** %8
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %8
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load double*, double** %5
%15 = call i32 @write_data_double(i8* %11, i32 %12, i32 %13, double* %14)
%16 = load double*, double** %5
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = call i64 @any_NaN(double* %16, i32 %17, i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %4
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @print_debug_NaN(double* %0, i32 %1, i32 %2, i8* %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = tail call i32 @write_data_double(i8* %3, i32 %1, i32 %2, double* %0)
%7 = tail call i64 @any_NaN(double* %0, i32 %1, i32 %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %4
ret void
}