; LLVM IR from AdarshGaur/Competitive-Programming :: SPOJ (PALIN - The Next Palindrome)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5palinRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %12) #4
  store i64 %13, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store i64 1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %14

14:                                               ; preds = %28, %1
  %15 = load i64, ptr %5, align 8, !tbaa !9
  %16 = load i64, ptr %3, align 8, !tbaa !9
  %17 = icmp slt i64 %15, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  store i32 2, ptr %6, align 4
  br label %31

19:                                               ; preds = %14
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = load i64, ptr %5, align 8, !tbaa !9
  %22 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %20, i64 noundef %21)
  %23 = load i8, ptr %22, align 1, !tbaa !11
  %24 = sext i8 %23 to i32
  %25 = icmp ne i32 %24, 57
  br i1 %25, label %26, label %27

26:                                               ; preds = %19
  store i64 0, ptr %4, align 8, !tbaa !9
  store i32 2, ptr %6, align 4
  br label %31

27:                                               ; preds = %19
  br label %28

28:                                               ; preds = %27
  %29 = load i64, ptr %5, align 8, !tbaa !9
  %30 = add nsw i64 %29, 1
  store i64 %30, ptr %5, align 8, !tbaa !9
  br label %14, !llvm.loop !12

31:                                               ; preds = %26, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %32

32:                                               ; preds = %31
  %33 = load i64, ptr %4, align 8, !tbaa !9
  %34 = icmp eq i64 %33, 1
  br i1 %34, label %35, label %54

35:                                               ; preds = %32
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %36, i64 noundef 0)
  store i8 49, ptr %37, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 1, ptr %7, align 8, !tbaa !9
  br label %38

38:                                               ; preds = %47, %35
  %39 = load i64, ptr %7, align 8, !tbaa !9
  %40 = load i64, ptr %3, align 8, !tbaa !9
  %41 = icmp slt i64 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %50

43:                                               ; preds = %38
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = load i64, ptr %7, align 8, !tbaa !9
  %46 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %44, i64 noundef %45)
  store i8 48, ptr %46, align 1, !tbaa !11
  br label %47

47:                                               ; preds = %43
  %48 = load i64, ptr %7, align 8, !tbaa !9
  %49 = add nsw i64 %48, 1
  store i64 %49, ptr %7, align 8, !tbaa !9
  br label %38, !llvm.loop !14

50:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #4
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %8, ptr noundef nonnull align 8 dereferenceable(32) %51, ptr noundef @.str)
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %52, ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #4
  br label %174

54:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %55

55:                                               ; preds = %105, %54
  %56 = load i64, ptr %11, align 8, !tbaa !9
  %57 = load i64, ptr %3, align 8, !tbaa !9
  %58 = sdiv i64 %57, 2
  %59 = icmp slt i64 %56, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %55
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %108

61:                                               ; preds = %55
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = load i64, ptr %11, align 8, !tbaa !9
  %64 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %62, i64 noundef %63)
  %65 = load i8, ptr %64, align 1, !tbaa !11
  %66 = sext i8 %65 to i32
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  %68 = load i64, ptr %3, align 8, !tbaa !9
  %69 = load i64, ptr %11, align 8, !tbaa !9
  %70 = sub nsw i64 %68, %69
  %71 = sub nsw i64 %70, 1
  %72 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %67, i64 noundef %71)
  %73 = load i8, ptr %72, align 1, !tbaa !11
  %74 = sext i8 %73 to i32
  %75 = icmp sgt i32 %66, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %61
  store i64 -1, ptr %4, align 8, !tbaa !9
  br label %94

77:                                               ; preds = %61
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = load i64, ptr %11, align 8, !tbaa !9
  %80 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %78, i64 noundef %79)
  %81 = load i8, ptr %80, align 1, !tbaa !11
  %82 = sext i8 %81 to i32
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = load i64, ptr %3, align 8, !tbaa !9
  %85 = load i64, ptr %11, align 8, !tbaa !9
  %86 = sub nsw i64 %84, %85
  %87 = sub nsw i64 %86, 1
  %88 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %83, i64 noundef %87)
  %89 = load i8, ptr %88, align 1, !tbaa !11
  %90 = sext i8 %89 to i32
  %91 = icmp slt i32 %82, %90
  br i1 %91, label %92, label %93

92:                                               ; preds = %77
  store i64 1, ptr %4, align 8, !tbaa !9
  br label %93

93:                                               ; preds = %92, %77
  br label %94

94:                                               ; preds = %93, %76
  %95 = load ptr, ptr %2, align 8, !tbaa !5
  %96 = load i64, ptr %11, align 8, !tbaa !9
  %97 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %95, i64 noundef %96)
  %98 = load i8, ptr %97, align 1, !tbaa !11
  %99 = load ptr, ptr %2, align 8, !tbaa !5
  %100 = load i64, ptr %3, align 8, !tbaa !9
  %101 = load i64, ptr %11, align 8, !tbaa !9
  %102 = sub nsw i64 %100, %101
  %103 = sub nsw i64 %102, 1
  %104 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %99, i64 noundef %103)
  store i8 %98, ptr %104, align 1, !tbaa !11
  br label %105

105:                                              ; preds = %94
  %106 = load i64, ptr %11, align 8, !tbaa !9
  %107 = add nsw i64 %106, 1
  store i64 %107, ptr %11, align 8, !tbaa !9
  br label %55, !llvm.loop !15

108:                                              ; preds = %60
  %109 = load i64, ptr %4, align 8, !tbaa !9
  %110 = icmp eq i64 %109, 0
  br i1 %110, label %114, label %111

111:                                              ; preds = %108
  %112 = load i64, ptr %4, align 8, !tbaa !9
  %113 = icmp eq i64 %112, 1
  br i1 %113, label %114, label %173

114:                                              ; preds = %111, %108
  %115 = load i64, ptr %3, align 8, !tbaa !9
  %116 = srem i64 %115, 2
  %117 = icmp eq i64 %116, 0
  br i1 %117, label %118, label %122

118:                                              ; preds = %114
  %119 = load i64, ptr %3, align 8, !tbaa !9
  %120 = sdiv i64 %119, 2
  %121 = sub nsw i64 %120, 1
  store i64 %121, ptr %9, align 8, !tbaa !9
  br label %125

122:                                              ; preds = %114
  %123 = load i64, ptr %3, align 8, !tbaa !9
  %124 = sdiv i64 %123, 2
  store i64 %124, ptr %9, align 8, !tbaa !9
  br label %125

125:                                              ; preds = %122, %118
  store i64 0, ptr %10, align 8, !tbaa !9
  br label %126

126:                                              ; preds = %135, %125
  %127 = load ptr, ptr %2, align 8, !tbaa !5
  %128 = load i64, ptr %9, align 8, !tbaa !9
  %129 = load i64, ptr %10, align 8, !tbaa !9
  %130 = sub nsw i64 %128, %129
  %131 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %127, i64 noundef %130)
  %132 = load i8, ptr %131, align 1, !tbaa !11
  %133 = sext i8 %132 to i32
  %134 = icmp eq i32 %133, 57
  br i1 %134, label %135, label %151

135:                                              ; preds = %126
  %136 = load ptr, ptr %2, align 8, !tbaa !5
  %137 = load i64, ptr %9, align 8, !tbaa !9
  %138 = load i64, ptr %10, align 8, !tbaa !9
  %139 = sub nsw i64 %137, %138
  %140 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %136, i64 noundef %139)
  store i8 48, ptr %140, align 1, !tbaa !11
  %141 = load ptr, ptr %2, align 8, !tbaa !5
  %142 = load i64, ptr %3, align 8, !tbaa !9
  %143 = sub nsw i64 %142, 1
  %144 = load i64, ptr %9, align 8, !tbaa !9
  %145 = sub nsw i64 %143, %144
  %146 = load i64, ptr %10, align 8, !tbaa !9
  %147 = add nsw i64 %145, %146
  %148 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %141, i64 noundef %147)
  store i8 48, ptr %148, align 1, !tbaa !11
  %149 = load i64, ptr %10, align 8, !tbaa !9
  %150 = add nsw i64 %149, 1
  store i64 %150, ptr %10, align 8, !tbaa !9
  br label %126, !llvm.loop !16

151:                                              ; preds = %126
  %152 = load ptr, ptr %2, align 8, !tbaa !5
  %153 = load i64, ptr %9, align 8, !tbaa !9
  %154 = load i64, ptr %10, align 8, !tbaa !9
  %155 = sub nsw i64 %153, %154
  %156 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %152, i64 noundef %155)
  %157 = load i8, ptr %156, align 1, !tbaa !11
  %158 = add i8 %157, 1
  store i8 %158, ptr %156, align 1, !tbaa !11
  %159 = load ptr, ptr %2, align 8, !tbaa !5
  %160 = load i64, ptr %9, align 8, !tbaa !9
  %161 = load i64, ptr %10, align 8, !tbaa !9
  %162 = sub nsw i64 %160, %161
  %163 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %159, i64 noundef %162)
  %164 = load i8, ptr %163, align 1, !tbaa !11
  %165 = load ptr, ptr %2, align 8, !tbaa !5
  %166 = load i64, ptr %3, align 8, !tbaa !9
  %167 = sub nsw i64 %166, 1
  %168 = load i64, ptr %9, align 8, !tbaa !9
  %169 = sub nsw i64 %167, %168
  %170 = load i64, ptr %10, align 8, !tbaa !9
  %171 = add nsw i64 %169, %170
  %172 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %165, i64 noundef %171)
  store i8 %164, ptr %172, align 1, !tbaa !11
  br label %173

173:                                              ; preds = %151, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %174

174:                                              ; preds = %173, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #2 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5palinRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %0) local_unnamed_addr #0 {
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  %.not6567 = icmp sgt i64 %3, 0
  br i1 %.not6567, label %.lr.ph, label %.critedge.thread

.critedge.thread:                                 ; preds = %1
  %4 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  store i8 49, ptr %4, align 1, !tbaa !5
  br label %._crit_edge

5:                                                ; preds = %.lr.ph
  %6 = add nuw nsw i64 %.06268, 1
  %exitcond.not = icmp eq i64 %6, %3
  br i1 %exitcond.not, label %.critedge, label %.lr.ph, !llvm.loop !8

.lr.ph:                                           ; preds = %1, %5
  %.06268 = phi i64 [ %6, %5 ], [ 0, %1 ]
  %7 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.06268)
  %8 = load i8, ptr %7, align 1, !tbaa !5
  %.not = icmp eq i8 %8, 57
  br i1 %.not, label %5, label %.preheader

.preheader:                                       ; preds = %.lr.ph
  %9 = lshr i64 %3, 1
  %.not82 = icmp eq i64 %3, 1
  br i1 %.not82, label %._crit_edge74.thread, label %.lr.ph73.preheader

.lr.ph73.preheader:                               ; preds = %.preheader
  %umax = tail call i64 @llvm.umax.i64(i64 %9, i64 1)
  br label %.lr.ph73

.critedge:                                        ; preds = %5
  %10 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  store i8 49, ptr %10, align 1, !tbaa !5
  %.not92 = icmp eq i64 %3, 1
  br i1 %.not92, label %._crit_edge, label %.lr.ph70

._crit_edge:                                      ; preds = %.lr.ph70, %.critedge.thread, %.critedge
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #5
  call void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %2, ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str)
  %11 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #5
  br label %55

.lr.ph70:                                         ; preds = %.critedge, %.lr.ph70
  %.06169 = phi i64 [ %13, %.lr.ph70 ], [ 1, %.critedge ]
  %12 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.06169)
  store i8 48, ptr %12, align 1, !tbaa !5
  %13 = add nuw nsw i64 %.06169, 1
  %exitcond86.not = icmp eq i64 %13, %3
  br i1 %exitcond86.not, label %._crit_edge, label %.lr.ph70, !llvm.loop !10

._crit_edge74:                                    ; preds = %28
  %14 = icmp ult i64 %.2, 2
  br i1 %14, label %._crit_edge74.thread, label %55

.lr.ph73:                                         ; preds = %.lr.ph73.preheader, %28
  %.072 = phi i64 [ %32, %28 ], [ 0, %.lr.ph73.preheader ]
  %.171 = phi i64 [ %.2, %28 ], [ 0, %.lr.ph73.preheader ]
  %15 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.072)
  %16 = load i8, ptr %15, align 1, !tbaa !5
  %17 = xor i64 %.072, -1
  %18 = add nsw i64 %3, %17
  %19 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %18)
  %20 = load i8, ptr %19, align 1, !tbaa !5
  %21 = icmp sgt i8 %16, %20
  br i1 %21, label %28, label %22

22:                                               ; preds = %.lr.ph73
  %23 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.072)
  %24 = load i8, ptr %23, align 1, !tbaa !5
  %25 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %18)
  %26 = load i8, ptr %25, align 1, !tbaa !5
  %27 = icmp slt i8 %24, %26
  %spec.select = select i1 %27, i64 1, i64 %.171
  br label %28

28:                                               ; preds = %22, %.lr.ph73
  %.2 = phi i64 [ -1, %.lr.ph73 ], [ %spec.select, %22 ]
  %29 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.072)
  %30 = load i8, ptr %29, align 1, !tbaa !5
  %31 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %18)
  store i8 %30, ptr %31, align 1, !tbaa !5
  %32 = add nuw nsw i64 %.072, 1
  %exitcond85.not = icmp eq i64 %32, %umax
  br i1 %exitcond85.not, label %._crit_edge74, label %.lr.ph73, !llvm.loop !11

._crit_edge74.thread:                             ; preds = %.preheader, %._crit_edge74
  %33 = and i64 %3, 1
  %sext = add nsw i64 %33, -1
  %.060 = add nsw i64 %sext, %9
  %34 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.060)
  %35 = load i8, ptr %34, align 1, !tbaa !5
  %36 = icmp eq i8 %35, 57
  %37 = xor i64 %.060, -1
  %38 = add i64 %3, %37
  br i1 %36, label %.lr.ph78, label %._crit_edge79

.lr.ph78:                                         ; preds = %._crit_edge74.thread, %.lr.ph78
  %39 = phi i64 [ %44, %.lr.ph78 ], [ %.060, %._crit_edge74.thread ]
  %.05976 = phi i64 [ %43, %.lr.ph78 ], [ 0, %._crit_edge74.thread ]
  %40 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %39)
  store i8 48, ptr %40, align 1, !tbaa !5
  %41 = add nsw i64 %38, %.05976
  %42 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %41)
  store i8 48, ptr %42, align 1, !tbaa !5
  %43 = add nuw nsw i64 %.05976, 1
  %44 = sub nsw i64 %.060, %43
  %45 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %44)
  %46 = load i8, ptr %45, align 1, !tbaa !5
  %47 = icmp eq i8 %46, 57
  br i1 %47, label %.lr.ph78, label %._crit_edge79, !llvm.loop !12

._crit_edge79:                                    ; preds = %.lr.ph78, %._crit_edge74.thread
  %.059.lcssa = phi i64 [ 0, %._crit_edge74.thread ], [ %43, %.lr.ph78 ]
  %.lcssa = phi i64 [ %.060, %._crit_edge74.thread ], [ %44, %.lr.ph78 ]
  %48 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.lcssa)
  %49 = load i8, ptr %48, align 1, !tbaa !5
  %50 = add i8 %49, 1
  store i8 %50, ptr %48, align 1, !tbaa !5
  %51 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.lcssa)
  %52 = load i8, ptr %51, align 1, !tbaa !5
  %53 = add nsw i64 %38, %.059.lcssa
  %54 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %53)
  store i8 %52, ptr %54, align 1, !tbaa !5
  br label %55

55:                                               ; preds = %._crit_edge79, %._crit_edge74, %._crit_edge
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
!12 = distinct !{!12, !9}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass