#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);
int /*<<< orphan*/ test_fp_fmt(char *, double);
int /*<<< orphan*/ test_fp_val(double);
void test_fp(void) {
  double d;
  printf("one half is %e\n", 0.5);
  printf("one half is %f\n", 0.5);
  printf("one third is %e\n", 1.0 / 3.0);
  printf("one third is %f\n", 1.0 / 3.0);
  test_fp_val(0.0);
  test_fp_fmt("%.500e", 1.0);
  d = 1.234567e+10;
  test_fp_val(d);
  test_fp_val(-d);
  d = 1.234567e308;
  test_fp_val(d);
  test_fp_val(-d);
  d = 1.234567e-307;
  test_fp_val(d);
  test_fp_val(-d);
  d = 1.234567e-310;
  test_fp_val(d);
  test_fp_val(-d);
}


x86 assembly (clang, -O0):
<test_fp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xef9(%rip),%rdi
movsd  0xee9(%rip),%xmm0
call   1050 <printf@plt>
lea    0xef5(%rip),%rdi
movsd  0xed5(%rip),%xmm0
call   1050 <printf@plt>
lea    0xef1(%rip),%rdi
movsd  0xeb9(%rip),%xmm0
call   1050 <printf@plt>
lea    0xeee(%rip),%rdi
movsd  0xea5(%rip),%xmm0
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
call   1040 <test_fp_val@plt>
lea    0xee3(%rip),%rdi
movsd  0xe81(%rip),%xmm0
call   1030 <test_fp_fmt@plt>
movsd  0xe6c(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <test_fp_val@plt>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <test_fp_val@plt>
movsd  0xe2c(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <test_fp_val@plt>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <test_fp_val@plt>
movsd  0xdec(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <test_fp_val@plt>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <test_fp_val@plt>
movsd  0xdac(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <test_fp_val@plt>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <test_fp_val@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fp>:
push   %rax
lea    0xf20(%rip),%rdi
movsd  0xec0(%rip),%xmm0
call   1050 <printf@plt>
lea    0xf1c(%rip),%rdi
movsd  0xeac(%rip),%xmm0
call   1050 <printf@plt>
lea    0xf18(%rip),%rdi
movsd  0xea0(%rip),%xmm0
call   1050 <printf@plt>
lea    0xf15(%rip),%rdi
movsd  0xe8c(%rip),%xmm0
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
call   1040 <test_fp_val@plt>
lea    0xf0a(%rip),%rdi
movsd  0xe78(%rip),%xmm0
call   1030 <test_fp_fmt@plt>
movsd  0xe73(%rip),%xmm0
call   1040 <test_fp_val@plt>
movsd  0xe6e(%rip),%xmm0
call   1040 <test_fp_val@plt>
movsd  0xe69(%rip),%xmm0
call   1040 <test_fp_val@plt>
movsd  0xe64(%rip),%xmm0
call   1040 <test_fp_val@plt>
movsd  0xe5f(%rip),%xmm0
call   1040 <test_fp_val@plt>
movsd  0xe5a(%rip),%xmm0
call   1040 <test_fp_val@plt>
movsd  0xe55(%rip),%xmm0
call   1040 <test_fp_val@plt>
movsd  0xe50(%rip),%xmm0
pop    %rax
jmp    1040 <test_fp_val@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"one half is %e\0A\00"
@.str.1 = [16 x i8] c"one half is %f\0A\00"
@.str.2 = [17 x i8] c"one third is %e\0A\00"
@.str.3 = [17 x i8] c"one third is %f\0A\00"
@.str.4 = [7 x i8] c"%.500e\00"
define void @test_fp() {
%1 = alloca double
%2 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double 5.000000e-01)
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double 5.000000e-01)
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double 0x3FD5555555555555)
%5 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double 0x3FD5555555555555)
%6 = call i32 @test_fp_val(double 0.000000e+00)
%7 = call i32 @test_fp_fmt(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double 1.000000e+00)
store double 0x4206FEDFCB800000, double* %1
%8 = load double, double* %1
%9 = call i32 @test_fp_val(double %8)
%10 = load double, double* %1
%11 = fneg double %10
%12 = call i32 @test_fp_val(double %11)
store double 0x7FE5F9DC950686AA, double* %1
%13 = load double, double* %1
%14 = call i32 @test_fp_val(double %13)
%15 = load double, double* %1
%16 = fneg double %15
%17 = call i32 @test_fp_val(double %16)
store double 0x3631980A5FBDFC, double* %1
%18 = load double, double* %1
%19 = call i32 @test_fp_val(double %18)
%20 = load double, double* %1
%21 = fneg double %20
%22 = call i32 @test_fp_val(double %21)
store double 0x16B9F3C0E51D, double* %1
%23 = load double, double* %1
%24 = call i32 @test_fp_val(double %23)
%25 = load double, double* %1
%26 = fneg double %25
%27 = call i32 @test_fp_val(double %26)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"one half is %e\0A\00"
@.str.1 = [16 x i8] c"one half is %f\0A\00"
@.str.2 = [17 x i8] c"one third is %e\0A\00"
@.str.3 = [17 x i8] c"one third is %f\0A\00"
@.str.4 = [7 x i8] c"%.500e\00"
define void @test_fp() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double 5.000000e-01)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double 5.000000e-01)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double 0x3FD5555555555555)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double 0x3FD5555555555555)
%5 = tail call i32 @test_fp_val(double 0.000000e+00)
%6 = tail call i32 @test_fp_fmt(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double 1.000000e+00)
%7 = tail call i32 @test_fp_val(double 0x4206FEDFCB800000)
%8 = tail call i32 @test_fp_val(double 0xC206FEDFCB800000)
%9 = tail call i32 @test_fp_val(double 0x7FE5F9DC950686AA)
%10 = tail call i32 @test_fp_val(double 0xFFE5F9DC950686AA)
%11 = tail call i32 @test_fp_val(double 0x3631980A5FBDFC)
%12 = tail call i32 @test_fp_val(double 0x803631980A5FBDFC)
%13 = tail call i32 @test_fp_val(double 0x16B9F3C0E51D)
%14 = tail call i32 @test_fp_val(double 0x800016B9F3C0E51D)
ret void
}