integer a(5), b(5)
read *, a
b = (a + 9) / 10 * 10
print *, sum(b) - maxval(b - a)
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.2f3850337c3b33b200a0535d7c75d8d1 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4544/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
.lr.ph.i:
  %0 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %1 = alloca [5 x i32], align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.2f3850337c3b33b200a0535d7c75d8d1, i32 2)
  store ptr %1, ptr %0, align 8, !tbaa !3
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !3
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !3
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !3
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !3
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !3
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !3
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !3
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 7, i64 0, i64 1
  store i64 5, ptr %.fca.7.0.1.gep, align 8, !tbaa !3
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !3
  %3 = call i1 @_FortranAioInputDescriptor(ptr %2, ptr nonnull %0)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = load i32, ptr %1, align 4, !tbaa !7
  %.fr42 = freeze i32 %5
  %6 = add i32 %.fr42, 9
  %7 = srem i32 %6, 10
  %8 = sub nsw i32 %6, %7
  %9 = getelementptr inbounds i32, ptr %1, i64 1
  %10 = load i32, ptr %9, align 4, !tbaa !7
  %.fr42.1 = freeze i32 %10
  %11 = add i32 %.fr42.1, 9
  %12 = srem i32 %11, 10
  %13 = sub nsw i32 %11, %12
  %14 = getelementptr inbounds i32, ptr %1, i64 2
  %15 = load i32, ptr %14, align 4, !tbaa !7
  %.fr42.2 = freeze i32 %15
  %16 = add i32 %.fr42.2, 9
  %17 = srem i32 %16, 10
  %18 = sub nsw i32 %16, %17
  %19 = getelementptr inbounds i32, ptr %1, i64 3
  %20 = load i32, ptr %19, align 4, !tbaa !7
  %.fr42.3 = freeze i32 %20
  %21 = add i32 %.fr42.3, 9
  %22 = srem i32 %21, 10
  %23 = sub nsw i32 %21, %22
  %24 = getelementptr inbounds i32, ptr %1, i64 4
  %25 = load i32, ptr %24, align 4, !tbaa !7
  %.fr42.4 = freeze i32 %25
  %26 = add i32 %.fr42.4, 9
  %27 = srem i32 %26, 10
  %28 = sub nsw i32 %26, %27
  %29 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.2f3850337c3b33b200a0535d7c75d8d1, i32 4)
  %30 = load i32, ptr %1, align 4, !tbaa !7
  %31 = sub i32 %8, %30
  %32 = load i32, ptr %9, align 4, !tbaa !7
  %33 = sub i32 %13, %32
  %34 = load i32, ptr %14, align 4, !tbaa !7
  %35 = sub i32 %18, %34
  %36 = load i32, ptr %19, align 4, !tbaa !7
  %37 = sub i32 %23, %36
  %38 = load i32, ptr %24, align 4, !tbaa !7
  %39 = sub i32 %28, %38
  %40 = add i32 %13, %8
  %41 = add i32 %18, %40
  %42 = add i32 %23, %41
  %43 = call i32 @llvm.smax.i32(i32 %33, i32 %31)
  %44 = call i32 @llvm.smax.i32(i32 %35, i32 %43)
  %45 = call i32 @llvm.smax.i32(i32 %37, i32 %44)
  %46 = call i32 @llvm.smax.i32(i32 %39, i32 %45)
  %47 = add i32 %28, %42
  %48 = sub i32 %47, %46
  %49 = call i1 @_FortranAioOutputInteger32(ptr %29, i32 %48)
  %50 = call i32 @_FortranAioEndIoStatement(ptr %29)
  ret void
}

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

declare i1 @_FortranAioInputDescriptor(ptr, ptr) 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #0

attributes #0 = { mustprogress 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 = !{!"descriptor member", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any data access", !5, i64 0}
