#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 *, int, float);
int main(void) {
  float f = 3.1415926;
  for (int i = 0; i <= 9; i++) {
    printf("%.*g\n", i, f);
  }
  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)
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jg     115f <main+0x4f>
mov    -0xc(%rbp),%esi
movss  -0x8(%rbp),%xmm0
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <main+0x23>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeec(%rip),%rbx
movss  0xee0(%rip),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
movss  0xec6(%rip),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
movss  0xeb1(%rip),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
movss  0xe9c(%rip),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
movss  0xe87(%rip),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
movss  0xe72(%rip),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
movss  0xe5d(%rip),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
movss  0xe48(%rip),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
movss  0xe33(%rip),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
movss  0xe1e(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.*g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
store i32 0, i32* %1
store float 0x400921FB40000000, float* %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 9
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load float, float* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8, float %9)
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
ret i32 0
}

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