program palindrome_philia
    implicit none
    character(100):: s
    integer(4):: i, ans, s_len

    read*, s
    ans = 0
    s_len = len_trim(s)
    
    do i = 1, s_len/2
        if (s(i:i) /= s(s_len-i+1:s_len-i+1)) ans = ans+1
    end do

    print*, ans
end program palindrome_philia
; 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 [100 x i8] undef
@_QQcl.90b64eca665233d3eec97ffa7f2b4307 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_2860/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.90b64eca665233d3eec97ffa7f2b4307, i32 6)
  %2 = tail call i1 @_FortranAioInputAscii(ptr %1, ptr nonnull @_QFEs, i64 100)
  %3 = tail call i32 @_FortranAioEndIoStatement(ptr %1)
  br label %4

4:                                                ; preds = %0, %4
  %5 = phi i64 [ 99, %0 ], [ %9, %4 ]
  %6 = getelementptr [100 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 = trunc i64 %5 to i32
  %14 = add i32 %13, 1
  %15 = select i1 %8, i32 0, i32 %14
  %16 = icmp sgt i32 %15, 1
  br i1 %16, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %12
  %17 = lshr i32 %15, 1
  %18 = add nuw i32 %15, 1
  %narrow = add nuw nsw i32 %17, 1
  %19 = zext i32 %narrow to i64
  br label %20

20:                                               ; preds = %.lr.ph, %20
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %20 ]
  %.09 = phi i32 [ 0, %.lr.ph ], [ %spec.select, %20 ]
  %21 = add nsw i64 %indvars.iv, -1
  %22 = getelementptr [100 x [1 x i8]], ptr @_QFEs, i64 0, i64 %21
  %23 = trunc i64 %indvars.iv to i32
  %24 = sub i32 %18, %23
  %25 = sext i32 %24 to i64
  %26 = add nsw i64 %25, -1
  %27 = getelementptr [100 x [1 x i8]], ptr @_QFEs, i64 0, i64 %26
  %28 = tail call i32 @_FortranACharacterCompareScalar1(ptr %22, ptr %27, i64 1, i64 1)
  %.not = icmp ne i32 %28, 0
  %29 = zext i1 %.not to i32
  %spec.select = add i32 %.09, %29
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %19
  br i1 %exitcond.not, label %._crit_edge, label %20

._crit_edge:                                      ; preds = %20, %12
  %.0.lcssa = phi i32 [ 0, %12 ], [ %spec.select, %20 ]
  %30 = tail call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.90b64eca665233d3eec97ffa7f2b4307, i32 14)
  %31 = tail call i1 @_FortranAioOutputInteger32(ptr %30, i32 %.0.lcssa)
  %32 = tail call i32 @_FortranAioEndIoStatement(ptr %30)
  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 i32 @_FortranACharacterCompareScalar1(ptr, ptr, i64, i64) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

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