#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 getopt(int, char **, char *);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, unsigned int *, unsigned int *);
int main(int argc, char *argv[]) {
  int c, opt = 'x';
  unsigned int exponent, mantissa;
  union {
    long x;
    float f;
  } u;
  while ((c = getopt(argc, argv, "xd")) != -1)
    switch (c) {
    case 'x':
    case 'd':
      opt = c;
      break;
    case '?':
    default:
      opt = 'x';
    }
  (void)scanf((opt == 'x') ? "%x %x" : "%d %d", &exponent, &mantissa);
  u.x = (exponent << 24) | (mantissa & 0xffffff);
  (void)printf("%f\n", u.f);
}


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)
movl   $0x78,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xea5(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11be <main+0x8e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x3f,%eax
je     11ad <main+0x7d>
jmp    1180 <main+0x50>
mov    -0x2c(%rbp),%eax
sub    $0x64,%eax
je     11a2 <main+0x72>
jmp    1191 <main+0x61>
mov    -0x2c(%rbp),%eax
sub    $0x78,%eax
jne    11b2 <main+0x82>
jmp    11a2 <main+0x72>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11b9 <main+0x89>
jmp    11b2 <main+0x82>
movl   $0x78,-0x18(%rbp)
jmp    114d <main+0x1d>
mov    -0x18(%rbp),%ecx
lea    0xe41(%rip),%rdi
lea    0xe34(%rip),%rax
cmp    $0x78,%ecx
cmove  %rax,%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
shl    $0x18,%eax
mov    -0x20(%rbp),%ecx
and    $0xffffff,%ecx
or     %ecx,%eax
mov    %eax,%eax
mov    %rax,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebp
mov    $0x78,%eax
lea    0xeb8(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %eax,%ebx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <getopt@plt>
cmp    $0x64,%eax
je     1150 <main+0x20>
cmp    $0x78,%eax
je     1150 <main+0x20>
cmp    $0xffffffff,%eax
je     1175 <main+0x45>
mov    $0x78,%eax
jmp    1150 <main+0x20>
cmp    $0x78,%ebx
lea    0xe84(%rip),%rax
lea    0xe83(%rip),%rdi
cmove  %rax,%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
shl    $0x18,%eax
mov    $0xffffff,%ecx
and    (%rsp),%ecx
or     %eax,%ecx
movd   %ecx,%xmm0
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%union.anon = type { i64 }
@.str = [3 x i8] c"xd\00"
@.str.1 = [6 x i8] c"%x %x\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [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
store i32 120, i32* %7
br label %11
11: ; preds = %22, %2
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %14, i32* %6
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %23
16: ; preds = %11
%17 = load i32, i32* %6
switch i32 %17, label %21 [
i32 120, label %18
i32 100, label %18
i32 63, label %20
]
18: ; preds = %16, %16
%19 = load i32, i32* %6
store i32 %19, i32* %7
br label %22
20: ; preds = %16
br label %21
21: ; preds = %16, %20
store i32 120, i32* %7
br label %22
22: ; preds = %21, %18
br label %11
23: ; preds = %11
%24 = load i32, i32* %7
%25 = icmp eq i32 %24, 120
%26 = zext i1 %25 to i64
%27 = select i1 %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%28 = call i32 @scanf(i8* %27, i32* %8, i32* %9)
%29 = load i32, i32* %8
%30 = shl i32 %29, 24
%31 = load i32, i32* %9
%32 = and i32 %31, 16777215
%33 = or i32 %30, %32
%34 = zext i32 %33 to i64
%35 = bitcast %union.anon* %10 to i64*
store i64 %34, i64* %35
%36 = bitcast %union.anon* %10 to float*
%37 = load float, float* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), float %37)
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@.str = [3 x i8] c"xd\00"
@.str.1 = [6 x i8] c"%x %x\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
br label %7
7: ; preds = %10, %2
%8 = phi i32 [ 120, %2 ], [ %11, %10 ]
%9 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %9, label %12 [
i32 -1, label %13
i32 120, label %10
i32 100, label %10
]
10: ; preds = %7, %7, %12
%11 = phi i32 [ 120, %12 ], [ %9, %7 ], [ %9, %7 ]
br label %7
12: ; preds = %7
br label %10
13: ; preds = %7
%14 = icmp eq i32 %8, 120
%15 = select i1 %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%16 = call i32 @scanf(i8* %15, i32* %3, i32* %4)
%17 = load i32, i32* %3
%18 = shl i32 %17, 24
%19 = load i32, i32* %4
%20 = and i32 %19, 16777215
%21 = or i32 %20, %18
%22 = bitcast i32 %21 to float
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), float %22)
ret i32 0
}