#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 findMaxConsecutiveOnes(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int arr3[] = {0, 1, 0, 1, 1, 0, 1, 1, 1};
  printf("%d\n", findMaxConsecutiveOnes(arr3, 0));
  printf("%d\n", findMaxConsecutiveOnes(arr3, 1));
  printf("%d\n", findMaxConsecutiveOnes(arr3, 2));
  printf("%d\n", findMaxConsecutiveOnes(arr3, 3));
  printf("%d\n", findMaxConsecutiveOnes(arr3, 4));
  printf("%d\n", findMaxConsecutiveOnes(arr3, 5));
  printf("%d\n", findMaxConsecutiveOnes(arr3, 6));
  printf("%d\n", findMaxConsecutiveOnes(arr3, 7));
  printf("%d\n", findMaxConsecutiveOnes(arr3, 8));
  printf("%d\n", findMaxConsecutiveOnes(arr3, 9));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1040 <memset@plt>
movl   $0x1,-0x2c(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
call   1050 <findMaxConsecutiveOnes@plt>
mov    %eax,%esi
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x1,%esi
call   1050 <findMaxConsecutiveOnes@plt>
mov    %eax,%esi
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x2,%esi
call   1050 <findMaxConsecutiveOnes@plt>
mov    %eax,%esi
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   1050 <findMaxConsecutiveOnes@plt>
mov    %eax,%esi
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
call   1050 <findMaxConsecutiveOnes@plt>
mov    %eax,%esi
lea    0xe03(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1050 <findMaxConsecutiveOnes@plt>
mov    %eax,%esi
lea    0xde7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x6,%esi
call   1050 <findMaxConsecutiveOnes@plt>
mov    %eax,%esi
lea    0xdcb(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x7,%esi
call   1050 <findMaxConsecutiveOnes@plt>
mov    %eax,%esi
lea    0xdaf(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   1050 <findMaxConsecutiveOnes@plt>
mov    %eax,%esi
lea    0xd93(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
call   1050 <findMaxConsecutiveOnes@plt>
mov    %eax,%esi
lea    0xd77(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x1,0x4(%rsp)
movl   $0x1,0xc(%rsp)
movl   $0x1,0x10(%rsp)
movabs $0x100000001,%rax
mov    %rax,0x18(%rsp)
movl   $0x1,0x20(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <findMaxConsecutiveOnes@plt>
lea    0xe8a(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
call   1040 <findMaxConsecutiveOnes@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
call   1040 <findMaxConsecutiveOnes@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
call   1040 <findMaxConsecutiveOnes@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <findMaxConsecutiveOnes@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
call   1040 <findMaxConsecutiveOnes@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x6,%esi
call   1040 <findMaxConsecutiveOnes@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x7,%esi
call   1040 <findMaxConsecutiveOnes@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x8,%esi
call   1040 <findMaxConsecutiveOnes@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x9,%esi
call   1040 <findMaxConsecutiveOnes@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i32]
store i32 0, i32* %1
%3 = bitcast [9 x i32]* %2 to i8*
%4 = bitcast i8* %3 to [9 x i32]*
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 1
store i32 1, i32* %5
%6 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 3
store i32 1, i32* %6
%7 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 4
store i32 1, i32* %7
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 6
store i32 1, i32* %8
%9 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 7
store i32 1, i32* %9
%10 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 8
store i32 1, i32* %10
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%12 = call i32 @findMaxConsecutiveOnes(i32* %11, i32 0)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%15 = call i32 @findMaxConsecutiveOnes(i32* %14, i32 1)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%18 = call i32 @findMaxConsecutiveOnes(i32* %17, i32 2)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%21 = call i32 @findMaxConsecutiveOnes(i32* %20, i32 3)
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%24 = call i32 @findMaxConsecutiveOnes(i32* %23, i32 4)
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%27 = call i32 @findMaxConsecutiveOnes(i32* %26, i32 5)
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%30 = call i32 @findMaxConsecutiveOnes(i32* %29, i32 6)
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%33 = call i32 @findMaxConsecutiveOnes(i32* %32, i32 7)
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%36 = call i32 @findMaxConsecutiveOnes(i32* %35, i32 8)
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%39 = call i32 @findMaxConsecutiveOnes(i32* %38, i32 9)
%40 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 1
store i32 1, i32* %3
%4 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 3
store i32 1, i32* %4
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 4
store i32 1, i32* %5
%6 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 6
store i32 1, i32* %6
%7 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 7
store i32 1, i32* %7
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 8
store i32 1, i32* %8
%9 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%10 = call i32 @findMaxConsecutiveOnes(i32* %9, i32 0)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @findMaxConsecutiveOnes(i32* %9, i32 1)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 @findMaxConsecutiveOnes(i32* %9, i32 2)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 @findMaxConsecutiveOnes(i32* %9, i32 3)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 @findMaxConsecutiveOnes(i32* %9, i32 4)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = call i32 @findMaxConsecutiveOnes(i32* %9, i32 5)
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = call i32 @findMaxConsecutiveOnes(i32* %9, i32 6)
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = call i32 @findMaxConsecutiveOnes(i32* %9, i32 7)
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = call i32 @findMaxConsecutiveOnes(i32* %9, i32 8)
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = call i32 @findMaxConsecutiveOnes(i32* %9, i32 9)
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
ret i32 0
}