#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_bounds(int *, int, int *);
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ scanf(char *, int *);
int main() {
  int array[50], temp = 0, hops = 0, i, size, result = 0;
  int *ptr = array;
  for (i = 0; i < 50 && scanf("%d", &temp) != EOF; i++) {
    array[i] = temp;
  }
  size = i;
  temp = 0;
  for (i = 0; i < 50; i++) {
    if (is_in_bounds(array, size, ptr) == 0) {
      break;
    }
    if (*ptr == 0) {
      result = 1;
      break;
    }
    ptr = hop(ptr);
    hops++;
  }
  printf("%d\n%d", result, hops);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xd4(%rbp)
movl   $0x0,-0xd8(%rbp)
movl   $0x0,-0xe4(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
movl   $0x0,-0xdc(%rbp)
xor    %eax,%eax
cmpl   $0x32,-0xdc(%rbp)
mov    %al,-0xf1(%rbp)
jge    11c3 <main+0x83>
lea    0xe5f(%rip),%rdi
lea    -0xd4(%rbp),%rsi
call   1060 <scanf@plt>
mov    0x2e31(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
mov    %al,-0xf1(%rbp)
mov    -0xf1(%rbp),%al
test   $0x1,%al
jne    11d6 <main+0x96>
jmp    11fe <main+0xbe>
mov    -0xd4(%rbp),%ecx
movslq -0xdc(%rbp),%rax
mov    %ecx,-0xd0(%rbp,%rax,4)
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    1188 <main+0x48>
mov    -0xdc(%rbp),%eax
mov    %eax,-0xe0(%rbp)
movl   $0x0,-0xd4(%rbp)
movl   $0x0,-0xdc(%rbp)
cmpl   $0x32,-0xdc(%rbp)
jge    12a8 <main+0x168>
lea    -0xd0(%rbp),%rdi
mov    -0xe0(%rbp),%esi
mov    -0xf0(%rbp),%rdx
call   1040 <is_in_bounds@plt>
cmp    $0x0,%rax
jne    1253 <main+0x113>
jmp    12a8 <main+0x168>
mov    -0xf0(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1272 <main+0x132>
movl   $0x1,-0xe4(%rbp)
jmp    12a8 <main+0x168>
mov    -0xf0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xf0(%rbp)
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    121e <main+0xde>
mov    -0xe4(%rbp),%esi
mov    -0xd8(%rbp),%edx
lea    0xd45(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xe0,%rsp
movl   $0x0,0xc(%rsp)
xor    %ebx,%ebx
lea    0xea3(%rip),%r14
lea    0xc(%rsp),%r15
mov    0x2e7c(%rip),%rbp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
cmp    0x0(%rbp),%rax
je     1198 <main+0x58>
mov    0xc(%rsp),%eax
mov    %eax,0x10(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x32,%rbx
jne    1170 <main+0x30>
mov    $0x32,%ebx
lea    0x10(%rsp),%r15
movl   $0x0,0xc(%rsp)
xor    %r14d,%r14d
mov    %r15,%rbp
xor    %r12d,%r12d
xchg   %ax,%ax
mov    %r15,%rdi
mov    %ebx,%esi
mov    %rbp,%rdx
call   1040 <is_in_bounds@plt>
test   %rax,%rax
je     11eb <main+0xab>
cmpl   $0x0,0x0(%rbp)
je     11e5 <main+0xa5>
mov    %rbp,%rdi
call   1030 <hop@plt>
mov    %rax,%rbp
add    $0x1,%r12d
cmp    $0x32,%r12d
jne    11b0 <main+0x70>
mov    $0x32,%r12d
jmp    11eb <main+0xab>
mov    $0x1,%r14d
lea    0xe0e(%rip),%rdi
mov    %r14d,%esi
mov    %r12d,%edx
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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