#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 scalar_t__ __uint64_t;
typedef int __uint16_t;

/* Variables and functions */
int FP_INFINITE;
int FP_NAN;
int FP_NORMAL;
int FP_SUBNORMAL;
int FP_ZERO;
int __fpclassifyl(long double __x) {
  union {
    long double __ld;
    __uint16_t __hw[5];
    __uint64_t __m;
  } __y = {__x};
  int __ee = __y.__hw[4] & 0x7fff;
  if (!__ee)
    return __y.__m ? FP_SUBNORMAL : FP_ZERO;
  if (__ee == 0x7fff)
    return __y.__m ? FP_NAN : FP_INFINITE;
  return FP_NORMAL;
}


x86 assembly (clang, -O0):
<__fpclassifyl>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fstpt  -0x40(%rbp)
mov    -0x30(%rbp),%eax
and    $0x7fff,%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    1158 <__fpclassifyl+0x58>
cmpq   $0x0,-0x40(%rbp)
je     1141 <__fpclassifyl+0x41>
mov    0x2e89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
jmp    114d <__fpclassifyl+0x4d>
mov    0x2e88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a4 <__fpclassifyl+0xa4>
cmpl   $0x7fff,-0x44(%rbp)
jne    1198 <__fpclassifyl+0x98>
cmpq   $0x0,-0x40(%rbp)
je     1181 <__fpclassifyl+0x81>
mov    0x2e69(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
jmp    118d <__fpclassifyl+0x8d>
mov    0x2e50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a4 <__fpclassifyl+0xa4>
mov    0x2e51(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fpclassifyl>:
cmpq   $0x0,0x8(%rsp)
jne    1112 <__fpclassifyl+0x12>
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2ebf(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%union.anon = type { x86_fp80, [16 x i8] }
@FP_SUBNORMAL = global i32 0
@FP_ZERO = global i32 0
@FP_NAN = global i32 0
@FP_INFINITE = global i32 0
@FP_NORMAL = global i32 0
define i32 @__fpclassifyl(x86_fp80 %0) {
%2 = alloca i32
%3 = alloca x86_fp80
%4 = alloca %union.anon
%5 = alloca i32
store x86_fp80 %0, x86_fp80* %3
%6 = bitcast %union.anon* %4 to x86_fp80*
%7 = load x86_fp80, x86_fp80* %3
store x86_fp80 %7, x86_fp80* %6
%8 = bitcast %union.anon* %4 to [5 x i32]*
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 4
%10 = load i32, i32* %9
%11 = and i32 %10, 32767
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %24, label %14
14: ; preds = %1
%15 = bitcast %union.anon* %4 to i64*
%16 = load i64, i64* %15
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = load i32, i32* @FP_SUBNORMAL
br label %22
20: ; preds = %14
%21 = load i32, i32* @FP_ZERO
br label %22
22: ; preds = %20, %18
%23 = phi i32 [ %19, %18 ], [ %21, %20 ]
store i32 %23, i32* %2
br label %39
24: ; preds = %1
%25 = load i32, i32* %5
%26 = icmp eq i32 %25, 32767
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = bitcast %union.anon* %4 to i64*
%29 = load i64, i64* %28
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = load i32, i32* @FP_NAN
br label %35
33: ; preds = %27
%34 = load i32, i32* @FP_INFINITE
br label %35
35: ; preds = %33, %31
%36 = phi i32 [ %32, %31 ], [ %34, %33 ]
store i32 %36, i32* %2
br label %39
37: ; preds = %24
%38 = load i32, i32* @FP_NORMAL
store i32 %38, i32* %2
br label %39
39: ; preds = %37, %35, %22
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
@FP_SUBNORMAL = global i32 0
@FP_ZERO = global i32 0
@FP_NAN = global i32 0
@FP_INFINITE = global i32 0
@FP_NORMAL = global i32 0
define i32 @__fpclassifyl(x86_fp80 %0) {
%2 = bitcast x86_fp80 %0 to i80
%3 = trunc i80 %2 to i64
%4 = icmp eq i64 %3, 0
%5 = load i32, i32* @FP_ZERO
%6 = load i32, i32* @FP_SUBNORMAL
%7 = select i1 %4, i32 %5, i32 %6
ret i32 %7
}