#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 cfrac_tan(double, int);
double my_fabs(double);
int /*<<< orphan*/ printf(char *, int, double, double, double, double, double);
double tan(double);
double taylor_tan(double, int);
void tan_task(double rads, int it_b, int it_e) {
  double tan_r, tay_r, cf_r;
  tan_r = tan(rads);
  for (; it_b <= it_e; it_b++) {
    tay_r = taylor_tan(rads, it_b);
    cf_r = cfrac_tan(rads, it_b);
    printf("%d %e %e %e %e %e\n", it_b, tan_r, tay_r, my_fabs(tan_r - tay_r),
           cf_r, my_fabs(tan_r - cf_r));
  }
  return;
}


x86 assembly (clang, -O0):
<tan_task>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <tan@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     121d <tan_task+0xcd>
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <taylor_tan@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1050 <cfrac_tan@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
call   1070 <my_fabs@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
call   1070 <my_fabs@plt>
mov    -0x4c(%rbp),%esi
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
movaps %xmm0,%xmm4
movsd  -0x30(%rbp),%xmm0
lea    0xdf6(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1172 <tan_task+0x22>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tan_task>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
movsd  %xmm0,0x10(%rsp)
call   1060 <tan@plt>
movsd  %xmm0,0x8(%rsp)
cmp    %ebx,%ebp
jg     11fb <tan_task+0xab>
add    $0x1,%ebx
lea    0xe81(%rip),%r14
nop
movsd  0x10(%rsp),%xmm0
mov    %ebp,%edi
call   1030 <taylor_tan@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
mov    %ebp,%edi
call   1050 <cfrac_tan@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
call   1070 <my_fabs@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
call   1070 <my_fabs@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    %ebp,%ebx
jne    1180 <tan_task+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 @tan_task(double %0, i32 %1, i32 %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load double, double* %4
%11 = call double @tan(double %10)
store double %11, double* %7
br label %12
12: ; preds = %36, %3
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %39
16: ; preds = %12
%17 = load double, double* %4
%18 = load i32, i32* %5
%19 = call double @taylor_tan(double %17, i32 %18)
store double %19, double* %8
%20 = load double, double* %4
%21 = load i32, i32* %5
%22 = call double @cfrac_tan(double %20, i32 %21)
store double %22, double* %9
%23 = load i32, i32* %5
%24 = load double, double* %7
%25 = load double, double* %8
%26 = load double, double* %7
%27 = load double, double* %8
%28 = fsub double %26, %27
%29 = call double @my_fabs(double %28)
%30 = load double, double* %9
%31 = load double, double* %7
%32 = load double, double* %9
%33 = fsub double %31, %32
%34 = call double @my_fabs(double %33)
%35 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %23, double %24, double %25, double %29, double %30, double %34)
br label %36
36: ; preds = %16
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %12
39: ; preds = %12
ret void
}

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