#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 main(void) {
  float pi = 113.14159f;
  printf("Testing the formatting of printf\n");
  printf("Original question from quiz\n");
  printf("Value of pi is : %d, %f, %1.2f, %1.4f\n", (int)pi, pi, pi, pi);
  printf("The test !!!\n");
  printf("Value of pi is : %d, %f, %.2f, %.4f\n", (int)pi, pi, pi, pi);
  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)
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvttss2si -0x8(%rbp),%esi
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x8(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xed4(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvttss2si -0x8(%rbp),%esi
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x8(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xecd(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf2c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf41(%rip),%rdi
call   1030 <puts@plt>
lea    0xec8(%rip),%rdi
movsd  0xeb8(%rip),%xmm0
mov    $0x71,%esi
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xf30(%rip),%rdi
call   1030 <puts@plt>
lea    0xec2(%rip),%rdi
mov    $0x71,%esi
movsd  0xe86(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Testing the formatting of printf\0A\00"
@.str.1 = [29 x i8] c"Original question from quiz\0A\00"
@.str.2 = [39 x i8] c"Value of pi is : %d, %f, %1.2f, %1.4f\0A\00"
@.str.3 = [14 x i8] c"The test !!!\0A\00"
@.str.4 = [37 x i8] c"Value of pi is : %d, %f, %.2f, %.4f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
store float 0x405C490FC0000000, float* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%5 = load float, float* %2
%6 = fptosi float %5 to i32
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = load float, float* %2
%10 = fpext float %9 to double
%11 = load float, float* %2
%12 = fpext float %11 to double
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %6, double %8, double %10, double %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%15 = load float, float* %2
%16 = fptosi float %15 to i32
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = load float, float* %2
%20 = fpext float %19 to double
%21 = load float, float* %2
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 %16, double %18, double %20, double %22)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [39 x i8] c"Value of pi is : %d, %f, %1.2f, %1.4f\0A\00"
@.str.4 = [37 x i8] c"Value of pi is : %d, %f, %.2f, %.4f\0A\00"
@str = [33 x i8] c"Testing the formatting of printf\00"
@str.5 = [28 x i8] c"Original question from quiz\00"
@str.6 = [13 x i8] c"The test !!!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 113, double 0x405C490FC0000000, double 0x405C490FC0000000, double 0x405C490FC0000000)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.6, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 113, double 0x405C490FC0000000, double 0x405C490FC0000000, double 0x405C490FC0000000)
ret i32 0
}