program main
  implicit none
  integer(8) :: n, i, j, q, r, cnt, m
  integer(8), allocatable :: ca(:), cb(:), cc(:), cq(:), pt(:)
  character(10 ** 5) :: s
  m = 10 ** 9 + 7
  read *, s
  n = len_trim(s)
  allocate (ca(0:n), cb(0:n), cc(0:n), cq(0:n), pt(-3:n))
  ca = 0
  cb = 0
  cc = 0
  cq = 0
  do i = 1, n
    if (s(i:i) == "A") ca(i) = 1
    if (s(i:i) == "B") cb(i) = 1
    if (s(i:i) == "C") cc(i) = 1
    if (s(i:i) == "?") cq(i) = 1
    ca(i) = ca(i) + ca(i - 1)
    cb(i) = cb(i) + cb(i - 1)
    cc(i) = cc(i) + cc(i - 1)
    cq(i) = cq(i) + cq(i - 1)
  end do
  q = cq(n)

  call prep_pt()

  cnt = 0
  do j = 2, n - 1
    if (s(j:j) == "A" .or. s(j:j) == "C") cycle
    if (s(j:j) == "?") then
      r = q - 1
    else if (s(j:j) == "B") then
      r = q
    end if
    cnt = cnt + ca(j - 1) * (cc(n) - cc(j)) * pt(r)
    cnt = modulo(cnt, m)
    cnt = cnt + cq(j - 1) * (cc(n) - cc(j)) * pt(r - 1)
    cnt = modulo(cnt, m)
    cnt = cnt + ca(j - 1) * (cq(n) - cq(j)) * pt(r - 1)
    cnt = modulo(cnt, m)
    cnt = cnt + cq(j - 1) * (cq(n) - cq(j)) * pt(r - 2)
    cnt = modulo(cnt, m)
  end do
  print "(i0)", cnt

  contains

  subroutine prep_pt()
    integer(8) :: i
    pt(:) = 0
    pt(0) = 1
    do i = 1, n
      pt(i) = modulo(pt(i - 1) * 3, m)
    end do
  end subroutine prep_pt
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"

@_QFEca.0 = internal unnamed_addr global ptr null
@_QFEca.7 = internal unnamed_addr global i64 1
@_QFEcb.0 = internal unnamed_addr global ptr null
@_QFEcb.7 = internal unnamed_addr global i64 1
@_QFEcb.8 = internal unnamed_addr global i64 0
@_QFEcc.0 = internal unnamed_addr global ptr null
@_QFEcc.7 = internal unnamed_addr global i64 1
@_QFEcc.8 = internal unnamed_addr global i64 0
@_QFEcq.0 = internal unnamed_addr global ptr null
@_QFEcq.7 = internal unnamed_addr global i64 1
@_QFEcq.8 = internal unnamed_addr global i64 0
@_QFEpt.0 = internal unnamed_addr global ptr null
@_QFEpt.7 = internal unnamed_addr global i64 1
@_QFEpt.8 = internal unnamed_addr global i64 0
@_QFEs = internal global [100000 x i8] undef
@_QQcl.a1f755a7dcb541a9473fdf487f053ef8 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5711/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.41 = linkonce constant [1 x i8] c"A"
@_QQcl.42 = linkonce constant [1 x i8] c"B"
@_QQcl.43 = linkonce constant [1 x i8] c"C"
@_QQcl.3F = linkonce constant [1 x i8] c"?"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_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 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a1f755a7dcb541a9473fdf487f053ef8, i32 7)
  %2 = tail call i1 @_FortranAioInputAscii(ptr %1, ptr nonnull @_QFEs, i64 100000)
  %3 = tail call i32 @_FortranAioEndIoStatement(ptr %1)
  br label %4

4:                                                ; preds = %0, %4
  %5 = phi i64 [ 99999, %0 ], [ %9, %4 ]
  %6 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %5
  %7 = load i8, ptr %6, align 1, !tbaa !3
  %8 = icmp eq i8 %7, 32
  %9 = add nsw i64 %5, -1
  %10 = icmp ne i64 %5, 0
  %11 = and i1 %8, %10
  br i1 %11, label %4, label %12

12:                                               ; preds = %4
  %13 = shl i64 %5, 32
  %sext = add i64 %13, 4294967296
  %14 = ashr exact i64 %sext, 32
  %15 = select i1 %8, i64 0, i64 %14
  %16 = tail call i64 @llvm.smax.i64(i64 %15, i64 -1)
  %17 = add nsw i64 %16, 1
  %18 = shl nuw nsw i64 %17, 3
  %19 = tail call ptr @malloc(i64 %18)
  %20 = icmp eq i64 %17, 0
  %21 = zext i1 %20 to i64
  store ptr %19, ptr @_QFEca.0, align 8, !tbaa !7
  store i64 %21, ptr @_QFEca.7, align 8, !tbaa !7
  %22 = tail call ptr @malloc(i64 %18)
  %23 = icmp ugt i64 %15, 9223372036854775806
  %24 = zext i1 %23 to i64
  store ptr %22, ptr @_QFEcb.0, align 8, !tbaa !7
  store i64 %24, ptr @_QFEcb.7, align 8, !tbaa !7
  store i64 %17, ptr @_QFEcb.8, align 8, !tbaa !7
  %25 = tail call ptr @malloc(i64 %18)
  store ptr %25, ptr @_QFEcc.0, align 8, !tbaa !7
  store i64 %24, ptr @_QFEcc.7, align 8, !tbaa !7
  store i64 %17, ptr @_QFEcc.8, align 8, !tbaa !7
  %26 = tail call ptr @malloc(i64 %18)
  store ptr %26, ptr @_QFEcq.0, align 8, !tbaa !7
  store i64 %24, ptr @_QFEcq.7, align 8, !tbaa !7
  store i64 %17, ptr @_QFEcq.8, align 8, !tbaa !7
  %27 = tail call i64 @llvm.smax.i64(i64 %15, i64 -4)
  %28 = add nsw i64 %27, 4
  %29 = shl nuw nsw i64 %28, 3
  %30 = tail call ptr @malloc(i64 %29)
  %31 = icmp slt i64 %15, -3
  %32 = select i1 %31, i64 1, i64 -3
  store ptr %30, ptr @_QFEpt.0, align 8, !tbaa !7
  store i64 %32, ptr @_QFEpt.7, align 8, !tbaa !7
  store i64 %28, ptr @_QFEpt.8, align 8, !tbaa !7
  %.not = icmp eq ptr %19, null
  br i1 %.not, label %37, label %.preheader1297

.preheader1297:                                   ; preds = %12
  %33 = icmp sgt i64 %15, -1
  br i1 %33, label %.lr.ph.preheader, label %.loopexit1298

.lr.ph.preheader:                                 ; preds = %.preheader1297
  %34 = add nsw i64 %16, 2
  %smin = tail call i64 @llvm.smin.i64(i64 %17, i64 1)
  %35 = sub nuw nsw i64 %34, %smin
  %36 = shl nuw nsw i64 %35, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %19, i8 0, i64 %36, i1 false), !tbaa !3
  br label %.loopexit1298

37:                                               ; preds = %12
  %38 = tail call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.a1f755a7dcb541a9473fdf487f053ef8, i32 10)
  %.unpack1266.unpack.unpack = load i64, ptr @_QFEca.7, align 8, !tbaa !7
  %39 = select i1 %20, i64 1, i64 %.unpack1266.unpack.unpack
  store ptr null, ptr @_QFEca.0, align 8, !tbaa !7
  store i64 %39, ptr @_QFEca.7, align 8, !tbaa !7
  %.unpack998.pre = load ptr, ptr @_QFEcb.0, align 8, !tbaa !7
  %.unpack1005.unpack.unpack1007.pre = load i64, ptr @_QFEcb.8, align 8, !tbaa !7
  br label %.loopexit1298

.loopexit1298:                                    ; preds = %.lr.ph.preheader, %.preheader1297, %37
  %.unpack1005.unpack.unpack1007 = phi i64 [ %17, %.lr.ph.preheader ], [ %17, %.preheader1297 ], [ %.unpack1005.unpack.unpack1007.pre, %37 ]
  %.unpack998 = phi ptr [ %22, %.lr.ph.preheader ], [ %22, %.preheader1297 ], [ %.unpack998.pre, %37 ]
  %.not1010 = icmp eq ptr %.unpack998, null
  br i1 %.not1010, label %42, label %.preheader1295

.preheader1295:                                   ; preds = %.loopexit1298
  %40 = icmp sgt i64 %.unpack1005.unpack.unpack1007, 0
  br i1 %40, label %.lr.ph1300.preheader, label %.loopexit1296

.lr.ph1300.preheader:                             ; preds = %.preheader1295
  %41 = shl nuw i64 %.unpack1005.unpack.unpack1007, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %.unpack998, i8 0, i64 %41, i1 false), !tbaa !3
  br label %.loopexit1296

42:                                               ; preds = %.loopexit1298
  %43 = tail call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.a1f755a7dcb541a9473fdf487f053ef8, i32 11)
  %.unpack1245.unpack.unpack = load i64, ptr @_QFEcb.7, align 8, !tbaa !7
  %44 = icmp eq i64 %.unpack1005.unpack.unpack1007, 0
  %45 = select i1 %44, i64 1, i64 %.unpack1245.unpack.unpack
  store ptr null, ptr @_QFEcb.0, align 8, !tbaa !7
  store i64 %45, ptr @_QFEcb.7, align 8, !tbaa !7
  store i64 %.unpack1005.unpack.unpack1007, ptr @_QFEcb.8, align 8, !tbaa !7
  br label %.loopexit1296

.loopexit1296:                                    ; preds = %.lr.ph1300.preheader, %.preheader1295, %42
  %.unpack1011 = load ptr, ptr @_QFEcc.0, align 8, !tbaa !7
  %.unpack1018.unpack.unpack1020 = load i64, ptr @_QFEcc.8, align 8, !tbaa !7
  %.not1023 = icmp eq ptr %.unpack1011, null
  br i1 %.not1023, label %48, label %.preheader1293

.preheader1293:                                   ; preds = %.loopexit1296
  %46 = icmp sgt i64 %.unpack1018.unpack.unpack1020, 0
  br i1 %46, label %.lr.ph1301.preheader, label %.loopexit1294

.lr.ph1301.preheader:                             ; preds = %.preheader1293
  %47 = shl nuw i64 %.unpack1018.unpack.unpack1020, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %.unpack1011, i8 0, i64 %47, i1 false), !tbaa !3
  br label %.loopexit1294

48:                                               ; preds = %.loopexit1296
  %49 = tail call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.a1f755a7dcb541a9473fdf487f053ef8, i32 12)
  %.unpack1224.unpack.unpack = load i64, ptr @_QFEcc.7, align 8, !tbaa !7
  %50 = icmp eq i64 %.unpack1018.unpack.unpack1020, 0
  %51 = select i1 %50, i64 1, i64 %.unpack1224.unpack.unpack
  store ptr null, ptr @_QFEcc.0, align 8, !tbaa !7
  store i64 %51, ptr @_QFEcc.7, align 8, !tbaa !7
  store i64 %.unpack1018.unpack.unpack1020, ptr @_QFEcc.8, align 8, !tbaa !7
  br label %.loopexit1294

.loopexit1294:                                    ; preds = %.lr.ph1301.preheader, %.preheader1293, %48
  %.unpack1024 = load ptr, ptr @_QFEcq.0, align 8, !tbaa !7
  %.unpack1031.unpack.unpack1033 = load i64, ptr @_QFEcq.8, align 8, !tbaa !7
  %.not1036 = icmp eq ptr %.unpack1024, null
  br i1 %.not1036, label %54, label %.preheader

.preheader:                                       ; preds = %.loopexit1294
  %52 = icmp sgt i64 %.unpack1031.unpack.unpack1033, 0
  br i1 %52, label %.lr.ph1302.preheader, label %.loopexit

.lr.ph1302.preheader:                             ; preds = %.preheader
  %53 = shl nuw i64 %.unpack1031.unpack.unpack1033, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %.unpack1024, i8 0, i64 %53, i1 false), !tbaa !3
  br label %.loopexit

54:                                               ; preds = %.loopexit1294
  %55 = tail call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.a1f755a7dcb541a9473fdf487f053ef8, i32 13)
  %.unpack1203.unpack.unpack = load i64, ptr @_QFEcq.7, align 8, !tbaa !7
  %56 = icmp eq i64 %.unpack1031.unpack.unpack1033, 0
  %57 = select i1 %56, i64 1, i64 %.unpack1203.unpack.unpack
  store ptr null, ptr @_QFEcq.0, align 8, !tbaa !7
  store i64 %57, ptr @_QFEcq.7, align 8, !tbaa !7
  store i64 %.unpack1031.unpack.unpack1033, ptr @_QFEcq.8, align 8, !tbaa !7
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph1302.preheader, %.preheader, %54
  %58 = icmp sgt i64 %15, 0
  br i1 %58, label %.lr.ph1303, label %.loopexit.._crit_edge_crit_edge

.loopexit.._crit_edge_crit_edge:                  ; preds = %.loopexit
  %.unpack1044.unpack.unpack.pre = load i64, ptr @_QFEcq.7, align 8, !tbaa !7
  br label %._crit_edge

.lr.ph1303:                                       ; preds = %.loopexit, %._crit_edge1312
  %59 = phi i64 [ %112, %._crit_edge1312 ], [ 1, %.loopexit ]
  %60 = add nsw i64 %59, -1
  %61 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %60
  %62 = tail call i32 @_FortranACharacterCompareScalar1(ptr %61, ptr nonnull @_QQcl.41, i64 1, i64 1)
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %64, label %67

64:                                               ; preds = %.lr.ph1303
  %.unpack1184 = load ptr, ptr @_QFEca.0, align 8, !tbaa !7
  %.unpack1191.unpack.unpack = load i64, ptr @_QFEca.7, align 8, !tbaa !7
  %65 = sub i64 %59, %.unpack1191.unpack.unpack
  %66 = getelementptr i64, ptr %.unpack1184, i64 %65
  store i64 1, ptr %66, align 8, !tbaa !3
  br label %67

67:                                               ; preds = %64, %.lr.ph1303
  %68 = tail call i32 @_FortranACharacterCompareScalar1(ptr %61, ptr nonnull @_QQcl.42, i64 1, i64 1)
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %70, label %73

70:                                               ; preds = %67
  %.unpack1172 = load ptr, ptr @_QFEcb.0, align 8, !tbaa !7
  %.unpack1179.unpack.unpack = load i64, ptr @_QFEcb.7, align 8, !tbaa !7
  %71 = sub i64 %59, %.unpack1179.unpack.unpack
  %72 = getelementptr i64, ptr %.unpack1172, i64 %71
  store i64 1, ptr %72, align 8, !tbaa !3
  br label %73

73:                                               ; preds = %70, %67
  %74 = tail call i32 @_FortranACharacterCompareScalar1(ptr %61, ptr nonnull @_QQcl.43, i64 1, i64 1)
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %79

76:                                               ; preds = %73
  %.unpack1160 = load ptr, ptr @_QFEcc.0, align 8, !tbaa !7
  %.unpack1167.unpack.unpack = load i64, ptr @_QFEcc.7, align 8, !tbaa !7
  %77 = sub i64 %59, %.unpack1167.unpack.unpack
  %78 = getelementptr i64, ptr %.unpack1160, i64 %77
  store i64 1, ptr %78, align 8, !tbaa !3
  br label %79

79:                                               ; preds = %76, %73
  %80 = tail call i32 @_FortranACharacterCompareScalar1(ptr %61, ptr nonnull @_QQcl.3F, i64 1, i64 1)
  %81 = icmp eq i32 %80, 0
  %.unpack1148 = load ptr, ptr @_QFEcq.0, align 8, !tbaa !7
  %.unpack1155.unpack.unpack = load i64, ptr @_QFEcq.7, align 8, !tbaa !7
  %82 = sub i64 %59, %.unpack1155.unpack.unpack
  br i1 %81, label %83, label %._crit_edge1312

83:                                               ; preds = %79
  %84 = getelementptr i64, ptr %.unpack1148, i64 %82
  store i64 1, ptr %84, align 8, !tbaa !3
  br label %._crit_edge1312

._crit_edge1312:                                  ; preds = %79, %83
  %.unpack1100 = load ptr, ptr @_QFEca.0, align 8, !tbaa !7
  %.unpack1107.unpack.unpack = load i64, ptr @_QFEca.7, align 8, !tbaa !7
  %85 = sub i64 %59, %.unpack1107.unpack.unpack
  %86 = getelementptr i64, ptr %.unpack1100, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !3
  %88 = sub i64 %60, %.unpack1107.unpack.unpack
  %89 = getelementptr i64, ptr %.unpack1100, i64 %88
  %90 = load i64, ptr %89, align 8, !tbaa !3
  %91 = add i64 %90, %87
  store i64 %91, ptr %86, align 8, !tbaa !3
  %.unpack1112 = load ptr, ptr @_QFEcb.0, align 8, !tbaa !7
  %.unpack1119.unpack.unpack = load i64, ptr @_QFEcb.7, align 8, !tbaa !7
  %92 = sub i64 %59, %.unpack1119.unpack.unpack
  %93 = getelementptr i64, ptr %.unpack1112, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !3
  %95 = sub i64 %60, %.unpack1119.unpack.unpack
  %96 = getelementptr i64, ptr %.unpack1112, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !3
  %98 = add i64 %97, %94
  store i64 %98, ptr %93, align 8, !tbaa !3
  %.unpack1124 = load ptr, ptr @_QFEcc.0, align 8, !tbaa !7
  %.unpack1131.unpack.unpack = load i64, ptr @_QFEcc.7, align 8, !tbaa !7
  %99 = sub i64 %59, %.unpack1131.unpack.unpack
  %100 = getelementptr i64, ptr %.unpack1124, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !3
  %102 = sub i64 %60, %.unpack1131.unpack.unpack
  %103 = getelementptr i64, ptr %.unpack1124, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !3
  %105 = add i64 %104, %101
  store i64 %105, ptr %100, align 8, !tbaa !3
  %106 = getelementptr i64, ptr %.unpack1148, i64 %82
  %107 = load i64, ptr %106, align 8, !tbaa !3
  %108 = sub i64 %60, %.unpack1155.unpack.unpack
  %109 = getelementptr i64, ptr %.unpack1148, i64 %108
  %110 = load i64, ptr %109, align 8, !tbaa !3
  %111 = add i64 %110, %107
  store i64 %111, ptr %106, align 8, !tbaa !3
  %112 = add nuw nsw i64 %59, 1
  %exitcond.not = icmp eq i64 %59, %15
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph1303

._crit_edge:                                      ; preds = %._crit_edge1312, %.loopexit.._crit_edge_crit_edge
  %.unpack1044.unpack.unpack = phi i64 [ %.unpack1044.unpack.unpack.pre, %.loopexit.._crit_edge_crit_edge ], [ %.unpack1155.unpack.unpack, %._crit_edge1312 ]
  %.unpack1037 = phi ptr [ %.unpack1024, %.loopexit.._crit_edge_crit_edge ], [ %.unpack1148, %._crit_edge1312 ]
  %113 = sub i64 %15, %.unpack1044.unpack.unpack
  %114 = getelementptr i64, ptr %.unpack1037, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !3
  %.unpack.i = load ptr, ptr @_QFEpt.0, align 8, !tbaa !7
  %.unpack49.unpack.unpack51.i = load i64, ptr @_QFEpt.8, align 8, !tbaa !7
  %.not.i = icmp slt i64 %.unpack49.unpack.unpack51.i, 1
  br i1 %.not.i, label %._crit_edge.i, label %.lr.ph.preheader.i

.lr.ph.preheader.i:                               ; preds = %._crit_edge
  %116 = shl nuw i64 %.unpack49.unpack.unpack51.i, 3
  tail call void @llvm.memset.p0.i64(ptr align 8 %.unpack.i, i8 0, i64 %116, i1 false), !tbaa !3
  br label %._crit_edge.i

._crit_edge.i:                                    ; preds = %.lr.ph.preheader.i, %._crit_edge
  %.unpack61.unpack.unpack.i = load i64, ptr @_QFEpt.7, align 8, !tbaa !7
  %117 = sub i64 0, %.unpack61.unpack.unpack.i
  %118 = getelementptr i64, ptr %.unpack.i, i64 %117
  store i64 1, ptr %118, align 8, !tbaa !3
  br i1 %58, label %.lr.ph79.i, label %._crit_edge1307

.lr.ph79.i:                                       ; preds = %._crit_edge.i
  %119 = mul i64 %.unpack61.unpack.unpack.i, -8
  %uglygep = getelementptr i8, ptr %.unpack.i, i64 %119
  %load_initial = load i64, ptr %uglygep, align 8
  br label %120

120:                                              ; preds = %120, %.lr.ph79.i
  %store_forwarded = phi i64 [ %load_initial, %.lr.ph79.i ], [ %128, %120 ]
  %121 = phi i64 [ 1, %.lr.ph79.i ], [ %131, %120 ]
  %122 = mul i64 %store_forwarded, 3
  %123 = srem i64 %122, 1000000007
  %124 = icmp slt i64 %122, 0
  %125 = icmp ne i64 %123, 0
  %126 = and i1 %124, %125
  %127 = select i1 %126, i64 1000000007, i64 0
  %128 = add nsw i64 %127, %123
  %129 = sub i64 %121, %.unpack61.unpack.unpack.i
  %130 = getelementptr i64, ptr %.unpack.i, i64 %129
  store i64 %128, ptr %130, align 8, !tbaa !3
  %131 = add nuw nsw i64 %121, 1
  %exitcond.not.i = icmp eq i64 %121, %15
  br i1 %exitcond.not.i, label %_QFPprep_pt.exit, label %120

_QFPprep_pt.exit:                                 ; preds = %120
  %132 = icmp sgt i64 %15, 2
  br i1 %132, label %.lr.ph1306, label %._crit_edge1307

.lr.ph1306:                                       ; preds = %_QFPprep_pt.exit
  %133 = add i64 %115, -1
  br label %134

134:                                              ; preds = %.lr.ph1306, %216
  %135 = phi i64 [ 2, %.lr.ph1306 ], [ %217, %216 ]
  %.01305 = phi i64 [ undef, %.lr.ph1306 ], [ %.2, %216 ]
  %.09331304 = phi i64 [ 0, %.lr.ph1306 ], [ %.1934, %216 ]
  %136 = add nsw i64 %135, -1
  %137 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %136
  %138 = tail call i32 @_FortranACharacterCompareScalar1(ptr %137, ptr nonnull @_QQcl.41, i64 1, i64 1)
  %139 = icmp ne i32 %138, 0
  %140 = tail call i32 @_FortranACharacterCompareScalar1(ptr %137, ptr nonnull @_QQcl.43, i64 1, i64 1)
  %141 = icmp ne i32 %140, 0
  %.not1051 = and i1 %139, %141
  br i1 %.not1051, label %142, label %216

142:                                              ; preds = %134
  %143 = tail call i32 @_FortranACharacterCompareScalar1(ptr %137, ptr nonnull @_QQcl.3F, i64 1, i64 1)
  %144 = icmp eq i32 %143, 0
  br i1 %144, label %148, label %145

145:                                              ; preds = %142
  %146 = tail call i32 @_FortranACharacterCompareScalar1(ptr %137, ptr nonnull @_QQcl.42, i64 1, i64 1)
  %147 = icmp eq i32 %146, 0
  %spec.select = select i1 %147, i64 %115, i64 %.01305
  br label %148

148:                                              ; preds = %142, %145
  %.1 = phi i64 [ %spec.select, %145 ], [ %133, %142 ]
  %.unpack1052 = load ptr, ptr @_QFEca.0, align 8, !tbaa !7
  %.unpack1059.unpack.unpack = load i64, ptr @_QFEca.7, align 8, !tbaa !7
  %149 = sub i64 %136, %.unpack1059.unpack.unpack
  %150 = getelementptr i64, ptr %.unpack1052, i64 %149
  %151 = load i64, ptr %150, align 8, !tbaa !3
  %.unpack1064 = load ptr, ptr @_QFEcc.0, align 8, !tbaa !7
  %.unpack1071.unpack.unpack = load i64, ptr @_QFEcc.7, align 8, !tbaa !7
  %152 = sub i64 %15, %.unpack1071.unpack.unpack
  %153 = getelementptr i64, ptr %.unpack1064, i64 %152
  %154 = load i64, ptr %153, align 8, !tbaa !3
  %155 = sub i64 %135, %.unpack1071.unpack.unpack
  %156 = getelementptr i64, ptr %.unpack1064, i64 %155
  %157 = load i64, ptr %156, align 8, !tbaa !3
  %158 = sub i64 %154, %157
  %159 = mul i64 %158, %151
  %.unpack1076 = load ptr, ptr @_QFEpt.0, align 8, !tbaa !7
  %.unpack1083.unpack.unpack = load i64, ptr @_QFEpt.7, align 8, !tbaa !7
  %160 = sub i64 %.1, %.unpack1083.unpack.unpack
  %161 = getelementptr i64, ptr %.unpack1076, i64 %160
  %162 = load i64, ptr %161, align 8, !tbaa !3
  %163 = mul i64 %159, %162
  %164 = add i64 %163, %.09331304
  %165 = srem i64 %164, 1000000007
  %166 = icmp slt i64 %164, 0
  %167 = icmp ne i64 %165, 0
  %168 = and i1 %166, %167
  %169 = select i1 %168, i64 1000000007, i64 0
  %.unpack1088 = load ptr, ptr @_QFEcq.0, align 8, !tbaa !7
  %.unpack1095.unpack.unpack = load i64, ptr @_QFEcq.7, align 8, !tbaa !7
  %170 = sub i64 %136, %.unpack1095.unpack.unpack
  %171 = getelementptr i64, ptr %.unpack1088, i64 %170
  %172 = load i64, ptr %171, align 8, !tbaa !3
  %173 = mul i64 %172, %158
  %174 = xor i64 %.unpack1083.unpack.unpack, -1
  %175 = add i64 %.1, %174
  %176 = getelementptr i64, ptr %.unpack1076, i64 %175
  %177 = load i64, ptr %176, align 8, !tbaa !3
  %178 = mul i64 %173, %177
  %179 = add i64 %178, %165
  %180 = add i64 %179, %169
  %181 = srem i64 %180, 1000000007
  %182 = icmp slt i64 %180, 0
  %183 = icmp ne i64 %181, 0
  %184 = and i1 %182, %183
  %185 = select i1 %184, i64 1000000007, i64 0
  %186 = sub i64 %15, %.unpack1095.unpack.unpack
  %187 = getelementptr i64, ptr %.unpack1088, i64 %186
  %188 = load i64, ptr %187, align 8, !tbaa !3
  %189 = sub i64 %135, %.unpack1095.unpack.unpack
  %190 = getelementptr i64, ptr %.unpack1088, i64 %189
  %191 = load i64, ptr %190, align 8, !tbaa !3
  %192 = sub i64 %188, %191
  %193 = mul i64 %177, %151
  %194 = mul i64 %193, %192
  %195 = add i64 %194, %181
  %196 = add i64 %195, %185
  %197 = srem i64 %196, 1000000007
  %198 = icmp slt i64 %196, 0
  %199 = icmp ne i64 %197, 0
  %200 = and i1 %198, %199
  %201 = select i1 %200, i64 1000000007, i64 0
  %202 = mul i64 %192, %172
  %203 = add i64 %.1, -2
  %204 = sub i64 %203, %.unpack1083.unpack.unpack
  %205 = getelementptr i64, ptr %.unpack1076, i64 %204
  %206 = load i64, ptr %205, align 8, !tbaa !3
  %207 = mul i64 %202, %206
  %208 = add i64 %197, %207
  %209 = add i64 %208, %201
  %210 = srem i64 %209, 1000000007
  %211 = icmp slt i64 %209, 0
  %212 = icmp ne i64 %210, 0
  %213 = and i1 %211, %212
  %214 = select i1 %213, i64 1000000007, i64 0
  %215 = add nsw i64 %214, %210
  br label %216

216:                                              ; preds = %148, %134
  %.1934 = phi i64 [ %215, %148 ], [ %.09331304, %134 ]
  %.2 = phi i64 [ %.1, %148 ], [ %.01305, %134 ]
  %217 = add nuw nsw i64 %135, 1
  %exitcond1309.not = icmp eq i64 %217, %15
  br i1 %exitcond1309.not, label %._crit_edge1307, label %134

._crit_edge1307:                                  ; preds = %216, %._crit_edge.i, %_QFPprep_pt.exit
  %.0933.lcssa = phi i64 [ 0, %_QFPprep_pt.exit ], [ 0, %._crit_edge.i ], [ %.1934, %216 ]
  %218 = tail call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.a1f755a7dcb541a9473fdf487f053ef8, i32 45)
  %219 = tail call i1 @_FortranAioOutputInteger64(ptr %218, i64 %.0933.lcssa)
  %220 = tail call i32 @_FortranAioEndIoStatement(ptr %218)
  ret void
}

; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none)
define void @_QFPprep_pt(ptr nest nocapture readonly %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr %0, align 8, !tbaa !3
  %3 = getelementptr { ptr, ptr }, ptr %0, i64 0, i32 1
  %4 = load ptr, ptr %3, align 8, !tbaa !3
  %.unpack = load ptr, ptr @_QFEpt.0, align 8, !tbaa !7
  %.unpack49.unpack.unpack51 = load i64, ptr @_QFEpt.8, align 8, !tbaa !7
  %.not = icmp slt i64 %.unpack49.unpack.unpack51, 1
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %1
  %5 = shl nuw i64 %.unpack49.unpack.unpack51, 3
  tail call void @llvm.memset.p0.i64(ptr align 8 %.unpack, i8 0, i64 %5, i1 false), !tbaa !3
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.preheader, %1
  %.unpack61.unpack.unpack = load i64, ptr @_QFEpt.7, align 8, !tbaa !7
  %6 = sub i64 0, %.unpack61.unpack.unpack
  %7 = getelementptr i64, ptr %.unpack, i64 %6
  store i64 1, ptr %7, align 8, !tbaa !3
  %8 = load i64, ptr %2, align 8, !tbaa !3
  %9 = icmp sgt i64 %8, 0
  br i1 %9, label %.lr.ph79, label %._crit_edge80

.lr.ph79:                                         ; preds = %._crit_edge
  %10 = mul i64 %.unpack61.unpack.unpack, -8
  %uglygep = getelementptr i8, ptr %.unpack, i64 %10
  %load_initial = load i64, ptr %uglygep, align 8
  br label %11

11:                                               ; preds = %.lr.ph79, %11
  %store_forwarded = phi i64 [ %load_initial, %.lr.ph79 ], [ %21, %11 ]
  %12 = phi i64 [ 1, %.lr.ph79 ], [ %24, %11 ]
  %13 = mul i64 %store_forwarded, 3
  %14 = load i64, ptr %4, align 8, !tbaa !3
  %15 = srem i64 %13, %14
  %16 = xor i64 %13, %14
  %17 = icmp slt i64 %16, 0
  %18 = icmp ne i64 %15, 0
  %19 = and i1 %18, %17
  %20 = select i1 %19, i64 %14, i64 0
  %21 = add i64 %20, %15
  %22 = sub i64 %12, %.unpack61.unpack.unpack
  %23 = getelementptr i64, ptr %.unpack, i64 %22
  store i64 %21, ptr %23, align 8, !tbaa !3
  %24 = add nuw i64 %12, 1
  %exitcond.not = icmp eq i64 %12, %8
  br i1 %exitcond.not, label %._crit_edge80, label %11

._crit_edge80:                                    ; preds = %11, %._crit_edge
  ret void
}

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

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

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare {} @_FortranAReportFatalUserError(ptr, ptr, i32) local_unnamed_addr

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

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, 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) #2

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

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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}
