#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 unsigned long uint64_t;
typedef int uint32_t;

/* Variables and functions */
double FLT_MIN;
scalar_t__ isinf(double);
scalar_t__ isnan(double);
scalar_t__ isnormal(double);
scalar_t__ signbit(double);
uint32_t __hsail_class_f64(double a, uint32_t flags) {
  return (flags & 0x0001 && isnan(a) && !(*(uint64_t *)&a & (1ul << 51))) ||
         (flags & 0x0002 && isnan(a) && (*(uint64_t *)&a & (1ul << 51))) ||
         (flags & 0x0004 && isinf(a) && a < 0.0f) ||
         (flags & 0x0008 && isnormal(a) && signbit(a)) ||
         (flags & 0x0010 && a < 0.0f && a > -FLT_MIN) ||
         (flags & 0x0020 && a == 0.0f && signbit(a)) ||
         (flags & 0x0040 && a == 0.0f && !signbit(a)) ||
         (flags & 0x0080 && a > 0.0f && a < FLT_MIN) ||
         (flags & 0x0100 && isnormal(a) && !signbit(a)) ||
         (flags & 0x0200 && isinf(a) && a >= 0.0f);
}


x86 assembly (clang, -O0):
<__hsail_class_f64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1190 <__hsail_class_f64+0x50>
movsd  -0x8(%rbp),%xmm0
call   1040 <isnan@plt>
cmp    $0x0,%rax
je     1190 <__hsail_class_f64+0x50>
movabs $0x8000000000000,%rcx
and    -0x8(%rbp),%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xd(%rbp)
je     13ec <__hsail_class_f64+0x2ac>
mov    -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11d0 <__hsail_class_f64+0x90>
movsd  -0x8(%rbp),%xmm0
call   1040 <isnan@plt>
cmp    $0x0,%rax
je     11d0 <__hsail_class_f64+0x90>
movabs $0x8000000000000,%rcx
and    -0x8(%rbp),%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xd(%rbp)
jne    13ec <__hsail_class_f64+0x2ac>
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1206 <__hsail_class_f64+0xc6>
movsd  -0x8(%rbp),%xmm0
call   1060 <isinf@plt>
cmp    $0x0,%rax
je     1206 <__hsail_class_f64+0xc6>
mov    $0x1,%al
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
mov    %al,-0xd(%rbp)
ja     13ec <__hsail_class_f64+0x2ac>
mov    -0xc(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1245 <__hsail_class_f64+0x105>
movsd  -0x8(%rbp),%xmm0
call   1030 <isnormal@plt>
cmp    $0x0,%rax
je     1245 <__hsail_class_f64+0x105>
movsd  -0x8(%rbp),%xmm0
call   1050 <signbit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xd(%rbp)
jne    13ec <__hsail_class_f64+0x2ac>
mov    -0xc(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1298 <__hsail_class_f64+0x158>
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1298 <__hsail_class_f64+0x158>
movsd  -0x8(%rbp),%xmm0
mov    0x2d7a(%rip),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0xd(%rbp)
ja     13ec <__hsail_class_f64+0x2ac>
mov    -0xc(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     12db <__hsail_class_f64+0x19b>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12db <__hsail_class_f64+0x19b>
jp     12db <__hsail_class_f64+0x19b>
movsd  -0x8(%rbp),%xmm0
call   1050 <signbit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xd(%rbp)
jne    13ec <__hsail_class_f64+0x2ac>
mov    -0xc(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     131e <__hsail_class_f64+0x1de>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    131e <__hsail_class_f64+0x1de>
jp     131e <__hsail_class_f64+0x1de>
movsd  -0x8(%rbp),%xmm0
call   1050 <signbit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xd(%rbp)
je     13ec <__hsail_class_f64+0x2ac>
mov    -0xc(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1360 <__hsail_class_f64+0x220>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1360 <__hsail_class_f64+0x220>
movsd  -0x8(%rbp),%xmm1
mov    0x2c9b(%rip),%rax
movsd  (%rax),%xmm0
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0xd(%rbp)
ja     13ec <__hsail_class_f64+0x2ac>
mov    -0xc(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     13a1 <__hsail_class_f64+0x261>
movsd  -0x8(%rbp),%xmm0
call   1030 <isnormal@plt>
cmp    $0x0,%rax
je     13a1 <__hsail_class_f64+0x261>
movsd  -0x8(%rbp),%xmm0
call   1050 <signbit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xd(%rbp)
je     13ec <__hsail_class_f64+0x2ac>
mov    -0xc(%rbp),%ecx
and    $0x200,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xe(%rbp)
je     13e6 <__hsail_class_f64+0x2a6>
movsd  -0x8(%rbp),%xmm0
call   1060 <isinf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xe(%rbp)
je     13e6 <__hsail_class_f64+0x2a6>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hsail_class_f64>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
test   $0x1,%bl
movq   %xmm0,(%rsp)
je     1173 <__hsail_class_f64+0x33>
call   1040 <isnan@plt>
movq   (%rsp),%xmm0
test   %rax,%rax
je     1173 <__hsail_class_f64+0x33>
movq   %xmm0,%rax
mov    $0x1,%ebp
bt     $0x33,%rax
jae    12e8 <__hsail_class_f64+0x1a8>
test   $0x2,%bl
je     119c <__hsail_class_f64+0x5c>
call   1040 <isnan@plt>
movq   (%rsp),%xmm0
test   %rax,%rax
je     119c <__hsail_class_f64+0x5c>
movq   %xmm0,%rax
mov    $0x1,%ebp
bt     $0x33,%rax
jb     12e8 <__hsail_class_f64+0x1a8>
test   $0x4,%bl
je     11c3 <__hsail_class_f64+0x83>
call   1060 <isinf@plt>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    11c3 <__hsail_class_f64+0x83>
mov    $0x1,%ebp
test   %rax,%rax
jne    12e8 <__hsail_class_f64+0x1a8>
test   $0x8,%bl
je     11ef <__hsail_class_f64+0xaf>
call   1030 <isnormal@plt>
movq   (%rsp),%xmm0
test   %rax,%rax
je     11ef <__hsail_class_f64+0xaf>
call   1050 <signbit@plt>
movq   (%rsp),%xmm0
mov    $0x1,%ebp
test   %rax,%rax
jne    12e8 <__hsail_class_f64+0x1a8>
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
jbe    1222 <__hsail_class_f64+0xe2>
mov    %ebx,%eax
and    $0x10,%eax
je     1222 <__hsail_class_f64+0xe2>
mov    0x2de1(%rip),%rax
movsd  (%rax),%xmm1
xorpd  0xded(%rip),%xmm1
mov    $0x1,%ebp
ucomisd %xmm1,%xmm0
ja     12e8 <__hsail_class_f64+0x1a8>
ucomisd %xmm2,%xmm0
jne    1249 <__hsail_class_f64+0x109>
jp     1249 <__hsail_class_f64+0x109>
mov    %ebx,%eax
and    $0x20,%eax
je     1249 <__hsail_class_f64+0x109>
call   1050 <signbit@plt>
movsd  (%rsp),%xmm0
mov    $0x1,%ebp
test   %rax,%rax
jne    12e8 <__hsail_class_f64+0x1a8>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    126f <__hsail_class_f64+0x12f>
jp     126f <__hsail_class_f64+0x12f>
mov    %ebx,%eax
and    $0x40,%eax
je     126f <__hsail_class_f64+0x12f>
call   1050 <signbit@plt>
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm0
test   %rax,%rax
je     12e3 <__hsail_class_f64+0x1a3>
ucomisd %xmm1,%xmm0
mov    $0x1,%ebp
jbe    1294 <__hsail_class_f64+0x154>
mov    %ebx,%eax
and    $0x80,%eax
je     1294 <__hsail_class_f64+0x154>
mov    0x2d5e(%rip),%rax
movsd  (%rax),%xmm1
ucomisd %xmm0,%xmm1
ja     12e8 <__hsail_class_f64+0x1a8>
test   $0x100,%ebx
je     12ba <__hsail_class_f64+0x17a>
call   1030 <isnormal@plt>
movsd  (%rsp),%xmm0
test   %rax,%rax
je     12ba <__hsail_class_f64+0x17a>
call   1050 <signbit@plt>
movsd  (%rsp),%xmm0
test   %rax,%rax
je     12e8 <__hsail_class_f64+0x1a8>
xor    %ebp,%ebp
test   $0x200,%ebx
je     12e8 <__hsail_class_f64+0x1a8>
call   1060 <isinf@plt>
movsd  (%rsp),%xmm1
test   %rax,%rax
je     12e8 <__hsail_class_f64+0x1a8>
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
ucomisd %xmm0,%xmm1
setae  %bpl
jmp    12e8 <__hsail_class_f64+0x1a8>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@FLT_MIN = global double 0.000000e+00
define i32 @__hsail_class_f64(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 1
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = load double, double* %3
%10 = call i64 @isnan(double %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = bitcast double* %3 to i64*
%14 = load i64, i64* %13
%15 = and i64 %14, 2251799813685248
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %123
17: ; preds = %12, %8, %2
%18 = load i32, i32* %4
%19 = and i32 %18, 2
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %17
%22 = load double, double* %3
%23 = call i64 @isnan(double %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = bitcast double* %3 to i64*
%27 = load i64, i64* %26
%28 = and i64 %27, 2251799813685248
%29 = icmp ne i64 %28, 0
br i1 %29, label %123, label %30
30: ; preds = %25, %21, %17
%31 = load i32, i32* %4
%32 = and i32 %31, 4
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %41
34: ; preds = %30
%35 = load double, double* %3
%36 = call i64 @isinf(double %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load double, double* %3
%40 = fcmp olt double %39, 0.000000e+00
br i1 %40, label %123, label %41
41: ; preds = %38, %34, %30
%42 = load i32, i32* %4
%43 = and i32 %42, 8
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %53
45: ; preds = %41
%46 = load double, double* %3
%47 = call i64 @isnormal(double %46)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %53
49: ; preds = %45
%50 = load double, double* %3
%51 = call i64 @signbit(double %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %123, label %53
53: ; preds = %49, %45, %41
%54 = load i32, i32* %4
%55 = and i32 %54, 16
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %65
57: ; preds = %53
%58 = load double, double* %3
%59 = fcmp olt double %58, 0.000000e+00
br i1 %59, label %60, label %65
60: ; preds = %57
%61 = load double, double* %3
%62 = load double, double* @FLT_MIN
%63 = fneg double %62
%64 = fcmp ogt double %61, %63
br i1 %64, label %123, label %65
65: ; preds = %60, %57, %53
%66 = load i32, i32* %4
%67 = and i32 %66, 32
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %76
69: ; preds = %65
%70 = load double, double* %3
%71 = fcmp oeq double %70, 0.000000e+00
br i1 %71, label %72, label %76
72: ; preds = %69
%73 = load double, double* %3
%74 = call i64 @signbit(double %73)
%75 = icmp ne i64 %74, 0
br i1 %75, label %123, label %76
76: ; preds = %72, %69, %65
%77 = load i32, i32* %4
%78 = and i32 %77, 64
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %87
80: ; preds = %76
%81 = load double, double* %3
%82 = fcmp oeq double %81, 0.000000e+00
br i1 %82, label %83, label %87
83: ; preds = %80
%84 = load double, double* %3
%85 = call i64 @signbit(double %84)
%86 = icmp ne i64 %85, 0
br i1 %86, label %87, label %123
87: ; preds = %83, %80, %76
%88 = load i32, i32* %4
%89 = and i32 %88, 128
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %98
91: ; preds = %87
%92 = load double, double* %3
%93 = fcmp ogt double %92, 0.000000e+00
br i1 %93, label %94, label %98
94: ; preds = %91
%95 = load double, double* %3
%96 = load double, double* @FLT_MIN
%97 = fcmp olt double %95, %96
br i1 %97, label %123, label %98
98: ; preds = %94, %91, %87
%99 = load i32, i32* %4
%100 = and i32 %99, 256
%101 = icmp ne i32 %100, 0
br i1 %101, label %102, label %110
102: ; preds = %98
%103 = load double, double* %3
%104 = call i64 @isnormal(double %103)
%105 = icmp ne i64 %104, 0
br i1 %105, label %106, label %110
106: ; preds = %102
%107 = load double, double* %3
%108 = call i64 @signbit(double %107)
%109 = icmp ne i64 %108, 0
br i1 %109, label %110, label %123
110: ; preds = %106, %102, %98
%111 = load i32, i32* %4
%112 = and i32 %111, 512
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %121
114: ; preds = %110
%115 = load double, double* %3
%116 = call i64 @isinf(double %115)
%117 = icmp ne i64 %116, 0
br i1 %117, label %118, label %121
118: ; preds = %114
%119 = load double, double* %3
%120 = fcmp oge double %119, 0.000000e+00
br label %121
121: ; preds = %118, %114, %110
%122 = phi i1 [ false, %114 ], [ false, %110 ], [ %120, %118 ]
br label %123
123: ; preds = %121, %106, %94, %83, %72, %60, %49, %38, %25, %12
%124 = phi i1 [ true, %106 ], [ true, %94 ], [ true, %83 ], [ true, %72 ], [ true, %60 ], [ true, %49 ], [ true, %38 ], [ true, %25 ], [ true, %12 ], [ %122, %121 ]
%125 = zext i1 %124 to i32
ret i32 %125
}

LLVM IR (-O2):
@FLT_MIN = global double 0.000000e+00
define i32 @__hsail_class_f64(double %0, i32 %1) {
%3 = and i32 %1, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = tail call i64 @isnan(double %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = bitcast double %0 to i64
%10 = and i64 %9, 2251799813685248
%11 = icmp eq i64 %10, 0
br i1 %11, label %89, label %12
12: ; preds = %8, %5, %2
%13 = and i32 %1, 2
%14 = icmp eq i32 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %12
%16 = tail call i64 @isnan(double %0)
%17 = icmp eq i64 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = bitcast double %0 to i64
%20 = and i64 %19, 2251799813685248
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %89
22: ; preds = %18, %15, %12
%23 = and i32 %1, 4
%24 = icmp eq i32 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %22
%26 = tail call i64 @isinf(double %0)
%27 = icmp ne i64 %26, 0
%28 = fcmp olt double %0, 0.000000e+00
%29 = and i1 %28, %27
br i1 %29, label %89, label %30
30: ; preds = %25, %22
%31 = and i32 %1, 8
%32 = icmp eq i32 %31, 0
br i1 %32, label %39, label %33
33: ; preds = %30
%34 = tail call i64 @isnormal(double %0)
%35 = icmp eq i64 %34, 0
br i1 %35, label %39, label %36
36: ; preds = %33
%37 = tail call i64 @signbit(double %0)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %89
39: ; preds = %36, %33, %30
%40 = and i32 %1, 16
%41 = icmp ne i32 %40, 0
%42 = fcmp olt double %0, 0.000000e+00
%43 = and i1 %42, %41
br i1 %43, label %44, label %48
44: ; preds = %39
%45 = load double, double* @FLT_MIN
%46 = fneg double %45
%47 = fcmp olt double %46, %0
br i1 %47, label %89, label %48
48: ; preds = %44, %39
%49 = and i32 %1, 32
%50 = icmp ne i32 %49, 0
%51 = fcmp oeq double %0, 0.000000e+00
%52 = and i1 %51, %50
br i1 %52, label %53, label %56
53: ; preds = %48
%54 = tail call i64 @signbit(double %0)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %89
56: ; preds = %53, %48
%57 = and i32 %1, 64
%58 = icmp ne i32 %57, 0
%59 = and i1 %51, %58
br i1 %59, label %60, label %63
60: ; preds = %56
%61 = tail call i64 @signbit(double %0)
%62 = icmp eq i64 %61, 0
br i1 %62, label %89, label %63
63: ; preds = %60, %56
%64 = and i32 %1, 128
%65 = icmp ne i32 %64, 0
%66 = fcmp ogt double %0, 0.000000e+00
%67 = and i1 %66, %65
%68 = load double, double* @FLT_MIN
%69 = fcmp ogt double %68, %0
%70 = select i1 %67, i1 %69, i1 false
br i1 %70, label %89, label %71
71: ; preds = %63
%72 = and i32 %1, 256
%73 = icmp eq i32 %72, 0
br i1 %73, label %80, label %74
74: ; preds = %71
%75 = tail call i64 @isnormal(double %0)
%76 = icmp eq i64 %75, 0
br i1 %76, label %80, label %77
77: ; preds = %74
%78 = tail call i64 @signbit(double %0)
%79 = icmp eq i64 %78, 0
br i1 %79, label %89, label %80
80: ; preds = %77, %74, %71
%81 = and i32 %1, 512
%82 = icmp eq i32 %81, 0
br i1 %82, label %89, label %83
83: ; preds = %80
%84 = tail call i64 @isinf(double %0)
%85 = icmp eq i64 %84, 0
br i1 %85, label %89, label %86
86: ; preds = %83
%87 = fcmp oge double %0, 0.000000e+00
%88 = zext i1 %87 to i32
br label %89
89: ; preds = %63, %80, %83, %86, %25, %77, %60, %53, %44, %36, %18, %8
%90 = phi i32 [ 1, %77 ], [ 1, %60 ], [ 1, %53 ], [ 1, %44 ], [ 1, %36 ], [ 1, %18 ], [ 1, %8 ], [ 1, %25 ], [ 0, %83 ], [ 0, %80 ], [ %88, %86 ], [ 1, %63 ]
ret i32 %90
}