#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 *, float);
int main() {
  float num = 23.123456789023;
  printf("num: %f \n", num);
  printf("num: %.1f \n", num);
  printf("num: %.3f \n", num);
  printf("num: %.4f \n", num);
  printf("num: %.5f \n", num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xed9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeec(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
movss  0xecc(%rip),%xmm0
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
movss  0xeb8(%rip),%xmm0
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
movss  0xea4(%rip),%xmm0
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
movss  0xe90(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"num: %f \0A\00"
@.str.1 = [12 x i8] c"num: %.1f \0A\00"
@.str.2 = [12 x i8] c"num: %.3f \0A\00"
@.str.3 = [12 x i8] c"num: %.4f \0A\00"
@.str.4 = [12 x i8] c"num: %.5f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
store float 0x40371F9AE0000000, float* %2
%3 = load float, float* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), float %3)
%5 = load float, float* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float %5)
%7 = load float, float* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), float %7)
%9 = load float, float* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), float %9)
%11 = load float, float* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), float %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"num: %f \0A\00"
@.str.1 = [12 x i8] c"num: %.1f \0A\00"
@.str.2 = [12 x i8] c"num: %.3f \0A\00"
@.str.3 = [12 x i8] c"num: %.4f \0A\00"
@.str.4 = [12 x i8] c"num: %.5f \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), float 0x40371F9AE0000000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float 0x40371F9AE0000000)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), float 0x40371F9AE0000000)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), float 0x40371F9AE0000000)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), float 0x40371F9AE0000000)
ret i32 0
}