#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 */
int /*<<< orphan*/ FP_ILOGB0;
int /*<<< orphan*/ FP_ILOGBNAN;
int /*<<< orphan*/ INT_MAX;
int /*<<< orphan*/ INT_MIN;
int /*<<< orphan*/ puts(char *);
int main(void) {
  int result = 0;
  if (FP_ILOGB0 != INT_MIN && FP_ILOGB0 != -INT_MAX) {
    puts("FP_ILOGB0 has no valid value");
    result = 1;
  } else
    puts("FP_ILOGB0 value is OK");
  if (FP_ILOGBNAN != INT_MIN && FP_ILOGBNAN != INT_MAX) {
    puts("FP_ILOBNAN has no valid value");
    result = 1;
  } else
    puts("FP_ILOGBNAN value is OK");
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%eax
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%eax
je     1172 <main+0x62>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
xor    %ecx,%ecx
mov    0x2e98(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
je     1172 <main+0x62>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
jmp    117e <main+0x6e>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%eax
mov    0x2e52(%rip),%rcx
cmp    (%rcx),%eax
je     11c6 <main+0xb6>
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
mov    0x2e42(%rip),%rcx
cmp    (%rcx),%eax
je     11c6 <main+0xb6>
lea    0xe7e(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
jmp    11d2 <main+0xc2>
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    0x2eb6(%rip),%rax
mov    (%rax),%eax
mov    0x2ebd(%rip),%rbx
cmp    (%rbx),%eax
je     1132 <main+0x22>
mov    0x2eba(%rip),%rcx
add    (%rcx),%eax
jne    113d <main+0x2d>
xor    %ebp,%ebp
lea    0xee2(%rip),%rdi
jmp    1149 <main+0x39>
mov    $0x1,%ebp
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%eax
cmp    (%rbx),%eax
sete   %cl
mov    0x2e85(%rip),%rdx
cmp    (%rdx),%eax
sete   %al
or     %cl,%al
lea    0xee0(%rip),%rax
lea    0xebb(%rip),%rdi
cmovne %rax,%rdi
mov    $0x1,%ebx
cmovne %ebp,%ebx
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@FP_ILOGB0 = global i32 0
@INT_MIN = global i32 0
@INT_MAX = global i32 0
@.str = [29 x i8] c"FP_ILOGB0 has no valid value\00"
@.str.1 = [22 x i8] c"FP_ILOGB0 value is OK\00"
@FP_ILOGBNAN = global i32 0
@.str.2 = [30 x i8] c"FP_ILOBNAN has no valid value\00"
@.str.3 = [24 x i8] c"FP_ILOGBNAN value is OK\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = load i32, i32* @FP_ILOGB0
%4 = load i32, i32* @INT_MIN
%5 = icmp ne i32 %3, %4
br i1 %5, label %6, label %13
6: ; preds = %0
%7 = load i32, i32* @FP_ILOGB0
%8 = load i32, i32* @INT_MAX
%9 = sub nsw i32 0, %8
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %15
13: ; preds = %6, %0
%14 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
%16 = load i32, i32* @FP_ILOGBNAN
%17 = load i32, i32* @INT_MIN
%18 = icmp ne i32 %16, %17
br i1 %18, label %19, label %25
19: ; preds = %15
%20 = load i32, i32* @FP_ILOGBNAN
%21 = load i32, i32* @INT_MAX
%22 = icmp ne i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %27
25: ; preds = %19, %15
%26 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
@FP_ILOGB0 = global i32 0
@INT_MIN = global i32 0
@INT_MAX = global i32 0
@.str = [29 x i8] c"FP_ILOGB0 has no valid value\00"
@.str.1 = [22 x i8] c"FP_ILOGB0 value is OK\00"
@FP_ILOGBNAN = global i32 0
@.str.2 = [30 x i8] c"FP_ILOBNAN has no valid value\00"
@.str.3 = [24 x i8] c"FP_ILOGBNAN value is OK\00"
define i32 @main() {
%1 = load i32, i32* @FP_ILOGB0
%2 = load i32, i32* @INT_MIN
%3 = icmp eq i32 %1, %2
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = load i32, i32* @INT_MAX
%6 = sub nsw i32 0, %5
%7 = icmp eq i32 %1, %6
br i1 %7, label %8, label %9
8: ; preds = %4, %0
br label %9
9: ; preds = %4, %8
%10 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), %8 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), %4 ]
%11 = phi i32 [ 0, %8 ], [ 1, %4 ]
%12 = tail call i32 @puts(i8* dereferenceable(1) %10)
%13 = load i32, i32* @FP_ILOGBNAN
%14 = load i32, i32* @INT_MIN
%15 = icmp eq i32 %13, %14
%16 = load i32, i32* @INT_MAX
%17 = icmp eq i32 %13, %16
%18 = select i1 %15, i1 true, i1 %17
%19 = select i1 %18, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0)
%20 = select i1 %18, i32 %11, i32 1
%21 = tail call i32 @puts(i8* dereferenceable(1) %19)
ret i32 %20
}