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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int find_max_consecutive_ones(int *, int);
int main() {
  int array0[] = {0, 0, 0, 0, 0};
  int len0 = sizeof(array0) / sizeof(int);
  assert(0 == find_max_consecutive_ones(array0, len0));
  int array1[] = {1, 1, 1, 1, 1};
  int len1 = sizeof(array1) / sizeof(int);
  assert(len1 == find_max_consecutive_ones(array1, len1));
  int array2[] = {1, 1, 0, 1, 1, 1};
  int len2 = sizeof(array2) / sizeof(int);
  assert(3 == find_max_consecutive_ones(array2, len2));
  int array3[] = {1, 0, 1, 0, 1, 0, 1};
  int len3 = sizeof(array3) / sizeof(int);
  assert(1 == find_max_consecutive_ones(array3, len3));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1030 <memset@plt>
movl   $0x5,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1040 <find_max_consecutive_ones@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0xe81(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe7e(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe7c(%rip),%eax
mov    %eax,-0x30(%rbp)
movl   $0x5,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x88(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1040 <find_max_consecutive_ones@plt>
mov    %eax,%ecx
mov    -0x88(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0xe4f(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe4c(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xe49(%rip),%rax
mov    %rax,-0x50(%rbp)
movl   $0x6,-0x64(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1040 <find_max_consecutive_ones@plt>
mov    %eax,%ecx
mov    $0x3,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0xe25(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xe22(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xe1f(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe1d(%rip),%eax
mov    %eax,-0x68(%rbp)
movl   $0x7,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%esi
call   1040 <find_max_consecutive_ones@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x88,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x30(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x5,%esi
call   1030 <find_max_consecutive_ones@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    0xeb7(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1030 <find_max_consecutive_ones@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1040 <assert@plt>
mov    0xea6(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xe8a(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0x40(%rsp),%rdi
mov    $0x6,%esi
call   1030 <find_max_consecutive_ones@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1040 <assert@plt>
movups 0xe8d(%rip),%xmm0
movups %xmm0,0x6c(%rsp)
movaps 0xe75(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
lea    0x60(%rsp),%rdi
mov    $0x7,%esi
call   1030 <find_max_consecutive_ones@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x88,%rsp
ret

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

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