#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 *, double);
int main() {
  float f = 3.532;
  double d = 5.22334567879876543;
  long double ld = 6.234234546325657543;
  printf("%f\n", f);
  printf("%f\n", d);
  printf("%llf\n", ld);
  printf("%.2e\n", d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x40620c4a,-0x8(%rbp)
movabs $0x4014e4b4bac89311,%rax
e4 14 40
mov    %rax,-0x10(%rbp)
fldl   0xec6(%rip)
fstpt  -0x20(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xebb(%rip),%rdi
mov    %rdi,-0x30(%rbp)
call   1030 <printf@plt>
mov    -0x30(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
call   1030 <printf@plt>
fldt   -0x20(%rbp)
fstpl  -0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf00(%rip),%rbx
movsd  0xee0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xed8(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
movsd  0xec9(%rip),%xmm0
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
movsd  0xead(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [6 x i8] c"%llf\0A\00"
@.str.2 = [6 x i8] c"%.2e\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca double
%4 = alloca x86_fp80
store i32 0, i32* %1
store float 0x400C418940000000, float* %2
store double 0x4014E4B4BAC89311, double* %3
store x86_fp80 0xK4001C77ED97281FCB000, x86_fp80* %4
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %6)
%8 = load double, double* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %8)
%10 = load x86_fp80, x86_fp80* %4
%11 = fptrunc x86_fp80 %10 to double
%12 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %11)
%13 = load double, double* %3
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [6 x i8] c"%llf\0A\00"
@.str.2 = [6 x i8] c"%.2e\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 0x400C418940000000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 0x4014E4B4BAC89311)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double 0x4018EFDB2E503F96)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double 0x4014E4B4BAC89311)
ret i32 0
}