#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 */
typedef int /*<<< orphan*/ array1;
typedef int /*<<< orphan*/ array0;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int get_max_sum_without_consecutive_elements_v1(int *, int, int);
int get_max_sum_without_consecutive_elements_v2(int *, int, int);
int main() {
  int array0[] = {10, 12, 5};
  int low0 = 0;
  int high0 = sizeof(array0) / sizeof(int) - 1;
  int max_sum0 = 15;
  assert(max_sum0 ==
         get_max_sum_without_consecutive_elements_v1(array0, low0, high0));
  assert(max_sum0 ==
         get_max_sum_without_consecutive_elements_v2(array0, low0, high0));
  int array1[] = {12, 100, 70};
  int low1 = 0;
  int high1 = sizeof(array1) / sizeof(int) - 1;
  int max_sum1 = 100;
  assert(max_sum1 ==
         get_max_sum_without_consecutive_elements_v1(array1, low1, high1));
  assert(max_sum1 ==
         get_max_sum_without_consecutive_elements_v2(array1, low1, high1));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
movl   $0xf,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x44(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <get_max_sum_without_consecutive_elements_v1@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x40(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <get_max_sum_without_consecutive_elements_v2@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0xe4b(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe49(%rip),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x2,-0x30(%rbp)
movl   $0x64,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
lea    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
call   1050 <get_max_sum_without_consecutive_elements_v1@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
lea    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
call   1030 <get_max_sum_without_consecutive_elements_v2@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xecd(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xeba(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1050 <get_max_sum_without_consecutive_elements_v1@plt>
xor    %edi,%edi
cmp    $0xf,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1030 <get_max_sum_without_consecutive_elements_v2@plt>
xor    %edi,%edi
cmp    $0xf,%eax
sete   %dil
call   1040 <assert@plt>
mov    0xe84(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xe71(%rip),%rax
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1050 <get_max_sum_without_consecutive_elements_v1@plt>
xor    %edi,%edi
cmp    $0x64,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1030 <get_max_sum_without_consecutive_elements_v2@plt>
xor    %edi,%edi
cmp    $0x64,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array0 = [3 x i32] [i32 10, i32 12, i32 5]
@__const.main.array1 = [3 x i32] [i32 12, i32 100, i32 70]
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [3 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = bitcast [3 x i32]* %2 to i8*
store i32 0, i32* %3
store i32 2, i32* %4
store i32 15, i32* %5
%11 = load i32, i32* %5
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @get_max_sum_without_consecutive_elements_v1(i32* %12, i32 %13, i32 %14)
%16 = icmp eq i32 %11, %15
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i32, i32* %5
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = call i32 @get_max_sum_without_consecutive_elements_v2(i32* %20, i32 %21, i32 %22)
%24 = icmp eq i32 %19, %23
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = bitcast [3 x i32]* %6 to i8*
store i32 0, i32* %7
store i32 2, i32* %8
store i32 100, i32* %9
%28 = load i32, i32* %9
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = call i32 @get_max_sum_without_consecutive_elements_v1(i32* %29, i32 %30, i32 %31)
%33 = icmp eq i32 %28, %32
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = load i32, i32* %9
%37 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
%38 = load i32, i32* %7
%39 = load i32, i32* %8
%40 = call i32 @get_max_sum_without_consecutive_elements_v2(i32* %37, i32 %38, i32 %39)
%41 = icmp eq i32 %36, %40
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array0 = [3 x i32] [i32 10, i32 12, i32 5]
@__const.main.array1 = [3 x i32] [i32 12, i32 100, i32 70]
define i32 @main() {
%1 = alloca [3 x i32]
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %1 to i8*
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%5 = call i32 @get_max_sum_without_consecutive_elements_v1(i32* %4, i32 0, i32 2)
%6 = icmp eq i32 %5, 15
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @get_max_sum_without_consecutive_elements_v2(i32* %4, i32 0, i32 2)
%10 = icmp eq i32 %9, 15
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = bitcast [3 x i32]* %2 to i8*
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%15 = call i32 @get_max_sum_without_consecutive_elements_v1(i32* %14, i32 0, i32 2)
%16 = icmp eq i32 %15, 100
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = call i32 @get_max_sum_without_consecutive_elements_v2(i32* %14, i32 0, i32 2)
%20 = icmp eq i32 %19, 100
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
ret i32 0
}