#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 absd(double);
double cfrac_tan(double, unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int, double, double, double, double,
                          double);
double tan(double);
double taylor_tan(double, unsigned int);
void show_tan_diff_table(double alpha, unsigned int from, unsigned int to) {
  double math_tan_result = tan(alpha);
  for (unsigned int i = from; i <= to; i++) {
    double taylor_tan_result = taylor_tan(alpha, i);
    double cfrac_tan_result = cfrac_tan(alpha, i);
    printf("%d %e %e %e %e %e\n", i, math_tan_result, taylor_tan_result,
           absd(math_tan_result - taylor_tan_result), cfrac_tan_result,
           absd(math_tan_result - cfrac_tan_result));
  }
}


x86 assembly (clang, -O0):
<show_tan_diff_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <tan@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
ja     1223 <show_tan_diff_table+0xd3>
movsd  -0x8(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
call   1030 <taylor_tan@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
call   1060 <cfrac_tan@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x54(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
call   1050 <absd@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
call   1050 <absd@plt>
mov    -0x54(%rbp),%esi
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
movaps %xmm0,%xmm4
movsd  -0x38(%rbp),%xmm0
lea    0xdf0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1178 <show_tan_diff_table+0x28>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_tan_diff_table>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
movsd  %xmm0,0x10(%rsp)
call   1070 <tan@plt>
movsd  %xmm0,0x8(%rsp)
cmp    %ebx,%ebp
ja     11fb <show_tan_diff_table+0xab>
lea    0xe84(%rip),%r14
nopl   0x0(%rax)
movsd  0x10(%rsp),%xmm0
mov    %ebp,%edi
call   1030 <taylor_tan@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
mov    %ebp,%edi
call   1060 <cfrac_tan@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
call   1050 <absd@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
call   1050 <absd@plt>
movapd %xmm0,%xmm4
mov    %r14,%rdi
mov    %ebp,%esi
movsd  0x8(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebx,%ebp
jbe    1180 <show_tan_diff_table+0x30>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"%d %e %e %e %e %e\0A\00"
define void @show_tan_diff_table(double %0, i32 %1, i32 %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca double
%10 = alloca double
store double %0, double* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load double, double* %4
%12 = call double @tan(double %11)
store double %12, double* %7
%13 = load i32, i32* %5
store i32 %13, i32* %8
br label %14
14: ; preds = %38, %3
%15 = load i32, i32* %8
%16 = load i32, i32* %6
%17 = icmp ule i32 %15, %16
br i1 %17, label %18, label %41
18: ; preds = %14
%19 = load double, double* %4
%20 = load i32, i32* %8
%21 = call double @taylor_tan(double %19, i32 %20)
store double %21, double* %9
%22 = load double, double* %4
%23 = load i32, i32* %8
%24 = call double @cfrac_tan(double %22, i32 %23)
store double %24, double* %10
%25 = load i32, i32* %8
%26 = load double, double* %7
%27 = load double, double* %9
%28 = load double, double* %7
%29 = load double, double* %9
%30 = fsub double %28, %29
%31 = call double @absd(double %30)
%32 = load double, double* %10
%33 = load double, double* %7
%34 = load double, double* %10
%35 = fsub double %33, %34
%36 = call double @absd(double %35)
%37 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %25, double %26, double %27, double %31, double %32, double %36)
br label %38
38: ; preds = %18
%39 = load i32, i32* %8
%40 = add i32 %39, 1
store i32 %40, i32* %8
br label %14
41: ; preds = %14
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"%d %e %e %e %e %e\0A\00"
define void @show_tan_diff_table(double %0, i32 %1, i32 %2) {
%4 = tail call double @tan(double %0)
%5 = icmp ugt i32 %1, %2
br i1 %5, label %6, label %7
6: ; preds = %7, %3
ret void
7: ; preds = %3, %7
%8 = phi i32 [ %16, %7 ], [ %1, %3 ]
%9 = tail call double @taylor_tan(double %0, i32 %8)
%10 = tail call double @cfrac_tan(double %0, i32 %8)
%11 = fsub double %4, %9
%12 = tail call double @absd(double %11)
%13 = fsub double %4, %10
%14 = tail call double @absd(double %13)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %8, double %4, double %9, double %12, double %10, double %14)
%16 = add i32 %8, 1
%17 = icmp ugt i32 %16, %2
br i1 %17, label %6, label %7
}