#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 /*<<< orphan*/ test_fp_fmt(char *, double);
void test_fp_val(double val) {
  printf("\n123456789012345678901234567890"
         "123456789012345678901234567890\n");
  test_fp_fmt("%e", val);
  test_fp_fmt("%30.15e.", val);
  test_fp_fmt("%-30.15e.", val);
  test_fp_fmt("%f.", val);
  test_fp_fmt("%30.15f.", val);
  test_fp_fmt("%-30.15f.", val);
}


x86 assembly (clang, -O0):
<test_fp_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xefa(%rip),%rdi
call   1030 <test_fp_fmt@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xeec(%rip),%rdi
call   1030 <test_fp_fmt@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xee4(%rip),%rdi
call   1030 <test_fp_fmt@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xedd(%rip),%rdi
call   1030 <test_fp_fmt@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xed0(%rip),%rdi
call   1030 <test_fp_fmt@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xec8(%rip),%rdi
call   1030 <test_fp_fmt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fp_val>:
push   %rax
movsd  %xmm0,(%rsp)
lea    0xf00(%rip),%rdi
call   1040 <puts@plt>
lea    0xec7(%rip),%rdi
movsd  (%rsp),%xmm0
call   1030 <test_fp_fmt@plt>
lea    0xeb9(%rip),%rdi
movsd  (%rsp),%xmm0
call   1030 <test_fp_fmt@plt>
lea    0xeb1(%rip),%rdi
movsd  (%rsp),%xmm0
call   1030 <test_fp_fmt@plt>
lea    0xeaa(%rip),%rdi
movsd  (%rsp),%xmm0
call   1030 <test_fp_fmt@plt>
lea    0xe9d(%rip),%rdi
movsd  (%rsp),%xmm0
call   1030 <test_fp_fmt@plt>
lea    0xe95(%rip),%rdi
movsd  (%rsp),%xmm0
pop    %rax
jmp    1030 <test_fp_fmt@plt>

LLVM IR (-O0):
@.str = [63 x i8] c"\0A123456789012345678901234567890123456789012345678901234567890\0A\00"
@.str.1 = [3 x i8] c"%e\00"
@.str.2 = [9 x i8] c"%30.15e.\00"
@.str.3 = [10 x i8] c"%-30.15e.\00"
@.str.4 = [4 x i8] c"%f.\00"
@.str.5 = [9 x i8] c"%30.15f.\00"
@.str.6 = [10 x i8] c"%-30.15f.\00"
define void @test_fp_val(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%4 = load double, double* %2
%5 = call i32 @test_fp_fmt(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = load double, double* %2
%7 = call i32 @test_fp_fmt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %6)
%8 = load double, double* %2
%9 = call i32 @test_fp_fmt(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %8)
%10 = load double, double* %2
%11 = call i32 @test_fp_fmt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %10)
%12 = load double, double* %2
%13 = call i32 @test_fp_fmt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), double %12)
%14 = load double, double* %2
%15 = call i32 @test_fp_fmt(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %14)
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%e\00"
@.str.2 = [9 x i8] c"%30.15e.\00"
@.str.3 = [10 x i8] c"%-30.15e.\00"
@.str.4 = [4 x i8] c"%f.\00"
@.str.5 = [9 x i8] c"%30.15f.\00"
@.str.6 = [10 x i8] c"%-30.15f.\00"
@str = [62 x i8] c"\0A123456789012345678901234567890123456789012345678901234567890\00"
define void @test_fp_val(double %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @test_fp_fmt(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %0)
%4 = tail call i32 @test_fp_fmt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %0)
%5 = tail call i32 @test_fp_fmt(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %0)
%6 = tail call i32 @test_fp_fmt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %0)
%7 = tail call i32 @test_fp_fmt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), double %0)
%8 = tail call i32 @test_fp_fmt(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %0)
ret void
}