#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 /*<<< orphan*/ printf(char *, ...);
void sub(float f) {
  union {
    float f;
    unsigned int i;
  } x;
  unsigned char *p;
  unsigned int *l;
  int i;
  unsigned int g;
  p = (unsigned char *)&f;
  l = (unsigned int *)&f;
  x.f = f;
  g = x.i;
  printf(" %-12g : %x %d ", f, *l, *l);
  for (i = 0; i < sizeof(float); i++) {
    printf("%02x", *p++);
  }
  printf(" : ");
  for (i = 0; i < 32; i++) {
    printf("%c", ((0x80000000) & g) ? '1' : '0');
    if ((i == 0) || (i == 8))
      printf(" ");
    g = g << 1;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xea7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x4,%rax
jae    11a3 <sub+0x93>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1167 <sub+0x57>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    1222 <sub+0x112>
mov    -0x20(%rbp),%ecx
and    $0x80000000,%ecx
mov    $0x30,%esi
mov    $0x31,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
je     11fd <sub+0xed>
cmpl   $0x8,-0x1c(%rbp)
jne    120b <sub+0xfb>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b8 <sub+0xa8>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub>:
push   %rbp
push   %r14
push   %rbx
movd   %xmm0,%ebx
cvtss2sd %xmm0,%xmm0
lea    0xecd(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
mov    $0x1,%al
call   1040 <printf@plt>
movzbl %bl,%esi
lea    0xec8(%rip),%r14
xor    %ebp,%ebp
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl %bh,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
shr    $0x18,%eax
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11aa <sub+0x8a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %ebx,%ebx
add    $0x1,%ebp
cmp    $0x20,%ebp
je     11cb <sub+0xab>
mov    %ebx,%edi
shr    $0x1f,%edi
or     $0x30,%edi
call   1030 <putchar@plt>
test   $0x7ffffff7,%ebp
jne    11a0 <sub+0x80>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    11a0 <sub+0x80>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%union.anon = type { float }
@.str = [16 x i8] c" %-12g : %x %d \00"
@.str.1 = [5 x i8] c"%02x\00"
@.str.2 = [4 x i8] c" : \00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @sub(float %0) {
%2 = alloca float
%3 = alloca %union.anon
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store float %0, float* %2
%8 = bitcast float* %2 to i8*
store i8* %8, i8** %4
%9 = bitcast float* %2 to i32*
store i32* %9, i32** %5
%10 = load float, float* %2
%11 = bitcast %union.anon* %3 to float*
store float %10, float* %11
%12 = bitcast %union.anon* %3 to i32*
%13 = load i32, i32* %12
store i32 %13, i32* %7
%14 = load float, float* %2
%15 = fpext float %14 to double
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = load i32*, i32** %5
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %15, i32 %17, i32 %19)
store i32 0, i32* %6
br label %21
21: ; preds = %31, %1
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = icmp ult i64 %23, 4
br i1 %24, label %25, label %34
25: ; preds = %21
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %4
%28 = load i8, i8* %26
%29 = zext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %25
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %21
34: ; preds = %21
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %36
36: ; preds = %56, %34
%37 = load i32, i32* %6
%38 = icmp slt i32 %37, 32
br i1 %38, label %39, label %59
39: ; preds = %36
%40 = load i32, i32* %7
%41 = and i32 -2147483648, %40
%42 = icmp ne i32 %41, 0
%43 = zext i1 %42 to i64
%44 = select i1 %42, i32 49, i32 48
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %6
%47 = icmp eq i32 %46, 0
br i1 %47, label %51, label %48
48: ; preds = %39
%49 = load i32, i32* %6
%50 = icmp eq i32 %49, 8
br i1 %50, label %51, label %53
51: ; preds = %48, %39
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %53
53: ; preds = %51, %48
%54 = load i32, i32* %7
%55 = shl i32 %54, 1
store i32 %55, i32* %7
br label %56
56: ; preds = %53
%57 = load i32, i32* %6
%58 = add nsw i32 %57, 1
store i32 %58, i32* %6
br label %36
59: ; preds = %36
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c" %-12g : %x %d \00"
@.str.1 = [5 x i8] c"%02x\00"
@.str.2 = [4 x i8] c" : \00"
define void @sub(float %0) {
%2 = bitcast float %0 to i32
%3 = fpext float %0 to double
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %3, i32 %2, i32 %2)
%5 = and i32 %2, 255
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = lshr i32 %2, 8
%8 = and i32 %7, 255
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = lshr i32 %2, 16
%11 = and i32 %10, 255
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = lshr i32 %2, 24
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %1, %26
%17 = phi i32 [ %2, %1 ], [ %27, %26 ]
%18 = phi i32 [ 0, %1 ], [ %28, %26 ]
%19 = icmp sgt i32 %17, -1
%20 = select i1 %19, i32 48, i32 49
%21 = tail call i32 @putchar(i32 %20)
%22 = and i32 %18, 2147483639
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %16
%25 = tail call i32 @putchar(i32 32)
br label %26
26: ; preds = %16, %24
%27 = shl i32 %17, 1
%28 = add nuw nsw i32 %18, 1
%29 = icmp eq i32 %28, 32
br i1 %29, label %30, label %16
30: ; preds = %26
%31 = tail call i32 @putchar(i32 10)
ret void
}