program palindrome_phobia
  implicit none
  character(100000) :: s
  integer :: n, i, m(3)
  read(*,*) s
  s = trim(adjustl(s))
  n = len_trim(s)
  m = 0
  do i = 1, n
    m(ichar(s(i:i))-96) = m(ichar(s(i:i))-96)+1
  end do
  if (maxval(m)-minval(m).le.1) then
    write(*,'(a)') "YES"
  else
    write(*,'(a)') "NO"
  end if
  stop
end program palindrome_phobia
; 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"

@_QFEs = internal global [100000 x i8] undef
@_QQcl.00bd54ab0856bebf1f70ad4c1c311949 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6670/source.f\00"
@_QQcl.286129 = linkonce constant [3 x i8] c"(a)"
@_QQcl.594553 = linkonce constant [3 x i8] c"YES"
@_QQcl.4E4F = linkonce constant [2 x i8] c"NO"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #1 {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %3 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %4 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %5 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %6 = alloca [3 x i32], align 4
  %7 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.00bd54ab0856bebf1f70ad4c1c311949, i32 5)
  %8 = tail call i1 @_FortranAioInputAscii(ptr %7, ptr nonnull @_QFEs, i64 100000)
  %9 = tail call i32 @_FortranAioEndIoStatement(ptr %7)
  store ptr @_QFEs, ptr %3, align 8, !tbaa !3
  %.fca.1.gep46 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 1
  store i64 100000, ptr %.fca.1.gep46, align 8, !tbaa !3
  %.fca.2.gep47 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep47, align 8, !tbaa !3
  %.fca.3.gep48 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 3
  store i8 0, ptr %.fca.3.gep48, align 4, !tbaa !3
  %.fca.4.gep49 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 4
  store i8 40, ptr %.fca.4.gep49, align 1, !tbaa !3
  %.fca.5.gep50 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep50, align 2, !tbaa !3
  %.fca.6.gep51 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep51, align 1, !tbaa !3
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 1
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !3
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 3
  store i8 0, ptr %.fca.3.gep, align 4, !tbaa !3
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 4
  store i8 40, ptr %.fca.4.gep, align 1, !tbaa !3
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 5
  store i8 2, ptr %.fca.5.gep, align 2, !tbaa !3
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !3
  %10 = call {} @_FortranAAdjustl(ptr nonnull %5, ptr nonnull %3, ptr nonnull @_QQcl.00bd54ab0856bebf1f70ad4c1c311949, i32 6)
  %.fca.0.load = load ptr, ptr %5, align 8, !tbaa !3
  %.fca.1.load = load i64, ptr %.fca.1.gep, align 8, !tbaa !3
  store ptr %.fca.0.load, ptr %2, align 8, !tbaa !3
  %.fca.1.gep112 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 1
  store i64 %.fca.1.load, ptr %.fca.1.gep112, align 8, !tbaa !3
  %.fca.2.gep114 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep114, align 8, !tbaa !3
  %.fca.3.gep116 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 3
  store i8 0, ptr %.fca.3.gep116, align 4, !tbaa !3
  %.fca.4.gep118 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 4
  store i8 40, ptr %.fca.4.gep118, align 1, !tbaa !3
  %.fca.5.gep120 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep120, align 2, !tbaa !3
  %.fca.6.gep122 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep122, align 1, !tbaa !3
  %.fca.1.gep13 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 1
  %.fca.2.gep15 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, i8 0, i64 16, i1 false)
  store i32 20180515, ptr %.fca.2.gep15, align 8, !tbaa !3
  %.fca.3.gep17 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 3
  store i8 0, ptr %.fca.3.gep17, align 4, !tbaa !3
  %.fca.4.gep19 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 4
  store i8 40, ptr %.fca.4.gep19, align 1, !tbaa !3
  %.fca.5.gep21 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 5
  store i8 2, ptr %.fca.5.gep21, align 2, !tbaa !3
  %.fca.6.gep23 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep23, align 1, !tbaa !3
  %11 = call {} @_FortranATrim(ptr nonnull %4, ptr nonnull %2, ptr nonnull @_QQcl.00bd54ab0856bebf1f70ad4c1c311949, i32 6)
  %.fca.0.load25 = load ptr, ptr %4, align 8, !tbaa !3
  %.fca.1.load28 = load i64, ptr %.fca.1.gep13, align 8, !tbaa !3
  %12 = call i64 @llvm.smin.i64(i64 %.fca.1.load28, i64 100000)
  call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 @_QFEs, ptr align 1 %.fca.0.load25, i64 %12, i1 false)
  %13 = sub i64 100000, %12
  %14 = icmp sgt i64 %13, 0
  br i1 %14, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %uglygep = getelementptr i8, ptr @_QFEs, i64 %12
  call void @llvm.memset.p0.i64(ptr align 1 %uglygep, i8 32, i64 %13, i1 false), !tbaa !7
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.preheader, %0
  call void @free(ptr %.fca.0.load25)
  call void @free(ptr %.fca.0.load)
  br label %19

.preheader:                                       ; preds = %19
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %6, i8 0, i64 12, i1 false), !tbaa !7
  %15 = shl i64 %20, 32
  %sext = add i64 %15, 4294967296
  %16 = ashr exact i64 %sext, 32
  %spec.select = select i1 %23, i64 0, i64 %16
  %17 = icmp sgt i64 %spec.select, 0
  br i1 %17, label %select.unfold.preheader, label %.lr.ph.i

select.unfold.preheader:                          ; preds = %.preheader
  %xtraiter = and i64 %spec.select, 1
  %18 = icmp eq i64 %spec.select, 1
  br i1 %18, label %.lr.ph.i.loopexit.unr-lcssa, label %select.unfold.preheader.new

select.unfold.preheader.new:                      ; preds = %select.unfold.preheader
  %unroll_iter = and i64 %spec.select, -2
  br label %select.unfold

19:                                               ; preds = %._crit_edge, %19
  %20 = phi i64 [ 99999, %._crit_edge ], [ %24, %19 ]
  %21 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %20
  %22 = load i8, ptr %21, align 1, !tbaa !7
  %23 = icmp eq i8 %22, 32
  %24 = add nsw i64 %20, -1
  %25 = icmp ne i64 %20, 0
  %26 = and i1 %23, %25
  br i1 %26, label %19, label %.preheader

select.unfold:                                    ; preds = %select.unfold, %select.unfold.preheader.new
  %indvars.iv = phi i64 [ 1, %select.unfold.preheader.new ], [ %indvars.iv.next.1, %select.unfold ]
  %niter = phi i64 [ 0, %select.unfold.preheader.new ], [ %niter.next.1, %select.unfold ]
  %27 = add nsw i64 %indvars.iv, -1
  %28 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %27
  %.unpack = load i8, ptr %28, align 1, !tbaa !7
  %29 = zext i8 %.unpack to i64
  %30 = add nsw i64 %29, -97
  %31 = getelementptr [3 x i32], ptr %6, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !7
  %33 = add i32 %32, 1
  store i32 %33, ptr %31, align 4, !tbaa !7
  %34 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %indvars.iv
  %.unpack.1 = load i8, ptr %34, align 1, !tbaa !7
  %35 = zext i8 %.unpack.1 to i64
  %36 = add nsw i64 %35, -97
  %37 = getelementptr [3 x i32], ptr %6, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !7
  %39 = add i32 %38, 1
  store i32 %39, ptr %37, align 4, !tbaa !7
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 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 %.lr.ph.i.loopexit.unr-lcssa.loopexit, label %select.unfold

.lr.ph.i.loopexit.unr-lcssa.loopexit:             ; preds = %select.unfold
  %40 = add nuw nsw i64 %indvars.iv, 1
  br label %.lr.ph.i.loopexit.unr-lcssa

.lr.ph.i.loopexit.unr-lcssa:                      ; preds = %.lr.ph.i.loopexit.unr-lcssa.loopexit, %select.unfold.preheader
  %indvars.iv.unr = phi i64 [ 0, %select.unfold.preheader ], [ %40, %.lr.ph.i.loopexit.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.i.loopexit, label %select.unfold.epil

select.unfold.epil:                               ; preds = %.lr.ph.i.loopexit.unr-lcssa
  %41 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %indvars.iv.unr
  %.unpack.epil = load i8, ptr %41, align 1, !tbaa !7
  %42 = zext i8 %.unpack.epil to i64
  %43 = add nsw i64 %42, -97
  %44 = getelementptr [3 x i32], ptr %6, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !7
  %46 = add i32 %45, 1
  store i32 %46, ptr %44, align 4, !tbaa !7
  br label %.lr.ph.i.loopexit

.lr.ph.i.loopexit:                                ; preds = %.lr.ph.i.loopexit.unr-lcssa, %select.unfold.epil
  %.pre = load i32, ptr %6, align 4, !tbaa !7
  %.phi.trans.insert = getelementptr inbounds i8, ptr %6, i64 4
  %.pre154 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !7
  %.phi.trans.insert155 = getelementptr inbounds i8, ptr %6, i64 8
  %.pre156 = load i32, ptr %.phi.trans.insert155, align 4, !tbaa !7
  br label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.lr.ph.i.loopexit, %.preheader
  %47 = phi i32 [ %.pre156, %.lr.ph.i.loopexit ], [ 0, %.preheader ]
  %48 = phi i32 [ %.pre154, %.lr.ph.i.loopexit ], [ 0, %.preheader ]
  %49 = phi i32 [ %.pre, %.lr.ph.i.loopexit ], [ 0, %.preheader ]
  store ptr %6, ptr %1, align 8, !tbaa !3
  %.fca.1.gep133 = 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.gep133, align 8, !tbaa !3
  %.fca.2.gep135 = 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.gep135, align 8, !tbaa !3
  %.fca.3.gep137 = 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.gep137, align 4, !tbaa !3
  %.fca.4.gep139 = 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.gep139, align 1, !tbaa !3
  %.fca.5.gep141 = 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.gep141, align 2, !tbaa !3
  %.fca.6.gep143 = 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.gep143, align 1, !tbaa !3
  %.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 !3
  %.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 3, 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 %1, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !3
  %50 = call i32 @llvm.smax.i32(i32 %48, i32 %49)
  %51 = call i32 @llvm.smax.i32(i32 %47, i32 %50)
  %52 = call i32 @_FortranAMinvalInteger4(ptr nonnull %1, ptr nonnull @_QQcl.00bd54ab0856bebf1f70ad4c1c311949, i32 11, i32 0, ptr null)
  %53 = sub i32 %51, %52
  %54 = icmp slt i32 %53, 2
  %. = select i1 %54, i32 13, i32 15
  %.160 = select i1 %54, i64 3, i64 2
  %_QQcl.594553._QQcl.4E4F = select i1 %54, ptr @_QQcl.594553, ptr @_QQcl.4E4F
  %55 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.00bd54ab0856bebf1f70ad4c1c311949, i32 %.)
  %56 = call i1 @_FortranAioOutputAscii(ptr %55, ptr nonnull %_QQcl.594553._QQcl.4E4F, i64 %.160)
  %57 = call i32 @_FortranAioEndIoStatement(ptr %55)
  %58 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

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 {} @_FortranAAdjustl(ptr, ptr, ptr, i32) local_unnamed_addr

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #2

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

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

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

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3

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

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

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