#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 */
int get_larger_neighbors_index(const int *str, size_t size) {
  int index = -1;
  int i;
  for (i = 1; i < size; i++) {
    if (str[i] > str[i + 1] && str[i] > str[i - 1]) {
      index = i;
      break;
    }
  }
  return index;
}


x86 assembly (clang, -O0):
<get_larger_neighbors_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1188 <get_larger_neighbors_index+0x88>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    1175 <get_larger_neighbors_index+0x75>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    1175 <get_larger_neighbors_index+0x75>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1188 <get_larger_neighbors_index+0x88>
jmp    117a <get_larger_neighbors_index+0x7a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    111a <get_larger_neighbors_index+0x1a>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_larger_neighbors_index>:
mov    $0xffffffff,%eax
cmp    $0x2,%rsi
jb     113e <get_larger_neighbors_index+0x3e>
mov    0x4(%rdi),%edx
mov    $0x1,%ecx
jmp    112c <get_larger_neighbors_index+0x2c>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rcx
mov    %r8d,%edx
cmp    %rcx,%rsi
je     113e <get_larger_neighbors_index+0x3e>
mov    0x4(%rdi,%rcx,4),%r8d
cmp    %r8d,%edx
jle    1120 <get_larger_neighbors_index+0x20>
cmp    -0x4(%rdi,%rcx,4),%edx
jle    1120 <get_larger_neighbors_index+0x20>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @get_larger_neighbors_index(i32* nocapture %0, i64 %1) {
%3 = icmp ugt i64 %1, 1
br i1 %3, label %4, label %23
4: ; preds = %2
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
br label %7
7: ; preds = %4, %19
%8 = phi i32 [ %6, %4 ], [ %12, %19 ]
%9 = phi i64 [ 1, %4 ], [ %10, %19 ]
%10 = add nuw nsw i64 %9, 1
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = icmp sgt i32 %8, %12
br i1 %13, label %14, label %19
14: ; preds = %7
%15 = add nsw i64 %9, -1
%16 = getelementptr inbounds i32, i32* %0, i64 %15
%17 = load i32, i32* %16
%18 = icmp sgt i32 %8, %17
br i1 %18, label %21, label %19
19: ; preds = %7, %14
%20 = icmp eq i64 %10, %1
br i1 %20, label %23, label %7
21: ; preds = %14
%22 = trunc i64 %9 to i32
br label %23
23: ; preds = %19, %21, %2
%24 = phi i32 [ -1, %2 ], [ %22, %21 ], [ -1, %19 ]
ret i32 %24
}