#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 *hop(int *);
int is_in_bound(int *, int, int *);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int arr[50];
  int i = 0, *m, c = 0, sym;
  do {
    scanf("%d", &arr[i]);
    i++;
  } while (i < 6);
  sym = i;
  m = hop(&arr[0]);
  for (i = 1; i < 50; i++) {
    if (is_in_bound(arr, 50, m) == 1 && m - &arr[0] < sym) {
      if (arr[m - &arr[0]] == 0) {
        c = 1;
        break;
      } else {
        m = hop(m);
      }
    } else {
      break;
    }
  }
  printf("%d\n%d", c, i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xd4(%rbp)
movl   $0x0,-0xe4(%rbp)
movslq -0xd4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe81(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
cmpl   $0x6,-0xd4(%rbp)
jl     1166 <main+0x26>
mov    -0xd4(%rbp),%eax
mov    %eax,-0xe8(%rbp)
lea    -0xd0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xe0(%rbp)
movl   $0x1,-0xd4(%rbp)
cmpl   $0x32,-0xd4(%rbp)
jge    1287 <main+0x147>
lea    -0xd0(%rbp),%rdi
mov    -0xe0(%rbp),%rdx
mov    $0x32,%esi
call   1060 <is_in_bound@plt>
cmp    $0x1,%eax
jne    1269 <main+0x129>
mov    -0xe0(%rbp),%rax
lea    -0xd0(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
movslq -0xe8(%rbp),%rcx
cmp    %rcx,%rax
jge    1269 <main+0x129>
mov    -0xe0(%rbp),%rax
lea    -0xd0(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
cmpl   $0x0,-0xd0(%rbp,%rax,4)
jne    1251 <main+0x111>
movl   $0x1,-0xe4(%rbp)
jmp    1287 <main+0x147>
mov    -0xe0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xe0(%rbp)
jmp    126e <main+0x12e>
jmp    1287 <main+0x147>
jmp    1273 <main+0x133>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    11cc <main+0x8c>
mov    -0xe4(%rbp),%esi
mov    -0xd4(%rbp),%edx
lea    0xd66(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc8,%rsp
lea    0xeaf(%rip),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
call   1030 <hop@plt>
mov    %rax,%rbx
mov    $0x1,%ebp
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x32,%esi
mov    %rbx,%rdx
call   1060 <is_in_bound@plt>
cmp    $0x1,%eax
jne    1207 <main+0xc7>
mov    %rbx,%rax
sub    %r14,%rax
cmp    $0x17,%rax
jg     1207 <main+0xc7>
cmpl   $0x0,(%rsp,%rax,1)
je     1201 <main+0xc1>
mov    %rbx,%rdi
call   1030 <hop@plt>
mov    %rax,%rbx
add    $0x1,%ebp
cmp    $0x32,%ebp
jne    11c0 <main+0x80>
mov    $0x32,%ebp
jmp    1207 <main+0xc7>
mov    $0x1,%r15d
lea    0xdf2(%rip),%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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