#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(void) {
  double d = .3;
  double df = .3f;
  float f = .3;
  float ff = .3f;
  printf("%.40f\n", d);
  printf("%.40f\n", df);
  printf("%.40f\n", f);
  printf("%.40f\n", ff);
  printf(".3 (float)  * 3.1 (float)  = %.40f\n", f * 3.1f);
  printf(".3 (float)  * 3.1 (double) = %.40f\n", f * 3.1);
  printf(".3 (double) * 3.1 (double) = %.40f\n", 0.3 * 3.1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  0xef8(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  0xeea(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xedd(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
movss  0xe80(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe42(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
movsd  0xe1b(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf2d(%rip),%rbx
movsd  0xee0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xed8(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xec5(%rip),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xeb5(%rip),%xmm0
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
movsd  0xea9(%rip),%xmm0
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
movsd  0xe9d(%rip),%xmm0
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
movsd  0xe91(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%.40f\0A\00"
@.str.1 = [36 x i8] c".3 (float) * 3.1 (float) = %.40f\0A\00"
@.str.2 = [36 x i8] c".3 (float) * 3.1 (double) = %.40f\0A\00"
@.str.3 = [36 x i8] c".3 (double) * 3.1 (double) = %.40f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca float
%4 = alloca float
store double 3.000000e-01, double* %1
store double 0x3FD3333340000000, double* %2
store float 0x3FD3333340000000, float* %3
store float 0x3FD3333340000000, float* %4
%5 = load double, double* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %5)
%7 = load double, double* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %7)
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %10)
%12 = load float, float* %4
%13 = fpext float %12 to double
%14 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %13)
%15 = load float, float* %3
%16 = fmul float %15, 0x4008CCCCC0000000
%17 = fpext float %16 to double
%18 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), double %17)
%19 = load float, float* %3
%20 = fpext float %19 to double
%21 = fmul double %20, 3.100000e+00
%22 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double 0x3FEDC28F5C28F5C2)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.40f\0A\00"
@.str.1 = [36 x i8] c".3 (float) * 3.1 (float) = %.40f\0A\00"
@.str.2 = [36 x i8] c".3 (float) * 3.1 (double) = %.40f\0A\00"
@.str.3 = [36 x i8] c".3 (double) * 3.1 (double) = %.40f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double 3.000000e-01)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double 0x3FD3333340000000)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double 0x3FD3333340000000)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double 0x3FD3333340000000)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), double 0x3FEDC28F60000000)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double 0x3FEDC28F70000000)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double 0x3FEDC28F5C28F5C2)
ret i32 0
}