#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 EOF;
int *hop(int *);
scalar_t__ is_in_bound(int *, int, int *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int m[50], i, n, *p;
  for (i = 0; m[i] != EOF; i++)
    scanf("%d", &m[i]);
  n = i - 8;
  p = m;
  for (i = 0; i < 50 && is_in_bound(m, n, p) != 0 && *p != 0; ++i)
    p = hop(p);
  if (m[i + 1] == 0)
    printf("1\n%d", i);
  else
    printf("0\n%d", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xd4(%rbp)
movslq -0xd4(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%eax
mov    0x2e77(%rip),%rcx
cmp    (%rcx),%eax
je     11ae <main+0x6e>
movslq -0xd4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe72(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    115c <main+0x1c>
mov    -0xd4(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0xd8(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
movl   $0x0,-0xd4(%rbp)
xor    %eax,%eax
cmpl   $0x32,-0xd4(%rbp)
mov    %al,-0xe1(%rbp)
jge    122b <main+0xeb>
lea    -0xd0(%rbp),%rdi
mov    -0xd8(%rbp),%esi
mov    -0xe0(%rbp),%rdx
call   1060 <is_in_bound@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xe1(%rbp)
je     122b <main+0xeb>
mov    -0xe0(%rbp),%rax
cmpl   $0x0,(%rax)
setne  %al
mov    %al,-0xe1(%rbp)
mov    -0xe1(%rbp),%al
test   $0x1,%al
jne    123e <main+0xfe>
jmp    1265 <main+0x125>
mov    -0xe0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    11d5 <main+0x95>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
cltq
cmpl   $0x0,-0xd0(%rbp,%rax,4)
jne    1295 <main+0x155>
mov    -0xd4(%rbp),%esi
lea    0xd75(%rip),%rdi
call   1040 <printf@plt>
jmp    12a7 <main+0x167>
mov    -0xd4(%rbp),%esi
lea    0xd63(%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
mov    $0xfffffff8,%ebx
mov    %rsp,%rbp
lea    0xeab(%rip),%r14
mov    0x2e85(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0x4(%rbp),%eax
add    $0x4,%rbp
add    $0x1,%ebx
cmp    (%r15),%eax
jne    1170 <main+0x30>
xor    %r15d,%r15d
mov    %rsp,%r14
mov    %r14,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rbp,%rdx
call   1060 <is_in_bound@plt>
test   %rax,%rax
je     11d3 <main+0x93>
cmpl   $0x0,0x0(%rbp)
je     11d3 <main+0x93>
mov    %rbp,%rdi
call   1030 <hop@plt>
mov    %rax,%rbp
add    $0x1,%r15d
cmp    $0x32,%r15d
jne    11a0 <main+0x60>
mov    $0x32,%r15d
mov    %r15d,%eax
cmpl   $0x0,0x4(%rsp,%rax,4)
lea    0xe1e(%rip),%rax
lea    0xe1c(%rip),%rdi
cmove  %rax,%rdi
mov    %r15d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"1\0A%d\00"
@.str.2 = [5 x i8] c"0\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
br label %4
4: ; preds = %0, %4
%5 = phi i64 [ 0, %0 ], [ %8, %4 ]
%6 = phi i32* [ %3, %0 ], [ %9, %4 ]
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = trunc i64 %8 to i32
%15 = add i32 %14, -8
br label %16
16: ; preds = %13, %24
%17 = phi i32* [ %3, %13 ], [ %25, %24 ]
%18 = phi i32 [ 0, %13 ], [ %26, %24 ]
%19 = call i64 @is_in_bound(i32* %3, i32 %15, i32* %17)
%20 = icmp eq i64 %19, 0
br i1 %20, label %28, label %21
21: ; preds = %16
%22 = load i32, i32* %17
%23 = icmp eq i32 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %21
%25 = call i32* @hop(i32* %17)
%26 = add nuw nsw i32 %18, 1
%27 = icmp eq i32 %26, 50
br i1 %27, label %28, label %16
28: ; preds = %24, %16, %21
%29 = phi i32 [ 50, %24 ], [ %18, %16 ], [ %18, %21 ]
%30 = add nuw nsw i32 %29, 1
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = icmp eq i32 %33, 0
%35 = select i1 %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%36 = call i32 @printf(i8* %35, i32 %29)
ret i32 0
}