#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 x;
typedef int uint32_t;

/* Variables and functions */
void fp32_parsefin(uint32_t x, bool *ps, int *pe, uint32_t *pf, bool ftz) {
  bool sx = ((x) >> 31 & 1);
  int ex = ((x) >> 23 & 0xff);
  uint32_t fx = ((x)&0x7fffff);
  *ps = sx;
  if (!ex) {
    *pe = 1;
    *pf = ftz ? 0 : fx;
  } else {
    *pe = ex;
    *pf = 0x800000 + fx;
  }
}


x86 assembly (clang, -O0):
<fp32_parsefin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
and    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x17,%eax
and    $0xff,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7fffff,%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x2c(%rbp)
jne    1181 <fp32_parsefin+0x81>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
cmpl   $0x0,-0x24(%rbp)
je     116d <fp32_parsefin+0x6d>
xor    %eax,%eax
mov    %eax,-0x34(%rbp)
jmp    1173 <fp32_parsefin+0x73>
mov    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1199 <fp32_parsefin+0x99>
mov    -0x2c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%ecx
add    $0x800000,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fp32_parsefin>:
mov    %edi,%r9d
shr    $0x1f,%r9d
mov    %edi,%eax
shr    $0x17,%eax
and    $0x7fffff,%edi
mov    %r9d,(%rsi)
and    $0xff,%eax
je     1127 <fp32_parsefin+0x27>
mov    %eax,(%rdx)
or     $0x800000,%edi
mov    %edi,(%rcx)
ret
movl   $0x1,(%rdx)
xor    %eax,%eax
test   %r8d,%r8d
cmove  %edi,%eax
mov    %eax,(%rcx)
ret

LLVM IR (-O0):
define void @fp32_parsefin(i32 %0, i32* %1, i32* %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%14 = load i32, i32* %6
%15 = ashr i32 %14, 31
%16 = and i32 %15, 1
store i32 %16, i32* %11
%17 = load i32, i32* %6
%18 = ashr i32 %17, 23
%19 = and i32 %18, 255
store i32 %19, i32* %12
%20 = load i32, i32* %6
%21 = and i32 %20, 8388607
store i32 %21, i32* %13
%22 = load i32, i32* %11
%23 = load i32*, i32** %7
store i32 %22, i32* %23
%24 = load i32, i32* %12
%25 = icmp ne i32 %24, 0
br i1 %25, label %36, label %26
26: ; preds = %5
%27 = load i32*, i32** %8
store i32 1, i32* %27
%28 = load i32, i32* %10
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %26
br label %33
31: ; preds = %26
%32 = load i32, i32* %13
br label %33
33: ; preds = %31, %30
%34 = phi i32 [ 0, %30 ], [ %32, %31 ]
%35 = load i32*, i32** %9
store i32 %34, i32* %35
br label %42
36: ; preds = %5
%37 = load i32, i32* %12
%38 = load i32*, i32** %8
store i32 %37, i32* %38
%39 = load i32, i32* %13
%40 = add nsw i32 8388608, %39
%41 = load i32*, i32** %9
store i32 %40, i32* %41
br label %42
42: ; preds = %36, %33
ret void
}

LLVM IR (-O2):
define void @fp32_parsefin(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32 %4) {
%6 = lshr i32 %0, 31
%7 = lshr i32 %0, 23
%8 = and i32 %7, 255
%9 = and i32 %0, 8388607
store i32 %6, i32* %1
%10 = icmp eq i32 %8, 0
br i1 %10, label %11, label %14
11: ; preds = %5
store i32 1, i32* %2
%12 = icmp eq i32 %4, 0
%13 = select i1 %12, i32 %9, i32 0
br label %16
14: ; preds = %5
store i32 %8, i32* %2
%15 = or i32 %9, 8388608
br label %16
16: ; preds = %14, %11
%17 = phi i32 [ %13, %11 ], [ %15, %14 ]
store i32 %17, i32* %3
ret void
}