#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*/ buf;

/* Variables and functions */
int DBL_MANT_DIG;
int DBL_MAX_EXP;
int DBL_MIN_EXP;
int FLT_MANT_DIG;
int FLT_MAX_EXP;
int FLT_MIN_EXP;
int FP_ILOGB0;
int FP_ILOGBNAN;
long double INFINITY;
int INT_MAX;
int LDBL_MANT_DIG;
int LDBL_MAX_EXP;
int LDBL_MIN_EXP;
long double NAN;
int /*<<< orphan*/ assert(int);
int ilogb(double);
int ilogbf(float);
int ilogbl(long double);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
double strtod(char *, char **);
float strtof(char *, char **);
long double strtold(char *, char **);
int main(void) {
  char buf[128], *end;
  double d;
  float f;
  long double ld;
  int e, i;
  printf("1..3\n");
  assert(ilogb(0) == FP_ILOGB0);
  assert(ilogb(NAN) == FP_ILOGBNAN);
  assert(ilogb(INFINITY) == INT_MAX);
  for (e = DBL_MIN_EXP - DBL_MANT_DIG; e < DBL_MAX_EXP; e++) {
    snprintf(buf, sizeof(buf), "0x1.p%d", e);
    d = strtod(buf, &end);
    assert(*end == '\0');
    i = ilogb(d);
    assert(i == e);
  }
  printf("ok 1 - ilogb\n");
  assert(ilogbf(0) == FP_ILOGB0);
  assert(ilogbf(NAN) == FP_ILOGBNAN);
  assert(ilogbf(INFINITY) == INT_MAX);
  for (e = FLT_MIN_EXP - FLT_MANT_DIG; e < FLT_MAX_EXP; e++) {
    snprintf(buf, sizeof(buf), "0x1.p%d", e);
    f = strtof(buf, &end);
    assert(*end == '\0');
    i = ilogbf(f);
    assert(i == e);
  }
  printf("ok 2 - ilogbf\n");
  assert(ilogbl(0) == FP_ILOGB0);
  assert(ilogbl(NAN) == FP_ILOGBNAN);
  assert(ilogbl(INFINITY) == INT_MAX);
  for (e = LDBL_MIN_EXP - LDBL_MANT_DIG; e < LDBL_MAX_EXP; e++) {
    snprintf(buf, sizeof(buf), "0x1.p%d", e);
    ld = strtold(buf, &end);
    assert(*end == '\0');
    i = ilogbl(ld);
    assert(i == e);
  }
  printf("ok 3 - ilogbl\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe57(%rip),%rdi
call   1060 <printf@plt>
xorps  %xmm0,%xmm0
call   1090 <ilogb@plt>
mov    0x2de3(%rip),%rcx
mov    (%rcx),%ecx
sub    %ecx,%eax
sete   %al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    0x2e25(%rip),%rax
fldt   (%rax)
fstpl  -0xd0(%rbp)
movsd  -0xd0(%rbp),%xmm0
ff
call   1090 <ilogb@plt>
mov    0x2da9(%rip),%rcx
mov    (%rcx),%ecx
sub    %ecx,%eax
sete   %al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    0x2ddb(%rip),%rax
fldt   (%rax)
fstpl  -0xd8(%rbp)
movsd  -0xd8(%rbp),%xmm0
ff
call   1090 <ilogb@plt>
mov    0x2d9f(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%eax
mov    0x2d88(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0xc4(%rbp)
mov    -0xc4(%rbp),%eax
mov    0x2d7b(%rip),%rcx
cmp    (%rcx),%eax
jge    12f0 <main+0x160>
lea    -0x90(%rbp),%rdi
mov    -0xc4(%rbp),%ecx
mov    $0x80,%esi
lea    0xd90(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0x90(%rbp),%rdi
lea    -0x98(%rbp),%rsi
call   1050 <strtod@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x98(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
movsd  -0xa0(%rbp),%xmm0
ff
call   1090 <ilogb@plt>
mov    %eax,-0xc8(%rbp)
mov    -0xc8(%rbp),%eax
cmp    -0xc4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    1248 <main+0xb8>
lea    0xd17(%rip),%rdi
call   1060 <printf@plt>
xorps  %xmm0,%xmm0
call   1040 <ilogbf@plt>
mov    0x2c95(%rip),%rcx
mov    (%rcx),%ecx
sub    %ecx,%eax
sete   %al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    0x2cd7(%rip),%rax
fldt   (%rax)
fstps  -0xdc(%rbp)
movss  -0xdc(%rbp),%xmm0
ff
call   1040 <ilogbf@plt>
mov    0x2c5b(%rip),%rcx
mov    (%rcx),%ecx
sub    %ecx,%eax
sete   %al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    0x2c8d(%rip),%rax
fldt   (%rax)
fstps  -0xe0(%rbp)
movss  -0xe0(%rbp),%xmm0
ff
call   1040 <ilogbf@plt>
mov    0x2c51(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    0x2c2b(%rip),%rax
mov    (%rax),%eax
mov    0x2bfa(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0xc4(%rbp)
mov    -0xc4(%rbp),%eax
mov    0x2c15(%rip),%rcx
cmp    (%rcx),%eax
jge    143e <main+0x2ae>
lea    -0x90(%rbp),%rdi
mov    -0xc4(%rbp),%ecx
mov    $0x80,%esi
lea    0xc42(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0x90(%rbp),%rdi
lea    -0x98(%rbp),%rsi
call   1080 <strtof@plt>
movss  %xmm0,-0xa4(%rbp)
ff
mov    -0x98(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
movss  -0xa4(%rbp),%xmm0
ff
call   1040 <ilogbf@plt>
mov    %eax,-0xc8(%rbp)
mov    -0xc8(%rbp),%eax
cmp    -0xc4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    1396 <main+0x206>
lea    0xbd7(%rip),%rdi
call   1060 <printf@plt>
mov    %rsp,%rax
fldz
fstpt  (%rax)
call   1030 <ilogbl@plt>
mov    0x2b43(%rip),%rcx
mov    (%rcx),%ecx
sub    %ecx,%eax
sete   %al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    0x2b85(%rip),%rax
fldt   (%rax)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <ilogbl@plt>
mov    0x2b12(%rip),%rcx
mov    (%rcx),%ecx
sub    %ecx,%eax
sete   %al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    0x2b44(%rip),%rax
fldt   (%rax)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <ilogbl@plt>
mov    0x2b11(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    0x2abb(%rip),%rax
mov    (%rax),%eax
mov    0x2aaa(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0xc4(%rbp)
mov    -0xc4(%rbp),%eax
mov    0x2aad(%rip),%rcx
cmp    (%rcx),%eax
jge    1582 <main+0x3f2>
mov    -0xc4(%rbp),%ecx
lea    0xb0e(%rip),%rdx
lea    -0x90(%rbp),%rdi
mov    %rdi,-0xe8(%rbp)
mov    $0x80,%esi
call   1070 <snprintf@plt>
mov    -0xe8(%rbp),%rdi
lea    -0x98(%rbp),%rsi
call   10b0 <strtold@plt>
fstpt  -0xc0(%rbp)
mov    -0x98(%rbp),%rax
mov    (%rax),%al
test   %al,%al
sete   %al
movzbl %al,%edi
call   10a0 <assert@plt>
fldt   -0xc0(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <ilogbl@plt>
mov    %eax,-0xc8(%rbp)
mov    -0xc8(%rbp),%eax
cmp    -0xc4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    14d6 <main+0x346>
lea    0xaa2(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
lea    0xe60(%rip),%rdi
call   1050 <puts@plt>
xorps  %xmm0,%xmm0
call   1090 <ilogb@plt>
mov    0x2de4(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%eax
sete   %dil
call   10a0 <assert@plt>
mov    0x2e28(%rip),%rax
fldt   (%rax)
fstpl  0x38(%rsp)
movsd  0x38(%rsp),%xmm0
call   1090 <ilogb@plt>
mov    0x2db0(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%eax
sete   %dil
call   10a0 <assert@plt>
mov    0x2de4(%rip),%rax
fldt   (%rax)
fstpl  0x30(%rsp)
movsd  0x30(%rsp),%xmm0
call   1090 <ilogb@plt>
mov    0x2dac(%rip),%r13
xor    %edi,%edi
cmp    0x0(%r13),%eax
sete   %dil
call   10a0 <assert@plt>
mov    0x2dae(%rip),%rax
mov    (%rax),%ebx
mov    0x2d95(%rip),%rax
sub    (%rax),%ebx
mov    0x2d94(%rip),%rbp
cmp    0x0(%rbp),%ebx
jge    12b6 <main+0x126>
lea    0xdb8(%rip),%r14
lea    0x40(%rsp),%r15
lea    0x10(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
mov    %ebx,%ecx
call   1070 <snprintf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <strtod@plt>
movsd  %xmm0,0x18(%rsp)
mov    0x10(%rsp),%rax
xor    %edi,%edi
cmpb   $0x0,(%rax)
sete   %dil
call   10a0 <assert@plt>
movsd  0x18(%rsp),%xmm0
call   1090 <ilogb@plt>
xor    %edi,%edi
cmp    %eax,%ebx
sete   %dil
call   10a0 <assert@plt>
add    $0x1,%ebx
cmp    0x0(%rbp),%ebx
jl     1260 <main+0xd0>
lea    0xd50(%rip),%rdi
call   1050 <puts@plt>
xorps  %xmm0,%xmm0
call   1040 <ilogbf@plt>
xor    %edi,%edi
mov    0x2ccd(%rip),%rcx
cmp    (%rcx),%eax
sete   %dil
call   10a0 <assert@plt>
mov    0x2d13(%rip),%rax
fldt   (%rax)
fstps  0x2c(%rsp)
movss  0x2c(%rsp),%xmm0
call   1040 <ilogbf@plt>
xor    %edi,%edi
mov    0x2c99(%rip),%rcx
cmp    (%rcx),%eax
sete   %dil
call   10a0 <assert@plt>
mov    0x2ccf(%rip),%rax
fldt   (%rax)
fstps  0x28(%rsp)
movss  0x28(%rsp),%xmm0
call   1040 <ilogbf@plt>
xor    %edi,%edi
cmp    0x0(%r13),%eax
sete   %dil
call   10a0 <assert@plt>
mov    0x2c78(%rip),%rax
mov    (%rax),%ebx
mov    0x2c47(%rip),%rax
sub    (%rax),%ebx
mov    0x2c6e(%rip),%rbp
cmp    0x0(%rbp),%ebx
jge    13b6 <main+0x226>
lea    0xcaa(%rip),%r14
lea    0x40(%rsp),%r15
lea    0x10(%rsp),%r12
mov    %r15,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
mov    %ebx,%ecx
call   1070 <snprintf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1080 <strtof@plt>
movss  %xmm0,0x18(%rsp)
mov    0x10(%rsp),%rax
xor    %edi,%edi
cmpb   $0x0,(%rax)
sete   %dil
call   10a0 <assert@plt>
movss  0x18(%rsp),%xmm0
call   1040 <ilogbf@plt>
xor    %edi,%edi
cmp    %eax,%ebx
sete   %dil
call   10a0 <assert@plt>
add    $0x1,%ebx
cmp    0x0(%rbp),%ebx
jl     1360 <main+0x1d0>
lea    0xc5d(%rip),%rdi
call   1050 <puts@plt>
fldz
fstpt  (%rsp)
call   1030 <ilogbl@plt>
xor    %edi,%edi
mov    0x2bcb(%rip),%rcx
cmp    (%rcx),%eax
sete   %dil
call   10a0 <assert@plt>
mov    0x2c11(%rip),%rax
fldt   (%rax)
fstpt  (%rsp)
call   1030 <ilogbl@plt>
xor    %edi,%edi
mov    0x2b9e(%rip),%rcx
cmp    (%rcx),%eax
sete   %dil
call   10a0 <assert@plt>
mov    0x2bd4(%rip),%rax
fldt   (%rax)
fstpt  (%rsp)
call   1030 <ilogbl@plt>
xor    %edi,%edi
cmp    0x0(%r13),%eax
sete   %dil
call   10a0 <assert@plt>
mov    0x2b54(%rip),%rax
mov    (%rax),%ebx
mov    0x2b43(%rip),%rax
sub    (%rax),%ebx
mov    0x2b52(%rip),%rbp
cmp    0x0(%rbp),%ebx
jge    14b5 <main+0x325>
lea    0xbb6(%rip),%r14
lea    0x40(%rsp),%r15
lea    0x10(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
mov    %ebx,%ecx
call   1070 <snprintf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   10b0 <strtold@plt>
fstpt  0x18(%rsp)
mov    0x10(%rsp),%rax
xor    %edi,%edi
cmpb   $0x0,(%rax)
sete   %dil
call   10a0 <assert@plt>
fldt   0x18(%rsp)
fstpt  (%rsp)
call   1030 <ilogbl@plt>
xor    %edi,%edi
cmp    %eax,%ebx
sete   %dil
call   10a0 <assert@plt>
add    $0x1,%ebx
cmp    0x0(%rbp),%ebx
jl     1460 <main+0x2d0>
lea    0xb6c(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"1..3\0A\00"
@FP_ILOGB0 = global i32 0
@NAN = global x86_fp80 0xK00000000000000000000
@FP_ILOGBNAN = global i32 0
@INFINITY = global x86_fp80 0xK00000000000000000000
@INT_MAX = global i32 0
@DBL_MIN_EXP = global i32 0
@DBL_MANT_DIG = global i32 0
@DBL_MAX_EXP = global i32 0
@.str.1 = [8 x i8] c"0x1.p%d\00"
@.str.2 = [14 x i8] c"ok 1 - ilogb\0A\00"
@FLT_MIN_EXP = global i32 0
@FLT_MANT_DIG = global i32 0
@FLT_MAX_EXP = global i32 0
@.str.3 = [15 x i8] c"ok 2 - ilogbf\0A\00"
@LDBL_MIN_EXP = global i32 0
@LDBL_MANT_DIG = global i32 0
@LDBL_MAX_EXP = global i32 0
@.str.4 = [15 x i8] c"ok 3 - ilogbl\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca i8*
%4 = alloca double
%5 = alloca float
%6 = alloca x86_fp80
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @ilogb(double 0.000000e+00)
%11 = load i32, i32* @FP_ILOGB0
%12 = icmp eq i32 %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load x86_fp80, x86_fp80* @NAN
%16 = fptrunc x86_fp80 %15 to double
%17 = call i32 @ilogb(double %16)
%18 = load i32, i32* @FP_ILOGBNAN
%19 = icmp eq i32 %17, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load x86_fp80, x86_fp80* @INFINITY
%23 = fptrunc x86_fp80 %22 to double
%24 = call i32 @ilogb(double %23)
%25 = load i32, i32* @INT_MAX
%26 = icmp eq i32 %24, %25
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = load i32, i32* @DBL_MIN_EXP
%30 = load i32, i32* @DBL_MANT_DIG
%31 = sub nsw i32 %29, %30
store i32 %31, i32* %7
br label %32
32: ; preds = %55, %0
%33 = load i32, i32* %7
%34 = load i32, i32* @DBL_MAX_EXP
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %58
36: ; preds = %32
%37 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%38 = load i32, i32* %7
%39 = call i32 @snprintf(i8* %37, i32 128, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%41 = call double @strtod(i8* %40, i8** %3)
store double %41, double* %4
%42 = load i8*, i8** %3
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 0
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
%48 = load double, double* %4
%49 = call i32 @ilogb(double %48)
store i32 %49, i32* %8
%50 = load i32, i32* %8
%51 = load i32, i32* %7
%52 = icmp eq i32 %50, %51
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
br label %55
55: ; preds = %36
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
br label %32
58: ; preds = %32
%59 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%60 = call i32 @ilogbf(float 0.000000e+00)
%61 = load i32, i32* @FP_ILOGB0
%62 = icmp eq i32 %60, %61
%63 = zext i1 %62 to i32
%64 = call i32 @assert(i32 %63)
%65 = load x86_fp80, x86_fp80* @NAN
%66 = fptrunc x86_fp80 %65 to float
%67 = call i32 @ilogbf(float %66)
%68 = load i32, i32* @FP_ILOGBNAN
%69 = icmp eq i32 %67, %68
%70 = zext i1 %69 to i32
%71 = call i32 @assert(i32 %70)
%72 = load x86_fp80, x86_fp80* @INFINITY
%73 = fptrunc x86_fp80 %72 to float
%74 = call i32 @ilogbf(float %73)
%75 = load i32, i32* @INT_MAX
%76 = icmp eq i32 %74, %75
%77 = zext i1 %76 to i32
%78 = call i32 @assert(i32 %77)
%79 = load i32, i32* @FLT_MIN_EXP
%80 = load i32, i32* @FLT_MANT_DIG
%81 = sub nsw i32 %79, %80
store i32 %81, i32* %7
br label %82
82: ; preds = %105, %58
%83 = load i32, i32* %7
%84 = load i32, i32* @FLT_MAX_EXP
%85 = icmp slt i32 %83, %84
br i1 %85, label %86, label %108
86: ; preds = %82
%87 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%88 = load i32, i32* %7
%89 = call i32 @snprintf(i8* %87, i32 128, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %88)
%90 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%91 = call float @strtof(i8* %90, i8** %3)
store float %91, float* %5
%92 = load i8*, i8** %3
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = icmp eq i32 %94, 0
%96 = zext i1 %95 to i32
%97 = call i32 @assert(i32 %96)
%98 = load float, float* %5
%99 = call i32 @ilogbf(float %98)
store i32 %99, i32* %8
%100 = load i32, i32* %8
%101 = load i32, i32* %7
%102 = icmp eq i32 %100, %101
%103 = zext i1 %102 to i32
%104 = call i32 @assert(i32 %103)
br label %105
105: ; preds = %86
%106 = load i32, i32* %7
%107 = add nsw i32 %106, 1
store i32 %107, i32* %7
br label %82
108: ; preds = %82
%109 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%110 = call i32 @ilogbl(x86_fp80 0xK00000000000000000000)
%111 = load i32, i32* @FP_ILOGB0
%112 = icmp eq i32 %110, %111
%113 = zext i1 %112 to i32
%114 = call i32 @assert(i32 %113)
%115 = load x86_fp80, x86_fp80* @NAN
%116 = call i32 @ilogbl(x86_fp80 %115)
%117 = load i32, i32* @FP_ILOGBNAN
%118 = icmp eq i32 %116, %117
%119 = zext i1 %118 to i32
%120 = call i32 @assert(i32 %119)
%121 = load x86_fp80, x86_fp80* @INFINITY
%122 = call i32 @ilogbl(x86_fp80 %121)
%123 = load i32, i32* @INT_MAX
%124 = icmp eq i32 %122, %123
%125 = zext i1 %124 to i32
%126 = call i32 @assert(i32 %125)
%127 = load i32, i32* @LDBL_MIN_EXP
%128 = load i32, i32* @LDBL_MANT_DIG
%129 = sub nsw i32 %127, %128
store i32 %129, i32* %7
br label %130
130: ; preds = %153, %108
%131 = load i32, i32* %7
%132 = load i32, i32* @LDBL_MAX_EXP
%133 = icmp slt i32 %131, %132
br i1 %133, label %134, label %156
134: ; preds = %130
%135 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%136 = load i32, i32* %7
%137 = call i32 @snprintf(i8* %135, i32 128, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %136)
%138 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%139 = call x86_fp80 @strtold(i8* %138, i8** %3)
store x86_fp80 %139, x86_fp80* %6
%140 = load i8*, i8** %3
%141 = load i8, i8* %140
%142 = sext i8 %141 to i32
%143 = icmp eq i32 %142, 0
%144 = zext i1 %143 to i32
%145 = call i32 @assert(i32 %144)
%146 = load x86_fp80, x86_fp80* %6
%147 = call i32 @ilogbl(x86_fp80 %146)
store i32 %147, i32* %8
%148 = load i32, i32* %8
%149 = load i32, i32* %7
%150 = icmp eq i32 %148, %149
%151 = zext i1 %150 to i32
%152 = call i32 @assert(i32 %151)
br label %153
153: ; preds = %134
%154 = load i32, i32* %7
%155 = add nsw i32 %154, 1
store i32 %155, i32* %7
br label %130
156: ; preds = %130
%157 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@FP_ILOGB0 = global i32 0
@NAN = global x86_fp80 0xK00000000000000000000
@FP_ILOGBNAN = global i32 0
@INFINITY = global x86_fp80 0xK00000000000000000000
@INT_MAX = global i32 0
@DBL_MIN_EXP = global i32 0
@DBL_MANT_DIG = global i32 0
@DBL_MAX_EXP = global i32 0
@.str.1 = [8 x i8] c"0x1.p%d\00"
@FLT_MIN_EXP = global i32 0
@FLT_MANT_DIG = global i32 0
@FLT_MAX_EXP = global i32 0
@LDBL_MIN_EXP = global i32 0
@LDBL_MANT_DIG = global i32 0
@LDBL_MAX_EXP = global i32 0
@str = [5 x i8] c"1..3\00"
@str.5 = [13 x i8] c"ok 1 - ilogb\00"
@str.6 = [14 x i8] c"ok 2 - ilogbf\00"
@str.7 = [14 x i8] c"ok 3 - ilogbl\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = alloca i8*
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%4 = bitcast i8** %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @ilogb(double 0.000000e+00)
%7 = load i32, i32* @FP_ILOGB0
%8 = icmp eq i32 %6, %7
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = load x86_fp80, x86_fp80* @NAN
%12 = fptrunc x86_fp80 %11 to double
%13 = tail call i32 @ilogb(double %12)
%14 = load i32, i32* @FP_ILOGBNAN
%15 = icmp eq i32 %13, %14
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = load x86_fp80, x86_fp80* @INFINITY
%19 = fptrunc x86_fp80 %18 to double
%20 = tail call i32 @ilogb(double %19)
%21 = load i32, i32* @INT_MAX
%22 = icmp eq i32 %20, %21
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = load i32, i32* @DBL_MIN_EXP
%26 = load i32, i32* @DBL_MANT_DIG
%27 = sub nsw i32 %25, %26
%28 = load i32, i32* @DBL_MAX_EXP
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %46
30: ; preds = %0, %30
%31 = phi i32 [ %43, %30 ], [ %27, %0 ]
%32 = call i32 @snprintf(i8* %3, i32 128, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = call double @strtod(i8* %3, i8** %2)
%34 = load i8*, i8** %2
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, 0
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = call i32 @ilogb(double %33)
%40 = icmp eq i32 %39, %31
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
%43 = add nsw i32 %31, 1
%44 = load i32, i32* @DBL_MAX_EXP
%45 = icmp slt i32 %43, %44
br i1 %45, label %30, label %46
46: ; preds = %30, %0
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.5, i64 0, i64 0))
%48 = call i32 @ilogbf(float 0.000000e+00)
%49 = load i32, i32* @FP_ILOGB0
%50 = icmp eq i32 %48, %49
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = load x86_fp80, x86_fp80* @NAN
%54 = fptrunc x86_fp80 %53 to float
%55 = call i32 @ilogbf(float %54)
%56 = load i32, i32* @FP_ILOGBNAN
%57 = icmp eq i32 %55, %56
%58 = zext i1 %57 to i32
%59 = call i32 @assert(i32 %58)
%60 = load x86_fp80, x86_fp80* @INFINITY
%61 = fptrunc x86_fp80 %60 to float
%62 = call i32 @ilogbf(float %61)
%63 = load i32, i32* @INT_MAX
%64 = icmp eq i32 %62, %63
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
%67 = load i32, i32* @FLT_MIN_EXP
%68 = load i32, i32* @FLT_MANT_DIG
%69 = sub nsw i32 %67, %68
%70 = load i32, i32* @FLT_MAX_EXP
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %88
72: ; preds = %46, %72
%73 = phi i32 [ %85, %72 ], [ %69, %46 ]
%74 = call i32 @snprintf(i8* %3, i32 128, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %73)
%75 = call float @strtof(i8* %3, i8** %2)
%76 = load i8*, i8** %2
%77 = load i8, i8* %76
%78 = icmp eq i8 %77, 0
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
%81 = call i32 @ilogbf(float %75)
%82 = icmp eq i32 %81, %73
%83 = zext i1 %82 to i32
%84 = call i32 @assert(i32 %83)
%85 = add nsw i32 %73, 1
%86 = load i32, i32* @FLT_MAX_EXP
%87 = icmp slt i32 %85, %86
br i1 %87, label %72, label %88
88: ; preds = %72, %46
%89 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.6, i64 0, i64 0))
%90 = call i32 @ilogbl(x86_fp80 0xK00000000000000000000)
%91 = load i32, i32* @FP_ILOGB0
%92 = icmp eq i32 %90, %91
%93 = zext i1 %92 to i32
%94 = call i32 @assert(i32 %93)
%95 = load x86_fp80, x86_fp80* @NAN
%96 = call i32 @ilogbl(x86_fp80 %95)
%97 = load i32, i32* @FP_ILOGBNAN
%98 = icmp eq i32 %96, %97
%99 = zext i1 %98 to i32
%100 = call i32 @assert(i32 %99)
%101 = load x86_fp80, x86_fp80* @INFINITY
%102 = call i32 @ilogbl(x86_fp80 %101)
%103 = load i32, i32* @INT_MAX
%104 = icmp eq i32 %102, %103
%105 = zext i1 %104 to i32
%106 = call i32 @assert(i32 %105)
%107 = load i32, i32* @LDBL_MIN_EXP
%108 = load i32, i32* @LDBL_MANT_DIG
%109 = sub nsw i32 %107, %108
%110 = load i32, i32* @LDBL_MAX_EXP
%111 = icmp slt i32 %109, %110
br i1 %111, label %112, label %128
112: ; preds = %88, %112
%113 = phi i32 [ %125, %112 ], [ %109, %88 ]
%114 = call i32 @snprintf(i8* %3, i32 128, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %113)
%115 = call x86_fp80 @strtold(i8* %3, i8** %2)
%116 = load i8*, i8** %2
%117 = load i8, i8* %116
%118 = icmp eq i8 %117, 0
%119 = zext i1 %118 to i32
%120 = call i32 @assert(i32 %119)
%121 = call i32 @ilogbl(x86_fp80 %115)
%122 = icmp eq i32 %121, %113
%123 = zext i1 %122 to i32
%124 = call i32 @assert(i32 %123)
%125 = add nsw i32 %113, 1
%126 = load i32, i32* @LDBL_MAX_EXP
%127 = icmp slt i32 %125, %126
br i1 %127, label %112, label %128
128: ; preds = %112, %88
%129 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.7, i64 0, i64 0))
ret i32 0
}