program dm
  implicit none
  integer :: N,i,edge
  integer,allocatable ::A(:)
  integer,allocatable :: ans(:)

  read(*,*) N
  allocate(A(N))
  allocate(ans(N))
  read(*,*) A

  edge=0
  do i=1,n
     edge=edge-((-1)**i)*A(i)
  enddo
  ans(1)=edge/2
  do i=2,n
     ans(i)=(A(i-1)-ans(i-1))
  enddo
  do i=1,n
     write(*,'(i0)',advance='no') ans(i)*2
     write(*,'(a)',advance='no') ' '
  enddo
  write(*,*)
end program dm





; 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
@_QFEa.8 = internal unnamed_addr global i64 0
@_QFEans.0 = internal unnamed_addr global ptr null
@_QQcl.3628e367663c96c1a9d172c40c9cae18 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3834/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQcl.6E6F = linkonce constant [2 x i8] c"no"
@_QQcl.286129 = linkonce constant [3 x i8] c"(a)"
@_QQcl.20 = linkonce constant [1 x i8] c" "
@_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 { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.3628e367663c96c1a9d172c40c9cae18, i32 7)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = load i32, ptr %2, align 4, !tbaa !3
  %7 = call i32 @llvm.smax.i32(i32 %6, i32 0)
  %8 = zext i32 %7 to i64
  %9 = shl nuw nsw i64 %8, 2
  %10 = call ptr @malloc(i64 %9)
  store ptr %10, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %8, ptr @_QFEa.8, align 8, !tbaa !7
  %11 = call ptr @malloc(i64 %9)
  store ptr %11, ptr @_QFEans.0, align 8, !tbaa !7
  %12 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.3628e367663c96c1a9d172c40c9cae18, i32 10)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack262.unpack.unpack264 = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %.unpack262.unpack.unpack264, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %13 = call i1 @_FortranAioInputDescriptor(ptr %12, ptr nonnull %1)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %12)
  %15 = load i32, ptr %2, align 4, !tbaa !3
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %17 = zext i32 %15 to i64
  %.unpack315 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  br label %.preheader.i

.preheader.i:                                     ; preds = %.lr.ph, %__mlir_math_ipowi_i32.exit
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %__mlir_math_ipowi_i32.exit ]
  %.0327 = phi i32 [ 0, %.lr.ph ], [ %33, %__mlir_math_ipowi_i32.exit ]
  %18 = trunc i64 %indvars.iv to i32
  %19 = and i32 %18, 1
  %.not3.i = icmp eq i32 %19, 0
  %20 = select i1 %.not3.i, i32 1, i32 -1
  %21 = icmp eq i64 %indvars.iv, 1
  br i1 %21, label %__mlir_math_ipowi_i32.exit, label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.preheader.i, %.lr.ph.i
  %spec.select4.i = phi i32 [ %spec.select.i, %.lr.ph.i ], [ %20, %.preheader.i ]
  %22 = phi i32 [ %24, %.lr.ph.i ], [ %18, %.preheader.i ]
  %23 = phi i32 [ %25, %.lr.ph.i ], [ -1, %.preheader.i ]
  %24 = lshr i32 %22, 1
  %25 = mul i32 %23, %23
  %26 = and i32 %22, 2
  %.not.i = icmp eq i32 %26, 0
  %27 = select i1 %.not.i, i32 1, i32 %25
  %spec.select.i = mul i32 %27, %spec.select4.i
  %28 = icmp ult i32 %22, 4
  br i1 %28, label %__mlir_math_ipowi_i32.exit, label %.lr.ph.i

__mlir_math_ipowi_i32.exit:                       ; preds = %.lr.ph.i, %.preheader.i
  %common.ret.op.i = phi i32 [ %20, %.preheader.i ], [ %spec.select.i, %.lr.ph.i ]
  %29 = add nsw i64 %indvars.iv, -1
  %30 = getelementptr i32, ptr %.unpack315, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !3
  %32 = mul i32 %31, %common.ret.op.i
  %33 = sub i32 %.0327, %32
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %17
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %.preheader.i

._crit_edge.loopexit:                             ; preds = %__mlir_math_ipowi_i32.exit
  %34 = sdiv i32 %33, 2
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %0
  %.0.lcssa = phi i32 [ 0, %0 ], [ %34, %._crit_edge.loopexit ]
  %.unpack267 = load ptr, ptr @_QFEans.0, align 8, !tbaa !7
  store i32 %.0.lcssa, ptr %.unpack267, align 4, !tbaa !3
  %35 = load i32, ptr %2, align 4, !tbaa !3
  %36 = icmp sgt i32 %35, 1
  br i1 %36, label %.lr.ph329, label %._crit_edge330

.lr.ph329:                                        ; preds = %._crit_edge
  %37 = zext i32 %35 to i64
  %.unpack291 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %load_initial = load i32, ptr %.unpack267, align 4
  %38 = add nsw i64 %37, -1
  %xtraiter = and i64 %38, 1
  %39 = icmp eq i32 %35, 2
  br i1 %39, label %._crit_edge330.loopexit.unr-lcssa, label %.lr.ph329.new

.lr.ph329.new:                                    ; preds = %.lr.ph329
  %unroll_iter = and i64 %38, -2
  br label %40

40:                                               ; preds = %40, %.lr.ph329.new
  %store_forwarded = phi i32 [ %load_initial, %.lr.ph329.new ], [ %50, %40 ]
  %indvars.iv335 = phi i64 [ 2, %.lr.ph329.new ], [ %indvars.iv.next336.1, %40 ]
  %niter = phi i64 [ 0, %.lr.ph329.new ], [ %niter.next.1, %40 ]
  %41 = add nsw i64 %indvars.iv335, -2
  %42 = getelementptr i32, ptr %.unpack291, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !3
  %44 = sub i32 %43, %store_forwarded
  %45 = add nsw i64 %indvars.iv335, -1
  %46 = getelementptr i32, ptr %.unpack267, i64 %45
  store i32 %44, ptr %46, align 4, !tbaa !3
  %47 = add nsw i64 %indvars.iv335, -1
  %48 = getelementptr i32, ptr %.unpack291, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !3
  %50 = sub i32 %49, %44
  %51 = getelementptr i32, ptr %.unpack267, i64 %indvars.iv335
  store i32 %50, ptr %51, align 4, !tbaa !3
  %indvars.iv.next336.1 = add nuw nsw i64 %indvars.iv335, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge330.loopexit.unr-lcssa, label %40

._crit_edge330.loopexit.unr-lcssa:                ; preds = %40, %.lr.ph329
  %store_forwarded.unr = phi i32 [ %load_initial, %.lr.ph329 ], [ %50, %40 ]
  %indvars.iv335.unr = phi i64 [ 2, %.lr.ph329 ], [ %indvars.iv.next336.1, %40 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge330.loopexit, label %._crit_edge330.loopexit.epilog-lcssa

._crit_edge330.loopexit.epilog-lcssa:             ; preds = %._crit_edge330.loopexit.unr-lcssa
  %52 = add nsw i64 %indvars.iv335.unr, -2
  %53 = getelementptr i32, ptr %.unpack291, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !3
  %55 = sub i32 %54, %store_forwarded.unr
  %56 = add nsw i64 %indvars.iv335.unr, -1
  %57 = getelementptr i32, ptr %.unpack267, i64 %56
  store i32 %55, ptr %57, align 4, !tbaa !3
  br label %._crit_edge330.loopexit

._crit_edge330.loopexit:                          ; preds = %._crit_edge330.loopexit.unr-lcssa, %._crit_edge330.loopexit.epilog-lcssa
  %.pre = load i32, ptr %2, align 4, !tbaa !3
  br label %._crit_edge330

._crit_edge330:                                   ; preds = %._crit_edge330.loopexit, %._crit_edge
  %58 = phi i32 [ %.pre, %._crit_edge330.loopexit ], [ %35, %._crit_edge ]
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %.lr.ph332.preheader, label %._crit_edge333

.lr.ph332.preheader:                              ; preds = %._crit_edge330
  %60 = zext i32 %58 to i64
  br label %.lr.ph332

.lr.ph332:                                        ; preds = %.lr.ph332.preheader, %.lr.ph332
  %indvars.iv339 = phi i64 [ 1, %.lr.ph332.preheader ], [ %indvars.iv.next340, %.lr.ph332 ]
  %61 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.3628e367663c96c1a9d172c40c9cae18, i32 21)
  %62 = call i1 @_FortranAioSetAdvance(ptr %61, ptr nonnull @_QQcl.6E6F, i64 2)
  %.unpack279 = load ptr, ptr @_QFEans.0, align 8, !tbaa !7
  %63 = add nsw i64 %indvars.iv339, -1
  %64 = getelementptr i32, ptr %.unpack279, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !3
  %66 = shl i32 %65, 1
  %67 = call i1 @_FortranAioOutputInteger32(ptr %61, i32 %66)
  %68 = call i32 @_FortranAioEndIoStatement(ptr %61)
  %69 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.3628e367663c96c1a9d172c40c9cae18, i32 22)
  %70 = call i1 @_FortranAioSetAdvance(ptr %69, ptr nonnull @_QQcl.6E6F, i64 2)
  %71 = call i1 @_FortranAioOutputAscii(ptr %69, ptr nonnull @_QQcl.20, i64 1)
  %72 = call i32 @_FortranAioEndIoStatement(ptr %69)
  %indvars.iv.next340 = add nuw nsw i64 %indvars.iv339, 1
  %exitcond342.not = icmp eq i64 %indvars.iv339, %60
  br i1 %exitcond342.not, label %._crit_edge333, label %.lr.ph332

._crit_edge333:                                   ; preds = %.lr.ph332, %._crit_edge330
  %73 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.3628e367663c96c1a9d172c40c9cae18, i32 24)
  %74 = call i32 @_FortranAioEndIoStatement(ptr %73)
  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 i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

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

declare i1 @_FortranAioSetAdvance(ptr, ptr, i64) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

declare ptr @_FortranAioBeginExternalListOutput(i32, 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}
