#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;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int strtoul(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  uint32_t value, sign, mantissa, exponent;
  union {
    uint32_t u;
    float f;
  } bits;
  value = strtoul(argv[1], NULL, 16);
  sign = (value >> 19) & 0x1;
  exponent = (value >> 13) & 0x3f;
  mantissa = (value >> 0) & 0x1fff;
  if (exponent == 0x3f)
    exponent = 0xff;
  else
    exponent += 127 - 31;
  mantissa = mantissa << (23 - 13);
  bits.u = sign << 31 | (exponent << 23) | mantissa;
  printf("%f\n", bits.f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x13,%eax
and    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
sar    $0xd,%eax
and    $0x3f,%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x0,%eax
and    $0x1fff,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x3f,-0x20(%rbp)
jne    118b <main+0x6b>
movl   $0xff,-0x20(%rbp)
jmp    1194 <main+0x74>
mov    -0x20(%rbp),%eax
add    $0x60,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0xa,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x1f,%eax
mov    -0x20(%rbp),%ecx
shl    $0x17,%ecx
or     %ecx,%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
mov    %eax,%ecx
shr    $0xd,%ecx
and    $0x3f,%ecx
mov    %ecx,%edx
shl    $0x17,%edx
add    $0x30000000,%edx
cmp    $0x3f,%ecx
mov    $0x7f800000,%ecx
cmovne %edx,%ecx
mov    %eax,%edx
shl    $0xa,%edx
and    $0x7ffc00,%edx
shl    $0xc,%eax
and    $0x80000000,%eax
or     %edx,%eax
or     %ecx,%eax
movd   %eax,%xmm0
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%union.anon = type { i32 }
@.str = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %union.anon
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strtoul(i8* %13, i32* null, i32 16)
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = ashr i32 %15, 19
%17 = and i32 %16, 1
store i32 %17, i32* %7
%18 = load i32, i32* %6
%19 = ashr i32 %18, 13
%20 = and i32 %19, 63
store i32 %20, i32* %9
%21 = load i32, i32* %6
%22 = ashr i32 %21, 0
%23 = and i32 %22, 8191
store i32 %23, i32* %8
%24 = load i32, i32* %9
%25 = icmp eq i32 %24, 63
br i1 %25, label %26, label %27
26: ; preds = %2
store i32 255, i32* %9
br label %30
27: ; preds = %2
%28 = load i32, i32* %9
%29 = add nsw i32 %28, 96
store i32 %29, i32* %9
br label %30
30: ; preds = %27, %26
%31 = load i32, i32* %8
%32 = shl i32 %31, 10
store i32 %32, i32* %8
%33 = load i32, i32* %7
%34 = shl i32 %33, 31
%35 = load i32, i32* %9
%36 = shl i32 %35, 23
%37 = or i32 %34, %36
%38 = load i32, i32* %8
%39 = or i32 %37, %38
%40 = bitcast %union.anon* %10 to i32*
store i32 %39, i32* %40
%41 = bitcast %union.anon* %10 to float*
%42 = load float, float* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %42)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @strtoul(i8* nocapture %4, i32* null, i32 16)
%6 = lshr i32 %5, 13
%7 = and i32 %6, 63
%8 = icmp eq i32 %7, 63
%9 = shl nuw nsw i32 %7, 23
%10 = add nuw nsw i32 %9, 805306368
%11 = select i1 %8, i32 2139095040, i32 %10
%12 = shl i32 %5, 10
%13 = and i32 %12, 8387584
%14 = shl i32 %5, 12
%15 = and i32 %14, -2147483648
%16 = or i32 %13, %15
%17 = or i32 %16, %11
%18 = bitcast i32 %17 to float
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %18)
ret i32 0
}