#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 fmax(double, double);
double stub1(double);
double stub2(double);
double stub3(double);
double stub4(double);
double stub5(double);
double stub6(double);
double stub7(double);
double stub8(double);
int extrema(double (*f)(double), double a, double b, double dx, double eps,
            int *extc, double extv[]) {
  double x1, x2, xr, xe, xc, f1, f2, fr, fe, fc;
  int n, s;
  if (*extc == 0)
    return 1;
  if (f == NULL) {
    *extc = 0;
    return 1;
  }
  if (b < a) {
    *extc = 0;
    return 1;
  }
  n = 0;
  extv[n++] = a;
  x1 = a;
  x2 = a + dx;
  f1 = (*f)(x1);
  f2 = (*f)(x2);
  s = f2 > f1 ? -1 : +1;
  while (n < *extc) {
    if (x1 > b) {
      extv[n++] = b;
      break;
    }
    if (fabs(x1 - x2) < eps) {
      extv[n++] = x1;
      x1 = fmax(x1, x2) + dx;
      x2 = x1 + dx;
      s *= -1;
    }
    if (s * f1 > s * f2) {
      xr = x1;
      fr = f1;
      x1 = x2;
      f1 = f2;
      x2 = xr;
      f2 = fr;
    }
    xr = 2 * x1 - x2;
    fr = (*f)(xr);
    if (s * fr < s * f1) {
      xe = 3 * x1 - 2 * x2;
      fe = (*f)(xe);
      if (s * fe < s * fr) {
        x2 = xe;
        f2 = fe;
      } else {
        x2 = xr;
        f2 = fr;
      }
    } else {
      if (s * fr < s * f2) {
        xc = 1.5 * x1 - 0.5 * x2;
        fc = (*f)(xc);
        if (s * fc <= s * fr) {
          x2 = xc;
          f2 = fc;
        } else {
          x2 = x1 + 0.5 * (x2 - x1);
          f2 = (*f)(x2);
        }
      } else {
        xc = 0.5 * x1 + 0.5 * x2;
        fc = (*f)(xc);
        if (s * fc < s * f2) {
          x2 = xc;
          f2 = fc;
        } else {
          x2 = x1 + 0.5 * (x2 - x1);
          f2 = (*f)(x2);
        }
      }
    }
  }
  *extc = n;
  return 0;
}


x86 assembly (clang, -O0):
<extrema>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    -0x38(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1144 <extrema+0x44>
movl   $0x1,-0x4(%rbp)
jmp    1625 <extrema+0x525>
cmpq   $0x0,-0x10(%rbp)
jne    1165 <extrema+0x65>
mov    -0x38(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1625 <extrema+0x525>
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    118f <extrema+0x8f>
mov    -0x38(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1625 <extrema+0x525>
movl   $0x0,-0x94(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x94(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x94(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x48(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x50(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x98(%rbp)
mov    -0x94(%rbp),%eax
mov    -0x38(%rbp),%rcx
cmp    (%rcx),%eax
jge    1612 <extrema+0x512>
movsd  -0x48(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    125e <extrema+0x15e>
movsd  -0x20(%rbp),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x94(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x94(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1612 <extrema+0x512>
movsd  -0x48(%rbp),%xmm1
subsd  -0x50(%rbp),%xmm1
movaps 0xd91(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12f2 <extrema+0x1f2>
movsd  -0x48(%rbp),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x94(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x94(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm3
movsd  -0x50(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
maxsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
imul   $0xffffffff,-0x98(%rbp),%eax
mov    %eax,-0x98(%rbp)
cvtsi2sdl -0x98(%rbp),%xmm0
ff
mulsd  -0x70(%rbp),%xmm0
cvtsi2sdl -0x98(%rbp),%xmm1
ff
mulsd  -0x78(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1352 <extrema+0x252>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x58(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x80(%rbp)
cvtsi2sdl -0x98(%rbp),%xmm1
ff
mulsd  -0x80(%rbp),%xmm1
cvtsi2sdl -0x98(%rbp),%xmm0
ff
mulsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1461 <extrema+0x361>
movsd  -0x48(%rbp),%xmm0
movsd  0xc67(%rip),%xmm1
mulsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xc3b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x60(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x88(%rbp)
ff
cvtsi2sdl -0x98(%rbp),%xmm1
ff
mulsd  -0x88(%rbp),%xmm1
ff
cvtsi2sdl -0x98(%rbp),%xmm0
ff
mulsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1448 <extrema+0x348>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
jmp    145c <extrema+0x35c>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    160d <extrema+0x50d>
cvtsi2sdl -0x98(%rbp),%xmm1
ff
mulsd  -0x80(%rbp),%xmm1
cvtsi2sdl -0x98(%rbp),%xmm0
ff
mulsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1552 <extrema+0x452>
movsd  -0x48(%rbp),%xmm0
movsd  0xb7e(%rip),%xmm1
mulsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xb62(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x68(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x90(%rbp)
ff
cvtsi2sdl -0x98(%rbp),%xmm1
ff
mulsd  -0x90(%rbp),%xmm1
ff
cvtsi2sdl -0x98(%rbp),%xmm0
ff
mulsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1519 <extrema+0x419>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
jmp    154d <extrema+0x44d>
movsd  -0x48(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  0xae0(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x50(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x78(%rbp)
jmp    1608 <extrema+0x508>
movsd  -0x48(%rbp),%xmm0
movsd  0xab1(%rip),%xmm1
mulsd  -0x50(%rbp),%xmm1
movsd  0xaa4(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x68(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x90(%rbp)
ff
cvtsi2sdl -0x98(%rbp),%xmm1
ff
mulsd  -0x90(%rbp),%xmm1
ff
cvtsi2sdl -0x98(%rbp),%xmm0
ff
mulsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    15cf <extrema+0x4cf>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
jmp    1603 <extrema+0x503>
movsd  -0x48(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  0xa2a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x50(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x78(%rbp)
jmp    1608 <extrema+0x508>
jmp    160d <extrema+0x50d>
jmp    1215 <extrema+0x115>
mov    -0x94(%rbp),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extrema>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
movsd  %xmm3,0x60(%rsp)
movsd  %xmm2,0x48(%rsp)
movsd  %xmm1,0x40(%rsp)
cmpl   $0x0,(%rsi)
je     144a <extrema+0x34a>
mov    %rsi,%r12
mov    %rdi,%rbp
xor    %ebx,%ebx
mov    $0x1,%r15d
test   %rdi,%rdi
je     1464 <extrema+0x364>
ucomisd 0x40(%rsp),%xmm0
ja     1464 <extrema+0x364>
mov    %rdx,%r14
movsd  %xmm0,(%rdx)
movapd %xmm0,%xmm1
addsd  0x48(%rsp),%xmm1
movapd %xmm1,0x30(%rsp)
movsd  %xmm0,(%rsp)
call   *%rbp
movsd  %xmm0,0x8(%rsp)
movapd 0x30(%rsp),%xmm0
call   *%rbp
xor    %r15d,%r15d
mov    $0x1,%ebx
cmpl   $0x2,(%r12)
jl     1464 <extrema+0x364>
xor    %eax,%eax
movsd  0x8(%rsp),%xmm3
ucomisd %xmm3,%xmm0
setbe  %al
lea    -0x1(%rax,%rax,1),%r13d
mov    $0x1,%ebx
movsd  (%rsp),%xmm2
movapd 0x30(%rsp),%xmm5
jmp    11ee <extrema+0xee>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpltsd %xmm1,%xmm5
movapd 0x20(%rsp),%xmm1
andpd  %xmm5,%xmm1
andnpd 0x30(%rsp),%xmm5
orpd   %xmm1,%xmm5
movsd  (%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
cmp    (%r12),%ebx
jge    1464 <extrema+0x364>
ucomisd 0x40(%rsp),%xmm2
ja     1452 <extrema+0x352>
movapd %xmm2,%xmm4
subsd  %xmm5,%xmm4
andpd  0xdf6(%rip),%xmm4
movsd  0x60(%rsp),%xmm1
ucomisd %xmm4,%xmm1
jbe    1258 <extrema+0x158>
movslq %ebx,%rax
add    $0x1,%ebx
movsd  %xmm2,(%r14,%rax,8)
movapd %xmm2,%xmm4
cmpunordsd %xmm2,%xmm4
movapd %xmm4,%xmm1
andpd  %xmm5,%xmm1
maxsd  %xmm2,%xmm5
andnpd %xmm5,%xmm4
orpd   %xmm1,%xmm4
movsd  0x48(%rsp),%xmm1
addsd  %xmm1,%xmm4
movapd %xmm4,%xmm5
addsd  %xmm1,%xmm5
neg    %r13d
movapd %xmm4,%xmm2
xorps  %xmm4,%xmm4
cvtsi2sd %r13d,%xmm4
movapd %xmm3,%xmm1
mulsd  %xmm4,%xmm1
movapd %xmm0,%xmm6
mulsd  %xmm4,%xmm6
ucomisd %xmm6,%xmm1
movapd %xmm4,0x50(%rsp)
jbe    12a0 <extrema+0x1a0>
movapd %xmm2,%xmm1
movapd %xmm5,%xmm2
movsd  %xmm3,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
movsd  %xmm6,0x18(%rsp)
jmp    12b6 <extrema+0x1b6>
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x10(%rsp)
movsd  %xmm3,0x8(%rsp)
movsd  %xmm1,0x18(%rsp)
movapd %xmm5,%xmm1
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x20(%rsp)
movapd %xmm2,%xmm0
addsd  %xmm2,%xmm0
subsd  %xmm1,%xmm0
movapd %xmm0,0x30(%rsp)
call   *%rbp
movapd %xmm0,%xmm1
movapd 0x50(%rsp),%xmm3
mulsd  %xmm3,%xmm1
movsd  0x18(%rsp),%xmm2
ucomisd %xmm1,%xmm2
jbe    1350 <extrema+0x250>
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm2
addsd  %xmm2,%xmm2
movsd  (%rsp),%xmm0
mulsd  0xd1c(%rip),%xmm0
subsd  %xmm2,%xmm0
movapd %xmm0,0x20(%rsp)
movsd  %xmm1,0x18(%rsp)
call   *%rbp
movsd  0x18(%rsp),%xmm1
movapd 0x50(%rsp),%xmm5
mulsd  %xmm0,%xmm5
ucomisd %xmm5,%xmm1
ja     11c0 <extrema+0xc0>
movsd  0x10(%rsp),%xmm0
jmp    11c0 <extrema+0xc0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm2
mulsd  %xmm3,%xmm2
ucomisd %xmm1,%xmm2
jbe    13c0 <extrema+0x2c0>
movapd %xmm0,%xmm4
mulsd  0xca6(%rip),%xmm4
movsd  (%rsp),%xmm0
mulsd  0xca1(%rip),%xmm0
addsd  %xmm4,%xmm0
movapd %xmm0,0x30(%rsp)
movsd  %xmm1,0x18(%rsp)
call   *%rbp
movapd 0x30(%rsp),%xmm5
movsd  (%rsp),%xmm2
movapd 0x50(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x18(%rsp),%xmm3
ucomisd %xmm1,%xmm3
movsd  0x8(%rsp),%xmm3
jae    11e4 <extrema+0xe4>
jmp    1416 <extrema+0x316>
xchg   %ax,%ax
movapd %xmm0,%xmm5
movsd  0xc44(%rip),%xmm1
mulsd  %xmm1,%xmm5
movsd  (%rsp),%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm5,%xmm0
movapd %xmm0,0x30(%rsp)
movsd  %xmm2,0x10(%rsp)
call   *%rbp
movapd 0x30(%rsp),%xmm5
movsd  (%rsp),%xmm2
movapd 0x50(%rsp),%xmm3
mulsd  %xmm0,%xmm3
movsd  0x10(%rsp),%xmm1
ucomisd %xmm3,%xmm1
movsd  0x8(%rsp),%xmm3
ja     11e4 <extrema+0xe4>
movsd  0x20(%rsp),%xmm0
subsd  %xmm2,%xmm0
mulsd  0xbe8(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x20(%rsp)
call   *%rbp
movsd  0x8(%rsp),%xmm3
movsd  (%rsp),%xmm2
movsd  0x20(%rsp),%xmm5
jmp    11e4 <extrema+0xe4>
mov    $0x1,%r15d
jmp    1468 <extrema+0x368>
movslq %ebx,%rax
add    $0x1,%ebx
movsd  0x40(%rsp),%xmm0
movsd  %xmm0,(%r14,%rax,8)
mov    %ebx,(%r12)
mov    %r15d,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @extrema(double (double)* %0, double %1, double %2, double %3, double %4, i32* %5, double* %6) {
%8 = alloca i32
%9 = alloca double (double)*
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32*
%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 i32
%27 = alloca i32
store double (double)* %0, double (double)** %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store i32* %5, i32** %14
store double* %6, double** %15
%28 = load i32*, i32** %14
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %7
store i32 1, i32* %8
br label %240
32: ; preds = %7
%33 = load double (double)*, double (double)** %9
%34 = icmp eq double (double)* %33, null
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = load i32*, i32** %14
store i32 0, i32* %36
store i32 1, i32* %8
br label %240
37: ; preds = %32
%38 = load double, double* %11
%39 = load double, double* %10
%40 = fcmp olt double %38, %39
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = load i32*, i32** %14
store i32 0, i32* %42
store i32 1, i32* %8
br label %240
43: ; preds = %37
store i32 0, i32* %26
%44 = load double, double* %10
%45 = load double*, double** %15
%46 = load i32, i32* %26
%47 = add nsw i32 %46, 1
store i32 %47, i32* %26
%48 = sext i32 %46 to i64
%49 = getelementptr inbounds double, double* %45, i64 %48
store double %44, double* %49
%50 = load double, double* %10
store double %50, double* %16
%51 = load double, double* %10
%52 = load double, double* %12
%53 = fadd double %51, %52
store double %53, double* %17
%54 = load double (double)*, double (double)** %9
%55 = load double, double* %16
%56 = call double %54(double %55)
store double %56, double* %21
%57 = load double (double)*, double (double)** %9
%58 = load double, double* %17
%59 = call double %57(double %58)
store double %59, double* %22
%60 = load double, double* %22
%61 = load double, double* %21
%62 = fcmp ogt double %60, %61
%63 = zext i1 %62 to i64
%64 = select i1 %62, i32 -1, i32 1
store i32 %64, i32* %27
br label %65
65: ; preds = %236, %43
%66 = load i32, i32* %26
%67 = load i32*, i32** %14
%68 = load i32, i32* %67
%69 = icmp slt i32 %66, %68
br i1 %69, label %70, label %237
70: ; preds = %65
%71 = load double, double* %16
%72 = load double, double* %11
%73 = fcmp ogt double %71, %72
br i1 %73, label %74, label %81
74: ; preds = %70
%75 = load double, double* %11
%76 = load double*, double** %15
%77 = load i32, i32* %26
%78 = add nsw i32 %77, 1
store i32 %78, i32* %26
%79 = sext i32 %77 to i64
%80 = getelementptr inbounds double, double* %76, i64 %79
store double %75, double* %80
br label %237
81: ; preds = %70
%82 = load double, double* %16
%83 = load double, double* %17
%84 = fsub double %82, %83
%85 = call double @llvm.fabs.f64(double %84)
%86 = load double, double* %13
%87 = fcmp olt double %85, %86
br i1 %87, label %88, label %105
88: ; preds = %81
%89 = load double, double* %16
%90 = load double*, double** %15
%91 = load i32, i32* %26
%92 = add nsw i32 %91, 1
store i32 %92, i32* %26
%93 = sext i32 %91 to i64
%94 = getelementptr inbounds double, double* %90, i64 %93
store double %89, double* %94
%95 = load double, double* %16
%96 = load double, double* %17
%97 = call double @llvm.maxnum.f64(double %95, double %96)
%98 = load double, double* %12
%99 = fadd double %97, %98
store double %99, double* %16
%100 = load double, double* %16
%101 = load double, double* %12
%102 = fadd double %100, %101
store double %102, double* %17
%103 = load i32, i32* %27
%104 = mul nsw i32 %103, -1
store i32 %104, i32* %27
br label %105
105: ; preds = %88, %81
%106 = load i32, i32* %27
%107 = sitofp i32 %106 to double
%108 = load double, double* %21
%109 = fmul double %107, %108
%110 = load i32, i32* %27
%111 = sitofp i32 %110 to double
%112 = load double, double* %22
%113 = fmul double %111, %112
%114 = fcmp ogt double %109, %113
br i1 %114, label %115, label %122
115: ; preds = %105
%116 = load double, double* %16
store double %116, double* %18
%117 = load double, double* %21
store double %117, double* %23
%118 = load double, double* %17
store double %118, double* %16
%119 = load double, double* %22
store double %119, double* %21
%120 = load double, double* %18
store double %120, double* %17
%121 = load double, double* %23
store double %121, double* %22
br label %122
122: ; preds = %115, %105
%123 = load double, double* %16
%124 = load double, double* %17
%125 = fneg double %124
%126 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %123, double %125)
store double %126, double* %18
%127 = load double (double)*, double (double)** %9
%128 = load double, double* %18
%129 = call double %127(double %128)
store double %129, double* %23
%130 = load i32, i32* %27
%131 = sitofp i32 %130 to double
%132 = load double, double* %23
%133 = fmul double %131, %132
%134 = load i32, i32* %27
%135 = sitofp i32 %134 to double
%136 = load double, double* %21
%137 = fmul double %135, %136
%138 = fcmp olt double %133, %137
br i1 %138, label %139, label %164
139: ; preds = %122
%140 = load double, double* %16
%141 = load double, double* %17
%142 = fmul double 2.000000e+00, %141
%143 = fneg double %142
%144 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %140, double %143)
store double %144, double* %19
%145 = load double (double)*, double (double)** %9
%146 = load double, double* %19
%147 = call double %145(double %146)
store double %147, double* %24
%148 = load i32, i32* %27
%149 = sitofp i32 %148 to double
%150 = load double, double* %24
%151 = fmul double %149, %150
%152 = load i32, i32* %27
%153 = sitofp i32 %152 to double
%154 = load double, double* %23
%155 = fmul double %153, %154
%156 = fcmp olt double %151, %155
br i1 %156, label %157, label %160
157: ; preds = %139
%158 = load double, double* %19
store double %158, double* %17
%159 = load double, double* %24
store double %159, double* %22
br label %163
160: ; preds = %139
%161 = load double, double* %18
store double %161, double* %17
%162 = load double, double* %23
store double %162, double* %22
br label %163
163: ; preds = %160, %157
br label %236
164: ; preds = %122
%165 = load i32, i32* %27
%166 = sitofp i32 %165 to double
%167 = load double, double* %23
%168 = fmul double %166, %167
%169 = load i32, i32* %27
%170 = sitofp i32 %169 to double
%171 = load double, double* %22
%172 = fmul double %170, %171
%173 = fcmp olt double %168, %172
br i1 %173, label %174, label %205
174: ; preds = %164
%175 = load double, double* %16
%176 = load double, double* %17
%177 = fmul double 5.000000e-01, %176
%178 = fneg double %177
%179 = call double @llvm.fmuladd.f64(double 1.500000e+00, double %175, double %178)
store double %179, double* %20
%180 = load double (double)*, double (double)** %9
%181 = load double, double* %20
%182 = call double %180(double %181)
store double %182, double* %25
%183 = load i32, i32* %27
%184 = sitofp i32 %183 to double
%185 = load double, double* %25
%186 = fmul double %184, %185
%187 = load i32, i32* %27
%188 = sitofp i32 %187 to double
%189 = load double, double* %23
%190 = fmul double %188, %189
%191 = fcmp ole double %186, %190
br i1 %191, label %192, label %195
192: ; preds = %174
%193 = load double, double* %20
store double %193, double* %17
%194 = load double, double* %25
store double %194, double* %22
br label %204
195: ; preds = %174
%196 = load double, double* %16
%197 = load double, double* %17
%198 = load double, double* %16
%199 = fsub double %197, %198
%200 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %199, double %196)
store double %200, double* %17
%201 = load double (double)*, double (double)** %9
%202 = load double, double* %17
%203 = call double %201(double %202)
store double %203, double* %22
br label %204
204: ; preds = %195, %192
br label %235
205: ; preds = %164
%206 = load double, double* %16
%207 = load double, double* %17
%208 = fmul double 5.000000e-01, %207
%209 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %206, double %208)
store double %209, double* %20
%210 = load double (double)*, double (double)** %9
%211 = load double, double* %20
%212 = call double %210(double %211)
store double %212, double* %25
%213 = load i32, i32* %27
%214 = sitofp i32 %213 to double
%215 = load double, double* %25
%216 = fmul double %214, %215
%217 = load i32, i32* %27
%218 = sitofp i32 %217 to double
%219 = load double, double* %22
%220 = fmul double %218, %219
%221 = fcmp olt double %216, %220
br i1 %221, label %222, label %225
222: ; preds = %205
%223 = load double, double* %20
store double %223, double* %17
%224 = load double, double* %25
store double %224, double* %22
br label %234
225: ; preds = %205
%226 = load double, double* %16
%227 = load double, double* %17
%228 = load double, double* %16
%229 = fsub double %227, %228
%230 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %229, double %226)
store double %230, double* %17
%231 = load double (double)*, double (double)** %9
%232 = load double, double* %17
%233 = call double %231(double %232)
store double %233, double* %22
br label %234
234: ; preds = %225, %222
br label %235
235: ; preds = %234, %204
br label %236
236: ; preds = %235, %163
br label %65
237: ; preds = %74, %65
%238 = load i32, i32* %26
%239 = load i32*, i32** %14
store i32 %238, i32* %239
store i32 0, i32* %8
br label %240
240: ; preds = %237, %41, %35, %31
%241 = load i32, i32* %8
ret i32 %241
}

LLVM IR (-O2):
define i32 @extrema(double (double)* %0, double %1, double %2, double %3, double %4, i32* nocapture %5, double* nocapture writeonly %6) {
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %107, label %10
10: ; preds = %7
%11 = icmp eq double (double)* %0, null
%12 = fcmp olt double %2, %1
%13 = or i1 %11, %12
br i1 %13, label %104, label %14
14: ; preds = %10
store double %1, double* %6
%15 = fadd double %1, %3
%16 = tail call double %0(double %1)
%17 = tail call double %0(double %15)
%18 = load i32, i32* %5
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %104
20: ; preds = %14
%21 = fcmp ogt double %17, %16
%22 = select i1 %21, i32 -1, i32 1
br label %23
23: ; preds = %20, %99
%24 = phi i32 [ %51, %99 ], [ %22, %20 ]
%25 = phi i32 [ %50, %99 ], [ 1, %20 ]
%26 = phi double [ %101, %99 ], [ %17, %20 ]
%27 = phi double [ %61, %99 ], [ %16, %20 ]
%28 = phi double [ %60, %99 ], [ %1, %20 ]
%29 = phi double [ %100, %99 ], [ %15, %20 ]
%30 = fcmp ogt double %28, %2
br i1 %30, label %31, label %35
31: ; preds = %23
%32 = add nsw i32 %25, 1
%33 = sext i32 %25 to i64
%34 = getelementptr inbounds double, double* %6, i64 %33
store double %2, double* %34
br label %104
35: ; preds = %23
%36 = fsub double %28, %29
%37 = tail call double @llvm.fabs.f64(double %36)
%38 = fcmp olt double %37, %4
br i1 %38, label %39, label %47
39: ; preds = %35
%40 = add nsw i32 %25, 1
%41 = sext i32 %25 to i64
%42 = getelementptr inbounds double, double* %6, i64 %41
store double %28, double* %42
%43 = tail call double @llvm.maxnum.f64(double %28, double %29)
%44 = fadd double %43, %3
%45 = fadd double %44, %3
%46 = sub nsw i32 0, %24
br label %47
47: ; preds = %39, %35
%48 = phi double [ %45, %39 ], [ %29, %35 ]
%49 = phi double [ %44, %39 ], [ %28, %35 ]
%50 = phi i32 [ %40, %39 ], [ %25, %35 ]
%51 = phi i32 [ %46, %39 ], [ %24, %35 ]
%52 = sitofp i32 %51 to double
%53 = fmul double %27, %52
%54 = fmul double %26, %52
%55 = fcmp ogt double %53, %54
br i1 %55, label %56, label %57
56: ; preds = %47
br label %57
57: ; preds = %56, %47
%58 = phi double [ %54, %56 ], [ %53, %47 ]
%59 = phi double [ %49, %56 ], [ %48, %47 ]
%60 = phi double [ %48, %56 ], [ %49, %47 ]
%61 = phi double [ %26, %56 ], [ %27, %47 ]
%62 = phi double [ %27, %56 ], [ %26, %47 ]
%63 = fneg double %59
%64 = tail call double @llvm.fmuladd.f64(double %60, double 2.000000e+00, double %63)
%65 = tail call double %0(double %64)
%66 = fmul double %65, %52
%67 = fcmp olt double %66, %58
br i1 %67, label %68, label %76
68: ; preds = %57
%69 = fmul double %59, -2.000000e+00
%70 = tail call double @llvm.fmuladd.f64(double %60, double 3.000000e+00, double %69)
%71 = tail call double %0(double %70)
%72 = fmul double %71, %52
%73 = fcmp olt double %72, %66
%74 = select i1 %73, double %70, double %64
%75 = select i1 %73, double %71, double %65
br label %99
76: ; preds = %57
%77 = fmul double %62, %52
%78 = fcmp olt double %66, %77
br i1 %78, label %79, label %89
79: ; preds = %76
%80 = fmul double %59, -5.000000e-01
%81 = tail call double @llvm.fmuladd.f64(double %60, double 1.500000e+00, double %80)
%82 = tail call double %0(double %81)
%83 = fmul double %82, %52
%84 = fcmp ugt double %83, %66
br i1 %84, label %85, label %99
85: ; preds = %79
%86 = fsub double %59, %60
%87 = tail call double @llvm.fmuladd.f64(double %86, double 5.000000e-01, double %60)
%88 = tail call double %0(double %87)
br label %99
89: ; preds = %76
%90 = fmul double %59, 5.000000e-01
%91 = tail call double @llvm.fmuladd.f64(double %60, double 5.000000e-01, double %90)
%92 = tail call double %0(double %91)
%93 = fmul double %92, %52
%94 = fcmp olt double %93, %77
br i1 %94, label %99, label %95
95: ; preds = %89
%96 = fsub double %59, %60
%97 = tail call double @llvm.fmuladd.f64(double %96, double 5.000000e-01, double %60)
%98 = tail call double %0(double %97)
br label %99
99: ; preds = %89, %79, %68, %85, %95
%100 = phi double [ %87, %85 ], [ %97, %95 ], [ %74, %68 ], [ %81, %79 ], [ %91, %89 ]
%101 = phi double [ %88, %85 ], [ %98, %95 ], [ %75, %68 ], [ %82, %79 ], [ %92, %89 ]
%102 = load i32, i32* %5
%103 = icmp slt i32 %50, %102
br i1 %103, label %23, label %104
104: ; preds = %99, %31, %14, %10
%105 = phi i32 [ 0, %10 ], [ %32, %31 ], [ 1, %14 ], [ %50, %99 ]
%106 = phi i32 [ 1, %10 ], [ 0, %31 ], [ 0, %14 ], [ 0, %99 ]
store i32 %105, i32* %5
br label %107
107: ; preds = %104, %7
%108 = phi i32 [ 1, %7 ], [ %106, %104 ]
ret i32 %108
}