int main() {
  double realdoble;
  printf("Escriu un número amb decimals:\n");
  scanf("%lf", &realdoble);
  float real = (float)realdoble;
  int n = (int)realdoble;
  printf("|        | Binari                          | Octal       | "
         "Hexadecimal | Decimal\n");
  printf("| Sencer |");
  printbitssimple(n);
  printf(" |%12o |  %#010X | %i\n", n, n, n);
  unsigned int rr;
  memcpy(&rr, &real, sizeof(rr));
  printf("| Simple |");
  printbitssimple(rr);
  printf(" |%12o |  %#010x | %.20f\n", rr, rr, real);
  unsigned long long int rrealdoble;
  memcpy(&rrealdoble, &realdoble, sizeof(rrealdoble));
  printf("| Doble  |");
  printbitsdoble(rrealdoble);
  printf(" | %llo |  %#018llX | %.20f\n ", rrealdoble, rrealdoble, realdoble);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
cvttsd2si -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%edi
mov    $0x0,%al
call   1030 <printbitssimple@plt>
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    $0x0,%al
call   1030 <printbitssimple@plt>
mov    -0x1c(%rbp),%esi
mov    -0x1c(%rbp),%edx
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeae(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    $0x0,%al
call   1060 <printbitsdoble@plt>
mov    -0x28(%rbp),%rsi
mov    -0x28(%rbp),%rdx
movsd  -0x10(%rbp),%xmm0
lea    0xe97(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf18(%rip),%rdi
call   1030 <puts@plt>
lea    0xe98(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
cvttsd2si %xmm0,%ebx
lea    0xf05(%rip),%rdi
call   1030 <puts@plt>
lea    0xe69(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <printbitssimple@plt>
lea    0xe5d(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
movd   0x4(%rsp),%xmm0
movd   %xmm0,%ebx
lea    0xe56(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <printbitssimple@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe40(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x8(%rsp),%rbx
lea    0xe43(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printbitsdoble@plt>
movsd  0x8(%rsp),%xmm0
lea    0xe30(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Escriu un n\C3\BAmero amb decimals:\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [82 x i8] c"| | Binari | Octal | Hexadecimal | Decimal\0A\00"
@.str.3 = [11 x i8] c"| Sencer |\00"
@.str.4 = [23 x i8] c" |%12o | %X | %i\0A\00"
@.str.5 = [11 x i8] c"| Simple |\00"
@.str.6 = [26 x i8] c" |%12o | %x | %.20f\0A\00"
@.str.7 = [11 x i8] c"| Doble |\00"
@.str.8 = [30 x i8] c" | %llo | %llX | %.20f\0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%9 = load double, double* %2
%10 = fptrunc double %9 to float
store float %10, float* %3
%11 = load double, double* %2
%12 = fptosi double %11 to i32
store i32 %12, i32* %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32, i32* %4
%16 = call i32 (i32, ...) bitcast (i32 (...)* @printbitssimple to i32 (i32, ...)*)(i32 %15)
%17 = load i32, i32* %4
%18 = load i32, i32* %4
%19 = load i32, i32* %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %17, i32 %18, i32 %19)
%21 = bitcast i32* %5 to i8*
%22 = bitcast float* %3 to i8*
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%24 = load i32, i32* %5
%25 = call i32 (i32, ...) bitcast (i32 (...)* @printbitssimple to i32 (i32, ...)*)(i32 %24)
%26 = load i32, i32* %5
%27 = load i32, i32* %5
%28 = load float, float* %3
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %26, i32 %27, double %29)
%31 = bitcast i64* %6 to i8*
%32 = bitcast double* %2 to i8*
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%34 = load i64, i64* %6
%35 = call i32 (i64, ...) bitcast (i32 (...)* @printbitsdoble to i32 (i64, ...)*)(i64 %34)
%36 = load i64, i64* %6
%37 = load i64, i64* %6
%38 = load double, double* %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i64 %36, i64 %37, double %38)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.3 = [11 x i8] c"| Sencer |\00"
@.str.4 = [23 x i8] c" |%12o | %X | %i\0A\00"
@.str.5 = [11 x i8] c"| Simple |\00"
@.str.6 = [26 x i8] c" |%12o | %x | %.20f\0A\00"
@.str.7 = [11 x i8] c"| Doble |\00"
@.str.8 = [30 x i8] c" | %llo | %llX | %.20f\0A \00"
@str = [32 x i8] c"Escriu un n\C3\BAmero amb decimals:\00"
@str.9 = [81 x i8] c"| | Binari | Octal | Hexadecimal | Decimal\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = fptrunc double %5 to float
%7 = fptosi double %5 to i32
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.9, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i32, ...) bitcast (i32 (...)* @printbitssimple to i32 (i32, ...)*)(i32 %7)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %7, i32 %7, i32 %7)
%12 = bitcast float %6 to i32
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (i32, ...) bitcast (i32 (...)* @printbitssimple to i32 (i32, ...)*)(i32 %12)
%15 = fpext float %6 to double
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %12, i32 %12, double %15)
%17 = bitcast double* %1 to i64*
%18 = load i64, i64* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%20 = call i32 (i64, ...) bitcast (i32 (...)* @printbitsdoble to i32 (i64, ...)*)(i64 %18)
%21 = load double, double* %1
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i64 %18, i64 %18, double %21)
ret i32 0
}