#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 */
scalar_t__ isbetween(long double *, long double *, long double *);
int find_st_indx(long double **nvp, int n_nvp, long double *st_point,
                 int st_indx, long double *old_st_point) {
  int i, N = n_nvp - 1;
  if (st_indx != 0)
    if (isbetween(old_st_point, nvp[st_indx], st_point))
      return st_indx;
  for (i = st_indx; i < N; i++) {
    if (isbetween(nvp[i], nvp[i + 1], st_point))
      return i + 1;
  }
  return -1;
}


x86 assembly (clang, -O0):
<find_st_indx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1170 <find_st_indx+0x60>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <isbetween@plt>
cmp    $0x0,%rax
je     116b <find_st_indx+0x5b>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11da <find_st_indx+0xca>
jmp    1170 <find_st_indx+0x60>
mov    -0x24(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    11d3 <find_st_indx+0xc3>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <isbetween@plt>
cmp    $0x0,%rax
je     11c0 <find_st_indx+0xb0>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11da <find_st_indx+0xca>
jmp    11c5 <find_st_indx+0xb5>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1176 <find_st_indx+0x66>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_st_indx>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %esi,%r12d
mov    %rdi,%r15
test   %ecx,%ecx
je     1140 <find_st_indx+0x30>
movslq %ebp,%rbx
mov    (%r15,%rbx,8),%rsi
mov    %r8,%rdi
mov    %r14,%rdx
call   1030 <isbetween@plt>
test   %rax,%rax
jne    1179 <find_st_indx+0x69>
jmp    1142 <find_st_indx+0x32>
xor    %ebx,%ebx
add    $0xffffffff,%r12d
cmp    %r12d,%ebp
cmovg  %ebp,%r12d
movslq %r12d,%r12
cmp    %rbx,%r12
je     1174 <find_st_indx+0x64>
lea    0x1(%rbx),%rbp
mov    (%r15,%rbx,8),%rdi
mov    0x8(%r15,%rbx,8),%rsi
mov    %r14,%rdx
call   1030 <isbetween@plt>
mov    %rbp,%rbx
test   %rax,%rax
je     1150 <find_st_indx+0x40>
jmp    1179 <find_st_indx+0x69>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @find_st_indx(x86_fp80** %0, i32 %1, x86_fp80* %2, i32 %3, x86_fp80* %4) {
%6 = alloca i32
%7 = alloca x86_fp80**
%8 = alloca i32
%9 = alloca x86_fp80*
%10 = alloca i32
%11 = alloca x86_fp80*
%12 = alloca i32
%13 = alloca i32
store x86_fp80** %0, x86_fp80*** %7
store i32 %1, i32* %8
store x86_fp80* %2, x86_fp80** %9
store i32 %3, i32* %10
store x86_fp80* %4, x86_fp80** %11
%14 = load i32, i32* %8
%15 = sub nsw i32 %14, 1
store i32 %15, i32* %13
%16 = load i32, i32* %10
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %31
18: ; preds = %5
%19 = load x86_fp80*, x86_fp80** %11
%20 = load x86_fp80**, x86_fp80*** %7
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds x86_fp80*, x86_fp80** %20, i64 %22
%24 = load x86_fp80*, x86_fp80** %23
%25 = load x86_fp80*, x86_fp80** %9
%26 = call i64 @isbetween(x86_fp80* %19, x86_fp80* %24, x86_fp80* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %18
%29 = load i32, i32* %10
store i32 %29, i32* %6
br label %60
30: ; preds = %18
br label %31
31: ; preds = %30, %5
%32 = load i32, i32* %10
store i32 %32, i32* %12
br label %33
33: ; preds = %56, %31
%34 = load i32, i32* %12
%35 = load i32, i32* %13
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %59
37: ; preds = %33
%38 = load x86_fp80**, x86_fp80*** %7
%39 = load i32, i32* %12
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds x86_fp80*, x86_fp80** %38, i64 %40
%42 = load x86_fp80*, x86_fp80** %41
%43 = load x86_fp80**, x86_fp80*** %7
%44 = load i32, i32* %12
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds x86_fp80*, x86_fp80** %43, i64 %46
%48 = load x86_fp80*, x86_fp80** %47
%49 = load x86_fp80*, x86_fp80** %9
%50 = call i64 @isbetween(x86_fp80* %42, x86_fp80* %48, x86_fp80* %49)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %37
%53 = load i32, i32* %12
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %60
55: ; preds = %37
br label %56
56: ; preds = %55
%57 = load i32, i32* %12
%58 = add nsw i32 %57, 1
store i32 %58, i32* %12
br label %33
59: ; preds = %33
store i32 -1, i32* %6
br label %60
60: ; preds = %59, %52, %28
%61 = load i32, i32* %6
ret i32 %61
}

LLVM IR (-O2):
define i32 @find_st_indx(x86_fp80** nocapture %0, i32 %1, x86_fp80* %2, i32 %3, x86_fp80* %4) {
%6 = add i32 %1, -1
%7 = icmp eq i32 %3, 0
br i1 %7, label %14, label %8
8: ; preds = %5
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds x86_fp80*, x86_fp80** %0, i64 %9
%11 = load x86_fp80*, x86_fp80** %10
%12 = tail call i64 @isbetween(x86_fp80* %4, x86_fp80* %11, x86_fp80* %2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %31
14: ; preds = %5, %8
%15 = phi i64 [ %9, %8 ], [ 0, %5 ]
%16 = call i32 @llvm.smax.i32(i32 %3, i32 %6)
%17 = sext i32 %16 to i64
br label %18
18: ; preds = %21, %14
%19 = phi i64 [ %24, %21 ], [ %15, %14 ]
%20 = icmp eq i64 %19, %17
br i1 %20, label %31, label %21
21: ; preds = %18
%22 = getelementptr inbounds x86_fp80*, x86_fp80** %0, i64 %19
%23 = load x86_fp80*, x86_fp80** %22
%24 = add nsw i64 %19, 1
%25 = getelementptr inbounds x86_fp80*, x86_fp80** %0, i64 %24
%26 = load x86_fp80*, x86_fp80** %25
%27 = tail call i64 @isbetween(x86_fp80* %23, x86_fp80* %26, x86_fp80* %2)
%28 = icmp eq i64 %27, 0
br i1 %28, label %18, label %29
29: ; preds = %21
%30 = trunc i64 %24 to i32
br label %31
31: ; preds = %18, %29, %8
%32 = phi i32 [ %3, %8 ], [ %30, %29 ], [ -1, %18 ]
ret i32 %32
}