program sample
    implicit none
  
    integer(8) :: i,j,m,n,a,b,k
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) a,b,k
    do i=1,k/2
        b=b+a/2
        a=a/2+b/2
        b=b/2
    end do
    if(mod(k,2)==1)then
        b=b+a/2
        a=a/2
    end if
  
    write(*,*) a,b
  
    stop
end program sample
  


; 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.f7020abed3042440326fb00774dd1e20 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5412/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.f7020abed3042440326fb00774dd1e20, i32 7)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %1, i32 8)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 8)
  %7 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 8)
  %8 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %9 = load i64, ptr %3, align 8, !tbaa !3
  %.promoted = load i64, ptr %2, align 8, !tbaa !3
  %.promoted1 = load i64, ptr %1, align 8, !tbaa !3
  %10 = icmp sgt i64 %9, 1
  br i1 %10, label %.lr.ph.preheader, label %21

.lr.ph.preheader:                                 ; preds = %0
  %11 = lshr i64 %9, 1
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %12 = phi i64 [ %19, %.lr.ph ], [ %11, %.lr.ph.preheader ]
  %13 = phi i64 [ %17, %.lr.ph ], [ %.promoted, %.lr.ph.preheader ]
  %14 = phi i64 [ %18, %.lr.ph ], [ %.promoted1, %.lr.ph.preheader ]
  %15 = sdiv i64 %14, 2
  %16 = add i64 %15, %13
  %17 = sdiv i64 %16, 2
  %18 = add nsw i64 %17, %15
  %19 = add nsw i64 %12, -1
  %20 = icmp ugt i64 %12, 1
  br i1 %20, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph
  store i64 %17, ptr %2, align 8, !tbaa !3
  store i64 %18, ptr %1, align 8, !tbaa !3
  br label %21

21:                                               ; preds = %._crit_edge, %0
  %22 = phi i64 [ %18, %._crit_edge ], [ %.promoted1, %0 ]
  %23 = phi i64 [ %17, %._crit_edge ], [ %.promoted, %0 ]
  %24 = and i64 %9, -9223372036854775807
  %25 = icmp eq i64 %24, 1
  br i1 %25, label %26, label %29

26:                                               ; preds = %21
  %27 = sdiv i64 %22, 2
  %28 = add i64 %27, %23
  store i64 %28, ptr %2, align 8, !tbaa !3
  store i64 %27, ptr %1, align 8, !tbaa !3
  br label %29

29:                                               ; preds = %26, %21
  %30 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.f7020abed3042440326fb00774dd1e20, i32 18)
  %31 = load i64, ptr %1, align 8, !tbaa !3
  %32 = call i1 @_FortranAioOutputInteger64(ptr %30, i64 %31)
  %33 = load i64, ptr %2, align 8, !tbaa !3
  %34 = call i1 @_FortranAioOutputInteger64(ptr %30, i64 %33)
  %35 = call i32 @_FortranAioEndIoStatement(ptr %30)
  %36 = 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 @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) 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"}
