#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 DBL_EPSILON;
int /*<<< orphan*/ log(double);
double pow(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  double ct_a = 2 + (16640030.0 / 1.e8);
  double y0 = ct_a - 1;
  double yi;
  int i;
  int n;
  printf("a = %lf\n", ct_a);
  printf("epsilon = %+.20e\n", DBL_EPSILON);
  n = 20;
  yi = y0;
  for (i = 1; i <= n; i++) {
    yi = ct_a * pow(log(ct_a), i) - i * yi;
    printf("%3d %+.6e\n", i, yi);
  }
  yi = 0;
  for (i = 39; i >= 0; i--) {
    yi = (ct_a * pow(log(ct_a), i) - yi) / i;
    printf("%3d %+.6e\n", i, yi);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xea7(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvttsd2si -0x10(%rbp),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e6c(%rip),%rax
cvttsd2si (%rax),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x14,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jg     122a <main+0xfa>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
mov    %eax,%edi
mov    -0x24(%rbp),%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
lea    0xe16(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a6 <main+0x76>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x27,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     12bf <main+0x18f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
mov    %eax,%edi
mov    -0x24(%rbp),%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
lea    0xd81(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1239 <main+0x109>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeda(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e97(%rip),%rax
cvttsd2si (%rax),%esi
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
movsd  0xe90(%rip),%xmm0
movsd  0xe90(%rip),%xmm1
lea    0xeb4(%rip),%r14
movsd  %xmm0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm1,0x10(%rsp)
movsd  0xe72(%rip),%xmm0
call   1040 <log@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1050 <pow@plt>
movsd  0x10(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  0xe50(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe1c(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
add    $0x1,%ebx
movsd  0x10(%rsp),%xmm1
cmp    $0x15,%ebx
jne    1190 <main+0x60>
mov    $0x27,%ebx
xorpd  %xmm0,%xmm0
lea    0xe2b(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
movsd  0xdf2(%rip),%xmm0
call   1040 <log@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1050 <pow@plt>
mulsd  0xddc(%rip),%xmm0
subsd  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
add    $0xffffffff,%ebx
jb     1210 <main+0xe0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"a = %lf\0A\00"
@.str.1 = [18 x i8] c"epsilon = %+.20e\0A\00"
@DBL_EPSILON = global double 0.000000e+00
@.str.2 = [11 x i8] c"%3d %+.6e\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store double 0x400154C9AE345B51, double* %2
%7 = load double, double* %2
%8 = fsub double %7, 1.000000e+00
store double %8, double* %3
%9 = load double, double* %2
%10 = fptosi double %9 to i32
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load double, double* @DBL_EPSILON
%13 = fptosi double %12 to i32
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %13)
store i32 20, i32* %6
%15 = load double, double* %3
store double %15, double* %4
store i32 1, i32* %5
br label %16
16: ; preds = %35, %0
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = icmp sle i32 %17, %18
br i1 %19, label %20, label %38
20: ; preds = %16
%21 = load double, double* %2
%22 = load double, double* %2
%23 = call i32 @log(double %22)
%24 = load i32, i32* %5
%25 = call double @pow(i32 %23, i32 %24)
%26 = load i32, i32* %5
%27 = sitofp i32 %26 to double
%28 = load double, double* %4
%29 = fmul double %27, %28
%30 = fneg double %29
%31 = call double @llvm.fmuladd.f64(double %21, double %25, double %30)
store double %31, double* %4
%32 = load i32, i32* %5
%33 = load double, double* %4
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %32, double %33)
br label %35
35: ; preds = %20
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %16
38: ; preds = %16
store double 0.000000e+00, double* %4
store i32 39, i32* %5
br label %39
39: ; preds = %57, %38
%40 = load i32, i32* %5
%41 = icmp sge i32 %40, 0
br i1 %41, label %42, label %60
42: ; preds = %39
%43 = load double, double* %2
%44 = load double, double* %2
%45 = call i32 @log(double %44)
%46 = load i32, i32* %5
%47 = call double @pow(i32 %45, i32 %46)
%48 = load double, double* %4
%49 = fneg double %48
%50 = call double @llvm.fmuladd.f64(double %43, double %47, double %49)
%51 = load i32, i32* %5
%52 = sitofp i32 %51 to double
%53 = fdiv double %50, %52
store double %53, double* %4
%54 = load i32, i32* %5
%55 = load double, double* %4
%56 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %54, double %55)
br label %57
57: ; preds = %42
%58 = load i32, i32* %5
%59 = add nsw i32 %58, -1
store i32 %59, i32* %5
br label %39
60: ; preds = %39
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"a = %lf\0A\00"
@.str.1 = [18 x i8] c"epsilon = %+.20e\0A\00"
@DBL_EPSILON = global double 0.000000e+00
@.str.2 = [11 x i8] c"%3d %+.6e\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 2)
%2 = load double, double* @DBL_EPSILON
%3 = fptosi double %2 to i32
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %5
5: ; preds = %0, %5
%6 = phi double [ 0x3FF2A9935C68B6A2, %0 ], [ %13, %5 ]
%7 = phi i32 [ 1, %0 ], [ %15, %5 ]
%8 = tail call i32 @log(double 0x400154C9AE345B51)
%9 = tail call double @pow(i32 %8, i32 %7)
%10 = sitofp i32 %7 to double
%11 = fneg double %6
%12 = fmul double %11, %10
%13 = tail call double @llvm.fmuladd.f64(double %9, double 0x400154C9AE345B51, double %12)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %7, double %13)
%15 = add nuw nsw i32 %7, 1
%16 = icmp eq i32 %15, 21
br i1 %16, label %17, label %5
17: ; preds = %5, %17
%18 = phi double [ %25, %17 ], [ 0.000000e+00, %5 ]
%19 = phi i32 [ %27, %17 ], [ 39, %5 ]
%20 = tail call i32 @log(double 0x400154C9AE345B51)
%21 = tail call double @pow(i32 %20, i32 %19)
%22 = fneg double %18
%23 = tail call double @llvm.fmuladd.f64(double %21, double 0x400154C9AE345B51, double %22)
%24 = sitofp i32 %19 to double
%25 = fdiv double %23, %24
%26 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %19, double %25)
%27 = add nsw i32 %19, -1
%28 = icmp eq i32 %19, 0
br i1 %28, label %29, label %17
29: ; preds = %17
ret i32 0
}