#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 */
double fa_fast_log2(float);
float fa_fast_sqrtf(float);
int /*<<< orphan*/ fa_logtab_init();
float fabs(float);
float log(float);
float log10(float);
int /*<<< orphan*/ printf(char *, float, float, float);
float sqrtf(float);
int main() {
  float x;
  float y1, y2, dy;
  float y_sin, y_cos, y_tan;
  float y_arcsin, y_arccos, y_arctan;
  float y_sin_true, y_cos_true;
  float sita_true, sita;
  float delta;
  x = 487324.718;
  fa_logtab_init();
  y1 = log(x);
  y2 = (fa_fast_log2(x) * (0.69314718055994530942));
  dy = fabs(y2 - y1);
  printf("log:  y1=%f, y2=%f, dy=%f\n", y1, y2, dy);
  y1 = log10(x);
  y2 =
      (fa_fast_log2(x) * ((0.69314718055994530942) / (2.30258509299404568402)));
  dy = fabs(y2 - y1);
  printf("log10:  y1=%f, y2=%f, dy=%f\n", y1, y2, dy);
  y1 = sqrtf(x);
  y2 = (fa_fast_sqrtf(x));
  dy = fabs(y2 - y1);
  printf("sqrtf:  y1=%f, y2=%f, dy=%f\n", y1, y2, dy);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  0xe80(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <fa_logtab_init@plt>
movss  -0x4(%rbp),%xmm0
call   1080 <log@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1070 <fa_fast_log2@plt>
movsd  0xe4b(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
call   1050 <fabs@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
lea    0xe20(%rip),%rdi
call   1040 <printf@plt>
movss  -0x4(%rbp),%xmm0
call   1090 <log10@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1070 <fa_fast_log2@plt>
movsd  0xde6(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
call   1050 <fabs@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
lea    0xdde(%rip),%rdi
call   1040 <printf@plt>
movss  -0x4(%rbp),%xmm0
call   1060 <sqrtf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   10a0 <fa_fast_sqrtf@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
call   1050 <fabs@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
lea    0xdae(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <fa_logtab_init@plt>
movss  0xeb0(%rip),%xmm0
call   1050 <fa_fast_log2@plt>
mulsd  0xec3(%rip),%xmm0
cvtsd2ss %xmm0,%xmm1
movss  0xe9b(%rip),%xmm2
addss  %xmm1,%xmm2
andps  0xebc(%rip),%xmm2
lea    0xec5(%rip),%rdi
movss  0xe85(%rip),%xmm0
call   1040 <printf@plt>
movss  0xe70(%rip),%xmm0
call   1050 <fa_fast_log2@plt>
mulsd  0xe8b(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  0xe60(%rip),%xmm2
addss  %xmm1,%xmm2
andps  0xe79(%rip),%xmm2
lea    0xe9d(%rip),%rdi
movss  0xe4a(%rip),%xmm0
call   1040 <printf@plt>
movss  0xe2d(%rip),%xmm0
call   1060 <fa_fast_sqrtf@plt>
movaps %xmm0,%xmm1
movss  0xe31(%rip),%xmm2
addss  %xmm0,%xmm2
andps  0xe42(%rip),%xmm2
lea    0xe83(%rip),%rdi
movss  0xe1b(%rip),%xmm0
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"log: y1=%f, y2=%f, dy=%f\0A\00"
@.str.1 = [29 x i8] c"log10: y1=%f, y2=%f, dy=%f\0A\00"
@.str.2 = [29 x i8] c"sqrtf: y1=%f, y2=%f, dy=%f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
store float 0x411DBE72E0000000, float* %1
%16 = call i32 (...) @fa_logtab_init()
%17 = load float, float* %1
%18 = call float @log(float %17)
store float %18, float* %2
%19 = load float, float* %1
%20 = call double @fa_fast_log2(float %19)
%21 = fmul double %20, 0x3FE62E42FEFA39EF
%22 = fptrunc double %21 to float
store float %22, float* %3
%23 = load float, float* %3
%24 = load float, float* %2
%25 = fsub float %23, %24
%26 = call float @fabs(float %25)
store float %26, float* %4
%27 = load float, float* %2
%28 = load float, float* %3
%29 = load float, float* %4
%30 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), float %27, float %28, float %29)
%31 = load float, float* %1
%32 = call float @log10(float %31)
store float %32, float* %2
%33 = load float, float* %1
%34 = call double @fa_fast_log2(float %33)
%35 = fmul double %34, 0x3FD34413509F79FE
%36 = fptrunc double %35 to float
store float %36, float* %3
%37 = load float, float* %3
%38 = load float, float* %2
%39 = fsub float %37, %38
%40 = call float @fabs(float %39)
store float %40, float* %4
%41 = load float, float* %2
%42 = load float, float* %3
%43 = load float, float* %4
%44 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), float %41, float %42, float %43)
%45 = load float, float* %1
%46 = call float @sqrtf(float %45)
store float %46, float* %2
%47 = load float, float* %1
%48 = call float @fa_fast_sqrtf(float %47)
store float %48, float* %3
%49 = load float, float* %3
%50 = load float, float* %2
%51 = fsub float %49, %50
%52 = call float @fabs(float %51)
store float %52, float* %4
%53 = load float, float* %2
%54 = load float, float* %3
%55 = load float, float* %4
%56 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), float %53, float %54, float %55)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"log: y1=%f, y2=%f, dy=%f\0A\00"
@.str.1 = [29 x i8] c"log10: y1=%f, y2=%f, dy=%f\0A\00"
@.str.2 = [29 x i8] c"sqrtf: y1=%f, y2=%f, dy=%f\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @fa_logtab_init()
%2 = tail call double @fa_fast_log2(float 0x411DBE72E0000000)
%3 = fmul double %2, 0x3FE62E42FEFA39EF
%4 = fptrunc double %3 to float
%5 = fadd float %4, 0xC02A3180E0000000
%6 = tail call float @llvm.fabs.f32(float %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), float 0x402A3180E0000000, float %4, float %6)
%8 = tail call double @fa_fast_log2(float 0x411DBE72E0000000)
%9 = fmul double %8, 0x3FD34413509F79FE
%10 = fptrunc double %9 to float
%11 = fadd float %10, 0xC016C05380000000
%12 = tail call float @llvm.fabs.f32(float %11)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), float 0x4016C05380000000, float %10, float %12)
%14 = tail call float @fa_fast_sqrtf(float 0x411DBE72E0000000)
%15 = fadd float %14, 0xC085D0B120000000
%16 = tail call float @llvm.fabs.f32(float %15)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), float 0x4085D0B120000000, float %14, float %16)
ret i32 0
}