#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 *, int, int);
scalar_t__ scanf(char *, int *);
int main() {
  int arr[50] = {0};
  int hopz, size;
  int *ptr = arr;
  int begin = 0;
  hopz = 0;
  while (scanf("%d", &arr[hopz]) != EOF && hopz < 50)
    hopz++;
  size = hopz;
  hopz = 0;
  while (hopz < 50 && is_in_bound(arr, size, ptr)) {
    if (*ptr == 0) {
      begin = 1;
      break;
    }
    ptr = hop(ptr);
    hopz++;
  }
  printf("%d\n%d\n", begin, hopz);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1050 <memset@plt>
lea    -0xd0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
movl   $0x0,-0xe4(%rbp)
movl   $0x0,-0xd4(%rbp)
movslq -0xd4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe4d(%rip),%rdi
call   1060 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
mov    0x2e24(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0xe5(%rbp)
je     11e3 <main+0x93>
cmpl   $0x32,-0xd4(%rbp)
setl   %al
mov    %al,-0xe5(%rbp)
mov    -0xe5(%rbp),%al
test   $0x1,%al
jne    11f6 <main+0xa6>
jmp    120a <main+0xba>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1197 <main+0x47>
mov    -0xd4(%rbp),%eax
mov    %eax,-0xd8(%rbp)
movl   $0x0,-0xd4(%rbp)
xor    %eax,%eax
cmpl   $0x32,-0xd4(%rbp)
mov    %al,-0xe6(%rbp)
jge    125b <main+0x10b>
lea    -0xd0(%rbp),%rdi
mov    -0xd8(%rbp),%esi
mov    -0xe0(%rbp),%rdx
call   1070 <is_in_bound@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xe6(%rbp)
mov    -0xe6(%rbp),%al
test   $0x1,%al
jne    126e <main+0x11e>
jmp    12b4 <main+0x164>
mov    -0xe0(%rbp),%rax
cmpl   $0x0,(%rax)
jne    128d <main+0x13d>
movl   $0x1,-0xe4(%rbp)
jmp    12b4 <main+0x164>
mov    -0xe0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1220 <main+0xd0>
mov    -0xe4(%rbp),%esi
mov    -0xd4(%rbp),%edx
lea    0xd3c(%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   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0xc0(%rsp)
mov    %rsp,%rbp
xor    %ebx,%ebx
lea    0xe4d(%rip),%r14
mov    0x2e2e(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
lea    0x1(%rbx),%r13
cmp    (%r15),%rax
je     11e1 <main+0xa1>
add    $0x4,%rbp
cmp    $0x32,%rbx
mov    %r13,%rbx
jb     11c0 <main+0x80>
mov    %rsp,%r15
add    $0xffffffffffffffff,%r13
xor    %r14d,%r14d
mov    %r15,%rbp
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r13d,%esi
mov    %rbp,%rdx
call   1060 <is_in_bound@plt>
test   %rax,%rax
je     123c <main+0xfc>
cmpl   $0x0,0x0(%rbp)
je     1236 <main+0xf6>
mov    %rbp,%rdi
call   1030 <hop@plt>
mov    %rax,%rbp
add    $0x1,%r12d
cmp    $0x32,%r12d
jne    1200 <main+0xc0>
mov    $0x32,%r12d
jmp    123c <main+0xfc>
mov    $0x1,%r14d
lea    0xdc0(%rip),%rdi
mov    %r14d,%esi
mov    %r12d,%edx
call   1040 <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 = [7 x i8] c"%d\0A%d\0A\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
%7 = bitcast [50 x i32]* %2 to i8*
%8 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 0
store i32* %8, i32** %5
store i32 0, i32* %6
store i32 0, i32* %3
br label %9
9: ; preds = %21, %0
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %11
%13 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = load i64, i64* @EOF
%15 = icmp ne i64 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 50
br label %19
19: ; preds = %16, %9
%20 = phi i1 [ false, %9 ], [ %18, %16 ]
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %9
24: ; preds = %19
%25 = load i32, i32* %3
store i32 %25, i32* %4
store i32 0, i32* %3
br label %26
26: ; preds = %42, %24
%27 = load i32, i32* %3
%28 = icmp slt i32 %27, 50
br i1 %28, label %29, label %35
29: ; preds = %26
%30 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 0
%31 = load i32, i32* %4
%32 = load i32*, i32** %5
%33 = call i64 @is_in_bound(i32* %30, i32 %31, i32* %32)
%34 = icmp ne i64 %33, 0
br label %35
35: ; preds = %29, %26
%36 = phi i1 [ false, %26 ], [ %34, %29 ]
br i1 %36, label %37, label %47
37: ; preds = %35
%38 = load i32*, i32** %5
%39 = load i32, i32* %38
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %37
store i32 1, i32* %6
br label %47
42: ; preds = %37
%43 = load i32*, i32** %5
%44 = call i32* @hop(i32* %43)
store i32* %44, i32** %5
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %26
47: ; preds = %41, %35
%48 = load i32, i32* %6
%49 = load i32, i32* %3
%50 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %48, i32 %49)
ret i32 0
}

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