#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 log(double);
double my_abs(double);
int /*<<< orphan*/ printf(char *, double, ...);
double taylor_log(double, unsigned int);
void taylor_iter(double min, double max, double eps) {
  unsigned int hodnota_min;
  unsigned int hodnota_max;
  int pravda = 1;
  unsigned int max_interval = 8;
  unsigned int min_interval;
  unsigned int stred;
  while (pravda) {
    if (my_abs(log(min) - taylor_log(min, max_interval)) <= eps)
      pravda = 0;
    else
      max_interval *= 10;
  }
  if (max_interval == 1)
    min_interval = 1;
  else
    min_interval = max_interval / 10;
  stred = (min_interval + max_interval) / 2;
  max_interval = max_interval + min_interval;
  pravda = 1;
  int pom_pravda = 1;
  if (stred - 1 == 0) {
    pravda = 0;
    hodnota_min = 0;
  }
  while (pravda) {
    if (my_abs(log(min) - taylor_log(min, stred)) <= eps)
      pom_pravda = 1;
    else
      pom_pravda = 0;
    if (pom_pravda && (my_abs(log(min) - taylor_log(min, stred - 1)) > eps)) {
      pravda = 0;
      hodnota_min = stred;
      break;
    }
    if (pom_pravda) {
      max_interval = stred;
      stred = stred / 2;
    } else {
      stred = (max_interval + stred) / 2;
    }
    if (stred == 0) {
      pravda = 0;
      hodnota_min = stred;
    }
  }
  pravda = 1;
  max_interval = 1;
  while (pravda) {
    if (my_abs(log(max) - taylor_log(max, max_interval)) > eps)
      pravda = 0;
    else
      max_interval *= 10;
  }
  if (max_interval == 1)
    min_interval = 1;
  else
    min_interval = max_interval / 10;
  pravda = 1;
  stred = (min_interval + max_interval) / 2;
  max_interval = max_interval + min_interval;
  if (stred - 1 == 0) {
    pravda = 0;
    hodnota_max = 0;
  }
  while (pravda) {
    if (my_abs(log(max) - taylor_log(max, stred)) <= eps)
      pom_pravda = 1;
    else
      pom_pravda = 0;
    if (pom_pravda && (my_abs(log(max) - taylor_log(max, stred - 1)) > eps)) {
      pravda = 0;
      hodnota_max = stred;
      break;
    }
    if (pom_pravda) {
      max_interval = stred;
      stred = stred / 2;
    } else {
      stred = (max_interval + stred) / 2;
    }
    if (stred == 0) {
      pravda = 0;
      hodnota_max = stred;
    }
  }
  if (hodnota_min < hodnota_max)
    stred = hodnota_max;
  else
    stred = hodnota_min;
  printf("taylor polynomial iterations = %d\n", stred);
  printf("taylor_log(%g) = %.12g\n", min, taylor_log(min, stred));
  printf("taylor_log(%g) = %.12g\n", max, taylor_log(max, stred));
  return;
}


x86 assembly (clang, -O0):
<taylor_iter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x8,-0x28(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11c9 <taylor_iter+0x89>
movsd  -0x8(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x28(%rbp),%edi
call   1050 <taylor_log@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
call   1030 <my_abs@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11bd <taylor_iter+0x7d>
movl   $0x0,-0x24(%rbp)
jmp    11c4 <taylor_iter+0x84>
imul   $0xa,-0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1168 <taylor_iter+0x28>
cmpl   $0x1,-0x28(%rbp)
jne    11df <taylor_iter+0x9f>
movl   $0x1,-0x2c(%rbp)
jmp    11ee <taylor_iter+0xae>
mov    -0x28(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    -0x28(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x30(%rbp),%eax
sub    $0x1,%eax
cmp    $0x0,%eax
jne    122e <taylor_iter+0xee>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
jmp    1233 <taylor_iter+0xf3>
cmpl   $0x0,-0x24(%rbp)
je     132c <taylor_iter+0x1ec>
movsd  -0x8(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x30(%rbp),%edi
call   1050 <taylor_log@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
call   1030 <my_abs@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1288 <taylor_iter+0x148>
movl   $0x1,-0x34(%rbp)
jmp    128f <taylor_iter+0x14f>
movl   $0x0,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     12e6 <taylor_iter+0x1a6>
movsd  -0x8(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x30(%rbp),%edi
sub    $0x1,%edi
call   1050 <taylor_log@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  %xmm1,%xmm0
call   1030 <my_abs@plt>
ucomisd -0x18(%rbp),%xmm0
jbe    12e6 <taylor_iter+0x1a6>
movl   $0x0,-0x24(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    132c <taylor_iter+0x1ec>
cmpl   $0x0,-0x34(%rbp)
je     1304 <taylor_iter+0x1c4>
mov    -0x30(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1310 <taylor_iter+0x1d0>
mov    -0x28(%rbp),%eax
add    -0x30(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    1327 <taylor_iter+0x1e7>
movl   $0x0,-0x24(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1233 <taylor_iter+0xf3>
movl   $0x1,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1394 <taylor_iter+0x254>
movsd  -0x10(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x28(%rbp),%edi
call   1050 <taylor_log@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
subsd  %xmm1,%xmm0
call   1030 <my_abs@plt>
ucomisd -0x18(%rbp),%xmm0
jbe    1388 <taylor_iter+0x248>
movl   $0x0,-0x24(%rbp)
jmp    138f <taylor_iter+0x24f>
imul   $0xa,-0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    133a <taylor_iter+0x1fa>
cmpl   $0x1,-0x28(%rbp)
jne    13aa <taylor_iter+0x26a>
movl   $0x1,-0x2c(%rbp)
jmp    13b9 <taylor_iter+0x279>
mov    -0x28(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x2c(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x2c(%rbp),%eax
add    -0x28(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%eax
sub    $0x1,%eax
cmp    $0x0,%eax
jne    13f2 <taylor_iter+0x2b2>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
jmp    13f7 <taylor_iter+0x2b7>
cmpl   $0x0,-0x24(%rbp)
je     14f0 <taylor_iter+0x3b0>
movsd  -0x10(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%edi
call   1050 <taylor_log@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
subsd  %xmm1,%xmm0
call   1030 <my_abs@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     144c <taylor_iter+0x30c>
movl   $0x1,-0x34(%rbp)
jmp    1453 <taylor_iter+0x313>
movl   $0x0,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     14aa <taylor_iter+0x36a>
movsd  -0x10(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%edi
sub    $0x1,%edi
call   1050 <taylor_log@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
subsd  %xmm1,%xmm0
call   1030 <my_abs@plt>
ucomisd -0x18(%rbp),%xmm0
jbe    14aa <taylor_iter+0x36a>
movl   $0x0,-0x24(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    14f0 <taylor_iter+0x3b0>
cmpl   $0x0,-0x34(%rbp)
je     14c8 <taylor_iter+0x388>
mov    -0x30(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    14d4 <taylor_iter+0x394>
mov    -0x28(%rbp),%eax
add    -0x30(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    14eb <taylor_iter+0x3ab>
movl   $0x0,-0x24(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    13f7 <taylor_iter+0x2b7>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jae    1507 <taylor_iter+0x3c7>
mov    -0x20(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    150d <taylor_iter+0x3cd>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cvtsi2sd %rax,%xmm0
lea    0xae4(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x30(%rbp),%edi
call   1050 <taylor_log@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
lea    0xada(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%edi
call   1050 <taylor_log@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
lea    0xaad(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<taylor_iter>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
call   1060 <log@plt>
movsd  %xmm0,(%rsp)
mov    $0x8,%ebx
movsd  0x10(%rsp),%xmm0
mov    $0x8,%edi
call   1050 <taylor_log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <my_abs@plt>
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jae    11e0 <taylor_iter+0xa0>
mov    $0x8,%ebx
nopl   (%rax)
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%ebx
movsd  0x10(%rsp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
mov    %ebx,%edi
call   1050 <taylor_log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <my_abs@plt>
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jb     11a0 <taylor_iter+0x60>
mov    %ebx,%eax
mov    $0xcccccccd,%r15d
imul   %rax,%r15
shr    $0x23,%r15
add    %ebx,%r15d
mov    %r15d,%r14d
shr    %r14d
cmp    $0x1,%r14d
jne    120d <taylor_iter+0xcd>
xor    %r14d,%r14d
movsd  0x8(%rsp),%xmm1
jmp    12ce <taylor_iter+0x18e>
movsd  0x10(%rsp),%xmm0
jmp    1247 <taylor_iter+0x107>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14d,%eax
add    %r15d,%eax
mov    %r15d,%r14d
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
mov    %r14d,%r15d
mov    %eax,%r14d
shr    %r14d
cmp    $0x1,%eax
jbe    12cb <taylor_iter+0x18b>
call   1060 <log@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
mov    %r14d,%edi
call   1050 <taylor_log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <my_abs@plt>
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jb     1220 <taylor_iter+0xe0>
movsd  0x10(%rsp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,(%rsp)
lea    -0x1(%r14),%edi
movsd  0x10(%rsp),%xmm0
call   1050 <taylor_log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <my_abs@plt>
ucomisd 0x18(%rsp),%xmm0
mov    %r14d,%eax
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
jbe    1235 <taylor_iter+0xf5>
jmp    12ce <taylor_iter+0x18e>
xor    %r14d,%r14d
movapd %xmm1,%xmm0
call   1060 <log@plt>
movsd  %xmm0,(%rsp)
mov    $0x1,%r15d
movsd  0x8(%rsp),%xmm0
mov    $0x1,%edi
call   1050 <taylor_log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <my_abs@plt>
ucomisd 0x18(%rsp),%xmm0
mov    $0x1,%ebx
ja     135c <taylor_iter+0x21c>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%ebx
movsd  0x8(%rsp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
mov    %ebx,%edi
call   1050 <taylor_log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <my_abs@plt>
ucomisd 0x18(%rsp),%xmm0
jbe    1320 <taylor_iter+0x1e0>
cmp    $0x1,%ebx
je     1371 <taylor_iter+0x231>
mov    %ebx,%eax
mov    $0xcccccccd,%r15d
imul   %rax,%r15
shr    $0x23,%r15
add    %ebx,%r15d
mov    %r15d,%ebx
shr    %ebx
cmp    $0x1,%ebx
movsd  0x8(%rsp),%xmm0
jne    141e <taylor_iter+0x2de>
xor    %ebx,%ebx
cmp    %ebx,%r14d
cmovb  %ebx,%r14d
xorps  %xmm0,%xmm0
cvtsi2sd %r14,%xmm0
lea    0xc60(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %r14d,%edi
call   1050 <taylor_log@plt>
movaps %xmm0,%xmm1
lea    0xc64(%rip),%rbx
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %r14d,%edi
call   1050 <taylor_log@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <printf@plt>
nopl   0x0(%rax)
mov    %ebx,%eax
add    %r15d,%eax
mov    %r15d,%ebx
movsd  0x8(%rsp),%xmm0
mov    %ebx,%r15d
mov    %eax,%ebx
shr    %ebx
cmp    $0x1,%eax
jbe    1388 <taylor_iter+0x248>
call   1060 <log@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
mov    %ebx,%edi
call   1050 <taylor_log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <my_abs@plt>
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jb     1400 <taylor_iter+0x2c0>
movsd  0x8(%rsp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,(%rsp)
lea    -0x1(%rbx),%edi
movsd  0x8(%rsp),%xmm0
call   1050 <taylor_log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <my_abs@plt>
ucomisd 0x18(%rsp),%xmm0
mov    %ebx,%eax
movsd  0x8(%rsp),%xmm0
jbe    140e <taylor_iter+0x2ce>
jmp    138a <taylor_iter+0x24a>

LLVM IR (-O0):
@.str = [35 x i8] c"taylor polynomial iterations = %d\0A\00"
@.str.1 = [24 x i8] c"taylor_log(%g) = %.12g\0A\00"
define void @taylor_iter(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
store i32 1, i32* %9
store i32 8, i32* %10
br label %14
14: ; preds = %31, %3
%15 = load i32, i32* %9
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %32
17: ; preds = %14
%18 = load double, double* %4
%19 = call double @log(double %18)
%20 = load double, double* %4
%21 = load i32, i32* %10
%22 = call double @taylor_log(double %20, i32 %21)
%23 = fsub double %19, %22
%24 = call double @my_abs(double %23)
%25 = load double, double* %6
%26 = fcmp ole double %24, %25
br i1 %26, label %27, label %28
27: ; preds = %17
store i32 0, i32* %9
br label %31
28: ; preds = %17
%29 = load i32, i32* %10
%30 = mul i32 %29, 10
store i32 %30, i32* %10
br label %31
31: ; preds = %28, %27
br label %14
32: ; preds = %14
%33 = load i32, i32* %10
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %36
35: ; preds = %32
store i32 1, i32* %11
br label %39
36: ; preds = %32
%37 = load i32, i32* %10
%38 = udiv i32 %37, 10
store i32 %38, i32* %11
br label %39
39: ; preds = %36, %35
%40 = load i32, i32* %11
%41 = load i32, i32* %10
%42 = add i32 %40, %41
%43 = udiv i32 %42, 2
store i32 %43, i32* %12
%44 = load i32, i32* %10
%45 = load i32, i32* %11
%46 = add i32 %44, %45
store i32 %46, i32* %10
store i32 1, i32* %9
store i32 1, i32* %13
%47 = load i32, i32* %12
%48 = sub i32 %47, 1
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %39
store i32 0, i32* %9
store i32 0, i32* %7
br label %51
51: ; preds = %50, %39
br label %52
52: ; preds = %100, %51
%53 = load i32, i32* %9
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %101
55: ; preds = %52
%56 = load double, double* %4
%57 = call double @log(double %56)
%58 = load double, double* %4
%59 = load i32, i32* %12
%60 = call double @taylor_log(double %58, i32 %59)
%61 = fsub double %57, %60
%62 = call double @my_abs(double %61)
%63 = load double, double* %6
%64 = fcmp ole double %62, %63
br i1 %64, label %65, label %66
65: ; preds = %55
store i32 1, i32* %13
br label %67
66: ; preds = %55
store i32 0, i32* %13
br label %67
67: ; preds = %66, %65
%68 = load i32, i32* %13
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %83
70: ; preds = %67
%71 = load double, double* %4
%72 = call double @log(double %71)
%73 = load double, double* %4
%74 = load i32, i32* %12
%75 = sub i32 %74, 1
%76 = call double @taylor_log(double %73, i32 %75)
%77 = fsub double %72, %76
%78 = call double @my_abs(double %77)
%79 = load double, double* %6
%80 = fcmp ogt double %78, %79
br i1 %80, label %81, label %83
81: ; preds = %70
store i32 0, i32* %9
%82 = load i32, i32* %12
store i32 %82, i32* %7
br label %101
83: ; preds = %70, %67
%84 = load i32, i32* %13
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %90
86: ; preds = %83
%87 = load i32, i32* %12
store i32 %87, i32* %10
%88 = load i32, i32* %12
%89 = udiv i32 %88, 2
store i32 %89, i32* %12
br label %95
90: ; preds = %83
%91 = load i32, i32* %10
%92 = load i32, i32* %12
%93 = add i32 %91, %92
%94 = udiv i32 %93, 2
store i32 %94, i32* %12
br label %95
95: ; preds = %90, %86
%96 = load i32, i32* %12
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %95
store i32 0, i32* %9
%99 = load i32, i32* %12
store i32 %99, i32* %7
br label %100
100: ; preds = %98, %95
br label %52
101: ; preds = %81, %52
store i32 1, i32* %9
store i32 1, i32* %10
br label %102
102: ; preds = %119, %101
%103 = load i32, i32* %9
%104 = icmp ne i32 %103, 0
br i1 %104, label %105, label %120
105: ; preds = %102
%106 = load double, double* %5
%107 = call double @log(double %106)
%108 = load double, double* %5
%109 = load i32, i32* %10
%110 = call double @taylor_log(double %108, i32 %109)
%111 = fsub double %107, %110
%112 = call double @my_abs(double %111)
%113 = load double, double* %6
%114 = fcmp ogt double %112, %113
br i1 %114, label %115, label %116
115: ; preds = %105
store i32 0, i32* %9
br label %119
116: ; preds = %105
%117 = load i32, i32* %10
%118 = mul i32 %117, 10
store i32 %118, i32* %10
br label %119
119: ; preds = %116, %115
br label %102
120: ; preds = %102
%121 = load i32, i32* %10
%122 = icmp eq i32 %121, 1
br i1 %122, label %123, label %124
123: ; preds = %120
store i32 1, i32* %11
br label %127
124: ; preds = %120
%125 = load i32, i32* %10
%126 = udiv i32 %125, 10
store i32 %126, i32* %11
br label %127
127: ; preds = %124, %123
store i32 1, i32* %9
%128 = load i32, i32* %11
%129 = load i32, i32* %10
%130 = add i32 %128, %129
%131 = udiv i32 %130, 2
store i32 %131, i32* %12
%132 = load i32, i32* %10
%133 = load i32, i32* %11
%134 = add i32 %132, %133
store i32 %134, i32* %10
%135 = load i32, i32* %12
%136 = sub i32 %135, 1
%137 = icmp eq i32 %136, 0
br i1 %137, label %138, label %139
138: ; preds = %127
store i32 0, i32* %9
store i32 0, i32* %8
br label %139
139: ; preds = %138, %127
br label %140
140: ; preds = %188, %139
%141 = load i32, i32* %9
%142 = icmp ne i32 %141, 0
br i1 %142, label %143, label %189
143: ; preds = %140
%144 = load double, double* %5
%145 = call double @log(double %144)
%146 = load double, double* %5
%147 = load i32, i32* %12
%148 = call double @taylor_log(double %146, i32 %147)
%149 = fsub double %145, %148
%150 = call double @my_abs(double %149)
%151 = load double, double* %6
%152 = fcmp ole double %150, %151
br i1 %152, label %153, label %154
153: ; preds = %143
store i32 1, i32* %13
br label %155
154: ; preds = %143
store i32 0, i32* %13
br label %155
155: ; preds = %154, %153
%156 = load i32, i32* %13
%157 = icmp ne i32 %156, 0
br i1 %157, label %158, label %171
158: ; preds = %155
%159 = load double, double* %5
%160 = call double @log(double %159)
%161 = load double, double* %5
%162 = load i32, i32* %12
%163 = sub i32 %162, 1
%164 = call double @taylor_log(double %161, i32 %163)
%165 = fsub double %160, %164
%166 = call double @my_abs(double %165)
%167 = load double, double* %6
%168 = fcmp ogt double %166, %167
br i1 %168, label %169, label %171
169: ; preds = %158
store i32 0, i32* %9
%170 = load i32, i32* %12
store i32 %170, i32* %8
br label %189
171: ; preds = %158, %155
%172 = load i32, i32* %13
%173 = icmp ne i32 %172, 0
br i1 %173, label %174, label %178
174: ; preds = %171
%175 = load i32, i32* %12
store i32 %175, i32* %10
%176 = load i32, i32* %12
%177 = udiv i32 %176, 2
store i32 %177, i32* %12
br label %183
178: ; preds = %171
%179 = load i32, i32* %10
%180 = load i32, i32* %12
%181 = add i32 %179, %180
%182 = udiv i32 %181, 2
store i32 %182, i32* %12
br label %183
183: ; preds = %178, %174
%184 = load i32, i32* %12
%185 = icmp eq i32 %184, 0
br i1 %185, label %186, label %188
186: ; preds = %183
store i32 0, i32* %9
%187 = load i32, i32* %12
store i32 %187, i32* %8
br label %188
188: ; preds = %186, %183
br label %140
189: ; preds = %169, %140
%190 = load i32, i32* %7
%191 = load i32, i32* %8
%192 = icmp ult i32 %190, %191
br i1 %192, label %193, label %195
193: ; preds = %189
%194 = load i32, i32* %8
store i32 %194, i32* %12
br label %197
195: ; preds = %189
%196 = load i32, i32* %7
store i32 %196, i32* %12
br label %197
197: ; preds = %195, %193
%198 = load i32, i32* %12
%199 = uitofp i32 %198 to double
%200 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), double %199)
%201 = load double, double* %4
%202 = load double, double* %4
%203 = load i32, i32* %12
%204 = call double @taylor_log(double %202, i32 %203)
%205 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %201, double %204)
%206 = load double, double* %5
%207 = load double, double* %5
%208 = load i32, i32* %12
%209 = call double @taylor_log(double %207, i32 %208)
%210 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %206, double %209)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"taylor polynomial iterations = %d\0A\00"
@.str.1 = [24 x i8] c"taylor_log(%g) = %.12g\0A\00"
define void @taylor_iter(double %0, double %1, double %2) {
%4 = tail call double @log(double %0)
%5 = tail call double @taylor_log(double %0, i32 8)
%6 = fsub double %4, %5
%7 = tail call double @my_abs(double %6)
%8 = fcmp ugt double %7, %2
br i1 %8, label %9, label %17
9: ; preds = %3, %9
%10 = phi i32 [ %11, %9 ], [ 8, %3 ]
%11 = mul i32 %10, 10
%12 = tail call double @log(double %0)
%13 = tail call double @taylor_log(double %0, i32 %11)
%14 = fsub double %12, %13
%15 = tail call double @my_abs(double %14)
%16 = fcmp ugt double %15, %2
br i1 %16, label %9, label %17
17: ; preds = %9, %3
%18 = phi i32 [ 8, %3 ], [ %11, %9 ]
%19 = udiv i32 %18, 10
%20 = add i32 %19, %18
%21 = lshr i32 %20, 1
%22 = icmp eq i32 %21, 1
br i1 %22, label %45, label %23
23: ; preds = %17, %40
%24 = phi i32 [ %43, %40 ], [ %21, %17 ]
%25 = phi i32 [ %41, %40 ], [ %20, %17 ]
%26 = tail call double @log(double %0)
%27 = tail call double @taylor_log(double %0, i32 %24)
%28 = fsub double %26, %27
%29 = tail call double @my_abs(double %28)
%30 = fcmp ugt double %29, %2
br i1 %30, label %38, label %31
31: ; preds = %23
%32 = tail call double @log(double %0)
%33 = add nsw i32 %24, -1
%34 = tail call double @taylor_log(double %0, i32 %33)
%35 = fsub double %32, %34
%36 = tail call double @my_abs(double %35)
%37 = fcmp ogt double %36, %2
br i1 %37, label %45, label %40
38: ; preds = %23
%39 = add i32 %24, %25
br label %40
40: ; preds = %31, %38
%41 = phi i32 [ %25, %38 ], [ %24, %31 ]
%42 = phi i32 [ %39, %38 ], [ %24, %31 ]
%43 = lshr i32 %42, 1
%44 = icmp ugt i32 %42, 1
br i1 %44, label %23, label %45
45: ; preds = %40, %31, %17
%46 = phi i32 [ 0, %17 ], [ %24, %31 ], [ 0, %40 ]
%47 = tail call double @log(double %1)
%48 = tail call double @taylor_log(double %1, i32 1)
%49 = fsub double %47, %48
%50 = tail call double @my_abs(double %49)
%51 = fcmp ogt double %50, %2
br i1 %51, label %60, label %52
52: ; preds = %45, %52
%53 = phi i32 [ %54, %52 ], [ 1, %45 ]
%54 = mul i32 %53, 10
%55 = tail call double @log(double %1)
%56 = tail call double @taylor_log(double %1, i32 %54)
%57 = fsub double %55, %56
%58 = tail call double @my_abs(double %57)
%59 = fcmp ogt double %58, %2
br i1 %59, label %60, label %52
60: ; preds = %52, %45
%61 = phi i32 [ 1, %45 ], [ %54, %52 ]
%62 = icmp eq i32 %61, 1
%63 = udiv i32 %61, 10
%64 = select i1 %62, i32 1, i32 %63
%65 = add i32 %64, %61
%66 = lshr i32 %65, 1
%67 = icmp eq i32 %66, 1
br i1 %67, label %90, label %68
68: ; preds = %60, %85
%69 = phi i32 [ %88, %85 ], [ %66, %60 ]
%70 = phi i32 [ %86, %85 ], [ %65, %60 ]
%71 = tail call double @log(double %1)
%72 = tail call double @taylor_log(double %1, i32 %69)
%73 = fsub double %71, %72
%74 = tail call double @my_abs(double %73)
%75 = fcmp ugt double %74, %2
br i1 %75, label %83, label %76
76: ; preds = %68
%77 = tail call double @log(double %1)
%78 = add nsw i32 %69, -1
%79 = tail call double @taylor_log(double %1, i32 %78)
%80 = fsub double %77, %79
%81 = tail call double @my_abs(double %80)
%82 = fcmp ogt double %81, %2
br i1 %82, label %90, label %85
83: ; preds = %68
%84 = add i32 %69, %70
br label %85
85: ; preds = %76, %83
%86 = phi i32 [ %70, %83 ], [ %69, %76 ]
%87 = phi i32 [ %84, %83 ], [ %69, %76 ]
%88 = lshr i32 %87, 1
%89 = icmp ugt i32 %87, 1
br i1 %89, label %68, label %90
90: ; preds = %85, %76, %60
%91 = phi i32 [ 0, %60 ], [ %69, %76 ], [ 0, %85 ]
%92 = icmp ult i32 %46, %91
%93 = select i1 %92, i32 %91, i32 %46
%94 = uitofp i32 %93 to double
%95 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), double %94)
%96 = tail call double @taylor_log(double %0, i32 %93)
%97 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %0, double %96)
%98 = tail call double @taylor_log(double %1, i32 %93)
%99 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %1, double %98)
ret void
}