; LLVM IR from Tunghohin/Competitive_Coding :: Codeforces/cf102800_gym_J.ll/Z7calc_ptRNSt7 (cxx1112basic_stringIcSt11char_traitsIcESaIcEEE)

; 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"

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z7calc_ptRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %58, %1
  %8 = load i32, ptr %5, align 4, !tbaa !9
  %9 = icmp slt i32 %8, 3
  br i1 %9, label %11, label %10

10:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %61

11:                                               ; preds = %7
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = load i32, ptr %5, align 4, !tbaa !9
  %14 = sext i32 %13 to i64
  %15 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %12, i64 noundef %14)
  %16 = load i8, ptr %15, align 1, !tbaa !11
  %17 = sext i8 %16 to i32
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = add nsw i32 %19, 3
  %21 = sext i32 %20 to i64
  %22 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %18, i64 noundef %21)
  %23 = load i8, ptr %22, align 1, !tbaa !11
  %24 = sext i8 %23 to i32
  %25 = icmp eq i32 %17, %24
  br i1 %25, label %26, label %57

26:                                               ; preds = %11
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = add nsw i32 %28, 3
  %30 = sext i32 %29 to i64
  %31 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %27, i64 noundef %30)
  %32 = load i8, ptr %31, align 1, !tbaa !11
  %33 = sext i8 %32 to i32
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = add nsw i32 %35, 6
  %37 = sext i32 %36 to i64
  %38 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %34, i64 noundef %37)
  %39 = load i8, ptr %38, align 1, !tbaa !11
  %40 = sext i8 %39 to i32
  %41 = icmp eq i32 %33, %40
  br i1 %41, label %42, label %57

42:                                               ; preds = %26
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = load i32, ptr %5, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %43, i64 noundef %45)
  %47 = load i8, ptr %46, align 1, !tbaa !11
  %48 = sext i8 %47 to i32
  %49 = icmp eq i32 %48, 49
  br i1 %49, label %50, label %53

50:                                               ; preds = %42
  %51 = load i32, ptr %3, align 4, !tbaa !9
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %3, align 4, !tbaa !9
  br label %56

53:                                               ; preds = %42
  %54 = load i32, ptr %4, align 4, !tbaa !9
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %4, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %53, %50
  br label %57

57:                                               ; preds = %56, %26, %11
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %5, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %5, align 4, !tbaa !9
  br label %7, !llvm.loop !12

61:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %62

62:                                               ; preds = %113, %61
  %63 = load i32, ptr %6, align 4, !tbaa !9
  %64 = icmp slt i32 %63, 9
  br i1 %64, label %66, label %65

65:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %116

66:                                               ; preds = %62
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  %68 = load i32, ptr %6, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %67, i64 noundef %69)
  %71 = load i8, ptr %70, align 1, !tbaa !11
  %72 = sext i8 %71 to i32
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = load i32, ptr %6, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  %76 = sext i32 %75 to i64
  %77 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %73, i64 noundef %76)
  %78 = load i8, ptr %77, align 1, !tbaa !11
  %79 = sext i8 %78 to i32
  %80 = icmp eq i32 %72, %79
  br i1 %80, label %81, label %112

81:                                               ; preds = %66
  %82 = load ptr, ptr %2, align 8, !tbaa !5
  %83 = load i32, ptr %6, align 4, !tbaa !9
  %84 = add nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %82, i64 noundef %85)
  %87 = load i8, ptr %86, align 1, !tbaa !11
  %88 = sext i8 %87 to i32
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  %90 = load i32, ptr %6, align 4, !tbaa !9
  %91 = add nsw i32 %90, 2
  %92 = sext i32 %91 to i64
  %93 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %89, i64 noundef %92)
  %94 = load i8, ptr %93, align 1, !tbaa !11
  %95 = sext i8 %94 to i32
  %96 = icmp eq i32 %88, %95
  br i1 %96, label %97, label %112

97:                                               ; preds = %81
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  %99 = load i32, ptr %6, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %98, i64 noundef %100)
  %102 = load i8, ptr %101, align 1, !tbaa !11
  %103 = sext i8 %102 to i32
  %104 = icmp eq i32 %103, 49
  br i1 %104, label %105, label %108

105:                                              ; preds = %97
  %106 = load i32, ptr %3, align 4, !tbaa !9
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %3, align 4, !tbaa !9
  br label %111

108:                                              ; preds = %97
  %109 = load i32, ptr %4, align 4, !tbaa !9
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %4, align 4, !tbaa !9
  br label %111

111:                                              ; preds = %108, %105
  br label %112

112:                                              ; preds = %111, %81, %66
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %6, align 4, !tbaa !9
  %115 = add nsw i32 %114, 3
  store i32 %115, ptr %6, align 4, !tbaa !9
  br label %62, !llvm.loop !14

116:                                              ; preds = %65
  %117 = load ptr, ptr %2, align 8, !tbaa !5
  %118 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %117, i64 noundef 0)
  %119 = load i8, ptr %118, align 1, !tbaa !11
  %120 = sext i8 %119 to i32
  %121 = load ptr, ptr %2, align 8, !tbaa !5
  %122 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %121, i64 noundef 4)
  %123 = load i8, ptr %122, align 1, !tbaa !11
  %124 = sext i8 %123 to i32
  %125 = icmp eq i32 %120, %124
  br i1 %125, label %126, label %149

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

136:                                              ; preds = %126
  %137 = load ptr, ptr %2, align 8, !tbaa !5
  %138 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %137, i64 noundef 0)
  %139 = load i8, ptr %138, align 1, !tbaa !11
  %140 = sext i8 %139 to i32
  %141 = icmp eq i32 %140, 49
  br i1 %141, label %142, label %145

142:                                              ; preds = %136
  %143 = load i32, ptr %3, align 4, !tbaa !9
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %3, align 4, !tbaa !9
  br label %148

145:                                              ; preds = %136
  %146 = load i32, ptr %4, align 4, !tbaa !9
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %4, align 4, !tbaa !9
  br label %148

148:                                              ; preds = %145, %142
  br label %149

149:                                              ; preds = %148, %126, %116
  %150 = load ptr, ptr %2, align 8, !tbaa !5
  %151 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %150, i64 noundef 2)
  %152 = load i8, ptr %151, align 1, !tbaa !11
  %153 = sext i8 %152 to i32
  %154 = load ptr, ptr %2, align 8, !tbaa !5
  %155 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %154, i64 noundef 4)
  %156 = load i8, ptr %155, align 1, !tbaa !11
  %157 = sext i8 %156 to i32
  %158 = icmp eq i32 %153, %157
  br i1 %158, label %159, label %182

159:                                              ; preds = %149
  %160 = load ptr, ptr %2, align 8, !tbaa !5
  %161 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %160, i64 noundef 4)
  %162 = load i8, ptr %161, align 1, !tbaa !11
  %163 = sext i8 %162 to i32
  %164 = load ptr, ptr %2, align 8, !tbaa !5
  %165 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %164, i64 noundef 6)
  %166 = load i8, ptr %165, align 1, !tbaa !11
  %167 = sext i8 %166 to i32
  %168 = icmp eq i32 %163, %167
  br i1 %168, label %169, label %182

169:                                              ; preds = %159
  %170 = load ptr, ptr %2, align 8, !tbaa !5
  %171 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %170, i64 noundef 2)
  %172 = load i8, ptr %171, align 1, !tbaa !11
  %173 = sext i8 %172 to i32
  %174 = icmp eq i32 %173, 49
  br i1 %174, label %175, label %178

175:                                              ; preds = %169
  %176 = load i32, ptr %3, align 4, !tbaa !9
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %3, align 4, !tbaa !9
  br label %181

178:                                              ; preds = %169
  %179 = load i32, ptr %4, align 4, !tbaa !9
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %4, align 4, !tbaa !9
  br label %181

181:                                              ; preds = %178, %175
  br label %182

182:                                              ; preds = %181, %159, %149
  %183 = load i32, ptr %3, align 4, !tbaa !9
  %184 = load i32, ptr %4, align 4, !tbaa !9
  %185 = sub nsw i32 %183, %184
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 %185
}

; 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 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

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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z7calc_ptRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %0) local_unnamed_addr #0 {
  %2 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  %3 = load i8, ptr %2, align 1, !tbaa !5
  %4 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 3)
  %5 = load i8, ptr %4, align 1, !tbaa !5
  %6 = icmp eq i8 %3, %5
  br i1 %6, label %7, label %17

7:                                                ; preds = %1
  %8 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 3)
  %9 = load i8, ptr %8, align 1, !tbaa !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 6)
  %11 = load i8, ptr %10, align 1, !tbaa !5
  %12 = icmp eq i8 %9, %11
  br i1 %12, label %13, label %17

13:                                               ; preds = %7
  %14 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  %15 = load i8, ptr %14, align 1, !tbaa !5
  %16 = icmp eq i8 %15, 49
  %spec.select = zext i1 %16 to i32
  %not. = xor i1 %16, true
  %spec.select59 = zext i1 %not. to i32
  br label %17

17:                                               ; preds = %13, %1, %7
  %.146 = phi i32 [ 0, %7 ], [ 0, %1 ], [ %spec.select, %13 ]
  %.1 = phi i32 [ 0, %7 ], [ 0, %1 ], [ %spec.select59, %13 ]
  %18 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 1)
  %19 = load i8, ptr %18, align 1, !tbaa !5
  %20 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 4)
  %21 = load i8, ptr %20, align 1, !tbaa !5
  %22 = icmp eq i8 %19, %21
  br i1 %22, label %23, label %37

23:                                               ; preds = %17
  %24 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 4)
  %25 = load i8, ptr %24, align 1, !tbaa !5
  %26 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 7)
  %27 = load i8, ptr %26, align 1, !tbaa !5
  %28 = icmp eq i8 %25, %27
  br i1 %28, label %29, label %37

29:                                               ; preds = %23
  %30 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 1)
  %31 = load i8, ptr %30, align 1, !tbaa !5
  %32 = icmp eq i8 %31, 49
  br i1 %32, label %35, label %33

33:                                               ; preds = %29
  %34 = add nuw nsw i32 %.1, 1
  br label %37

35:                                               ; preds = %29
  %36 = add nuw nsw i32 %.146, 1
  br label %37

37:                                               ; preds = %35, %33, %23, %17
  %.146.1 = phi i32 [ %36, %35 ], [ %.146, %33 ], [ %.146, %23 ], [ %.146, %17 ]
  %.1.1 = phi i32 [ %.1, %35 ], [ %34, %33 ], [ %.1, %23 ], [ %.1, %17 ]
  %38 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 2)
  %39 = load i8, ptr %38, align 1, !tbaa !5
  %40 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 5)
  %41 = load i8, ptr %40, align 1, !tbaa !5
  %42 = icmp eq i8 %39, %41
  br i1 %42, label %43, label %.preheader.preheader

43:                                               ; preds = %37
  %44 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 5)
  %45 = load i8, ptr %44, align 1, !tbaa !5
  %46 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 8)
  %47 = load i8, ptr %46, align 1, !tbaa !5
  %48 = icmp eq i8 %45, %47
  br i1 %48, label %49, label %.preheader.preheader

49:                                               ; preds = %43
  %50 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 2)
  %51 = load i8, ptr %50, align 1, !tbaa !5
  %52 = icmp eq i8 %51, 49
  br i1 %52, label %55, label %53

53:                                               ; preds = %49
  %54 = add nuw nsw i32 %.1.1, 1
  br label %.preheader.preheader

55:                                               ; preds = %49
  %56 = add nuw nsw i32 %.146.1, 1
  br label %.preheader.preheader

.preheader.preheader:                             ; preds = %55, %53, %43, %37
  %.146.2 = phi i32 [ %56, %55 ], [ %.146.1, %53 ], [ %.146.1, %43 ], [ %.146.1, %37 ]
  %.1.2 = phi i32 [ %.1.1, %55 ], [ %54, %53 ], [ %.1.1, %43 ], [ %.1.1, %37 ]
  %57 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  %58 = load i8, ptr %57, align 1, !tbaa !5
  %59 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 1)
  %60 = load i8, ptr %59, align 1, !tbaa !5
  %61 = icmp eq i8 %58, %60
  br i1 %61, label %62, label %.preheader.1

62:                                               ; preds = %.preheader.preheader
  %63 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 1)
  %64 = load i8, ptr %63, align 1, !tbaa !5
  %65 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 2)
  %66 = load i8, ptr %65, align 1, !tbaa !5
  %67 = icmp eq i8 %64, %66
  br i1 %67, label %68, label %.preheader.1

68:                                               ; preds = %62
  %69 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  %70 = load i8, ptr %69, align 1, !tbaa !5
  %71 = icmp eq i8 %70, 49
  br i1 %71, label %72, label %74

72:                                               ; preds = %68
  %73 = add nuw nsw i32 %.146.2, 1
  br label %.preheader.1

74:                                               ; preds = %68
  %75 = add nuw nsw i32 %.1.2, 1
  br label %.preheader.1

.preheader.1:                                     ; preds = %.preheader.preheader, %62, %74, %72
  %.348 = phi i32 [ %73, %72 ], [ %.146.2, %74 ], [ %.146.2, %62 ], [ %.146.2, %.preheader.preheader ]
  %.3 = phi i32 [ %.1.2, %72 ], [ %75, %74 ], [ %.1.2, %62 ], [ %.1.2, %.preheader.preheader ]
  %76 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 3)
  %77 = load i8, ptr %76, align 1, !tbaa !5
  %78 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 4)
  %79 = load i8, ptr %78, align 1, !tbaa !5
  %80 = icmp eq i8 %77, %79
  br i1 %80, label %81, label %.preheader.2

81:                                               ; preds = %.preheader.1
  %82 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 4)
  %83 = load i8, ptr %82, align 1, !tbaa !5
  %84 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 5)
  %85 = load i8, ptr %84, align 1, !tbaa !5
  %86 = icmp eq i8 %83, %85
  br i1 %86, label %87, label %.preheader.2

87:                                               ; preds = %81
  %88 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 3)
  %89 = load i8, ptr %88, align 1, !tbaa !5
  %90 = icmp eq i8 %89, 49
  br i1 %90, label %93, label %91

91:                                               ; preds = %87
  %92 = add nuw nsw i32 %.3, 1
  br label %.preheader.2

93:                                               ; preds = %87
  %94 = add nuw nsw i32 %.348, 1
  br label %.preheader.2

.preheader.2:                                     ; preds = %93, %91, %81, %.preheader.1
  %.348.1 = phi i32 [ %94, %93 ], [ %.348, %91 ], [ %.348, %81 ], [ %.348, %.preheader.1 ]
  %.3.1 = phi i32 [ %.3, %93 ], [ %92, %91 ], [ %.3, %81 ], [ %.3, %.preheader.1 ]
  %95 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 6)
  %96 = load i8, ptr %95, align 1, !tbaa !5
  %97 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 7)
  %98 = load i8, ptr %97, align 1, !tbaa !5
  %99 = icmp eq i8 %96, %98
  br i1 %99, label %100, label %114

100:                                              ; preds = %.preheader.2
  %101 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 7)
  %102 = load i8, ptr %101, align 1, !tbaa !5
  %103 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 8)
  %104 = load i8, ptr %103, align 1, !tbaa !5
  %105 = icmp eq i8 %102, %104
  br i1 %105, label %106, label %114

106:                                              ; preds = %100
  %107 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 6)
  %108 = load i8, ptr %107, align 1, !tbaa !5
  %109 = icmp eq i8 %108, 49
  br i1 %109, label %112, label %110

110:                                              ; preds = %106
  %111 = add nuw nsw i32 %.3.1, 1
  br label %114

112:                                              ; preds = %106
  %113 = add nuw nsw i32 %.348.1, 1
  br label %114

114:                                              ; preds = %112, %110, %100, %.preheader.2
  %.348.2 = phi i32 [ %113, %112 ], [ %.348.1, %110 ], [ %.348.1, %100 ], [ %.348.1, %.preheader.2 ]
  %.3.2 = phi i32 [ %.3.1, %112 ], [ %111, %110 ], [ %.3.1, %100 ], [ %.3.1, %.preheader.2 ]
  %115 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  %116 = load i8, ptr %115, align 1, !tbaa !5
  %117 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 4)
  %118 = load i8, ptr %117, align 1, !tbaa !5
  %119 = icmp eq i8 %116, %118
  br i1 %119, label %120, label %134

120:                                              ; preds = %114
  %121 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 4)
  %122 = load i8, ptr %121, align 1, !tbaa !5
  %123 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 8)
  %124 = load i8, ptr %123, align 1, !tbaa !5
  %125 = icmp eq i8 %122, %124
  br i1 %125, label %126, label %134

126:                                              ; preds = %120
  %127 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  %128 = load i8, ptr %127, align 1, !tbaa !5
  %129 = icmp eq i8 %128, 49
  br i1 %129, label %130, label %132

130:                                              ; preds = %126
  %131 = add nuw nsw i32 %.348.2, 1
  br label %134

132:                                              ; preds = %126
  %133 = add nuw nsw i32 %.3.2, 1
  br label %134

134:                                              ; preds = %130, %132, %120, %114
  %.449 = phi i32 [ %131, %130 ], [ %.348.2, %132 ], [ %.348.2, %120 ], [ %.348.2, %114 ]
  %.4 = phi i32 [ %.3.2, %130 ], [ %133, %132 ], [ %.3.2, %120 ], [ %.3.2, %114 ]
  %135 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 2)
  %136 = load i8, ptr %135, align 1, !tbaa !5
  %137 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 4)
  %138 = load i8, ptr %137, align 1, !tbaa !5
  %139 = icmp eq i8 %136, %138
  br i1 %139, label %140, label %154

140:                                              ; preds = %134
  %141 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 4)
  %142 = load i8, ptr %141, align 1, !tbaa !5
  %143 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 6)
  %144 = load i8, ptr %143, align 1, !tbaa !5
  %145 = icmp eq i8 %142, %144
  br i1 %145, label %146, label %154

146:                                              ; preds = %140
  %147 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 2)
  %148 = load i8, ptr %147, align 1, !tbaa !5
  %149 = icmp eq i8 %148, 49
  br i1 %149, label %150, label %152

150:                                              ; preds = %146
  %151 = add nuw nsw i32 %.449, 1
  br label %154

152:                                              ; preds = %146
  %153 = add nuw nsw i32 %.4, 1
  br label %154

154:                                              ; preds = %150, %152, %140, %134
  %.550 = phi i32 [ %151, %150 ], [ %.449, %152 ], [ %.449, %140 ], [ %.449, %134 ]
  %.5 = phi i32 [ %.4, %150 ], [ %153, %152 ], [ %.4, %140 ], [ %.4, %134 ]
  %155 = sub nsw i32 %.550, %.5
  ret i32 %155
}

; 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 #0 align 2

attributes #0 = { 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" }

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass