#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 fabs(double);
double iterate(double x0, double x2, double (*f)(double), double eps, int imax,
               int *error) {
  double x1, xm, ym, y0, y1, y2, y10, y20, y21, b, c, temp;
  double xmlast = x0;
  int i;
  *error = 0;
  y0 = f(x0);
  if (y0 == 0.0)
    return x0;
  y2 = f(x2);
  if (y2 == 0.0)
    return x2;
  if ((y2 * y0) > 0.0) {
    *error = -1;
    return x0;
  }
  for (i = 0; i < imax; i++) {
    x1 = 0.5 * (x2 + x0);
    y1 = f(x1);
    if (y1 == 0.0)
      return x1;
    if (fabs(x1 - x0) < eps)
      return x1;
    if ((y1 * y0) > 0.0) {
      temp = x0;
      x0 = x2;
      x2 = temp;
      temp = y0;
      y0 = y2;
      y2 = temp;
    }
    y10 = y1 - y0;
    y21 = y2 - y1;
    y20 = y2 - y0;
    if ((y2 * y20) < (2.0 * y1 * y10)) {
      x2 = x1;
      y2 = y1;
    } else {
      b = (x1 - x0) / y10;
      c = (y10 - y21) / (y21 * y20);
      xm = x0 - b * y0 * (1.0 - c * y1);
      ym = f(xm);
      if (ym == 0.0)
        return xm;
      if (fabs(xm - xmlast) < eps)
        return xm;
      xmlast = xm;
      if ((ym * y0) < 0.0) {
        x2 = xm;
        y2 = ym;
      } else {
        x0 = xm;
        y0 = ym;
        x2 = x1;
        y2 = y1;
      }
    }
  }
  *error = -2;
  return x1;
}


x86 assembly (clang, -O0):
<iterate>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
mov    %esi,-0x2c(%rbp)
mov    %rdx,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x38(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1173 <iterate+0x73>
jp     1173 <iterate+0x73>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    14e8 <iterate+0x3e8>
mov    -0x20(%rbp),%rax
movsd  -0x18(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11aa <iterate+0xaa>
jp     11aa <iterate+0xaa>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    14e8 <iterate+0x3e8>
movsd  -0x68(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11da <iterate+0xda>
mov    -0x38(%rbp),%rax
movl   $0xffffffff,(%rax)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    14e8 <iterate+0x3e8>
movl   $0x0,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    14d4 <iterate+0x3d4>
movsd  -0x18(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xdfb(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movsd  -0x40(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1245 <iterate+0x145>
jp     1245 <iterate+0x145>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    14e8 <iterate+0x3e8>
movsd  -0x40(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movaps 0xdca(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1278 <iterate+0x178>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    14e8 <iterate+0x3e8>
movsd  -0x60(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12d7 <iterate+0x1d7>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x18(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x68(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
movsd  0xcf2(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1343 <iterate+0x243>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    14bb <iterate+0x3bb>
movsd  -0x40(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
subsd  -0x80(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x10(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x58(%rbp),%xmm0
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x60(%rbp),%xmm3
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
movsd  0xc54(%rip),%xmm3
addsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x20(%rbp),%rax
movsd  -0x48(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    141b <iterate+0x31b>
jp     141b <iterate+0x31b>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    14e8 <iterate+0x3e8>
movsd  -0x48(%rbp),%xmm1
subsd  -0xa0(%rbp),%xmm1
ff
movaps 0xbf1(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1451 <iterate+0x351>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    14e8 <iterate+0x3e8>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x50(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    148e <iterate+0x38e>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    14b6 <iterate+0x3b6>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    14bb <iterate+0x3bb>
jmp    14c0 <iterate+0x3c0>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    11e4 <iterate+0xe4>
mov    -0x38(%rbp),%rax
movl   $0xfffffffe,(%rax)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iterate>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rdx,%r14
mov    %esi,%ebp
movsd  %xmm2,0x38(%rsp)
mov    %rdi,%rbx
movsd  %xmm1,0x8(%rsp)
movl   $0x0,(%rdx)
movsd  %xmm0,0x10(%rsp)
call   *%rdi
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1143 <iterate+0x43>
jp     1143 <iterate+0x43>
movsd  0x10(%rsp),%xmm0
jmp    1396 <iterate+0x296>
movapd %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   *%rbx
ucomisd 0xeb7(%rip),%xmm0
jne    1168 <iterate+0x68>
jp     1168 <iterate+0x68>
movsd  0x8(%rsp),%xmm0
jmp    1396 <iterate+0x296>
movapd %xmm0,%xmm4
movsd  0x8(%rsp),%xmm2
movapd 0x20(%rsp),%xmm7
movapd %xmm7,%xmm0
mulsd  %xmm4,%xmm0
mov    $0xffffffff,%r15d
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    119b <iterate+0x9b>
movsd  0x10(%rsp),%xmm6
jmp    138f <iterate+0x28f>
mov    $0xfffffffe,%r15d
test   %ebp,%ebp
jle    138f <iterate+0x28f>
movsd  0x10(%rsp),%xmm8
movapd %xmm2,%xmm1
jmp    11c7 <iterate+0xc7>
movapd %xmm0,%xmm4
movapd %xmm6,%xmm1
add    $0xffffffff,%ebp
je     138f <iterate+0x28f>
movsd  %xmm8,0x50(%rsp)
movapd %xmm7,0x20(%rsp)
movapd %xmm4,0x40(%rsp)
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
addsd  %xmm8,%xmm0
mulsd  0xe0f(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
call   *%rbx
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jne    1209 <iterate+0x109>
jnp    13a1 <iterate+0x2a1>
movsd  0x18(%rsp),%xmm6
movapd %xmm6,%xmm3
movsd  0x50(%rsp),%xmm5
subsd  %xmm5,%xmm3
andpd  0xdfb(%rip),%xmm3
movsd  0x38(%rsp),%xmm1
ucomisd %xmm3,%xmm1
ja     1392 <iterate+0x292>
movapd 0x20(%rsp),%xmm4
movapd %xmm4,%xmm1
mulsd  %xmm0,%xmm1
ucomisd %xmm2,%xmm1
movapd 0x40(%rsp),%xmm3
movapd %xmm3,%xmm7
movsd  0x8(%rsp),%xmm8
ja     1263 <iterate+0x163>
movapd %xmm4,%xmm7
movapd %xmm5,%xmm8
xorpd  %xmm2,%xmm2
cmpltsd %xmm1,%xmm2
andpd  %xmm2,%xmm4
andnpd %xmm3,%xmm2
orpd   %xmm4,%xmm2
movapd %xmm0,%xmm1
subsd  %xmm7,%xmm1
movapd %xmm2,%xmm5
subsd  %xmm7,%xmm5
movapd %xmm2,%xmm3
mulsd  %xmm5,%xmm3
movapd %xmm0,%xmm4
addsd  %xmm0,%xmm4
mulsd  %xmm1,%xmm4
ucomisd %xmm3,%xmm4
ja     11b6 <iterate+0xb6>
subsd  %xmm0,%xmm2
movapd %xmm6,%xmm3
subsd  %xmm8,%xmm3
divsd  %xmm1,%xmm3
subsd  %xmm2,%xmm1
mulsd  %xmm5,%xmm2
divsd  %xmm2,%xmm1
movsd  %xmm0,0x40(%rsp)
mulsd  %xmm0,%xmm1
movsd  0xd33(%rip),%xmm0
subsd  %xmm1,%xmm0
movapd %xmm7,0x50(%rsp)
mulsd  %xmm7,%xmm3
mulsd  %xmm0,%xmm3
movsd  %xmm8,0x8(%rsp)
movapd %xmm8,%xmm0
subsd  %xmm3,%xmm0
movsd  %xmm0,0x20(%rsp)
call   *%rbx
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
jne    130f <iterate+0x20f>
jnp    13a9 <iterate+0x2a9>
movsd  0x20(%rsp),%xmm5
movapd %xmm5,%xmm1
subsd  0x10(%rsp),%xmm1
andpd  0xcf9(%rip),%xmm1
movsd  0x38(%rsp),%xmm2
ucomisd %xmm1,%xmm2
ja     13b1 <iterate+0x2b1>
movapd %xmm0,%xmm2
movapd 0x50(%rsp),%xmm7
mulsd  %xmm7,%xmm2
ucomisd %xmm2,%xmm3
movapd %xmm0,%xmm4
ja     1351 <iterate+0x251>
movsd  0x40(%rsp),%xmm4
movapd %xmm5,%xmm1
movsd  0x8(%rsp),%xmm8
movsd  0x18(%rsp),%xmm6
ja     136d <iterate+0x26d>
movapd %xmm6,%xmm1
movapd %xmm5,%xmm8
cmpltsd %xmm3,%xmm2
andpd  %xmm2,%xmm7
andnpd %xmm0,%xmm2
orpd   %xmm2,%xmm7
movsd  %xmm5,0x10(%rsp)
add    $0xffffffff,%ebp
jne    11c7 <iterate+0xc7>
jmp    138f <iterate+0x28f>
mov    %r15d,(%r14)
movapd %xmm6,%xmm0
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movsd  0x18(%rsp),%xmm0
jmp    1396 <iterate+0x296>
movsd  0x20(%rsp),%xmm0
jmp    1396 <iterate+0x296>
movapd %xmm5,%xmm0
jmp    1396 <iterate+0x296>

LLVM IR (-O0):
define double @iterate(double %0, double %1, double (double)* %2, double %3, i32 %4, i32* %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double (double)*
%11 = alloca double
%12 = alloca i32
%13 = alloca i32*
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca i32
store double %0, double* %8
store double %1, double* %9
store double (double)* %2, double (double)** %10
store double %3, double* %11
store i32 %4, i32* %12
store i32* %5, i32** %13
%28 = load double, double* %8
store double %28, double* %26
%29 = load i32*, i32** %13
store i32 0, i32* %29
%30 = load double (double)*, double (double)** %10
%31 = load double, double* %8
%32 = call double %30(double %31)
store double %32, double* %17
%33 = load double, double* %17
%34 = fcmp oeq double %33, 0.000000e+00
br i1 %34, label %35, label %37
35: ; preds = %6
%36 = load double, double* %8
store double %36, double* %7
br label %173
37: ; preds = %6
%38 = load double (double)*, double (double)** %10
%39 = load double, double* %9
%40 = call double %38(double %39)
store double %40, double* %19
%41 = load double, double* %19
%42 = fcmp oeq double %41, 0.000000e+00
br i1 %42, label %43, label %45
43: ; preds = %37
%44 = load double, double* %9
store double %44, double* %7
br label %173
45: ; preds = %37
%46 = load double, double* %19
%47 = load double, double* %17
%48 = fmul double %46, %47
%49 = fcmp ogt double %48, 0.000000e+00
br i1 %49, label %50, label %53
50: ; preds = %45
%51 = load i32*, i32** %13
store i32 -1, i32* %51
%52 = load double, double* %8
store double %52, double* %7
br label %173
53: ; preds = %45
store i32 0, i32* %27
br label %54
54: ; preds = %167, %53
%55 = load i32, i32* %27
%56 = load i32, i32* %12
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %170
58: ; preds = %54
%59 = load double, double* %9
%60 = load double, double* %8
%61 = fadd double %59, %60
%62 = fmul double 5.000000e-01, %61
store double %62, double* %14
%63 = load double (double)*, double (double)** %10
%64 = load double, double* %14
%65 = call double %63(double %64)
store double %65, double* %18
%66 = load double, double* %18
%67 = fcmp oeq double %66, 0.000000e+00
br i1 %67, label %68, label %70
68: ; preds = %58
%69 = load double, double* %14
store double %69, double* %7
br label %173
70: ; preds = %58
%71 = load double, double* %14
%72 = load double, double* %8
%73 = fsub double %71, %72
%74 = call double @llvm.fabs.f64(double %73)
%75 = load double, double* %11
%76 = fcmp olt double %74, %75
br i1 %76, label %77, label %79
77: ; preds = %70
%78 = load double, double* %14
store double %78, double* %7
br label %173
79: ; preds = %70
%80 = load double, double* %18
%81 = load double, double* %17
%82 = fmul double %80, %81
%83 = fcmp ogt double %82, 0.000000e+00
br i1 %83, label %84, label %91
84: ; preds = %79
%85 = load double, double* %8
store double %85, double* %25
%86 = load double, double* %9
store double %86, double* %8
%87 = load double, double* %25
store double %87, double* %9
%88 = load double, double* %17
store double %88, double* %25
%89 = load double, double* %19
store double %89, double* %17
%90 = load double, double* %25
store double %90, double* %19
br label %91
91: ; preds = %84, %79
%92 = load double, double* %18
%93 = load double, double* %17
%94 = fsub double %92, %93
store double %94, double* %20
%95 = load double, double* %19
%96 = load double, double* %18
%97 = fsub double %95, %96
store double %97, double* %22
%98 = load double, double* %19
%99 = load double, double* %17
%100 = fsub double %98, %99
store double %100, double* %21
%101 = load double, double* %19
%102 = load double, double* %21
%103 = fmul double %101, %102
%104 = load double, double* %18
%105 = fmul double 2.000000e+00, %104
%106 = load double, double* %20
%107 = fmul double %105, %106
%108 = fcmp olt double %103, %107
br i1 %108, label %109, label %112
109: ; preds = %91
%110 = load double, double* %14
store double %110, double* %9
%111 = load double, double* %18
store double %111, double* %19
br label %166
112: ; preds = %91
%113 = load double, double* %14
%114 = load double, double* %8
%115 = fsub double %113, %114
%116 = load double, double* %20
%117 = fdiv double %115, %116
store double %117, double* %23
%118 = load double, double* %20
%119 = load double, double* %22
%120 = fsub double %118, %119
%121 = load double, double* %22
%122 = load double, double* %21
%123 = fmul double %121, %122
%124 = fdiv double %120, %123
store double %124, double* %24
%125 = load double, double* %8
%126 = load double, double* %23
%127 = load double, double* %17
%128 = fmul double %126, %127
%129 = load double, double* %24
%130 = load double, double* %18
%131 = fneg double %129
%132 = call double @llvm.fmuladd.f64(double %131, double %130, double 1.000000e+00)
%133 = fneg double %128
%134 = call double @llvm.fmuladd.f64(double %133, double %132, double %125)
store double %134, double* %15
%135 = load double (double)*, double (double)** %10
%136 = load double, double* %15
%137 = call double %135(double %136)
store double %137, double* %16
%138 = load double, double* %16
%139 = fcmp oeq double %138, 0.000000e+00
br i1 %139, label %140, label %142
140: ; preds = %112
%141 = load double, double* %15
store double %141, double* %7
br label %173
142: ; preds = %112
%143 = load double, double* %15
%144 = load double, double* %26
%145 = fsub double %143, %144
%146 = call double @llvm.fabs.f64(double %145)
%147 = load double, double* %11
%148 = fcmp olt double %146, %147
br i1 %148, label %149, label %151
149: ; preds = %142
%150 = load double, double* %15
store double %150, double* %7
br label %173
151: ; preds = %142
%152 = load double, double* %15
store double %152, double* %26
%153 = load double, double* %16
%154 = load double, double* %17
%155 = fmul double %153, %154
%156 = fcmp olt double %155, 0.000000e+00
br i1 %156, label %157, label %160
157: ; preds = %151
%158 = load double, double* %15
store double %158, double* %9
%159 = load double, double* %16
store double %159, double* %19
br label %165
160: ; preds = %151
%161 = load double, double* %15
store double %161, double* %8
%162 = load double, double* %16
store double %162, double* %17
%163 = load double, double* %14
store double %163, double* %9
%164 = load double, double* %18
store double %164, double* %19
br label %165
165: ; preds = %160, %157
br label %166
166: ; preds = %165, %109
br label %167
167: ; preds = %166
%168 = load i32, i32* %27
%169 = add nsw i32 %168, 1
store i32 %169, i32* %27
br label %54
170: ; preds = %54
%171 = load i32*, i32** %13
store i32 -2, i32* %171
%172 = load double, double* %14
store double %172, double* %7
br label %173
173: ; preds = %170, %149, %140, %77, %68, %50, %43, %35
%174 = load double, double* %7
ret double %174
}

LLVM IR (-O2):
define double @iterate(double %0, double %1, double (double)* nocapture %2, double %3, i32 %4, i32* nocapture writeonly %5) {
store i32 0, i32* %5
%7 = tail call double %2(double %0)
%8 = fcmp oeq double %7, 0.000000e+00
br i1 %8, label %80, label %9
9: ; preds = %6
%10 = tail call double %2(double %1)
%11 = fcmp oeq double %10, 0.000000e+00
br i1 %11, label %80, label %12
12: ; preds = %9
%13 = fmul double %7, %10
%14 = fcmp ogt double %13, 0.000000e+00
br i1 %14, label %77, label %15
15: ; preds = %12
%16 = icmp sgt i32 %4, 0
br i1 %16, label %17, label %77
17: ; preds = %15, %69
%18 = phi i32 [ %75, %69 ], [ 0, %15 ]
%19 = phi double [ %74, %69 ], [ %0, %15 ]
%20 = phi double [ %73, %69 ], [ %0, %15 ]
%21 = phi double [ %72, %69 ], [ %1, %15 ]
%22 = phi double [ %71, %69 ], [ %7, %15 ]
%23 = phi double [ %70, %69 ], [ %10, %15 ]
%24 = fadd double %21, %20
%25 = fmul double %24, 5.000000e-01
%26 = tail call double %2(double %25)
%27 = fcmp oeq double %26, 0.000000e+00
br i1 %27, label %80, label %28
28: ; preds = %17
%29 = fsub double %25, %20
%30 = tail call double @llvm.fabs.f64(double %29)
%31 = fcmp olt double %30, %3
br i1 %31, label %80, label %32
32: ; preds = %28
%33 = fmul double %22, %26
%34 = fcmp ogt double %33, 0.000000e+00
%35 = select i1 %34, double %22, double %23
%36 = select i1 %34, double %23, double %22
%37 = select i1 %34, double %21, double %20
%38 = fsub double %26, %36
%39 = fsub double %35, %26
%40 = fsub double %35, %36
%41 = fmul double %35, %40
%42 = fmul double %26, 2.000000e+00
%43 = fmul double %42, %38
%44 = fcmp olt double %41, %43
br i1 %44, label %69, label %45
45: ; preds = %32
%46 = fsub double %25, %37
%47 = fsub double %38, %39
%48 = fmul double %39, %40
%49 = fneg double %47
%50 = fdiv double %49, %48
%51 = tail call double @llvm.fmuladd.f64(double %50, double %26, double 1.000000e+00)
%52 = fneg double %46
%53 = fdiv double %52, %38
%54 = fmul double %36, %53
%55 = tail call double @llvm.fmuladd.f64(double %54, double %51, double %37)
%56 = tail call double %2(double %55)
%57 = fcmp oeq double %56, 0.000000e+00
br i1 %57, label %80, label %58
58: ; preds = %45
%59 = fsub double %55, %19
%60 = tail call double @llvm.fabs.f64(double %59)
%61 = fcmp olt double %60, %3
br i1 %61, label %80, label %62
62: ; preds = %58
%63 = fmul double %36, %56
%64 = fcmp olt double %63, 0.000000e+00
%65 = select i1 %64, double %56, double %26
%66 = select i1 %64, double %36, double %56
%67 = select i1 %64, double %55, double %25
%68 = select i1 %64, double %37, double %55
br label %69
69: ; preds = %62, %32
%70 = phi double [ %26, %32 ], [ %65, %62 ]
%71 = phi double [ %36, %32 ], [ %66, %62 ]
%72 = phi double [ %25, %32 ], [ %67, %62 ]
%73 = phi double [ %37, %32 ], [ %68, %62 ]
%74 = phi double [ %19, %32 ], [ %55, %62 ]
%75 = add nuw nsw i32 %18, 1
%76 = icmp eq i32 %75, %4
br i1 %76, label %77, label %17
77: ; preds = %69, %15, %12
%78 = phi i32 [ -1, %12 ], [ -2, %15 ], [ -2, %69 ]
%79 = phi double [ %0, %12 ], [ undef, %15 ], [ %25, %69 ]
store i32 %78, i32* %5
br label %80
80: ; preds = %58, %45, %28, %17, %77, %9, %6
%81 = phi double [ %0, %6 ], [ %1, %9 ], [ %79, %77 ], [ %55, %58 ], [ %55, %45 ], [ %25, %28 ], [ %25, %17 ]
ret double %81
}