#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__ e_postformat(double, int *, int /*<<< orphan*/);
scalar_t__ e_preformat(double, int *, int /*<<< orphan*/);
scalar_t__ ft_islower(char);
scalar_t__ ft_putstr(char *);
int mp(char *);
int e_infnan(double n, int fl[8], char *s) {
  int ret;
  ret = 0;
  if (n != n || (n == 1.0 / 0.0) || (n == -1.0 / 0.0)) {
    fl[1] = 0;
    ret += e_preformat(n, fl, 0);
    if (n != n)
      ret += (ft_islower(*(s + mp(s)))) ? ft_putstr("nan") : ft_putstr("NAN");
    else if (n == 1.0 / 0.0 || n == -1.0 / 0.0)
      ret += (ft_islower(*(s + mp(s)))) ? ft_putstr("inf") : ft_putstr("INF");
    ret += e_postformat(n, fl, 0);
  }
  return (ret);
}


x86 assembly (clang, -O0):
<e_infnan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jne    11c1 <e_infnan+0x71>
jp     11c1 <e_infnan+0x71>
movsd  -0x8(%rbp),%xmm0
movsd  0xe71(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11a4 <e_infnan+0x54>
jp     11a4 <e_infnan+0x54>
jmp    11c1 <e_infnan+0x71>
movsd  -0x8(%rbp),%xmm0
movsd  0xe57(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    132a <e_infnan+0x1da>
jp     132a <e_infnan+0x1da>
mov    -0x10(%rbp),%rax
movl   $0x0,0x4(%rax)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1050 <e_preformat@plt>
mov    %rax,%rcx
movslq -0x1c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1c(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jne    1204 <e_infnan+0xb4>
jp     1204 <e_infnan+0xb4>
jmp    1269 <e_infnan+0x119>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <mp@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <ft_islower@plt>
cmp    $0x0,%rax
je     1246 <e_infnan+0xf6>
lea    0xdd8(%rip),%rdi
call   1070 <ft_putstr@plt>
mov    %rax,-0x30(%rbp)
jmp    1256 <e_infnan+0x106>
lea    0xdc7(%rip),%rdi
call   1070 <ft_putstr@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rcx
movslq -0x1c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1c(%rbp)
jmp    130d <e_infnan+0x1bd>
movsd  -0x8(%rbp),%xmm0
movsd  0xd8a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    128b <e_infnan+0x13b>
jp     128b <e_infnan+0x13b>
jmp    12a8 <e_infnan+0x158>
movsd  -0x8(%rbp),%xmm0
movsd  0xd70(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1308 <e_infnan+0x1b8>
jp     1308 <e_infnan+0x1b8>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <mp@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <ft_islower@plt>
cmp    $0x0,%rax
je     12ea <e_infnan+0x19a>
lea    0xd3c(%rip),%rdi
call   1070 <ft_putstr@plt>
mov    %rax,-0x40(%rbp)
jmp    12fa <e_infnan+0x1aa>
lea    0xd2b(%rip),%rdi
call   1070 <ft_putstr@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rcx
movslq -0x1c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1c(%rbp)
jmp    130d <e_infnan+0x1bd>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <e_postformat@plt>
mov    %rax,%rcx
movslq -0x1c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<e_infnan>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
movsd  0xe99(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1183 <e_infnan+0x33>
ucomisd %xmm0,%xmm0
jp     1183 <e_infnan+0x33>
xor    %ebx,%ebx
ucomisd 0xe8b(%rip),%xmm0
jb     120e <e_infnan+0xbe>
movl   $0x0,0x4(%r14)
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <e_preformat@plt>
movsd  0x8(%rsp),%xmm0
mov    %rax,%rbx
ucomisd %xmm0,%xmm0
jp     121a <e_infnan+0xca>
ucomisd 0xe50(%rip),%xmm0
movsd  0xe40(%rip),%xmm1
jae    11c8 <e_infnan+0x78>
ucomisd %xmm0,%xmm1
jb     1202 <e_infnan+0xb2>
mov    %r15,%rdi
call   1060 <mp@plt>
cltq
movsbl (%r15,%rax,1),%edi
call   1040 <ft_islower@plt>
test   %rax,%rax
lea    0xe36(%rip),%rax
lea    0xe2b(%rip),%rdi
cmove  %rax,%rdi
call   1070 <ft_putstr@plt>
movslq %ebx,%rbx
add    %rax,%rbx
movsd  0x8(%rsp),%xmm0
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <e_postformat@plt>
add    %eax,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %r15,%rdi
call   1060 <mp@plt>
cltq
movsbl (%r15,%rax,1),%edi
call   1040 <ft_islower@plt>
test   %rax,%rax
lea    0xddc(%rip),%rax
lea    0xdd1(%rip),%rdi
jmp    11ed <e_infnan+0x9d>

LLVM IR (-O0):
@.str = [4 x i8] c"nan\00"
@.str.1 = [4 x i8] c"NAN\00"
@.str.2 = [4 x i8] c"inf\00"
@.str.3 = [4 x i8] c"INF\00"
define i32 @e_infnan(double %0, i32* %1, i8* %2) {
%4 = alloca double
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
store double %0, double* %4
store i32* %1, i32** %5
store i8* %2, i8** %6
store i32 0, i32* %7
%8 = load double, double* %4
%9 = load double, double* %4
%10 = fcmp une double %8, %9
br i1 %10, label %17, label %11
11: ; preds = %3
%12 = load double, double* %4
%13 = fcmp oeq double %12, 0x7FF0000000000000
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load double, double* %4
%16 = fcmp oeq double %15, 0xFFF0000000000000
br i1 %16, label %17, label %83
17: ; preds = %14, %11, %3
%18 = load i32*, i32** %5
%19 = getelementptr inbounds i32, i32* %18, i64 1
store i32 0, i32* %19
%20 = load double, double* %4
%21 = load i32*, i32** %5
%22 = call i64 @e_preformat(double %20, i32* %21, i32 0)
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = add nsw i64 %24, %22
%26 = trunc i64 %25 to i32
store i32 %26, i32* %7
%27 = load double, double* %4
%28 = load double, double* %4
%29 = fcmp une double %27, %28
br i1 %29, label %30, label %49
30: ; preds = %17
%31 = load i8*, i8** %6
%32 = load i8*, i8** %6
%33 = call i32 @mp(i8* %32)
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %31, i64 %34
%36 = load i8, i8* %35
%37 = call i64 @ft_islower(i8 signext %36)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %30
%40 = call i64 @ft_putstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %43
41: ; preds = %30
%42 = call i64 @ft_putstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
%44 = phi i64 [ %40, %39 ], [ %42, %41 ]
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = add nsw i64 %46, %44
%48 = trunc i64 %47 to i32
store i32 %48, i32* %7
br label %75
49: ; preds = %17
%50 = load double, double* %4
%51 = fcmp oeq double %50, 0x7FF0000000000000
br i1 %51, label %55, label %52
52: ; preds = %49
%53 = load double, double* %4
%54 = fcmp oeq double %53, 0xFFF0000000000000
br i1 %54, label %55, label %74
55: ; preds = %52, %49
%56 = load i8*, i8** %6
%57 = load i8*, i8** %6
%58 = call i32 @mp(i8* %57)
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %56, i64 %59
%61 = load i8, i8* %60
%62 = call i64 @ft_islower(i8 signext %61)
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %55
%65 = call i64 @ft_putstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %68
66: ; preds = %55
%67 = call i64 @ft_putstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %68
68: ; preds = %66, %64
%69 = phi i64 [ %65, %64 ], [ %67, %66 ]
%70 = load i32, i32* %7
%71 = sext i32 %70 to i64
%72 = add nsw i64 %71, %69
%73 = trunc i64 %72 to i32
store i32 %73, i32* %7
br label %74
74: ; preds = %68, %52
br label %75
75: ; preds = %74, %43
%76 = load double, double* %4
%77 = load i32*, i32** %5
%78 = call i64 @e_postformat(double %76, i32* %77, i32 0)
%79 = load i32, i32* %7
%80 = sext i32 %79 to i64
%81 = add nsw i64 %80, %78
%82 = trunc i64 %81 to i32
store i32 %82, i32* %7
br label %83
83: ; preds = %75, %14
%84 = load i32, i32* %7
ret i32 %84
}

LLVM IR (-O2):
@.str = [4 x i8] c"nan\00"
@.str.1 = [4 x i8] c"NAN\00"
@.str.2 = [4 x i8] c"inf\00"
@.str.3 = [4 x i8] c"INF\00"
define i32 @e_infnan(double %0, i32* %1, i8* %2) {
%4 = fcmp uno double %0, 0.000000e+00
%5 = fcmp oeq double %0, 0x7FF0000000000000
%6 = or i1 %4, %5
%7 = fcmp oeq double %0, 0xFFF0000000000000
%8 = or i1 %7, %6
br i1 %8, label %9, label %41
9: ; preds = %3
%10 = getelementptr inbounds i32, i32* %1, i64 1
store i32 0, i32* %10
%11 = tail call i64 @e_preformat(double %0, i32* %1, i32 0)
br i1 %4, label %12, label %20
12: ; preds = %9
%13 = tail call i32 @mp(i8* %2)
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %2, i64 %14
%16 = load i8, i8* %15
%17 = tail call i64 @ft_islower(i8 signext %16)
%18 = icmp eq i64 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
br label %30
20: ; preds = %9
%21 = or i1 %5, %7
br i1 %21, label %22, label %36
22: ; preds = %20
%23 = tail call i32 @mp(i8* %2)
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %2, i64 %24
%26 = load i8, i8* %25
%27 = tail call i64 @ft_islower(i8 signext %26)
%28 = icmp eq i64 %27, 0
%29 = select i1 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
br label %30
30: ; preds = %12, %22
%31 = phi i8* [ %29, %22 ], [ %19, %12 ]
%32 = tail call i64 @ft_putstr(i8* %31)
%33 = shl i64 %11, 32
%34 = ashr exact i64 %33, 32
%35 = add nsw i64 %32, %34
br label %36
36: ; preds = %30, %20
%37 = phi i64 [ %11, %20 ], [ %35, %30 ]
%38 = tail call i64 @e_postformat(double %0, i32* %1, i32 0)
%39 = add i64 %38, %37
%40 = trunc i64 %39 to i32
br label %41
41: ; preds = %3, %36
%42 = phi i32 [ %40, %36 ], [ 0, %3 ]
ret i32 %42
}