implicit none

integer :: n
logical :: flg_a, flg_b, flg_c
integer :: tmp_a, tmp_b
integer :: a,b,c

read *,a,b,c

flg_a = (mod(a,2) == 1)
flg_b = (mod(b,2) == 1)
flg_c = (mod(c,2) == 1)
if (flg_a .or. flg_b .or. flg_c) then
   print '(i0)',0
   stop
endif

if (a == b .and. b == c .and. c == a) then
   print '(i0)',-1
   stop
endif

n = 0
do while (.true.)
   if (mod(a,2) == 1) exit
   if (mod(b,2) == 1) exit
   if (mod(c,2) == 1) exit
   n = n + 1
   tmp_a = a
   tmp_b = b
   a = (tmp_b+c)/2
   b = (c+tmp_a)/2
   c = (tmp_a+tmp_b)/2
enddo

write(6,'(i0)') n
stop
end
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QQcl.a9414d0a25dcde7dc19496cfbabefc2a = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_7310/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a9414d0a25dcde7dc19496cfbabefc2a, i32 8)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %1, i32 4)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 4)
  %7 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %8 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %9 = load i32, ptr %1, align 4, !tbaa !3
  %10 = and i32 %9, -2147483647
  %11 = icmp eq i32 %10, 1
  %12 = load i32, ptr %2, align 4, !tbaa !3
  %13 = and i32 %12, -2147483647
  %14 = icmp eq i32 %13, 1
  %15 = load i32, ptr %3, align 4, !tbaa !3
  %16 = and i32 %15, -2147483647
  %17 = icmp eq i32 %16, 1
  %18 = or i1 %11, %14
  %19 = or i1 %18, %17
  br i1 %19, label %20, label %25

20:                                               ; preds = %0
  %21 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.a9414d0a25dcde7dc19496cfbabefc2a, i32 14)
  %22 = call i1 @_FortranAioOutputInteger32(ptr %21, i32 0)
  %23 = call i32 @_FortranAioEndIoStatement(ptr %21)
  %24 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

25:                                               ; preds = %0
  %26 = icmp eq i32 %9, %12
  %27 = icmp eq i32 %12, %15
  %28 = and i1 %26, %27
  %29 = icmp eq i32 %15, %9
  %30 = and i1 %29, %28
  br i1 %30, label %31, label %.lr.ph

31:                                               ; preds = %25
  %32 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.a9414d0a25dcde7dc19496cfbabefc2a, i32 19)
  %33 = call i1 @_FortranAioOutputInteger32(ptr %32, i32 -1)
  %34 = call i32 @_FortranAioEndIoStatement(ptr %32)
  %35 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

.lr.ph:                                           ; preds = %25, %43
  %.011 = phi i32 [ %44, %43 ], [ 0, %25 ]
  %36 = phi i32 [ %46, %43 ], [ %9, %25 ]
  %37 = phi i32 [ %48, %43 ], [ %12, %25 ]
  %38 = phi i32 [ %50, %43 ], [ %15, %25 ]
  %39 = and i32 %37, -2147483647
  %40 = icmp eq i32 %39, 1
  %41 = and i32 %38, -2147483647
  %42 = icmp eq i32 %41, 1
  %or.cond = select i1 %40, i1 true, i1 %42
  br i1 %or.cond, label %._crit_edge, label %43

43:                                               ; preds = %.lr.ph
  %44 = add i32 %.011, 1
  %45 = add i32 %38, %37
  %46 = sdiv i32 %45, 2
  store i32 %46, ptr %1, align 4, !tbaa !3
  %47 = add i32 %38, %36
  %48 = sdiv i32 %47, 2
  store i32 %48, ptr %2, align 4, !tbaa !3
  %49 = add i32 %37, %36
  %50 = sdiv i32 %49, 2
  store i32 %50, ptr %3, align 4, !tbaa !3
  %51 = and i32 %46, -2147483647
  %52 = icmp eq i32 %51, 1
  br i1 %52, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %43, %.lr.ph
  %.0.lcssa.ph = phi i32 [ %44, %43 ], [ %.011, %.lr.ph ]
  %53 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 6, ptr nonnull @_QQcl.a9414d0a25dcde7dc19496cfbabefc2a, i32 36)
  %54 = call i1 @_FortranAioOutputInteger32(ptr %53, i32 %.0.lcssa.ph)
  %55 = call i32 @_FortranAioEndIoStatement(ptr %53)
  %56 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

attributes #0 = { noreturn }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
