program taka
implicit none
integer:: n,i,j,b,d,count
integer,allocatable,dimension(:):: a
 
read(5,*) n
allocate(a(n))
read(5,*) (a(i),i=1,n)

count=0

do j=1,n
  d=a(j)
   do while(mod(d,2)==0)
    count=count+1
    d=d/2
   end do
end do

write(6,*) count
 
end program taka
; 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"

@_QFEa.0 = internal unnamed_addr global ptr null
@_QQcl.77f8710cb15c325ead504da4e72ec70e = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5878/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 5, ptr nonnull @_QQcl.77f8710cb15c325ead504da4e72ec70e, i32 6)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = load i32, ptr %1, align 4, !tbaa !3
  %6 = call i32 @llvm.smax.i32(i32 %5, i32 0)
  %7 = zext i32 %6 to i64
  %8 = shl nuw nsw i64 %7, 2
  %9 = call ptr @malloc(i64 %8)
  store ptr %9, ptr @_QFEa.0, align 8, !tbaa !7
  %10 = call ptr @_FortranAioBeginExternalListInput(i32 5, ptr nonnull @_QQcl.77f8710cb15c325ead504da4e72ec70e, i32 8)
  %11 = load i32, ptr %1, align 4, !tbaa !3
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %13 = zext i32 %11 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %14 = phi i64 [ %19, %.lr.ph ], [ 1, %.lr.ph.preheader ]
  %.unpack80 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %sext = shl i64 %14, 32
  %15 = ashr exact i64 %sext, 32
  %16 = add nsw i64 %15, -1
  %17 = getelementptr i32, ptr %.unpack80, i64 %16
  %18 = call i1 @_FortranAioInputInteger(ptr %10, ptr %17, i32 4)
  %19 = add nuw nsw i64 %14, 1
  %exitcond.not = icmp eq i64 %14, %13
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %20 = call i32 @_FortranAioEndIoStatement(ptr %10)
  %21 = load i32, ptr %1, align 4, !tbaa !3
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph101, label %._crit_edge102

.lr.ph101:                                        ; preds = %._crit_edge
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  br label %23

23:                                               ; preds = %.lr.ph101, %._crit_edge96
  %.099 = phi i32 [ 1, %.lr.ph101 ], [ %34, %._crit_edge96 ]
  %.05798 = phi i32 [ 0, %.lr.ph101 ], [ %.1.lcssa, %._crit_edge96 ]
  %24 = sext i32 %.099 to i64
  %25 = add nsw i64 %24, -1
  %26 = getelementptr i32, ptr %.unpack, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !3
  %28 = and i32 %27, 1
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %.lr.ph95, label %._crit_edge96

.lr.ph95:                                         ; preds = %23, %.lr.ph95
  %.05693 = phi i32 [ %31, %.lr.ph95 ], [ %27, %23 ]
  %.192 = phi i32 [ %30, %.lr.ph95 ], [ %.05798, %23 ]
  %30 = add i32 %.192, 1
  %31 = sdiv i32 %.05693, 2
  %32 = and i32 %31, 1
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %.lr.ph95, label %._crit_edge96

._crit_edge96:                                    ; preds = %.lr.ph95, %23
  %.1.lcssa = phi i32 [ %.05798, %23 ], [ %30, %.lr.ph95 ]
  %34 = add nuw i32 %.099, 1
  %exitcond104.not = icmp eq i32 %.099, %21
  br i1 %exitcond104.not, label %._crit_edge102, label %23

._crit_edge102:                                   ; preds = %._crit_edge96, %._crit_edge
  %.057.lcssa = phi i32 [ 0, %._crit_edge ], [ %.1.lcssa, %._crit_edge96 ]
  %35 = call ptr @_FortranAioBeginExternalListOutput(i32 6, ptr nonnull @_QQcl.77f8710cb15c325ead504da4e72ec70e, i32 20)
  %36 = call i1 @_FortranAioOutputInteger32(ptr %35, i32 %.057.lcssa)
  %37 = call i32 @_FortranAioEndIoStatement(ptr %35)
  ret void
}

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 @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #1

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
