#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 */
scalar_t__ atof(char *);
int getExpbits(int);
int getFraction(int);
int getSignBit(int);
int /*<<< orphan*/ printAsBinary(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Usage: %s float_value\n", argv[0]);
    return -1;
  }
  float y = (float)atof(argv[1]);
  printf("Austin Parrish\n\n");
  printf("float val:\t\t%f\n", y);
  printf("in hex:\t\t\t%#08x\t", *((int *)&y));
  printAsBinary(*((int *)&y));
  printf("\n");
  printf("sign: %d\t", getSignBit(*((int *)&y)));
  printf("\t\t%#08x\t", getSignBit(*((int *)&y)));
  printAsBinary(getSignBit(*((int *)&y)));
  printf("expbits: %d\t\t", getExpbits(*((int *)&y)));
  printf("%#08x\t", getExpbits(*((int *)&y)));
  printAsBinary(getExpbits(*((int *)&y)));
  printf("fraction: %d\t", getFraction(*((int *)&y)));
  printf("%#08x\t", getFraction(*((int *)&y)));
  printAsBinary(getFraction(*((int *)&y)));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11a1 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12c1 <main+0x161>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atof@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe52(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1080 <printAsBinary@plt>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <getSignBit@plt>
mov    %eax,%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <getSignBit@plt>
mov    %eax,%esi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <getSignBit@plt>
mov    %eax,%edi
call   1080 <printAsBinary@plt>
mov    -0x14(%rbp),%edi
call   1060 <getExpbits@plt>
mov    %eax,%esi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1060 <getExpbits@plt>
mov    %eax,%esi
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1060 <getExpbits@plt>
mov    %eax,%edi
call   1080 <printAsBinary@plt>
mov    -0x14(%rbp),%edi
call   1070 <getFraction@plt>
mov    %eax,%esi
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1070 <getFraction@plt>
mov    %eax,%esi
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1070 <getFraction@plt>
mov    %eax,%edi
call   1080 <printAsBinary@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jne    12ab <main+0x12b>
mov    0x8(%rsi),%rdi
call   1060 <atof@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,0xc(%rsp)
lea    0xeb2(%rip),%rdi
call   1050 <puts@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe55(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movd   0xc(%rsp),%xmm0
movd   %xmm0,%ebp
lea    0xe4d(%rip),%rdi
xor    %ebx,%ebx
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
call   10a0 <printAsBinary@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
call   1040 <getSignBit@plt>
lea    0xe34(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
call   1040 <getSignBit@plt>
lea    0xe14(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
call   1040 <getSignBit@plt>
mov    %eax,%edi
call   10a0 <printAsBinary@plt>
mov    %ebp,%edi
call   1080 <getExpbits@plt>
lea    0xe02(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
call   1080 <getExpbits@plt>
lea    0xdda(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
call   1080 <getExpbits@plt>
mov    %eax,%edi
call   10a0 <printAsBinary@plt>
mov    %ebp,%edi
call   1090 <getFraction@plt>
lea    0xdd1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
call   1090 <getFraction@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
call   1090 <getFraction@plt>
mov    %eax,%edi
call   10a0 <printAsBinary@plt>
jmp    12c1 <main+0x141>
mov    (%rsi),%rsi
lea    0xd4b(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Usage: %s float_value\0A\00"
@.str.1 = [17 x i8] c"Austin Parrish\0A\0A\00"
@.str.2 = [16 x i8] c"float val:\09\09%f\0A\00"
@.str.3 = [17 x i8] c"in hex:\09\09\09%x\09\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [10 x i8] c"sign: %d\09\00"
@.str.6 = [9 x i8] c"\09\09%x\09\00"
@.str.7 = [14 x i8] c"expbits: %d\09\09\00"
@.str.8 = [7 x i8] c"%x\09\00"
@.str.9 = [14 x i8] c"fraction: %d\09\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 -1, i32* %3
br label %67
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @atof(i8* %17)
%19 = sitofp i64 %18 to float
store float %19, float* %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%21 = load float, float* %6
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %22)
%24 = bitcast float* %6 to i32*
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = bitcast float* %6 to i32*
%28 = load i32, i32* %27
%29 = call i32 @printAsBinary(i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%31 = bitcast float* %6 to i32*
%32 = load i32, i32* %31
%33 = call i32 @getSignBit(i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %33)
%35 = bitcast float* %6 to i32*
%36 = load i32, i32* %35
%37 = call i32 @getSignBit(i32 %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %37)
%39 = bitcast float* %6 to i32*
%40 = load i32, i32* %39
%41 = call i32 @getSignBit(i32 %40)
%42 = call i32 @printAsBinary(i32 %41)
%43 = bitcast float* %6 to i32*
%44 = load i32, i32* %43
%45 = call i32 @getExpbits(i32 %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %45)
%47 = bitcast float* %6 to i32*
%48 = load i32, i32* %47
%49 = call i32 @getExpbits(i32 %48)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %49)
%51 = bitcast float* %6 to i32*
%52 = load i32, i32* %51
%53 = call i32 @getExpbits(i32 %52)
%54 = call i32 @printAsBinary(i32 %53)
%55 = bitcast float* %6 to i32*
%56 = load i32, i32* %55
%57 = call i32 @getFraction(i32 %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 %57)
%59 = bitcast float* %6 to i32*
%60 = load i32, i32* %59
%61 = call i32 @getFraction(i32 %60)
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %61)
%63 = bitcast float* %6 to i32*
%64 = load i32, i32* %63
%65 = call i32 @getFraction(i32 %64)
%66 = call i32 @printAsBinary(i32 %65)
br label %67
67: ; preds = %14, %9
%68 = load i32, i32* %3
ret i32 %68
}

LLVM IR (-O2):
@.str = [23 x i8] c"Usage: %s float_value\0A\00"
@.str.2 = [16 x i8] c"float val:\09\09%f\0A\00"
@.str.3 = [17 x i8] c"in hex:\09\09\09%x\09\00"
@.str.5 = [10 x i8] c"sign: %d\09\00"
@.str.6 = [9 x i8] c"\09\09%x\09\00"
@.str.7 = [14 x i8] c"expbits: %d\09\09\00"
@.str.8 = [7 x i8] c"%x\09\00"
@.str.9 = [14 x i8] c"fraction: %d\09\00"
@str = [16 x i8] c"Austin Parrish\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %37
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @atof(i8* %9)
%11 = sitofp i64 %10 to float
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%13 = fpext float %11 to double
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %13)
%15 = bitcast float %11 to i32
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = tail call i32 @printAsBinary(i32 %15)
%18 = tail call i32 @putchar(i32 10)
%19 = tail call i32 @getSignBit(i32 %15)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %19)
%21 = tail call i32 @getSignBit(i32 %15)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %21)
%23 = tail call i32 @getSignBit(i32 %15)
%24 = tail call i32 @printAsBinary(i32 %23)
%25 = tail call i32 @getExpbits(i32 %15)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %25)
%27 = tail call i32 @getExpbits(i32 %15)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %27)
%29 = tail call i32 @getExpbits(i32 %15)
%30 = tail call i32 @printAsBinary(i32 %29)
%31 = tail call i32 @getFraction(i32 %15)
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 %31)
%33 = tail call i32 @getFraction(i32 %15)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %33)
%35 = tail call i32 @getFraction(i32 %15)
%36 = tail call i32 @printAsBinary(i32 %35)
br label %37
37: ; preds = %7, %4
%38 = phi i32 [ -1, %4 ], [ 0, %7 ]
ret i32 %38
}