#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 /*<<< orphan*/ free(int *);
int *hop(int *);
int is_in_bound(int *, int, int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int *arr = (int *)malloc(sizeof(int) * 50);
  int i, *p, k = 0, el;
  for (i = 0; i < 6; i++) {
    scanf("%d", &arr[i]);
  }
  el = i;
  p = hop(&arr[0]);
  for (i = 1; i < 50; i++) {
    if (is_in_bound(arr, 50, p) == 1 && p - &arr[0] < el) {
      if (arr[p - &arr[0]] == 0) {
        k = 1;
        break;
      } else
        p = hop(p);
    } else
      break;
  }
  printf("%d\n%d", k, i);
  free(arr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc8,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    11be <main+0x5e>
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe58(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118b <main+0x2b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <hop@plt>
mov    %rax,-0x20(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x32,-0x14(%rbp)
jge    126c <main+0x10c>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x32,%esi
call   1080 <is_in_bound@plt>
cmp    $0x1,%eax
jne    1254 <main+0xf4>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
movslq -0x28(%rbp),%rcx
cmp    %rcx,%rax
jge    1254 <main+0xf4>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rdx
sub    %rdx,%rcx
sar    $0x2,%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1242 <main+0xe2>
movl   $0x1,-0x24(%rbp)
jmp    126c <main+0x10c>
mov    -0x20(%rbp),%rdi
call   1040 <hop@plt>
mov    %rax,-0x20(%rbp)
jmp    1259 <main+0xf9>
jmp    126c <main+0x10c>
jmp    125e <main+0xfe>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d8 <main+0x78>
mov    -0x24(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xd87(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xc8,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0xe88(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1070 <scanf@plt>
lea    0x4(%r14),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x8(%r14),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xc(%r14),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x10(%r14),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x14(%r14),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
mov    %r14,%rdi
call   1040 <hop@plt>
mov    %rax,%rbx
mov    $0x1,%ebp
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    $0x32,%esi
mov    %rbx,%rdx
call   1080 <is_in_bound@plt>
cmp    $0x1,%eax
jne    1228 <main+0xc8>
mov    %rbx,%rax
sub    %r14,%rax
cmp    $0x17,%rax
jg     1228 <main+0xc8>
cmpl   $0x0,(%r14,%rax,1)
je     1222 <main+0xc2>
mov    %rbx,%rdi
call   1040 <hop@plt>
mov    %rax,%rbx
add    $0x1,%ebp
cmp    $0x32,%ebp
jne    11e0 <main+0x80>
mov    $0x32,%ebp
jmp    1228 <main+0xc8>
mov    $0x1,%r15d
lea    0xdd1(%rip),%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%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 i32*
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i64 @malloc(i32 200)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %2
store i32 0, i32* %5
store i32 0, i32* %3
br label %9
9: ; preds = %18, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 6
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load i32*, i32** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, 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 = %12
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %9
21: ; preds = %9
%22 = load i32, i32* %3
store i32 %22, i32* %6
%23 = load i32*, i32** %2
%24 = getelementptr inbounds i32, i32* %23, i64 0
%25 = call i32* @hop(i32* %24)
store i32* %25, i32** %4
store i32 1, i32* %3
br label %26
26: ; preds = %64, %21
%27 = load i32, i32* %3
%28 = icmp slt i32 %27, 50
br i1 %28, label %29, label %67
29: ; preds = %26
%30 = load i32*, i32** %2
%31 = load i32*, i32** %4
%32 = call i32 @is_in_bound(i32* %30, i32 50, i32* %31)
%33 = icmp eq i32 %32, 1
br i1 %33, label %34, label %62
34: ; preds = %29
%35 = load i32*, i32** %4
%36 = load i32*, i32** %2
%37 = getelementptr inbounds i32, i32* %36, i64 0
%38 = ptrtoint i32* %35 to i64
%39 = ptrtoint i32* %37 to i64
%40 = sub i64 %38, %39
%41 = sdiv exact i64 %40, 4
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = icmp slt i64 %41, %43
br i1 %44, label %45, label %62
45: ; preds = %34
%46 = load i32*, i32** %2
%47 = load i32*, i32** %4
%48 = load i32*, i32** %2
%49 = getelementptr inbounds i32, i32* %48, i64 0
%50 = ptrtoint i32* %47 to i64
%51 = ptrtoint i32* %49 to i64
%52 = sub i64 %50, %51
%53 = sdiv exact i64 %52, 4
%54 = getelementptr inbounds i32, i32* %46, i64 %53
%55 = load i32, i32* %54
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %45
store i32 1, i32* %5
br label %67
58: ; preds = %45
%59 = load i32*, i32** %4
%60 = call i32* @hop(i32* %59)
store i32* %60, i32** %4
br label %61
61: ; preds = %58
br label %63
62: ; preds = %34, %29
br label %67
63: ; preds = %61
br label %64
64: ; preds = %63
%65 = load i32, i32* %3
%66 = add nsw i32 %65, 1
store i32 %66, i32* %3
br label %26
67: ; preds = %62, %57, %26
%68 = load i32, i32* %5
%69 = load i32, i32* %3
%70 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %68, i32 %69)
%71 = load i32*, i32** %2
%72 = call i32 @free(i32* %71)
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 = tail call i64 @malloc(i32 200)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = getelementptr inbounds i32, i32* %2, i64 1
%5 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%6 = getelementptr inbounds i32, i32* %2, i64 2
%7 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds i32, i32* %2, i64 3
%9 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds i32, i32* %2, i64 4
%11 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds i32, i32* %2, i64 5
%13 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = tail call i32* @hop(i32* %2)
br label %15
15: ; preds = %0, %29
%16 = phi i32 [ 1, %0 ], [ %31, %29 ]
%17 = phi i32* [ %14, %0 ], [ %30, %29 ]
%18 = tail call i32 @is_in_bound(i32* %2, i32 50, i32* %17)
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %33
20: ; preds = %15
%21 = ptrtoint i32* %17 to i64
%22 = sub i64 %21, %1
%23 = icmp slt i64 %22, 24
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = ashr exact i64 %22, 2
%26 = getelementptr inbounds i32, i32* %2, i64 %25
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %33, label %29
29: ; preds = %24
%30 = tail call i32* @hop(i32* %17)
%31 = add nuw nsw i32 %16, 1
%32 = icmp eq i32 %31, 50
br i1 %32, label %33, label %15
33: ; preds = %24, %15, %20, %29
%34 = phi i32 [ %16, %24 ], [ %16, %15 ], [ %16, %20 ], [ 50, %29 ]
%35 = phi i32 [ 1, %24 ], [ 0, %15 ], [ 0, %20 ], [ 0, %29 ]
%36 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %35, i32 %34)
%37 = tail call i32 @free(i32* %2)
ret i32 0
}