program main
Implicit None
	character(len = 10),allocatable::s(:)
	integer(8)::n,i,j,p=0,x=0,y=0,z=0
	integer(8),allocatable::a(:),b(:)
	
	read*,n
	allocate(s(n),a(n),b(n))
	a = 0 ;b = 0
	
	read*,s
	
	do i = 1,n
		if(s(i)(1:1) == "B") b(i) = 1
		do j = 1,9
			if(s(i)(j:j) == " ")then
				if(s(i)(j-1:j-1) == "A") a(i) = 1
				exit
			endif
			if(s(i)(j:j+1) == "AB")then
				p = p+1
			endif
		enddo
		if(s(i)(9:10) == "A ") a(i) = 1
		if(s(i)(10:10) == "A") a(i) = 1
	enddo
	
	do i = 1,n
		if(a(i) == 1 .and. b(i) == 1) z = z+1
		if(a(i) == 1) x = x+1
		if(b(i) == 1) y = y+1
	enddo
	x = x-z
	y = y-z
	
	if(x == 0 .and. y == 0)then
		p = p+max(0,z-1)
		else if(y == 0 .or. x == 0)then
			p = p + z
		else if(z == 0)then
			p = p + min(x,y)
		else
			p = p + z + min(x,y)
	endif
	
	print*,p
end program main
; 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
@_QFEb.0 = internal unnamed_addr global ptr null
@_QFEb.7 = internal unnamed_addr global i64 1
@_QFEb.8 = internal unnamed_addr global i64 0
@_QFEp = internal unnamed_addr global i64 0
@_QFEs.0 = internal unnamed_addr global ptr null
@_QFEs.8 = internal unnamed_addr global i64 0
@_QFEx = internal unnamed_addr global i64 0
@_QFEy = internal unnamed_addr global i64 0
@_QFEz = internal unnamed_addr global i64 0
@_QQcl.c4971a375347f6b2a1a0550b7e263fa4 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4323/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"
@_QQcl.42 = linkonce constant [1 x i8] c"B"
@_QQcl.20 = linkonce constant [1 x i8] c" "
@_QQcl.41 = linkonce constant [1 x i8] c"A"
@_QQcl.4142 = linkonce constant [2 x i8] c"AB"
@_QQcl.4120 = linkonce constant [2 x i8] c"A "
@_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 i64, align 8
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.c4971a375347f6b2a1a0550b7e263fa4, i32 7)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 8)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = load i64, ptr %2, align 8, !tbaa !3
  %7 = call i64 @llvm.smax.i64(i64 %6, i64 0)
  %8 = mul i64 %7, 10
  %9 = call ptr @malloc(i64 %8)
  store ptr %9, ptr @_QFEs.0, align 8, !tbaa !7
  store i64 %7, ptr @_QFEs.8, align 8, !tbaa !7
  %10 = shl i64 %7, 3
  %11 = call ptr @malloc(i64 %10)
  store ptr %11, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEa.7, align 8, !tbaa !7
  %12 = call ptr @malloc(i64 %10)
  store ptr %12, ptr @_QFEb.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEb.7, align 8, !tbaa !7
  store i64 %7, ptr @_QFEb.8, align 8, !tbaa !7
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %13, label %.preheader1048

.preheader1048:                                   ; preds = %0
  %.not1060 = icmp slt i64 %6, 1
  br i1 %.not1060, label %.loopexit1049, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader1048
  call void @llvm.memset.p0.i64(ptr nonnull align 8 %11, i8 0, i64 %10, i1 false), !tbaa !3
  br label %.loopexit1049

13:                                               ; preds = %0
  %14 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.c4971a375347f6b2a1a0550b7e263fa4, i32 9)
  %.unpack1031.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %15 = icmp slt i64 %6, 1
  %16 = select i1 %15, i64 1, i64 %.unpack1031.unpack.unpack
  store ptr null, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %16, ptr @_QFEa.7, align 8, !tbaa !7
  %.unpack810.pre = load ptr, ptr @_QFEb.0, align 8, !tbaa !7
  %.unpack817.unpack.unpack819.pre = load i64, ptr @_QFEb.8, align 8, !tbaa !7
  br label %.loopexit1049

.loopexit1049:                                    ; preds = %.lr.ph.preheader, %.preheader1048, %13
  %.unpack817.unpack.unpack819 = phi i64 [ %7, %.lr.ph.preheader ], [ %7, %.preheader1048 ], [ %.unpack817.unpack.unpack819.pre, %13 ]
  %.unpack810 = phi ptr [ %12, %.lr.ph.preheader ], [ %12, %.preheader1048 ], [ %.unpack810.pre, %13 ]
  %.not822 = icmp eq ptr %.unpack810, null
  br i1 %.not822, label %19, label %.preheader

.preheader:                                       ; preds = %.loopexit1049
  %17 = icmp sgt i64 %.unpack817.unpack.unpack819, 0
  br i1 %17, label %.lr.ph1051.preheader, label %.loopexit1047

.lr.ph1051.preheader:                             ; preds = %.preheader
  %18 = shl nuw i64 %.unpack817.unpack.unpack819, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 8 %.unpack810, i8 0, i64 %18, i1 false), !tbaa !3
  br label %.loopexit1047

19:                                               ; preds = %.loopexit1049
  %20 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.c4971a375347f6b2a1a0550b7e263fa4, i32 9)
  %.unpack1010.unpack.unpack = load i64, ptr @_QFEb.7, align 8, !tbaa !7
  %21 = icmp eq i64 %.unpack817.unpack.unpack819, 0
  %22 = select i1 %21, i64 1, i64 %.unpack1010.unpack.unpack
  store ptr null, ptr @_QFEb.0, align 8, !tbaa !7
  store i64 %22, ptr @_QFEb.7, align 8, !tbaa !7
  store i64 %.unpack817.unpack.unpack819, ptr @_QFEb.8, align 8, !tbaa !7
  br label %.loopexit1047

.loopexit1047:                                    ; preds = %.lr.ph1051.preheader, %.preheader, %19
  %23 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.c4971a375347f6b2a1a0550b7e263fa4, i32 11)
  %.unpack823 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %.unpack830.unpack.unpack832 = load i64, ptr @_QFEs.8, align 8, !tbaa !7
  store ptr %.unpack823, 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 10, 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 40, 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 %.unpack830.unpack.unpack832, 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 10, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %24 = call i1 @_FortranAioInputDescriptor(ptr %23, ptr nonnull %1)
  %25 = call i32 @_FortranAioEndIoStatement(ptr %23)
  %26 = load i64, ptr %2, align 8, !tbaa !3
  %27 = icmp sgt i64 %26, 0
  br i1 %27, label %.lr.ph1056, label %._crit_edge.._crit_edge1059_crit_edge

.lr.ph1056:                                       ; preds = %.loopexit1047, %176
  %.07631055 = phi i64 [ %177, %176 ], [ 1, %.loopexit1047 ]
  %.unpack883 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %28 = add i64 %.07631055, -1
  %29 = getelementptr [10 x i8], ptr %.unpack883, i64 %28
  %30 = call i32 @_FortranACharacterCompareScalar1(ptr %29, ptr nonnull @_QQcl.42, i64 1, i64 1)
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %35

32:                                               ; preds = %.lr.ph1056
  %.unpack991 = load ptr, ptr @_QFEb.0, align 8, !tbaa !7
  %.unpack998.unpack.unpack = load i64, ptr @_QFEb.7, align 8, !tbaa !7
  %33 = sub i64 %.07631055, %.unpack998.unpack.unpack
  %34 = getelementptr i64, ptr %.unpack991, i64 %33
  store i64 1, ptr %34, align 8, !tbaa !3
  br label %35

35:                                               ; preds = %32, %.lr.ph1056
  %.unpack943 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %36 = add i64 %.07631055, -1
  %37 = getelementptr [10 x i8], ptr %.unpack943, i64 %36
  %38 = call i32 @_FortranACharacterCompareScalar1(ptr %37, ptr nonnull @_QQcl.20, i64 1, i64 1)
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %49

40:                                               ; preds = %148, %135, %122, %109, %96, %83, %70, %57, %35
  %.01053.lcssa = phi i64 [ -1, %35 ], [ 0, %57 ], [ 1, %70 ], [ 2, %83 ], [ 3, %96 ], [ 4, %109 ], [ 5, %122 ], [ 6, %135 ], [ 7, %148 ]
  %.unpack967 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %41 = add i64 %.07631055, -1
  %42 = getelementptr [10 x i8], ptr %.unpack967, i64 %41
  %43 = getelementptr [10 x [1 x i8]], ptr %42, i64 0, i64 %.01053.lcssa
  %44 = call i32 @_FortranACharacterCompareScalar1(ptr %43, ptr nonnull @_QQcl.41, i64 1, i64 1)
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %.loopexit

46:                                               ; preds = %40
  %.unpack979 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack986.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %47 = sub i64 %.07631055, %.unpack986.unpack.unpack
  %48 = getelementptr i64, ptr %.unpack979, i64 %47
  store i64 1, ptr %48, align 8, !tbaa !3
  br label %.loopexit

49:                                               ; preds = %35
  %.unpack955 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %50 = add i64 %.07631055, -1
  %51 = getelementptr [10 x i8], ptr %.unpack955, i64 %50
  %52 = call i32 @_FortranACharacterCompareScalar1(ptr %51, ptr nonnull @_QQcl.4142, i64 2, i64 2)
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %57

54:                                               ; preds = %49
  %55 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %56 = add i64 %55, 1
  store i64 %56, ptr @_QFEp, align 8, !tbaa !3
  br label %57

57:                                               ; preds = %54, %49
  %.unpack943.1 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %58 = add i64 %.07631055, -1
  %59 = getelementptr [10 x i8], ptr %.unpack943.1, i64 %58, i64 1
  %60 = call i32 @_FortranACharacterCompareScalar1(ptr %59, ptr nonnull @_QQcl.20, i64 1, i64 1)
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %40, label %62

62:                                               ; preds = %57
  %.unpack955.1 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %63 = add i64 %.07631055, -1
  %64 = getelementptr [10 x i8], ptr %.unpack955.1, i64 %63, i64 1
  %65 = call i32 @_FortranACharacterCompareScalar1(ptr %64, ptr nonnull @_QQcl.4142, i64 2, i64 2)
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %67, label %70

67:                                               ; preds = %62
  %68 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %69 = add i64 %68, 1
  store i64 %69, ptr @_QFEp, align 8, !tbaa !3
  br label %70

70:                                               ; preds = %67, %62
  %.unpack943.2 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %71 = add i64 %.07631055, -1
  %72 = getelementptr [10 x i8], ptr %.unpack943.2, i64 %71, i64 2
  %73 = call i32 @_FortranACharacterCompareScalar1(ptr %72, ptr nonnull @_QQcl.20, i64 1, i64 1)
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %40, label %75

75:                                               ; preds = %70
  %.unpack955.2 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %76 = add i64 %.07631055, -1
  %77 = getelementptr [10 x i8], ptr %.unpack955.2, i64 %76, i64 2
  %78 = call i32 @_FortranACharacterCompareScalar1(ptr %77, ptr nonnull @_QQcl.4142, i64 2, i64 2)
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %83

80:                                               ; preds = %75
  %81 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %82 = add i64 %81, 1
  store i64 %82, ptr @_QFEp, align 8, !tbaa !3
  br label %83

83:                                               ; preds = %80, %75
  %.unpack943.3 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %84 = add i64 %.07631055, -1
  %85 = getelementptr [10 x i8], ptr %.unpack943.3, i64 %84, i64 3
  %86 = call i32 @_FortranACharacterCompareScalar1(ptr %85, ptr nonnull @_QQcl.20, i64 1, i64 1)
  %87 = icmp eq i32 %86, 0
  br i1 %87, label %40, label %88

88:                                               ; preds = %83
  %.unpack955.3 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %89 = add i64 %.07631055, -1
  %90 = getelementptr [10 x i8], ptr %.unpack955.3, i64 %89, i64 3
  %91 = call i32 @_FortranACharacterCompareScalar1(ptr %90, ptr nonnull @_QQcl.4142, i64 2, i64 2)
  %92 = icmp eq i32 %91, 0
  br i1 %92, label %93, label %96

93:                                               ; preds = %88
  %94 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %95 = add i64 %94, 1
  store i64 %95, ptr @_QFEp, align 8, !tbaa !3
  br label %96

96:                                               ; preds = %93, %88
  %.unpack943.4 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %97 = add i64 %.07631055, -1
  %98 = getelementptr [10 x i8], ptr %.unpack943.4, i64 %97, i64 4
  %99 = call i32 @_FortranACharacterCompareScalar1(ptr %98, ptr nonnull @_QQcl.20, i64 1, i64 1)
  %100 = icmp eq i32 %99, 0
  br i1 %100, label %40, label %101

101:                                              ; preds = %96
  %.unpack955.4 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %102 = add i64 %.07631055, -1
  %103 = getelementptr [10 x i8], ptr %.unpack955.4, i64 %102, i64 4
  %104 = call i32 @_FortranACharacterCompareScalar1(ptr %103, ptr nonnull @_QQcl.4142, i64 2, i64 2)
  %105 = icmp eq i32 %104, 0
  br i1 %105, label %106, label %109

106:                                              ; preds = %101
  %107 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %108 = add i64 %107, 1
  store i64 %108, ptr @_QFEp, align 8, !tbaa !3
  br label %109

109:                                              ; preds = %106, %101
  %.unpack943.5 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %110 = add i64 %.07631055, -1
  %111 = getelementptr [10 x i8], ptr %.unpack943.5, i64 %110, i64 5
  %112 = call i32 @_FortranACharacterCompareScalar1(ptr %111, ptr nonnull @_QQcl.20, i64 1, i64 1)
  %113 = icmp eq i32 %112, 0
  br i1 %113, label %40, label %114

114:                                              ; preds = %109
  %.unpack955.5 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %115 = add i64 %.07631055, -1
  %116 = getelementptr [10 x i8], ptr %.unpack955.5, i64 %115, i64 5
  %117 = call i32 @_FortranACharacterCompareScalar1(ptr %116, ptr nonnull @_QQcl.4142, i64 2, i64 2)
  %118 = icmp eq i32 %117, 0
  br i1 %118, label %119, label %122

119:                                              ; preds = %114
  %120 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %121 = add i64 %120, 1
  store i64 %121, ptr @_QFEp, align 8, !tbaa !3
  br label %122

122:                                              ; preds = %119, %114
  %.unpack943.6 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %123 = add i64 %.07631055, -1
  %124 = getelementptr [10 x i8], ptr %.unpack943.6, i64 %123, i64 6
  %125 = call i32 @_FortranACharacterCompareScalar1(ptr %124, ptr nonnull @_QQcl.20, i64 1, i64 1)
  %126 = icmp eq i32 %125, 0
  br i1 %126, label %40, label %127

127:                                              ; preds = %122
  %.unpack955.6 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %128 = add i64 %.07631055, -1
  %129 = getelementptr [10 x i8], ptr %.unpack955.6, i64 %128, i64 6
  %130 = call i32 @_FortranACharacterCompareScalar1(ptr %129, ptr nonnull @_QQcl.4142, i64 2, i64 2)
  %131 = icmp eq i32 %130, 0
  br i1 %131, label %132, label %135

132:                                              ; preds = %127
  %133 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %134 = add i64 %133, 1
  store i64 %134, ptr @_QFEp, align 8, !tbaa !3
  br label %135

135:                                              ; preds = %132, %127
  %.unpack943.7 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %136 = add i64 %.07631055, -1
  %137 = getelementptr [10 x i8], ptr %.unpack943.7, i64 %136, i64 7
  %138 = call i32 @_FortranACharacterCompareScalar1(ptr %137, ptr nonnull @_QQcl.20, i64 1, i64 1)
  %139 = icmp eq i32 %138, 0
  br i1 %139, label %40, label %140

140:                                              ; preds = %135
  %.unpack955.7 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %141 = add i64 %.07631055, -1
  %142 = getelementptr [10 x i8], ptr %.unpack955.7, i64 %141, i64 7
  %143 = call i32 @_FortranACharacterCompareScalar1(ptr %142, ptr nonnull @_QQcl.4142, i64 2, i64 2)
  %144 = icmp eq i32 %143, 0
  br i1 %144, label %145, label %148

145:                                              ; preds = %140
  %146 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %147 = add i64 %146, 1
  store i64 %147, ptr @_QFEp, align 8, !tbaa !3
  br label %148

148:                                              ; preds = %145, %140
  %.unpack943.8 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %149 = add i64 %.07631055, -1
  %150 = getelementptr [10 x i8], ptr %.unpack943.8, i64 %149, i64 8
  %151 = call i32 @_FortranACharacterCompareScalar1(ptr %150, ptr nonnull @_QQcl.20, i64 1, i64 1)
  %152 = icmp eq i32 %151, 0
  br i1 %152, label %40, label %153

153:                                              ; preds = %148
  %.unpack955.8 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %154 = add i64 %.07631055, -1
  %155 = getelementptr [10 x i8], ptr %.unpack955.8, i64 %154, i64 8
  %156 = call i32 @_FortranACharacterCompareScalar1(ptr %155, ptr nonnull @_QQcl.4142, i64 2, i64 2)
  %157 = icmp eq i32 %156, 0
  br i1 %157, label %158, label %.loopexit

158:                                              ; preds = %153
  %159 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %160 = add i64 %159, 1
  store i64 %160, ptr @_QFEp, align 8, !tbaa !3
  br label %.loopexit

.loopexit:                                        ; preds = %153, %158, %46, %40
  %.unpack895 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %161 = add i64 %.07631055, -1
  %162 = getelementptr [10 x i8], ptr %.unpack895, i64 %161, i64 8
  %163 = call i32 @_FortranACharacterCompareScalar1(ptr %162, ptr nonnull @_QQcl.4120, i64 2, i64 2)
  %164 = icmp eq i32 %163, 0
  br i1 %164, label %165, label %168

165:                                              ; preds = %.loopexit
  %.unpack931 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack938.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %166 = sub i64 %.07631055, %.unpack938.unpack.unpack
  %167 = getelementptr i64, ptr %.unpack931, i64 %166
  store i64 1, ptr %167, align 8, !tbaa !3
  br label %168

168:                                              ; preds = %165, %.loopexit
  %.unpack907 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %169 = add i64 %.07631055, -1
  %170 = getelementptr [10 x i8], ptr %.unpack907, i64 %169, i64 9
  %171 = call i32 @_FortranACharacterCompareScalar1(ptr %170, ptr nonnull @_QQcl.41, i64 1, i64 1)
  %172 = icmp eq i32 %171, 0
  br i1 %172, label %173, label %176

173:                                              ; preds = %168
  %.unpack919 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack926.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %174 = sub i64 %.07631055, %.unpack926.unpack.unpack
  %175 = getelementptr i64, ptr %.unpack919, i64 %174
  store i64 1, ptr %175, align 8, !tbaa !3
  br label %176

176:                                              ; preds = %173, %168
  %177 = add nuw i64 %.07631055, 1
  %exitcond.not = icmp eq i64 %.07631055, %26
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph1056

._crit_edge:                                      ; preds = %176
  %.pre = load i64, ptr %2, align 8, !tbaa !3
  %178 = icmp sgt i64 %.pre, 0
  br i1 %178, label %.lr.ph1058, label %._crit_edge.._crit_edge1059_crit_edge

._crit_edge.._crit_edge1059_crit_edge:            ; preds = %.loopexit1047, %._crit_edge
  %.pre1065 = load i64, ptr @_QFEx, align 8, !tbaa !3
  %.pre1066 = load i64, ptr @_QFEz, align 8, !tbaa !3
  %.pre1067 = load i64, ptr @_QFEy, align 8, !tbaa !3
  br label %._crit_edge1059

.lr.ph1058:                                       ; preds = %._crit_edge
  %_QFEy.promoted = load i64, ptr @_QFEy, align 8, !tbaa !3
  %_QFEx.promoted = load i64, ptr @_QFEx, align 8, !tbaa !3
  %_QFEz.promoted = load i64, ptr @_QFEz, align 8, !tbaa !3
  %.unpack835 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack842.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %.unpack847 = load ptr, ptr @_QFEb.0, align 8, !tbaa !7
  %.unpack854.unpack.unpack = load i64, ptr @_QFEb.7, align 8, !tbaa !7
  br label %179

179:                                              ; preds = %.lr.ph1058, %198
  %180 = phi i64 [ 1, %.lr.ph1058 ], [ %202, %198 ]
  %181 = phi i64 [ %_QFEz.promoted, %.lr.ph1058 ], [ %200, %198 ]
  %182 = phi i64 [ %_QFEx.promoted, %.lr.ph1058 ], [ %199, %198 ]
  %183 = phi i64 [ %_QFEy.promoted, %.lr.ph1058 ], [ %spec.select, %198 ]
  %184 = sub i64 %180, %.unpack842.unpack.unpack
  %185 = getelementptr i64, ptr %.unpack835, i64 %184
  %186 = load i64, ptr %185, align 8, !tbaa !3
  %187 = icmp eq i64 %186, 1
  %188 = sub i64 %180, %.unpack854.unpack.unpack
  %189 = getelementptr i64, ptr %.unpack847, i64 %188
  %190 = load i64, ptr %189, align 8, !tbaa !3
  %191 = icmp eq i64 %190, 1
  %192 = and i1 %187, %191
  br i1 %192, label %.thread1046, label %194

.thread1046:                                      ; preds = %179
  %193 = add i64 %181, 1
  store i64 %193, ptr @_QFEz, align 8, !tbaa !3
  br label %195

194:                                              ; preds = %179
  br i1 %187, label %195, label %198

195:                                              ; preds = %.thread1046, %194
  %196 = phi i64 [ %193, %.thread1046 ], [ %181, %194 ]
  %197 = add i64 %182, 1
  br label %198

198:                                              ; preds = %195, %194
  %199 = phi i64 [ %197, %195 ], [ %182, %194 ]
  %200 = phi i64 [ %196, %195 ], [ %181, %194 ]
  %201 = zext i1 %191 to i64
  %spec.select = add i64 %183, %201
  %202 = add nuw i64 %180, 1
  %exitcond1062.not = icmp eq i64 %180, %.pre
  br i1 %exitcond1062.not, label %._crit_edge1059, label %179

._crit_edge1059:                                  ; preds = %198, %._crit_edge.._crit_edge1059_crit_edge
  %203 = phi i64 [ %.pre1067, %._crit_edge.._crit_edge1059_crit_edge ], [ %spec.select, %198 ]
  %204 = phi i64 [ %.pre1066, %._crit_edge.._crit_edge1059_crit_edge ], [ %200, %198 ]
  %205 = phi i64 [ %.pre1065, %._crit_edge.._crit_edge1059_crit_edge ], [ %199, %198 ]
  %206 = sub i64 %205, %204
  store i64 %206, ptr @_QFEx, align 8, !tbaa !3
  %207 = sub i64 %203, %204
  store i64 %207, ptr @_QFEy, align 8, !tbaa !3
  %208 = icmp eq i64 %205, %204
  %209 = icmp eq i64 %203, %204
  %210 = and i1 %208, %209
  br i1 %210, label %211, label %216

211:                                              ; preds = %._crit_edge1059
  %212 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %213 = add i64 %203, -1
  %214 = call i64 @llvm.smax.i64(i64 %213, i64 0)
  %215 = add i64 %212, %214
  br label %230

216:                                              ; preds = %._crit_edge1059
  %217 = or i1 %208, %209
  br i1 %217, label %218, label %221

218:                                              ; preds = %216
  %219 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %220 = add i64 %219, %204
  br label %230

221:                                              ; preds = %216
  %222 = icmp eq i64 %204, 0
  %223 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %224 = call i64 @llvm.smin.i64(i64 %206, i64 %207)
  br i1 %222, label %225, label %227

225:                                              ; preds = %221
  %226 = add i64 %223, %224
  br label %230

227:                                              ; preds = %221
  %228 = add i64 %224, %204
  %229 = add i64 %228, %223
  br label %230

230:                                              ; preds = %211, %218, %225, %227
  %.sink = phi i64 [ %215, %211 ], [ %220, %218 ], [ %226, %225 ], [ %229, %227 ]
  store i64 %.sink, ptr @_QFEp, align 8, !tbaa !3
  %231 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.c4971a375347f6b2a1a0550b7e263fa4, i32 46)
  %232 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %233 = call i1 @_FortranAioOutputInteger64(ptr %231, i64 %232)
  %234 = call i32 @_FortranAioEndIoStatement(ptr %231)
  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 i32 @_FortranACharacterCompareScalar1(ptr, ptr, i64, i64) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #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

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) }

!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}
