program probC
  implicit none
  integer,allocatable :: a(:)
  integer i,ans1,n

  read(*,*) n
  allocate(a(0:n+1))
  a=0
  read(*,*) a(1:n)

  ans1=0
  do i =1,n+1
     ans1 = ans1 + abs(a(i-1)-a(i))
  end do

  do i = 1,n
     write(*,*) ans1+abs(a(i-1)-a(i+1))-(abs(a(i-1)-a(i))+abs(a(i)-a(i+1)))
  end do
  
end program probC

; 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.7 = internal unnamed_addr global i64 1
@_QQcl.20a1687762ed6accda0aacb29cbfa46e = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6145/source.f\00"
@_QQcl.16373402fa3425c6e46827601abb88fa = linkonce constant [76 x i8] c"array left hand side must be allocated when the right hand side is a scalar\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 { 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.20a1687762ed6accda0aacb29cbfa46e, i32 6)
  %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 = add i32 %6, 1
  %8 = call i32 @llvm.smax.i32(i32 %7, i32 -1)
  %9 = sext i32 %8 to i64
  %10 = add nsw i64 %9, 1
  %11 = shl nuw nsw i64 %10, 2
  %12 = call ptr @malloc(i64 %11)
  %13 = icmp eq i64 %10, 0
  %14 = zext i1 %13 to i64
  store ptr %12, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %14, ptr @_QFEa.7, align 8, !tbaa !7
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %19, label %.preheader

.preheader:                                       ; preds = %0
  %15 = icmp sgt i32 %7, -1
  br i1 %15, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.preheader
  %16 = add nsw i64 %9, 2
  %smin = call i64 @llvm.smin.i64(i64 %10, i64 1)
  %17 = sub nuw nsw i64 %16, %smin
  %18 = shl nuw nsw i64 %17, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %12, i8 0, i64 %18, i1 false), !tbaa !3
  br label %.loopexit

19:                                               ; preds = %0
  %20 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.20a1687762ed6accda0aacb29cbfa46e, i32 8)
  %.unpack257.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %21 = select i1 %13, i64 1, i64 %.unpack257.unpack.unpack
  store ptr null, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %21, ptr @_QFEa.7, align 8, !tbaa !7
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph.preheader, %.preheader, %19
  %22 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.20a1687762ed6accda0aacb29cbfa46e, i32 9)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack221.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %23 = load i32, ptr %2, align 4, !tbaa !3
  %24 = sub i64 1, %.unpack221.unpack.unpack
  %25 = call i32 @llvm.smax.i32(i32 %23, i32 0)
  %26 = zext i32 %25 to i64
  %27 = getelementptr i32, ptr %.unpack, i64 %24
  store ptr %27, 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 %26, 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
  %28 = call i1 @_FortranAioInputDescriptor(ptr %22, ptr nonnull %1)
  %29 = call i32 @_FortranAioEndIoStatement(ptr %22)
  %30 = load i32, ptr %2, align 4, !tbaa !3
  %31 = icmp ult i32 %30, 2147483647
  br i1 %31, label %.lr.ph274, label %._crit_edge

.lr.ph274:                                        ; preds = %.loopexit
  %32 = add nuw nsw i32 %30, 1
  %33 = zext i32 %32 to i64
  %.unpack238 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack245.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %34 = xor i64 %.unpack245.unpack.unpack, -1
  %min.iters.check = icmp ult i32 %30, 7
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph274
  %n.vec = and i64 %33, 4294967288
  %ind.end = or i64 %n.vec, 1
  %ind.end282 = and i64 %33, 7
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %45, %vector.body ]
  %vec.phi284 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %46, %vector.body ]
  %offset.idx = or i64 %index, 1
  %35 = add i64 %offset.idx, %34
  %36 = getelementptr i32, ptr %.unpack238, i64 %35
  %wide.load = load <4 x i32>, ptr %36, align 4, !tbaa !3
  %37 = getelementptr i32, ptr %36, i64 4
  %wide.load285 = load <4 x i32>, ptr %37, align 4, !tbaa !3
  %38 = sub i64 %offset.idx, %.unpack245.unpack.unpack
  %39 = getelementptr i32, ptr %.unpack238, i64 %38
  %wide.load286 = load <4 x i32>, ptr %39, align 4, !tbaa !3
  %40 = getelementptr i32, ptr %39, i64 4
  %wide.load287 = load <4 x i32>, ptr %40, align 4, !tbaa !3
  %41 = sub <4 x i32> %wide.load, %wide.load286
  %42 = sub <4 x i32> %wide.load285, %wide.load287
  %43 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %41, i1 false)
  %44 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %42, i1 false)
  %45 = add <4 x i32> %43, %vec.phi
  %46 = add <4 x i32> %44, %vec.phi284
  %index.next = add nuw i64 %index, 8
  %47 = icmp eq i64 %index.next, %n.vec
  br i1 %47, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %46, %45
  %48 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %33
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.lr.ph274, %middle.block
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph274 ], [ %ind.end, %middle.block ]
  %.ph = phi i64 [ %33, %.lr.ph274 ], [ %ind.end282, %middle.block ]
  %.0273.ph = phi i32 [ 0, %.lr.ph274 ], [ %48, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %49 = phi i64 [ %59, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %.0273 = phi i32 [ %58, %scalar.ph ], [ %.0273.ph, %scalar.ph.preheader ]
  %50 = add i64 %indvars.iv, %34
  %51 = getelementptr i32, ptr %.unpack238, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !3
  %53 = sub i64 %indvars.iv, %.unpack245.unpack.unpack
  %54 = getelementptr i32, ptr %.unpack238, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !3
  %56 = sub i32 %52, %55
  %57 = call i32 @llvm.abs.i32(i32 %56, i1 false)
  %58 = add i32 %57, %.0273
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %59 = add nsw i64 %49, -1
  %60 = icmp ugt i64 %49, 1
  br i1 %60, label %scalar.ph, label %._crit_edge, !llvm.loop !12

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %.loopexit
  %.0.lcssa = phi i32 [ 0, %.loopexit ], [ %48, %middle.block ], [ %58, %scalar.ph ]
  %61 = icmp sgt i32 %30, 0
  br i1 %61, label %.lr.ph276.preheader, label %._crit_edge277

.lr.ph276.preheader:                              ; preds = %._crit_edge
  %62 = zext i32 %30 to i64
  br label %.lr.ph276

.lr.ph276:                                        ; preds = %.lr.ph276.preheader, %.lr.ph276
  %indvars.iv279 = phi i64 [ 1, %.lr.ph276.preheader ], [ %indvars.iv.next280, %.lr.ph276 ]
  %63 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.20a1687762ed6accda0aacb29cbfa46e, i32 17)
  %.unpack226 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack233.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %64 = xor i64 %.unpack233.unpack.unpack, -1
  %65 = add i64 %indvars.iv279, %64
  %66 = getelementptr i32, ptr %.unpack226, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !3
  %indvars.iv.next280 = add nuw nsw i64 %indvars.iv279, 1
  %sext = shl i64 %indvars.iv.next280, 32
  %68 = ashr exact i64 %sext, 32
  %69 = sub i64 %68, %.unpack233.unpack.unpack
  %70 = getelementptr i32, ptr %.unpack226, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !3
  %72 = sub i32 %67, %71
  %73 = call i32 @llvm.abs.i32(i32 %72, i1 false)
  %74 = sub i64 %indvars.iv279, %.unpack233.unpack.unpack
  %75 = getelementptr i32, ptr %.unpack226, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !3
  %77 = sub i32 %67, %76
  %78 = call i32 @llvm.abs.i32(i32 %77, i1 false)
  %79 = sub i32 %76, %71
  %80 = call i32 @llvm.abs.i32(i32 %79, i1 false)
  %.neg272 = add i32 %73, %.0.lcssa
  %81 = add i32 %80, %78
  %82 = sub i32 %.neg272, %81
  %83 = call i1 @_FortranAioOutputInteger32(ptr %63, i32 %82)
  %84 = call i32 @_FortranAioEndIoStatement(ptr %63)
  %exitcond.not = icmp eq i64 %indvars.iv279, %62
  br i1 %exitcond.not, label %._crit_edge277, label %.lr.ph276

._crit_edge277:                                   ; preds = %.lr.ph276, %._crit_edge
  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 {} @_FortranAReportFatalUserError(ptr, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, 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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3

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) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nosync nounwind 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}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !11, !10}
