#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() {
  double num = 9876.12345;
  printf("Precision 1: %0.1lg\n", num);
  printf("Precision 2: %0.2lg\n", num);
  printf("Precision 3: %0.3lg\n", num);
  printf("Precision 4: %0.4lg\n", num);
  printf("Precision 5: %0.5lg\n", num);
  printf("Precision 6: %0.6lg\n", num);
  printf("Precision 7: %0.7lg\n", num);
  printf("Precision 8: %0.8lg\n", num);
  printf("Precision 9: %0.9lg\n", num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xee4(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xef0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
movsd  0xecc(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
movsd  0xeb8(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
movsd  0xea4(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
movsd  0xe90(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
movsd  0xe7c(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
movsd  0xe68(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
movsd  0xe54(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
movsd  0xe40(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Precision 1: %0.1lg\0A\00"
@.str.1 = [21 x i8] c"Precision 2: %0.2lg\0A\00"
@.str.2 = [21 x i8] c"Precision 3: %0.3lg\0A\00"
@.str.3 = [21 x i8] c"Precision 4: %0.4lg\0A\00"
@.str.4 = [21 x i8] c"Precision 5: %0.5lg\0A\00"
@.str.5 = [21 x i8] c"Precision 6: %0.6lg\0A\00"
@.str.6 = [21 x i8] c"Precision 7: %0.7lg\0A\00"
@.str.7 = [21 x i8] c"Precision 8: %0.8lg\0A\00"
@.str.8 = [21 x i8] c"Precision 9: %0.9lg\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store double 0x40C34A0FCD35A858, double* %2
%3 = load double, double* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double %3)
%5 = load double, double* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), double %5)
%7 = load double, double* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %7)
%9 = load double, double* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), double %9)
%11 = load double, double* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %11)
%13 = load double, double* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %13)
%15 = load double, double* %2
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double %15)
%17 = load double, double* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), double %17)
%19 = load double, double* %2
%20 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), double %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Precision 1: %0.1lg\0A\00"
@.str.1 = [21 x i8] c"Precision 2: %0.2lg\0A\00"
@.str.2 = [21 x i8] c"Precision 3: %0.3lg\0A\00"
@.str.3 = [21 x i8] c"Precision 4: %0.4lg\0A\00"
@.str.4 = [21 x i8] c"Precision 5: %0.5lg\0A\00"
@.str.5 = [21 x i8] c"Precision 6: %0.6lg\0A\00"
@.str.6 = [21 x i8] c"Precision 7: %0.7lg\0A\00"
@.str.7 = [21 x i8] c"Precision 8: %0.8lg\0A\00"
@.str.8 = [21 x i8] c"Precision 9: %0.9lg\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double 0x40C34A0FCD35A858)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), double 0x40C34A0FCD35A858)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double 0x40C34A0FCD35A858)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), double 0x40C34A0FCD35A858)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double 0x40C34A0FCD35A858)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double 0x40C34A0FCD35A858)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double 0x40C34A0FCD35A858)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), double 0x40C34A0FCD35A858)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), double 0x40C34A0FCD35A858)
ret i32 0
}