#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);
void format_number(void) {
  double n = 123.123;
  printf("d %d\n", n);
  printf("i %i\n", n);
  printf("f %f\n", n);
  printf("e %e\n", n);
  printf("g %g\n", n);
  printf("o %o\n", n);
  printf("x %x\n", n);
  printf("p %p\n", n);
  printf(".7 %.7f\n", n);
  printf(".2 %.2f\n", n);
}


x86 assembly (clang, -O0):
<format_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xee0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_number>:
push   %rax
lea    0xef0(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
movsd  0xecc(%rip),%xmm0
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
movsd  0xeb8(%rip),%xmm0
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
movsd  0xea4(%rip),%xmm0
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
movsd  0xe90(%rip),%xmm0
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
movsd  0xe7c(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
movsd  0xe68(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
movsd  0xe54(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
movsd  0xe40(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
movsd  0xe2c(%rip),%xmm0
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"d %d\0A\00"
@.str.1 = [6 x i8] c"i %i\0A\00"
@.str.2 = [6 x i8] c"f %f\0A\00"
@.str.3 = [6 x i8] c"e %e\0A\00"
@.str.4 = [6 x i8] c"g %g\0A\00"
@.str.5 = [6 x i8] c"o %o\0A\00"
@.str.6 = [6 x i8] c"x %x\0A\00"
@.str.7 = [6 x i8] c"p %p\0A\00"
@.str.8 = [9 x i8] c".7 %.7f\0A\00"
@.str.9 = [9 x i8] c".2 %.2f\0A\00"
define void @format_number() {
%1 = alloca double
store double 1.231230e+02, double* %1
%2 = load double, double* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %2)
%4 = load double, double* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = load double, double* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %6)
%8 = load double, double* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %8)
%10 = load double, double* %1
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double %10)
%12 = load double, double* %1
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %12)
%14 = load double, double* %1
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), double %14)
%16 = load double, double* %1
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), double %16)
%18 = load double, double* %1
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), double %18)
%20 = load double, double* %1
%21 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), double %20)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"d %d\0A\00"
@.str.1 = [6 x i8] c"i %i\0A\00"
@.str.2 = [6 x i8] c"f %f\0A\00"
@.str.3 = [6 x i8] c"e %e\0A\00"
@.str.4 = [6 x i8] c"g %g\0A\00"
@.str.5 = [6 x i8] c"o %o\0A\00"
@.str.6 = [6 x i8] c"x %x\0A\00"
@.str.7 = [6 x i8] c"p %p\0A\00"
@.str.8 = [9 x i8] c".7 %.7f\0A\00"
@.str.9 = [9 x i8] c".2 %.2f\0A\00"
define void @format_number() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double 1.231230e+02)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double 1.231230e+02)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double 1.231230e+02)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 1.231230e+02)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double 1.231230e+02)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double 1.231230e+02)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), double 1.231230e+02)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), double 1.231230e+02)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), double 1.231230e+02)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), double 1.231230e+02)
ret void
}