#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 uint32_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
scalar_t__ FLT_MIN;
scalar_t__ fabsfk(float);
scalar_t__ xisinff(float);
scalar_t__ xisnanf(float);
__attribute__((visibility("default"))) const int xexpfrexpf(float x) {
  union {
    float f;
    uint32_t u;
  } cx;
  int ret = 0;
  if (fabsfk(x) < FLT_MIN) {
    x *= (1 << 30);
    ret = -30;
  }
  cx.f = x;
  ret += (int32_t)(((cx.u >> 23) & 0xff)) - 0x7e;
  if (x == 0 || xisnanf(x) || xisinff(x))
    ret = 0;
  return ret;
}


x86 assembly (clang, -O0):
<xexpfrexpf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <fabsfk@plt>
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%rax
jge    1177 <xexpfrexpf+0x47>
movss  0xe9a(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movl   $0xffffffe2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x17,%eax
and    $0xff,%eax
movslq %eax,%rcx
sub    $0x7e,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11b9 <xexpfrexpf+0x89>
jp     11b9 <xexpfrexpf+0x89>
jmp    11e1 <xexpfrexpf+0xb1>
movss  -0x4(%rbp),%xmm0
call   1050 <xisnanf@plt>
cmp    $0x0,%rax
jne    11e1 <xexpfrexpf+0xb1>
movss  -0x4(%rbp),%xmm0
call   1030 <xisinff@plt>
cmp    $0x0,%rax
je     11e8 <xexpfrexpf+0xb8>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xexpfrexpf>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
call   1040 <fabsfk@plt>
mov    0x2ea1(%rip),%rcx
mov    (%rcx),%rcx
cmp    %rcx,%rax
jl     1157 <xexpfrexpf+0x27>
movss  0xc(%rsp),%xmm0
jmp    1165 <xexpfrexpf+0x35>
movss  0xc(%rsp),%xmm0
mulss  0xe9b(%rip),%xmm0
movd   %xmm0,%edx
shr    $0x17,%edx
movzbl %dl,%ebx
lea    -0x7e(%rbx),%edx
add    $0xffffff64,%ebx
cmp    %rcx,%rax
cmovge %edx,%ebx
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1188 <xexpfrexpf+0x58>
jnp    11a8 <xexpfrexpf+0x78>
movss  %xmm0,0xc(%rsp)
call   1050 <xisnanf@plt>
movss  0xc(%rsp),%xmm0
test   %rax,%rax
jne    11a8 <xexpfrexpf+0x78>
call   1030 <xisinff@plt>
test   %rax,%rax
je     11aa <xexpfrexpf+0x7a>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%union.anon = type { float }
@FLT_MIN = global i64 0
define i32 @xexpfrexpf(float %0) {
%2 = alloca float
%3 = alloca %union.anon
%4 = alloca i32
store float %0, float* %2
store i32 0, i32* %4
%5 = load float, float* %2
%6 = call i64 @fabsfk(float %5)
%7 = load i64, i64* @FLT_MIN
%8 = icmp slt i64 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load float, float* %2
%11 = fmul float %10, 0x41D0000000000000
store float %11, float* %2
store i32 -30, i32* %4
br label %12
12: ; preds = %9, %1
%13 = load float, float* %2
%14 = bitcast %union.anon* %3 to float*
store float %13, float* %14
%15 = bitcast %union.anon* %3 to i32*
%16 = load i32, i32* %15
%17 = ashr i32 %16, 23
%18 = and i32 %17, 255
%19 = sext i32 %18 to i64
%20 = sub nsw i64 %19, 126
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = add nsw i64 %22, %20
%24 = trunc i64 %23 to i32
store i32 %24, i32* %4
%25 = load float, float* %2
%26 = fcmp oeq float %25, 0.000000e+00
br i1 %26, label %35, label %27
27: ; preds = %12
%28 = load float, float* %2
%29 = call i64 @xisnanf(float %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %27
%32 = load float, float* %2
%33 = call i64 @xisinff(float %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31, %27, %12
store i32 0, i32* %4
br label %36
36: ; preds = %35, %31
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
@FLT_MIN = global i64 0
define i32 @xexpfrexpf(float %0) {
%2 = tail call i64 @fabsfk(float %0)
%3 = load i64, i64* @FLT_MIN
%4 = icmp slt i64 %2, %3
%5 = fmul float %0, 0x41D0000000000000
%6 = select i1 %4, float %5, float %0
%7 = bitcast float %6 to i32
%8 = lshr i32 %7, 23
%9 = and i32 %8, 255
%10 = select i1 %4, i32 -156, i32 -126
%11 = add nsw i32 %10, %9
%12 = fcmp oeq float %6, 0.000000e+00
br i1 %12, label %19, label %13
13: ; preds = %1
%14 = tail call i64 @xisnanf(float %6)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = tail call i64 @xisinff(float %6)
%18 = icmp eq i64 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %16, %13, %1
br label %20
20: ; preds = %19, %16
%21 = phi i32 [ 0, %19 ], [ %11, %16 ]
ret i32 %21
}