#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 */
char *getBinaryEquivalent(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int strlen(char *);
int main() {
  int n, j, length, maxContinuousOne = 0, presentMaxContinuous = 0;
  scanf("%d", &n);
  char *binaryEquivalent = getBinaryEquivalent(n);
  length = strlen(binaryEquivalent);
  for (j = 0; j < length - 1; j++) {
    if (binaryEquivalent[j] == '1') {
      if (presentMaxContinuous == 0) {
        presentMaxContinuous = 1;
      }
      if (binaryEquivalent[j + 1] == '1') {
        presentMaxContinuous++;
      }
      if (presentMaxContinuous > maxContinuousOne) {
        maxContinuousOne = presentMaxContinuous;
      }
    } else {
      presentMaxContinuous = 0;
    }
  }
  printf("%d", maxContinuousOne);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe9c(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1060 <getBinaryEquivalent@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1217 <main+0xd7>
mov    -0x20(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x31,%eax
jne    11fd <main+0xbd>
cmpl   $0x0,-0x18(%rbp)
jne    11c3 <main+0x83>
movl   $0x1,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x31,%eax
jne    11e6 <main+0xa6>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11f8 <main+0xb8>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1204 <main+0xc4>
movl   $0x0,-0x18(%rbp)
jmp    1209 <main+0xc9>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118c <main+0x4c>
mov    -0x14(%rbp),%esi
lea    0xddf(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
call   1060 <getBinaryEquivalent@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
xor    %esi,%esi
cmp    $0x2,%eax
jl     11c1 <main+0x81>
add    $0xffffffff,%eax
xor    %edi,%edi
mov    $0x1,%r8d
xor    %edx,%edx
xor    %esi,%esi
jmp    11b0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %edx,%edx
cmove  %r8d,%edx
xor    %ecx,%ecx
cmpb   $0x31,0x1(%rbx,%rdi,1)
lea    0x1(%rdi),%rdi
sete   %cl
add    %ecx,%edx
cmp    %esi,%edx
cmovg  %edx,%esi
cmp    %rax,%rdi
je     11c1 <main+0x81>
cmpb   $0x31,(%rbx,%rdi,1)
je     1190 <main+0x50>
add    $0x1,%rdi
xor    %edx,%edx
cmp    %rax,%rdi
jne    11b0 <main+0x70>
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %6
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = call i8* @getBinaryEquivalent(i32 %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %4
store i32 0, i32* %3
br label %13
13: ; preds = %51, %0
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = sub nsw i32 %15, 1
%17 = icmp slt i32 %14, %16
br i1 %17, label %18, label %54
18: ; preds = %13
%19 = load i8*, i8** %7
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 49
br i1 %25, label %26, label %49
26: ; preds = %18
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %26
store i32 1, i32* %6
br label %30
30: ; preds = %29, %26
%31 = load i8*, i8** %7
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %31, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 49
br i1 %38, label %39, label %42
39: ; preds = %30
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %42
42: ; preds = %39, %30
%43 = load i32, i32* %6
%44 = load i32, i32* %5
%45 = icmp sgt i32 %43, %44
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = load i32, i32* %6
store i32 %47, i32* %5
br label %48
48: ; preds = %46, %42
br label %50
49: ; preds = %18
store i32 0, i32* %6
br label %50
50: ; preds = %49, %48
br label %51
51: ; preds = %50
%52 = load i32, i32* %3
%53 = add nsw i32 %52, 1
store i32 %53, i32* %3
br label %13
54: ; preds = %13
%55 = load i32, i32* %5
%56 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %55)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i8* @getBinaryEquivalent(i32 %4)
%6 = call i32 @strlen(i8* %5)
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %36
8: ; preds = %0
%9 = add nsw i32 %6, -1
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %8, %31
%12 = phi i64 [ 0, %8 ], [ %32, %31 ]
%13 = phi i32 [ 0, %8 ], [ %34, %31 ]
%14 = phi i32 [ 0, %8 ], [ %33, %31 ]
%15 = getelementptr inbounds i8, i8* %5, i64 %12
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 49
br i1 %17, label %20, label %18
18: ; preds = %11
%19 = add nuw nsw i64 %12, 1
br label %31
20: ; preds = %11
%21 = icmp eq i32 %13, 0
%22 = select i1 %21, i32 1, i32 %13
%23 = add nuw nsw i64 %12, 1
%24 = getelementptr inbounds i8, i8* %5, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 49
%27 = zext i1 %26 to i32
%28 = add nsw i32 %22, %27
%29 = icmp sgt i32 %28, %14
%30 = select i1 %29, i32 %28, i32 %14
br label %31
31: ; preds = %18, %20
%32 = phi i64 [ %19, %18 ], [ %23, %20 ]
%33 = phi i32 [ %14, %18 ], [ %30, %20 ]
%34 = phi i32 [ 0, %18 ], [ %28, %20 ]
%35 = icmp eq i64 %32, %10
br i1 %35, label %36, label %11
36: ; preds = %31, %0
%37 = phi i32 [ 0, %0 ], [ %33, %31 ]
%38 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %37)
ret i32 0
}