#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*/ FE_ALL_EXCEPT;
int /*<<< orphan*/ feclearexcept(int /*<<< orphan*/);
char *fmt_f64(double);
char *fmt_flags();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
void convert_single_to_double(float input) {
  double output;
  char *out_fmt, *flag_fmt;
  feclearexcept(FE_ALL_EXCEPT);
  output = input;
  out_fmt = fmt_f64(output);
  flag_fmt = fmt_flags();
  printf("  to double: %s (%s)\n", out_fmt, flag_fmt);
  free(out_fmt);
  free(flag_fmt);
}


x86 assembly (clang, -O0):
<convert_single_to_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1060 <feclearexcept@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1070 <fmt_f64@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <fmt_flags@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe5f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_single_to_double>:
push   %r14
push   %rbx
push   %rax
movss  %xmm0,0x4(%rsp)
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1060 <feclearexcept@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1070 <fmt_f64@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1050 <fmt_flags@plt>
mov    %rax,%rbx
lea    0xe75(%rip),%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
@FE_ALL_EXCEPT = global i32 0
@.str = [22 x i8] c" to double: %s (%s)\0A\00"
define void @convert_single_to_double(float %0) {
%2 = alloca float
%3 = alloca double
%4 = alloca i8*
%5 = alloca i8*
store float %0, float* %2
%6 = load i32, i32* @FE_ALL_EXCEPT
%7 = call i32 @feclearexcept(i32 %6)
%8 = load float, float* %2
%9 = fpext float %8 to double
store double %9, double* %3
%10 = load double, double* %3
%11 = call i8* @fmt_f64(double %10)
store i8* %11, i8** %4
%12 = call i8* (...) @fmt_flags()
store i8* %12, i8** %5
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = load i8*, i8** %4
%17 = call i32 @free(i8* %16)
%18 = load i8*, i8** %5
%19 = call i32 @free(i8* %18)
ret void
}

LLVM IR (-O2):
@FE_ALL_EXCEPT = global i32 0
@.str = [22 x i8] c" to double: %s (%s)\0A\00"
define void @convert_single_to_double(float %0) {
%2 = load i32, i32* @FE_ALL_EXCEPT
%3 = tail call i32 @feclearexcept(i32 %2)
%4 = fpext float %0 to double
%5 = tail call i8* @fmt_f64(double %4)
%6 = tail call i8* (...) @fmt_flags()
%7 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = tail call i32 @free(i8* %5)
%9 = tail call i32 @free(i8* %6)
ret void
}