#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 delta(unsigned int, unsigned int, double *, unsigned int);
unsigned int next_e(unsigned int i, double *points, unsigned int size,
                    double e) {
  unsigned int k;
  if (delta(i, size - 1, points, size) <= e) {
    return size;
  }
  for (k = i + 1; k < size; k++) {
    if (delta(i, k, points, size) > e) {
      return k;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<next_e>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <delta@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1159 <next_e+0x49>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11b0 <next_e+0xa0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    11a9 <next_e+0x99>
mov    -0x8(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <delta@plt>
ucomisd -0x20(%rbp),%xmm0
jbe    1196 <next_e+0x86>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11b0 <next_e+0xa0>
jmp    119b <next_e+0x8b>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1162 <next_e+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_e>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edi,%r15d
lea    -0x1(%rbx),%esi
mov    %r14,%rdx
mov    %ebx,%ecx
call   1030 <delta@plt>
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jae    115f <next_e+0x4f>
mov    %r15d,%ebp
nop
add    $0x1,%ebp
cmp    %ebx,%ebp
jae    1163 <next_e+0x53>
mov    %r15d,%edi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %ebx,%ecx
call   1030 <delta@plt>
ucomisd (%rsp),%xmm0
jbe    1140 <next_e+0x30>
jmp    1165 <next_e+0x55>
mov    %ebx,%ebp
jmp    1165 <next_e+0x55>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @next_e(i32 %0, double* %1, i32 %2, double %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca i32
%9 = alloca double
%10 = alloca i32
store i32 %0, i32* %6
store double* %1, double** %7
store i32 %2, i32* %8
store double %3, double* %9
%11 = load i32, i32* %6
%12 = load i32, i32* %8
%13 = sub i32 %12, 1
%14 = load double*, double** %7
%15 = load i32, i32* %8
%16 = call double @delta(i32 %11, i32 %13, double* %14, i32 %15)
%17 = load double, double* %9
%18 = fcmp ole double %16, %17
br i1 %18, label %19, label %21
19: ; preds = %4
%20 = load i32, i32* %8
store i32 %20, i32* %5
br label %43
21: ; preds = %4
%22 = load i32, i32* %6
%23 = add i32 %22, 1
store i32 %23, i32* %10
br label %24
24: ; preds = %39, %21
%25 = load i32, i32* %10
%26 = load i32, i32* %8
%27 = icmp ult i32 %25, %26
br i1 %27, label %28, label %42
28: ; preds = %24
%29 = load i32, i32* %6
%30 = load i32, i32* %10
%31 = load double*, double** %7
%32 = load i32, i32* %8
%33 = call double @delta(i32 %29, i32 %30, double* %31, i32 %32)
%34 = load double, double* %9
%35 = fcmp ogt double %33, %34
br i1 %35, label %36, label %38
36: ; preds = %28
%37 = load i32, i32* %10
store i32 %37, i32* %5
br label %43
38: ; preds = %28
br label %39
39: ; preds = %38
%40 = load i32, i32* %10
%41 = add i32 %40, 1
store i32 %41, i32* %10
br label %24
42: ; preds = %24
store i32 0, i32* %5
br label %43
43: ; preds = %42, %36, %19
%44 = load i32, i32* %5
ret i32 %44
}

LLVM IR (-O2):
define i32 @next_e(i32 %0, double* %1, i32 %2, double %3) {
%5 = add i32 %2, -1
%6 = tail call double @delta(i32 %0, i32 %5, double* %1, i32 %2)
%7 = fcmp ugt double %6, %3
br i1 %7, label %8, label %15
8: ; preds = %4, %12
%9 = phi i32 [ %10, %12 ], [ %0, %4 ]
%10 = add i32 %9, 1
%11 = icmp ult i32 %10, %2
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = tail call double @delta(i32 %0, i32 %10, double* %1, i32 %2)
%14 = fcmp ogt double %13, %3
br i1 %14, label %15, label %8
15: ; preds = %8, %12, %4
%16 = phi i32 [ %2, %4 ], [ 0, %8 ], [ %10, %12 ]
ret i32 %16
}