#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 */
scalar_t__ EOF;
int *hop(int *);
scalar_t__ is_in_bound(int *, int, int *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *);
int main() {
  int arr[50], n = 0, i = 0;
  int *ptr;
  while (scanf("%d", &arr[i]) != EOF && i < 50) {
    i++;
  }
  ptr = &arr[0];
  do {
    if (*ptr == 0) {
      printf("1\n");
      break;
    }
    ptr = hop(ptr);
    n++;
    if (is_in_bound(arr, i, ptr) == 0 || n > 49) {
      printf("0\n");
      break;
    }
  } while (5);
  printf("%d\n", n);
  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,-0xd8(%rbp)
movslq -0xd8(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe7e(%rip),%rdi
call   1050 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
mov    0x2e55(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0xe1(%rbp)
je     11b2 <main+0x72>
cmpl   $0x32,-0xd8(%rbp)
setl   %al
mov    %al,-0xe1(%rbp)
mov    -0xe1(%rbp),%al
test   $0x1,%al
jne    11c5 <main+0x85>
jmp    11d9 <main+0x99>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    1166 <main+0x26>
lea    -0xd0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rax
cmpl   $0x0,(%rax)
jne    120a <main+0xca>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1283 <main+0x143>
mov    -0xe0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0xd8(%rbp),%esi
mov    -0xe0(%rbp),%rdx
call   1060 <is_in_bound@plt>
cmp    $0x0,%rax
je     125c <main+0x11c>
cmpl   $0x31,-0xd4(%rbp)
jle    126f <main+0x12f>
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1283 <main+0x143>
jmp    1274 <main+0x134>
mov    $0x1,%al
test   $0x1,%al
jne    11e7 <main+0xa7>
jmp    1283 <main+0x143>
mov    -0xd4(%rbp),%esi
lea    0xd79(%rip),%rdi
mov    $0x0,%al
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   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rsp,%rbx
xor    %ebp,%ebp
lea    0xe93(%rip),%r14
mov    0x2e74(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
lea    0x1(%rbp),%r13
cmp    (%r15),%rax
je     11a1 <main+0x51>
add    $0x4,%rbx
cmp    $0x32,%rbp
mov    %r13,%rbp
jb     1180 <main+0x30>
add    $0xffffffffffffffff,%r13
xor    %r14d,%r14d
mov    %rsp,%r12
lea    0xe57(%rip),%r15
mov    %r12,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
cmpl   $0x0,(%rbx)
je     11fa <main+0xaa>
mov    %rbx,%rdi
call   1040 <hop@plt>
mov    %rax,%rbx
lea    0x1(%r14),%ebp
mov    %r12,%rdi
mov    %r13d,%esi
mov    %rax,%rdx
call   1070 <is_in_bound@plt>
test   %rax,%rax
je     11f0 <main+0xa0>
cmp    $0x31,%r14d
mov    %ebp,%r14d
jb     11c0 <main+0x70>
lea    0xe10(%rip),%r15
mov    %ebp,%r14d
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0xdfa(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.3 = [4 x i8] c"%d\0A\00"
@str = [2 x i8] c"0\00"
@str.4 = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca [50 x i32]
%2 = bitcast [50 x i32]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ %11, %3 ], [ 0, %0 ]
%5 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %4
%6 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
%9 = icmp ult i64 %4, 50
%10 = select i1 %8, i1 %9, i1 false
%11 = add nuw nsw i64 %4, 1
br i1 %10, label %3, label %12
12: ; preds = %3
%13 = trunc i64 %4 to i32
%14 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 0
br label %15
15: ; preds = %20, %12
%16 = phi i32 [ 0, %12 ], [ %22, %20 ]
%17 = phi i32* [ %14, %12 ], [ %21, %20 ]
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %27, label %20
20: ; preds = %15
%21 = call i32* @hop(i32* %17)
%22 = add nuw nsw i32 %16, 1
%23 = call i64 @is_in_bound(i32* %14, i32 %13, i32* %21)
%24 = icmp eq i64 %23, 0
%25 = icmp ugt i32 %16, 48
%26 = select i1 %24, i1 true, i1 %25
br i1 %26, label %27, label %15
27: ; preds = %20, %15
%28 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0), %15 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), %20 ]
%29 = phi i32 [ %16, %15 ], [ %22, %20 ]
%30 = call i32 @puts(i8* dereferenceable(1) %28)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %29)
ret i32 0
}