; LLVM IR from Tunghohin/Competitive_Coding :: Daimayuan/560.ll (Z5checkx)

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

@_Z2sbB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@up_del = external dso_local global [10 x i32], align 16
@down_del = external dso_local global [10 x i32], align 16

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z6is_subNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef, ptr noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #0 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) #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5checkx(i64 noundef %0) #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca i1, align 1
  %3 = alloca i64, align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.std::__cxx11::basic_string", align 8
  %15 = alloca %"class.std::__cxx11::basic_string", align 8
  %16 = alloca %"class.std::__cxx11::basic_string", align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #4
  %17 = load i64, ptr %3, align 8, !tbaa !5
  call void @_ZNSt7__cxx119to_stringEx(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %4, i64 noundef %17)
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) @_Z2sbB5cxx11)
          to label %18 unwind label %24

18:                                               ; preds = %1
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %19 unwind label %28

19:                                               ; preds = %18
  %20 = invoke noundef zeroext i1 @_Z6is_subNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef %5, ptr noundef %8)
          to label %21 unwind label %32

21:                                               ; preds = %19
  %22 = xor i1 %20, true
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  br i1 %22, label %23, label %37

23:                                               ; preds = %21
  store i1 false, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %142

24:                                               ; preds = %1
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %6, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %7, align 4
  br label %144

28:                                               ; preds = %18
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %6, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %7, align 4
  br label %36

32:                                               ; preds = %19
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %6, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %7, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  br label %36

36:                                               ; preds = %32, %28
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  br label %144

37:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %54, %37
  %39 = load i32, ptr %10, align 4, !tbaa !9
  %40 = icmp sle i32 %39, 9
  br i1 %40, label %42, label %41

41:                                               ; preds = %38
  store i32 2, ptr %9, align 4
  br label %57

42:                                               ; preds = %38
  %43 = load i32, ptr %10, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [10 x i32], ptr @up_del, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [10 x i32], ptr @down_del, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !9
  %51 = icmp ne i32 %46, %50
  br i1 %51, label %52, label %53

52:                                               ; preds = %42
  store i1 false, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %57

53:                                               ; preds = %42
  br label %54

54:                                               ; preds = %53
  %55 = load i32, ptr %10, align 4, !tbaa !9
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %10, align 4, !tbaa !9
  br label %38, !llvm.loop !11

57:                                               ; preds = %52, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %58 = load i32, ptr %9, align 4
  switch i32 %58, label %142 [
    i32 2, label %59
  ]

59:                                               ; preds = %57
  %60 = load i32, ptr @up_del, align 16, !tbaa !9
  %61 = load i32, ptr @down_del, align 16, !tbaa !9
  %62 = icmp eq i32 %60, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %59
  store i1 true, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %142

64:                                               ; preds = %59
  %65 = load i32, ptr @up_del, align 16, !tbaa !9
  %66 = load i32, ptr @down_del, align 16, !tbaa !9
  %67 = icmp sgt i32 %65, %66
  br i1 %67, label %68, label %69

68:                                               ; preds = %64
  store i1 false, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %142

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(32) @_Z2sbB5cxx11)
          to label %70 unwind label %80

70:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %71 = load i32, ptr @down_del, align 16, !tbaa !9
  %72 = load i32, ptr @up_del, align 16, !tbaa !9
  %73 = sub nsw i32 %71, %72
  store i32 %73, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %74

74:                                               ; preds = %117, %70
  %75 = load i32, ptr %13, align 4, !tbaa !9
  %76 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  %77 = trunc i64 %76 to i32
  %78 = icmp slt i32 %75, %77
  br i1 %78, label %84, label %79

79:                                               ; preds = %74
  store i32 5, ptr %9, align 4
  br label %120

80:                                               ; preds = %69
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %6, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %7, align 4
  br label %141

84:                                               ; preds = %74
  %85 = load i32, ptr %13, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %11, i64 noundef %86)
          to label %88 unwind label %107

88:                                               ; preds = %84
  %89 = load i8, ptr %87, align 1, !tbaa !13
  %90 = sext i8 %89 to i32
  %91 = icmp eq i32 %90, 48
  br i1 %91, label %92, label %116

92:                                               ; preds = %88
  %93 = load i32, ptr %12, align 4, !tbaa !9
  %94 = add nsw i32 %93, -1
  store i32 %94, ptr %12, align 4, !tbaa !9
  %95 = load i32, ptr %12, align 4, !tbaa !9
  %96 = icmp eq i32 %95, 0
  br i1 %96, label %97, label %115

97:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #4
  %98 = load i32, ptr %13, align 4, !tbaa !9
  %99 = add nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  %102 = load i32, ptr %13, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = sub i64 %101, %103
  invoke void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %14, ptr noundef nonnull align 8 dereferenceable(32) %11, i64 noundef %100, i64 noundef %104)
          to label %105 unwind label %111

105:                                              ; preds = %97
  %106 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(32) %14) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #4
  store i32 5, ptr %9, align 4
  br label %120

107:                                              ; preds = %84
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %6, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %7, align 4
  br label %121

111:                                              ; preds = %97
  %112 = landingpad { ptr, i32 }
          cleanup
  %113 = extractvalue { ptr, i32 } %112, 0
  store ptr %113, ptr %6, align 8
  %114 = extractvalue { ptr, i32 } %112, 1
  store i32 %114, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #4
  br label %121

115:                                              ; preds = %92
  br label %116

116:                                              ; preds = %115, %88
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %13, align 4, !tbaa !9
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %13, align 4, !tbaa !9
  br label %74, !llvm.loop !14

120:                                              ; preds = %105, %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %122

121:                                              ; preds = %111, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %140

122:                                              ; preds = %120
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %123 unwind label %127

123:                                              ; preds = %122
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %124 unwind label %131

124:                                              ; preds = %123
  %125 = invoke noundef zeroext i1 @_Z6is_subNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef %15, ptr noundef %16)
          to label %126 unwind label %135

126:                                              ; preds = %124
  store i1 %125, ptr %2, align 1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #4
  br label %142

127:                                              ; preds = %122
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %6, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %7, align 4
  br label %140

131:                                              ; preds = %123
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %6, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %7, align 4
  br label %139

135:                                              ; preds = %124
  %136 = landingpad { ptr, i32 }
          cleanup
  %137 = extractvalue { ptr, i32 } %136, 0
  store ptr %137, ptr %6, align 8
  %138 = extractvalue { ptr, i32 } %136, 1
  store i32 %138, ptr %7, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #4
  br label %139

139:                                              ; preds = %135, %131
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #4
  br label %140

140:                                              ; preds = %139, %127, %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  br label %141

141:                                              ; preds = %140, %80
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #4
  br label %144

142:                                              ; preds = %126, %68, %63, %57, %23
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #4
  %143 = load i1, ptr %2, align 1
  ret i1 %143

144:                                              ; preds = %141, %36, %24
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #4
  br label %145

145:                                              ; preds = %144
  %146 = load ptr, ptr %6, align 8
  %147 = load i32, ptr %7, align 4
  %148 = insertvalue { ptr, i32 } poison, ptr %146, 0
  %149 = insertvalue { ptr, i32 } %148, i32 %147, 1
  resume { ptr, i32 } %149
}

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) #1 align 2

; 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)) #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" }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !12}


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

@_Z2sbB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@up_del = external dso_local local_unnamed_addr global [10 x i32], align 16
@down_del = external dso_local local_unnamed_addr global [10 x i32], align 16

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z6is_subNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 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 #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5checkx(i64 noundef %0) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #4
  call void @_ZNSt7__cxx119to_stringEx(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %2, i64 noundef %0)
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull align 8 dereferenceable(32) @_Z2sbB5cxx11)
          to label %9 unwind label %15

9:                                                ; preds = %1
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %2)
          to label %10 unwind label %17

10:                                               ; preds = %9
  %11 = invoke noundef zeroext i1 @_Z6is_subNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef nonnull %3, ptr noundef nonnull %4)
          to label %12 unwind label %19

12:                                               ; preds = %10
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #4
  br i1 %11, label %.preheader.preheader, label %.loopexit36

.preheader.preheader:                             ; preds = %12
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @up_del, i64 4), align 4, !tbaa !5
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @down_del, i64 4), align 4, !tbaa !5
  %.not = icmp eq i32 %13, %14
  br i1 %.not, label %.preheader.1, label %.loopexit36

15:                                               ; preds = %1
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %85

17:                                               ; preds = %9
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %21

19:                                               ; preds = %10
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  br label %21

21:                                               ; preds = %19, %17
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %18, %17 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #4
  br label %85

.preheader.1:                                     ; preds = %.preheader.preheader
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @up_del, i64 8), align 8, !tbaa !5
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @down_del, i64 8), align 8, !tbaa !5
  %.not.1 = icmp eq i32 %22, %23
  br i1 %.not.1, label %.preheader.2, label %.loopexit36

.preheader.2:                                     ; preds = %.preheader.1
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @up_del, i64 12), align 4, !tbaa !5
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @down_del, i64 12), align 4, !tbaa !5
  %.not.2 = icmp eq i32 %24, %25
  br i1 %.not.2, label %.preheader.3, label %.loopexit36

.preheader.3:                                     ; preds = %.preheader.2
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @up_del, i64 16), align 16, !tbaa !5
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @down_del, i64 16), align 16, !tbaa !5
  %.not.3 = icmp eq i32 %26, %27
  br i1 %.not.3, label %.preheader.4, label %.loopexit36

.preheader.4:                                     ; preds = %.preheader.3
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @up_del, i64 20), align 4, !tbaa !5
  %29 = load i32, ptr getelementptr inbounds (i8, ptr @down_del, i64 20), align 4, !tbaa !5
  %.not.4 = icmp eq i32 %28, %29
  br i1 %.not.4, label %.preheader.5, label %.loopexit36

.preheader.5:                                     ; preds = %.preheader.4
  %30 = load i32, ptr getelementptr inbounds (i8, ptr @up_del, i64 24), align 8, !tbaa !5
  %31 = load i32, ptr getelementptr inbounds (i8, ptr @down_del, i64 24), align 8, !tbaa !5
  %.not.5 = icmp eq i32 %30, %31
  br i1 %.not.5, label %.preheader.6, label %.loopexit36

.preheader.6:                                     ; preds = %.preheader.5
  %32 = load i32, ptr getelementptr inbounds (i8, ptr @up_del, i64 28), align 4, !tbaa !5
  %33 = load i32, ptr getelementptr inbounds (i8, ptr @down_del, i64 28), align 4, !tbaa !5
  %.not.6 = icmp eq i32 %32, %33
  br i1 %.not.6, label %.preheader.7, label %.loopexit36

.preheader.7:                                     ; preds = %.preheader.6
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @up_del, i64 32), align 16, !tbaa !5
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @down_del, i64 32), align 16, !tbaa !5
  %.not.7 = icmp eq i32 %34, %35
  br i1 %.not.7, label %.preheader.8, label %.loopexit36

.preheader.8:                                     ; preds = %.preheader.7
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @up_del, i64 36), align 4, !tbaa !5
  %37 = load i32, ptr getelementptr inbounds (i8, ptr @down_del, i64 36), align 4, !tbaa !5
  %.not.8 = icmp eq i32 %36, %37
  br i1 %.not.8, label %.critedge, label %.loopexit36

.critedge:                                        ; preds = %.preheader.8
  %38 = load i32, ptr @up_del, align 16, !tbaa !5
  %39 = load i32, ptr @down_del, align 16, !tbaa !5
  %40 = icmp eq i32 %38, %39
  br i1 %40, label %.loopexit36, label %41

41:                                               ; preds = %.critedge
  %42 = icmp sgt i32 %38, %39
  br i1 %42, label %.loopexit36, label %43

43:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) @_Z2sbB5cxx11)
          to label %44 unwind label %51

44:                                               ; preds = %43
  %45 = load i32, ptr @down_del, align 16, !tbaa !5
  %46 = load i32, ptr @up_del, align 16, !tbaa !5
  %47 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  %48 = trunc i64 %47 to i32
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %44
  %50 = sub nsw i32 %45, %46
  br label %.lr.ph

51:                                               ; preds = %43
  %52 = landingpad { ptr, i32 }
          cleanup
  br label %84

.lr.ph:                                           ; preds = %.lr.ph.preheader, %68
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %68 ]
  %.01539 = phi i32 [ %50, %.lr.ph.preheader ], [ %.1, %68 ]
  %53 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef %indvars.iv)
  %54 = load i8, ptr %53, align 1, !tbaa !9
  %55 = icmp eq i8 %54, 48
  br i1 %55, label %56, label %68

56:                                               ; preds = %.lr.ph
  %57 = add nsw i32 %.01539, -1
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %68

59:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #4
  %60 = add nuw nsw i64 %indvars.iv, 1
  %61 = and i64 %60, 4294967295
  %62 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  %63 = sub i64 %62, %indvars.iv
  invoke void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %6, ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef %61, i64 noundef %63)
          to label %64 unwind label %66

64:                                               ; preds = %59
  %65 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) %6) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #4
  br label %.loopexit

66:                                               ; preds = %59
  %67 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #4
  br label %83

68:                                               ; preds = %.lr.ph, %56
  %.1 = phi i32 [ %57, %56 ], [ %.01539, %.lr.ph ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %69 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  %sext = shl i64 %69, 32
  %70 = ashr exact i64 %sext, 32
  %71 = icmp slt i64 %indvars.iv.next, %70
  br i1 %71, label %.lr.ph, label %.loopexit, !llvm.loop !10

.loopexit:                                        ; preds = %68, %44, %64
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %72 unwind label %76

72:                                               ; preds = %.loopexit
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %2)
          to label %73 unwind label %78

73:                                               ; preds = %72
  %74 = invoke noundef zeroext i1 @_Z6is_subNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef nonnull %7, ptr noundef nonnull %8)
          to label %75 unwind label %80

75:                                               ; preds = %73
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  br label %.loopexit36

76:                                               ; preds = %.loopexit
  %77 = landingpad { ptr, i32 }
          cleanup
  br label %83

78:                                               ; preds = %72
  %79 = landingpad { ptr, i32 }
          cleanup
  br label %82

80:                                               ; preds = %73
  %81 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  br label %82

82:                                               ; preds = %80, %78
  %.pn31 = phi { ptr, i32 } [ %81, %80 ], [ %79, %78 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  br label %83

83:                                               ; preds = %82, %76, %66
  %.pn31.pn = phi { ptr, i32 } [ %.pn31, %82 ], [ %77, %76 ], [ %67, %66 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  br label %84

84:                                               ; preds = %83, %51
  %.pn31.pn.pn = phi { ptr, i32 } [ %.pn31.pn, %83 ], [ %52, %51 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  br label %85

.loopexit36:                                      ; preds = %.preheader.preheader, %.preheader.1, %.preheader.2, %.preheader.3, %.preheader.4, %.preheader.5, %.preheader.6, %.preheader.7, %.preheader.8, %41, %.critedge, %12, %75
  %.126 = phi i1 [ %74, %75 ], [ false, %12 ], [ true, %.critedge ], [ false, %41 ], [ false, %.preheader.8 ], [ false, %.preheader.7 ], [ false, %.preheader.6 ], [ false, %.preheader.5 ], [ false, %.preheader.4 ], [ false, %.preheader.3 ], [ false, %.preheader.2 ], [ false, %.preheader.1 ], [ false, %.preheader.preheader ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #4
  ret i1 %.126

85:                                               ; preds = %84, %21, %15
  %.pn31.pn.pn.pn = phi { ptr, i32 } [ %.pn31.pn.pn, %84 ], [ %.pn, %21 ], [ %16, %15 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #4
  resume { ptr, i32 } %.pn31.pn.pn.pn
}

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; 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 #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" }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass