#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 DBL_DIG;
int FLT_DIG;
int /*<<< orphan*/ printf(char *, double, float);
int main() {
  double a = 1.0 / 3.0;
  float b = 1.0 / 3.0;
  printf("FLT_DIG = %d, DBL_DIG = %d.\n", FLT_DIG, DBL_DIG);
  printf("double = %.6f, float = %.6f\n", a, b);
  printf("double = %.12f, float = %.12f\n", a, b);
  printf("double = %.18f, float = %.18f\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    0x2eb8(%rip),%rax
cvtsi2sdl (%rax),%xmm0
mov    0x2e95(%rip),%rax
cvtsi2ssl (%rax),%xmm1
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ee0(%rip),%rax
cvtsi2sdl (%rax),%xmm0
mov    0x2ebd(%rip),%rax
cvtsi2ssl (%rax),%xmm1
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
movsd  0xebe(%rip),%xmm0
movss  0xebe(%rip),%xmm1
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
movsd  0xea2(%rip),%xmm0
movss  0xea2(%rip),%xmm1
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
movsd  0xe86(%rip),%xmm0
movss  0xe86(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"FLT_DIG = %d, DBL_DIG = %d.\0A\00"
@FLT_DIG = global i32 0
@DBL_DIG = global i32 0
@.str.1 = [29 x i8] c"double = %.6f, float = %.6f\0A\00"
@.str.2 = [31 x i8] c"double = %.12f, float = %.12f\0A\00"
@.str.3 = [31 x i8] c"double = %.18f, float = %.18f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca float
store i32 0, i32* %1
store double 0x3FD5555555555555, double* %2
store float 0x3FD5555560000000, float* %3
%4 = load i32, i32* @FLT_DIG
%5 = sitofp i32 %4 to double
%6 = load i32, i32* @DBL_DIG
%7 = sitofp i32 %6 to float
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %5, float %7)
%9 = load double, double* %2
%10 = load float, float* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), double %9, float %10)
%12 = load double, double* %2
%13 = load float, float* %3
%14 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), double %12, float %13)
%15 = load double, double* %2
%16 = load float, float* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), double %15, float %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"FLT_DIG = %d, DBL_DIG = %d.\0A\00"
@FLT_DIG = global i32 0
@DBL_DIG = global i32 0
@.str.1 = [29 x i8] c"double = %.6f, float = %.6f\0A\00"
@.str.2 = [31 x i8] c"double = %.12f, float = %.12f\0A\00"
@.str.3 = [31 x i8] c"double = %.18f, float = %.18f\0A\00"
define i32 @main() {
%1 = load i32, i32* @FLT_DIG
%2 = sitofp i32 %1 to double
%3 = load i32, i32* @DBL_DIG
%4 = sitofp i32 %3 to float
%5 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %2, float %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), double 0x3FD5555555555555, float 0x3FD5555560000000)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), double 0x3FD5555555555555, float 0x3FD5555560000000)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), double 0x3FD5555555555555, float 0x3FD5555560000000)
ret i32 0
}