#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 */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
scalar_t__ isnan_d(double);
scalar_t__ isnan_f(double);
scalar_t__ isnan_ld(double);
int isinf_d(double x) {
  return !(sizeof(x) == sizeof(long double) ? isnan_ld(x)
           : sizeof(x) == sizeof(double)    ? isnan_d(x)
                                            : isnan_f(x)) &&
         (sizeof(x - x) == sizeof(long double) ? isnan_ld(x - x)
          : sizeof(x - x) == sizeof(double)    ? isnan_d(x - x)
                                               : isnan_f(x - x));
}


x86 assembly (clang, -O0):
<isinf_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    114c <isinf_d+0x1c>
jmp    116d <isinf_d+0x3d>
movsd  -0x8(%rbp),%xmm0
call   1050 <isnan_ld@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
jne    11d2 <isinf_d+0xa2>
jmp    11b9 <isinf_d+0x89>
mov    $0x1,%al
test   $0x1,%al
jne    117c <isinf_d+0x4c>
jmp    119d <isinf_d+0x6d>
movsd  -0x8(%rbp),%xmm0
call   1030 <isnan_d@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
jne    11d2 <isinf_d+0xa2>
jmp    11b9 <isinf_d+0x89>
movsd  -0x8(%rbp),%xmm0
call   1040 <isnan_f@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
jne    11d2 <isinf_d+0xa2>
movsd  -0x8(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1030 <isnan_d@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isinf_d>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <isnan_d@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1127 <isinf_d+0x17>
pop    %rcx
ret
movsd  (%rsp),%xmm0
subsd  %xmm0,%xmm0
call   1030 <isnan_d@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @isinf_d(double %0) {
%2 = alloca double
store double %0, double* %2
br i1 false, label %3, label %7
3: ; preds = %1
%4 = load double, double* %2
%5 = call i64 @isnan_ld(double %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %22, label %16
7: ; preds = %1
br i1 true, label %8, label %12
8: ; preds = %7
%9 = load double, double* %2
%10 = call i64 @isnan_d(double %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %22, label %16
12: ; preds = %7
%13 = load double, double* %2
%14 = call i64 @isnan_f(double %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %12, %8, %3
%17 = load double, double* %2
%18 = load double, double* %2
%19 = fsub double %17, %18
%20 = call i64 @isnan_d(double %19)
%21 = icmp ne i64 %20, 0
br label %22
22: ; preds = %16, %12, %8, %3
%23 = phi i1 [ false, %12 ], [ false, %8 ], [ false, %3 ], [ %21, %16 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @isinf_d(double %0) {
%2 = tail call i64 @isnan_d(double %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = fsub double %0, %0
%6 = tail call i64 @isnan_d(double %5)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %4, %1
%10 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %10
}